该接口提供签名时所需的网络费用和 nonce 等参数。
查询 nonce,只返回上链数据。比如 当前地址链上已成功的交易最大 nonce 为 10,则请求的结果为 11。
广播了 nonce 为11的交易以后,当该交易没有上链还在 pending 的状态时,再次请求的结果也是11。请自行维护 nonce,或等交易上链后再进行下一笔交易的广播。
GET https://www.okx.com/api/waas/wallet/pre-transaction/sign-info
Parameter | Type | Required | Description |
---|---|---|---|
chainIndex | String | Yes | 链唯一标识 |
fromAddr | String | Yes | From地址 |
toAddr | String | Yes | To地址 |
txAmount | String | No | 交易的主链币金额,默认为 0。涉及主网币转账的时候必须要携带此参数,否则将会影响 gaslimit 的计算。 |
extJson | Object | Yes | 扩展参数,用于添加 calldata 等信息 |
extJson
Parameter | Type | Required | Description |
---|---|---|---|
inputData | String | No | calldata |
Parameter | Type | Description |
---|---|---|
gasLimt | String | gas 消耗数量 |
nonce | String | 当前数,只返回上链数据。比如 当前地址链上已成功的交易最大 nonce 为 10,则请求的结果为 11。 广播了 nonce 为 11 的交易以后,当该交易没有上链还在 pending 的状态时,再次请求的结果也是 11。请自行维护 nonce,或等交易上链后再进行下一笔交易的广播。 |
gasPrice | Object | gas 消耗单价 |
>normal | String | 中档 gasPrice,单位为 wei |
>min | String | 低档 gasPrice,单位为 wei |
>max | String | 高档 gasPrice,单位为 wei |
>supporteip1559 | Boolean | 是否支持 1559 |
>eip1559Protocol | Object | 1559 协议 |
Parameter | Type | Description |
---|---|---|
eip1559Protocol | Object | 1559 协议 |
>suggestBaseFee | String | 建议基础费用=基础费用*1.25,单位为 wei |
>baseFee | String | 基础费用 |
>proposePriorityFee | String | 中档小费,单位为 wei |
>safePriorityFee | String | 低档小费,单位为 wei |
>fastPriorityFee | String | 高档小费,单位为 wei |
Parameter | Type | Description |
---|---|---|
normalFeeRate | String | 中档位费率 |
maxFeeRate | String | 高档位费率 |
minFeeRate | Object | 低档位费率 |
inscriptionOutput | String | 铭文输出大小 |
minOutput | String | 铭文最小输出大小,单位为聪(通常为 546 聪) |
normalCost | String | 单笔铭刻交易的消耗,单位为聪 |
maxCost | String | 单笔铭刻交易的最大消耗,单位为聪 |
minCost | String | 单笔铭刻交易的最小消耗,单位为聪 |
curl --location --request POST 'https://www.okx.com/api/v5/waas/wallet/transaction/sign-info?chainIndex=1&fromAddr=oxsieeelxd&toAddr=ekljljlnbc&txAmount=1&extJson="xxx"' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \
--data-raw '{
"accountId":"0x04ad62387d1f1c7034087bbe4d16163d06fae42d",
"chainIndex": "1",
"tokenAddress": "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2"
}'
// EVM
{
"code": "0",
"data": [
{ // EVM
"gasLimit" : "21000",
"nonce" : "15",
"gasPrice" : {
"normal" : "21289500000", //中档gasPrice
"min" : "15670000000", //低档gasPrice
"max" : "29149000000", //高档gasPrice
"supportEip1559" : true, //是否支持1559
"erc1599Protocol": {
"suggestBaseFee" : "15170000000", //建议基础费用
"baseFee" : "15170000000", //基础费用
"proposePriorityFee" : "810000000", //中档小费
"safePriorityFee" : "500000000", //低档小费
"fastPriorityFee" : "3360000000" //高档小费
}
}
}
],
"msg": ""
}
// UTXO
{
"code": "0",
"data": [
{
"normalFeeRate": "27",
"maxFeeRate": "35",
"minFeeRate": "22",
"inscriptionOutput": "546",
"minOutput": "1500",
"normalCost": "1800",
"maxCost": "3600",
"minCost": "600"
}
],
"msg": ""
}