更多资源
获取签名所需数据

获取签名所需数据#

查询交易签名所需要的一些链上数据,如当前上链的 Nonce、Gas 等。

请求地址#

POST https://www.okx.com/api/v5/waas/transaction/get-sign-info

请求参数#

ParameterTypeRequiredDescription
chainIdStringYes链唯一标识
addrFromStringYes交易 From 地址
addrToStringYes交易 To 地址
txAmountStringYes交易金额
extJsonJson ObjectNo扩展参数
>inputdataStringNo调用合约时的 callData

响应参数#

ParameterTypeDescription
gasLimtStringgas 限额
nonceStringnonce
gasPriceObjectgas 价格
>normalString中档 gas 价格
>minString代档 gas 价格
>maxString高档 gas 价格
>supportEip1559Boolean是否支持 1559
>erc1559ProtocolObject1559 协议

erc1559Protocol

ParameterTypeDescription
erc1559ProtocolObject1559 协议
>suggestBaseFeeString建议基础费用
>baseFeeString基础费用
>proposePriorityFeeString中档小费
>safePriorityFeeString低档小费
>fastPriorityFeeString高档小费

请求示例#

shell
curl --location --request POST 'https://www.okx.com/api/v5/waas/transaction/get-sign-info' \
--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 '{
  "addrFrom": "0x383c8208b4711256753b70729ba0cf0cda55efad",
  "addrTo": "0x4ad041bbc6fa102394773c6d8f6d634320773af4",
  "txAmount": "31600000000000000",
  "chainId": "1",
  "extJson": {
    "inputData": "041bbc6fa102394773c6d8f6d634320773af4"
  }
}'

响应示例#

200
{
  "code": 0,
  "msg": "success",
  "data": [{
    "gasLimit": "21000",
    "nonce": "0",
    "gasPrice": {
      "normal": "12694000000",
      "min": "9340000000",
      "max": "17318000000",
      "supportEip1559": "true",
      "erc1599Protocol": {
        "suggestBaseFee": "8840000000",
        "proposePriorityFee": "760000000",
        "safePriorityFee": "500000000",
        "fastPriorityFee": "2290000000",
        "baseFee": "8840000000"
      }
    }
  }]
}