Skip to content

Commit

Permalink
http-api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
trim-me committed Mar 1, 2023
1 parent a936be4 commit 62b6473
Show file tree
Hide file tree
Showing 60 changed files with 6,059 additions and 14,033 deletions.
6 changes: 4 additions & 2 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ module.exports = {
["Endpoints", "endpoints"],
["Tools", "tools"],
["Migration", "migration"],
["Pvm", "pvm"]
["Pvm", "pvm"],
["Api", "http-api"]
])
},
"/zh/": {
Expand Down Expand Up @@ -115,7 +116,8 @@ module.exports = {
["服务端点", "/zh/endpoints"],
["工具", "/zh/tools"],
["迁移", "/zh/migration"],
["pvm", "/zh/pvm"]
["pvm", "/zh/pvm"],
["api", "/zh/http-api"]
])
}
},
Expand Down
48 changes: 48 additions & 0 deletions docs/http-api/account_addr_convert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
order: 2
---

# Address translation

- Conversion between addresses gx<==>0x<==>gxvloper

### Request method
`GET`

### URL
`/server/v1/account/addr_convert`

### Request example

```
/server/v1/account/addr_convert?addr=gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m
```


#### Request parameters

- `addr string ` Required "gx Address | gxvaloper Address of verifier | 0x Address"

### Return value
- `data`
- `Byte string`: Byte data
- `Hex string`: Hexadecimal
- `EIP55 string`:EIP55 0x address,EVM address
- `BechAcc string`:gx user address
- `BechVal string`:gxvaloper address of verifier


#### Return to examples
```json
{
"code": 0,
"data": {
"Byte": "/2nU+5UgNbTtOehe4pn9p5iIAuw=",
"Hex": "FF69D4FB952035B4ED39E85EE299FDA7988802EC",
"EIP55": "0xFf69D4fb952035B4ed39E85eE299fDA7988802Ec",
"BechAcc": "gx1la5af7u4yq6mfmfeap0w9x0a57vgsqhvqm9ywm",
"BechVal": "gxvaloper1la5af7u4yq6mfmfeap0w9x0a57vgsqhvzl4jp2"
},
"message": "ok"
}
```
47 changes: 47 additions & 0 deletions docs/http-api/account_balance_prc10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
order: 3
---


# PRC10Token balance

### Request method
`GET`

### URL
`/server/v1/account/balance/prc10`

### Request example

```
/server/v1/account/balance/prc10?addr=gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m&denom=uplugcn
```


#### Request parameters
- `addr string Required` :Address
- `denom string Required`:Currency, please fill in min_ unit in the token information to query, such as min_ unit of PC is uplugcn

### Return value
- `code int64 ` : 0 or field does not exist is success, others are failures
- `message string` : Response information
- `balances object` : Data returned successfully
- `denom` : Query currency
- `amount`: Balance, which is normal only after dividing decimal places


#### Return to example
```json
{
"balances": [
{
"denom": "uplugcn",
"amount": "22919755"
}
],
"pagination": {
"next_key": null,
"total": "1"
}
}
```
46 changes: 46 additions & 0 deletions docs/http-api/account_balance_prc20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
order: 4
---

# PRC20Token balance

### Request method
`GET`

### URL
`/server/v1/account/balance/prc10`

### Request example

```
/server/v1/account/balance/prc10?addr=gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m&denom=uplugcn
```


#### Request parameters
- `addr string Required` :Address
- `denom string Required`:Currency, please fill in min_ unit in the token information to query, such as min_ unit of PC is uplugcn

### Return value
- `code int64 ` : 0 or field does not exist is success, others are failures
- `message string` : Response information
- `balances object` : Data returned successfully
- `denom` : Query currency
- `amount`: Balance, which is normal only after dividing decimal places


#### Return to example
```json
{
"balances": [
{
"denom": "uplugcn",
"amount": "22919755"
}
],
"pagination": {
"next_key": null,
"total": "1"
}
}
```
66 changes: 66 additions & 0 deletions docs/http-api/account_info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
order: 5
---

# Address information

### Request method
`GET`

### URL
`/server/v1/account/account_info`

### Request example

```
/server/v1/account/account_info?addr=gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m
```


#### Request parameters
- `addr string Required` gx Address

