更多资源
获取动态 Gas 价格

获取动态 Gas 价格#

动态获取 Gas 价格,支持 1559 协议,当前仅支持 EVM 系网络,其他网络陆续支持中。

请求地址#

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

请求参数#

ParameterTypeRequiredDescription
chainIdStringYes链唯一标识

响应参数#

ParameterTypeDescription
normalString中档 gas 价格
minString低档 gas 价格
maxString高档 gas 价格
supportEip1559Boolean是否支持 1559
erc1559ProtocolObject1559 协议

erc1559Protocol

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

请求示例#

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'

响应示例#

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"
    }
  }]
}