Wallet API

Get Signature Data#

This API can retrieve all information needed to assemble a transaction at once (gas-limit, gas-price, nonce).

Request Path#

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

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain
fromAddrStringYesFrom address
toAddrStringYesTo address
txAmountStringNoNative token amount for the transaction, default is 0. Must include this parameter when involving mainnet coin transfer, otherwise it will affect the calculation of gas limit.
extJsonObjectYesExtension parameters, used to add calldata and other information

extJson

ParameterTypeRequiredDescription
inputDataStringNocalldata

Response Parameters#

EVM#

ParameterTypeDescription
gasLimitStringGas consumption
nonceStringCurrent nonce. Only returns on-chain data. For example, if the maximum nonce of successful transactions on the current address chain is 10, the request result will be 11. After broadcasting the transaction with nonce 11, if the transaction is still in pending status, the result of the next request will also be 11. Please maintain the nonce yourself or wait for the transaction to be on-chain before broadcasting the next transaction.
gasPriceObjectGas consumption price
>normalStringMedium gas price, in wei
>minStringLow gas price, in wei
>maxStringHigh gas price, in wei
>supporteip1559BooleanWhether supports 1559
>eip1559ProtocolObject1559 protocol
eip1559 Protocol
ParameterTypeDescription
eip1559ProtocolObject1559 protocol
>suggestBaseFeeStringSuggested base fee = base fee * 1.25, in wei
>baseFeeStringBase fee
>proposePriorityFeeStringMedium priority fee, in wei
>safePriorityFeeStringLow priority fee, in wei
>fastPriorityFeeStringHigh priority fee, in wei

BRC-20/UTXO#

ParameterTypeDescription
normalFeeRateStringMedium fee rate
maxFeeRateStringHigh fee rate
minFeeRateObjectLow fee rate
inscriptionOutputStringInscription output size
minOutputStringMinimum inscription output size, in Satoshi (usually 546 Satoshi)
normalCostStringSingle inscription transaction cost, in Satoshi
maxCostStringMaximum single inscription transaction cost, in Satoshi
minCostStringMinimum single inscription transaction cost, in Satoshi

Request Example#

shell
curl --location --request POST 'https://www.okx.com/api/v5/waas/wallet/transaction/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 '{
    "accountId":"0x04ad62387d1f1c7034087bbe4d16163d06fae42d",
    "chainIndex": "1",
    "tokenAddress": "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2"
}'

Response Example#

200
// EVM
{
    "code": "0",
    "data": [
        { // EVM
            "gasLimit" : "21000", 
            "nonce" : "15",
            "gasPrice" : {
                "normal" : "21289500000", // Medium gas price
                "min" : "15670000000", // Low gas price
                "max" : "29149000000", // High gas price            
                "supportEip1559" : true, // Whether supports 1559
                "erc1599Protocol": {
                    "suggestBaseFee" : "15170000000", // Suggested base fee
                    "baseFee" : "15170000000", // Base fee
                    "proposePriorityFee" : "810000000", // Medium priority fee
                    "safePriorityFee" : "500000000", // Low priority fee
                    "fastPriorityFee" : "3360000000" // High priority fee
                }
            }     
        }
    ],
    "msg": ""
}

// UTXO
{
    "code": "0",
    "data": [
        {
          "normalFeeRate": "27",
          "maxFeeRate": "35",
          "minFeeRate": "22",
          "inscriptionOutput": "546",
          "minOutput": "1500",
          "normalCost": "1800",
          "maxCost": "3600",
          "minCost": "600"
        }
    ],
    "msg": ""
}