Wallet API

Get dynamic gas price#

Dynamically get the gas price to reduce errors and increase the success rate of on-chain transactions. Supports 1559 protocol.

Request URL#

GET https://www.okx.com/api/v5/waas/transaction/get-gas-price

Request parameters#

ParameterTypeRequiredDescription
chainIdStringYesUnique identifier of the chain

Response parameters#

ParameterTypeDescription
normalStringMedium gasPrice
minStringLow gasPrice
maxStringHigh gasPrice
supportEip1559BooleanWhether to support 1559
erc1559ProtocolObject1559 protocol

erc1559Protocol

ParameterTypeDescription
erc1559ProtocolObject1559 protocol
suggestBaseFeeStringSuggested base fee
baseFeeStringBase fee
proposePriorityFeeStringMedium tip
safePriorityFeeStringLow tip
fastPriorityFeeStringHigh tip

Request example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/waas/transaction/get-gas-price?chainId=1' \
--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'

Response example#

200
{
  "code": 0,
  "msg": "success",
  "data": [{
    "normal": "24956500000",
    "min": "18490000000",
    "max": "33683000000",
    "supportEip1559": true,
    "erc1599Protocol": {
      "suggestBaseFee": "17990000000",
      "proposePriorityFee": "670000000",
      "safePriorityFee": "500000000",
      "fastPriorityFee": "3100000000",
      "baseFee": "17990000000"
    }
  }]
}