錢包 API
錢包 API 創建一個錢包,並獲取錢包信息及其餘額。
創建錢包
創建一對公鑰 - 私鑰(或助記詞)和一個錢包地址。
請求 URL
標頭參數
回應
請求範例
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v0/wallet'
-H 'accept: */*'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-H 'x-network: polygon'
-d ''
回應範例
// 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"
}
}
獲取錢包資訊
獲取有關帳戶狀態的信息,例如隨機數(序列)、帳戶號碼等。 獲取帳戶狀態,包括隨機數(序列)和帳戶號碼。如果錢包是 多簽錢包,則 API 返回從此錢包發送交易所需的 閾值 以及有關簽署者的信息。
請求 URL
路徑參數
標頭參數
回應
請求範例
curl -X 'GET'
'https://sandbox-bc-api.qpyou.cn/core/v1/wallet/0x9428e6eF51FEb2201676deEc11B7E36F7c1F0765'
-H 'accept: */*'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-H 'x-network: polygon'
回應範例
// 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
}
}
獲取錢包餘額
獲取錢包的餘額(Polygon: matic, XPLA: xpla)。
請求 URL
路徑參數
標頭參數
回應
請求範例
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'
回應範例
{
"code": 0,
"message": "success",
"data": {
"balance": "0.198284931197886585",
"rawBalance": "198284931197886585",
"decimals": 18
}
}