钱包 API
获取 Nonce

获取 Nonce#

支持 EVM 链查询 Nonce,返回即将上链的 nonce 和内存池 pending 排队的 nonce。

比如,当前地址已上链的最大 nonce 为 10,且内存池池有 nonce 为 11 和 12 正在 pending 。那么 nonce 为 11,pendingNonce 为 13。

请求路径#

GET https://www.okx.com/api/v5/wallet/pre-transaction/nonce

请求参数#

ParameterTypeRequiredDescription
chainIndexStringYes链唯一标识
addressStringYes地址

响应参数#

ParameterTypeDescription
nonceString可上链的 nonce
pendingNonceString内存池中 pending 的 nonce

请求示例#

shell
curl --location --request GET 'https://www.okx.com/api/v5/wallet/pre-transaction/nonce?chainIndex=1&address=0x1ucda' \
--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'

响应示例#

200
{
  "code": "0",
  "data": [
    {
      "nonce": "15",
      "pendingNonce": "21"
    }
  ],
  "msg": "success"
}