### Return value
- `code int64 ` : 0 or field does not exist is success, others are failures
- `message string` : Response information
- `account object` : Data returned successfully
- `@type` : Address type
- `account_number`: Address serial number
- `sequence` : Address transaction serial number, similar to the nonce of ETH


#### prc20 address return example
```json
{
"account": {
"@type": "/ethermint.types.v1.EthAccount",
"base_account": {
"address": "gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m",
"pub_key": {
"@type": "/ethermint.crypto.v1.ethsecp256k1.PubKey",
"key": "AmKig8ab3m88TtimAIfrUu/neBxk1axFBdl231FuOqfa"
},
"account_number": "25237",
"sequence": "4556"
},
"code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
}
```


#### prc10 address return example
```json
{
"account": {
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"address": "gx14x8qtfg8u075dmhunvqymy0v2a5zrwzfg5y2fj",
"pub_key": {
"@type": "/cosmos.crypto.secp256k1.PubKey",
"key": "AouLtAHVcdYNL1WPl0Tpb7wPZtsPYqwK5Ietr8jfsCnt"
},
"account_number": "8538",
"sequence": "362"
}
}
```
35 changes: 35 additions & 0 deletions docs/http-api/account_new_address.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
order: 6
---

# Generate new address

### Request method
`GET`

### URL
`/server/v1/account/new_address`


### Request example
- /server/v1/account/new_address
-
### Return value
- `code int64 ` : 0 or field does not exist is success, others are failures
- `message string` : Response information
- `data object` : Return to data
- `address string ` : Return to address
- `mnemonic string `: Mnemonic words


#### Return to example
```json
{
"data": {
"address": "gx1zsvp5cfe4q2uve48yvsa4s4mr385utjqw3jefl",
"mnemonic": "absurd coil front control brain kitten bunker beach remember limit hour else enact bone region divert biology balcony vacant regular motor prevent female kit"
},
"message": "响应完成",
"status": 200
}
```
84 changes: 84 additions & 0 deletions docs/http-api/account_txs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
order: 7
---

# Account transactions

### Request method
`GET`

### URL
`/server/v1/account/txs`

### Request example

```
/server/v1/account/txs?addr=gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m
```


#### Request parameters
- `code string `Optional "0=All 1=Success 2=Failure"
- `addr string ` Required "Address"
- `coins string `Optional "Currency"
- `begin_time string `Optional "Start Time"
- `end_time string `Optional "End Time"
- `page string `Optional "Current number of pages, minimum 1"

### Return value
- `code int64 ` : 0 or field does not exist is success, others are failures
- `message string` : Response information
- `data object` : Data returned successfully
- `count int` : Total number
- `txs array`: Transaction array
- `tx object`: Transaction data
- `height string` : Block height,
- `hash string` : Transaction hash,
- `module string` : Transaction module,
- `action string` : Transaction module branch,
- `type string` : Transaction arrival type,
- `signer string` : Transaction signer,
- `fee_amount string` : Transaction fee,
- `fee_coin string` : Transaction fee currency,
- `code string` : Response code,
- `code_err string` : Error information,
- `status string` : Transaction status,
- `status_err string` : Status error information,
- `coins string` : Currency included in the transaction,
- `memo string` : Remarks,
- `create_time string` : Creation time
- `msg string` : Transaction json data


#### Return to example
```json
{
"code": 0,
"data": {
"count": 4600,
"txs": [
{
"tx": {
"height": 8160857,
"hash": "1214C80429CA33776ACF5F1AA1900EA9EFC20119CFB1C7E5AD22733E89FAA8A4",
"module": "bank",
"action": "MsgSend",
"type": "Transfer",
"signer": "gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m",
"fee_amount": 200,
"fee_coin": "uplugcn",
"code": 0,
"code_err": "",
"status": "success",
"status_err": "",
"coins": "uplugcn",
"memo": "",
"create_time": "2023-02-10 16:04:44"
},
"msg": "{\"@type\":\"/cosmos.bank.v1beta1.MsgSend\",\"amount\":[{\"amount\":\"200000000\",\"denom\":\"uplugcn\"}],\"from_address\":\"gx1sqyqeef3ym6q9x7anlgxmxh6u7sjfx6ccc3d4m\",\"to_address\":\"gx1pu006rclnmkhs3y26v7euxstpr4ftgp5cfkctc\"}"
}
]
},
"message": "ok"
}
```
Loading

0 comments on commit 62b6473

Please sign in to comment.