Wallet API

Get Nonce#

Supports querying Nonce for EVM chains, returning only confirmed transaction data.

Note
For example: If the maximum nonce of successfully confirmed transactions on the address chain is 10, the request result will be 11. After broadcasting a transaction with nonce 11, if it remains pending without confirmation, subsequent requests will also return nonce 11.Therefore, for scenarios involving parallel sending of multiple transactions, please manage nonce manually or wait for transactions to be confirmed before broadcasting the next transaction.

Request Path#

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

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain
addressStringYesAddress

Response Parameters#

ParameterTypeDescription
nonceStringCurrent nonce

Request Example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/waas/wallet/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'
// If the chain is not supported, an error will be returned directly

Response Example#

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