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
Live URL | https://bc-api.qpyou.cn/core/v0/wallet |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v0/wallet |
HTTP Method | POST |
Content-Type | application/json |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | 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
1 2 3 4 5 6 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// 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" } } |
Get Wallet Information
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
Live URL | https://bc-api.qpyou.cn/core/v1/wallet/{address} |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/wallet/{address} |
HTTP Method | GET |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
address | the address of the account whose information will be returned | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | 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
|
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
1 2 3 4 5 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
// 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
Live URL | https://bc-api.qpyou.cn/core/v1/wallet/{address}/balance |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/wallet/{address}/balance |
HTTP Method | GET |
Content-Type | application/json |
Path Parameters
Field Name | Description | Type | Required |
---|---|---|---|
address | the address of the account whose information will be returned | string | Y |
Header Parameters
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks {ploygon, xpla} | 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
1 2 3 4 5 |
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
1 2 3 4 5 6 7 8 9 |
{ "code": 0, "message": "success", "data": { "balance": "0.198284931197886585", "rawBalance": "198284931197886585", "decimals": 18 } } |