Wallet API
Wallet API creates a wallet, and gets the wallet information and its balance.
Create wallet
Creates a public key - private key pair (or a mnemonic phrase) and a wallet address.
Request URL
| Field Name | Description | Type | Required |
| x-network | the blockchain networks | string | Y |
| Authorization | Authentication token required to call the API | string | Y |
Responses
| Field Name | Description | Type |
| code | api request result code, 0: success | number |
| message | the result message | String |
| data | API response data | json |
| data.address | the created wallet address | string |
| data.privateKey | the private key of the created wallet | string |
| data.publicKey | the public key of the created key (xpla) | string |
Request sample
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v0/wallet'
-H 'accept: */*'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-H 'x-network: polygon'
-d ''
Response sample
// Polygon
{
"code": 0,
"message": "success",
"data": {
"address": "0x413a1bF6584fF29d663f6CE5cf3F1Fce2064cf4d",
"privateKey": "0x250748507c8d83cc71fb4178d0b989062dc8e02ea050f9078ae0d8fbfda4d845"
}
}
// Xpla
{
"code": 0,
"message": "success",
"data": {
"address": "xpla1xckvhyu48uqlhduqgd79y45tpfhqlnrqhr87nt",
"publicKey": "AvNhefa+7fhS7RH/VryEtz1yWzXKGS1+jnheotpOMuSV",
"privateKey": "pledge outdoor ginger assault key luxury appear roast immense march burden charge season sea raw suspect tenant fossil portion easily onion fragile castle spoil"
}
}
Gets the information about the account status, like nonce (sequence), account number, and etc. Gets the account status including the nonce (sequence) and the account number. If the wallet is a multi-sig wallet, the API returns the thresholds required for sending a transaction from this wallet and the information about the signers.
Request URL
Path parameters
| Field Name | Description | Type | Required |
| address | the address of the account whose information will be returned | string | Y |
| Field Name | Description | Type | Required |
| x-network | the blockchain networks | string | Y |
| Authorization | Authentication token required to call the API | string | Y |
Responses
| Field Name | Description | Type |
| code | api request result code, 0: success | number |
| message | the result message | String |
| data | API response data | json |
| data.nonce | the nonce (sequence) of the wallet | number |
| data.accountNumber | the account number of the wallet (xpla) | number |
| data.publicKey | the public key of the wallet (xpla) | string |
| data.type | the wallet type * SINGLE: single-sig wallet * MULTI: multi-sig wallet | string |
| data.signers | If the wallet type is MULTI, the wallet addresses of the multiple signers | array |
| data.threshold | the threshold for multiple signatures | number |
Request sample
curl -X 'GET'
'https://sandbox-bc-api.qpyou.cn/core/v1/wallet/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765'
-H 'accept: */*'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-H 'x-network: polygon'
Response sample
// Polygon (SINGLE)
{
"code": 0,
"message": "success",
"data": {
"nonce": 185,
"type": "SINGLE"
}
}
// Xpla (SINGLE)
{
"code": 0,
"message": "success",
"data": {
"nonce": 52,
"accountNumber": 4658,
"publicKey": "xplapub1qtet7gjzyt6h3rm79ragfanses4xwgx6hjtjzh2juvtklxhup5gpgepz4yz",
"type": "SINGLE"
}
}
// Polygon (MULTI)
{
"code": 0,
"message": "success",
"data": {
"nonce": 185,
"type": "MULTI",
"signers": ["xpla1c49ehdl8dcd3wv0vj52h25gfxkxkr7sfpvqrhw", "xpla1gzq6a8t4dt9lpth6ufzlnnvll9cdsdfgmrhk73", "xpla16xhh685u829vrm407sq8rf82wt4gjudslzgtm7 "],
"threshold": 2
}
}
// Xpla (MULTI)
{
"code": 0,
"message": "success",
"data": {
"nonce": 52,
"accountNumber": 4658,
"publicKey": "xplapub1qtet7gjzyt6h3rm79ragfanses4xwgx6hjtjzh2juvtklxhup5gpgepz4yz",
"type": "MULTI",
"signers": ["0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0", "0xA10078576Ca6f63dc6f78ff9a8ed8bd05B51f463", "0xa245824a24daf3b312d3f59c7debf162c4993e8b"],
"threshold": 2
}
}
Get wallet balance
Gets the balance (Polygon: matic, XPLA: xpla) of the wallet.
Request URL
Path parameters
| Field Name | Description | Type | Required |
| address | the address of the account whose information will be returned | string | Y |
| Field Name | Description | Type | Required |
| x-network | the blockchain networks | string | Y |
| Authorization | Authentication token required to call the API | string | Y |
Responses
| Field Name | Description | Type |
| code | api request result code, 0: success | number |
| message | the result message | String |
| data | API response data | json |
| data.balance | the balance that the account has | string |
| data.rawBalance | the wallet balance of the account not applying data.decimals | string |
| data.decimals | the maximum decimal places of the token | number |
Request sample
curl -X 'GET'
'https://sandbox-bc-api.qpyou.cn/core/v1/wallet/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765/balance'
-H 'accept: */*'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-H 'x-network: polygon'
Response sample
{
"code": 0,
"message": "success",
"data": {
"balance": "0.198284931197886585",
"rawBalance": "198284931197886585",
"decimals": 18
}
}