钱包 API
获取各链 Gas price

获取各链 Gas price#

动态获取各个链的预估 gas price,支持 EIP-1559,覆盖 EVM、UTXO 模型的网络。

请求路径#

GET https://www.okx.com/api/waas/wallet/pre-transaction/gas-price

请求参数#

ParameterTypeRequiredDescription
chainIndexStringYes链唯一标识

响应参数#

EVM#

ParameterTypeDescription
normalString中档 gas price,单位为 wei
minString低档 gas price,单位为 wei
maxString高档 gas price,单位为 wei
supportEip1559Boolean是否支持 1559
eip1559ProtocolObject1559 协议结构
eip1559 Protocol
ParameterTypeDescription
eip1559ProtocolObject1559 协议结构
>suggestBaseFeeString建议基础费用=基础费用*1.25,单位为 wei
>baseFeeString基础费用,单位为 wei
>proposePriorityFeeString中档小费,单位为 wei
>safePriorityFeeString低档小费,单位为 wei
>fastPriorityFeeString高档小费,单位为 wei

BRC-20/UTXO#

ParameterTypeDescription
normalFeeRateString中档位费率
maxFeeRateString高档位费率
minFeeRateObject低档位费率
inscriptionOutputString铭文输出大小
minOutputString铭文最小输出大小,单位为聪(通常为 546 聪)
normalCostString单笔铭刻交易的消耗,单位为聪
maxCostString单笔铭刻交易的最大消耗,单位为聪
minCostString单笔铭刻交易的最小消耗,单位为聪

请求示例#

shell
curl --location --request GET 'https://www.okx.com/api/v5/waas/wallet/pre-transaction/gas-price?chainIndex=1' \
--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
// EVM
{
    "code": "0",
    "data": [
        {
            "normal" : "21289500000", //中档gasPrice
            "min" : "15670000000",//低档gasPrice
            "max" : "29149000000", //高档gasPrice            
            "supportEip1559" : true,//是否支持1559
            "erc1599Protocol": {
                "suggestBaseFee" : "15170000000",//建议基础费用
                "baseFee" : "15170000000",//基础费用
                "proposePriorityFee" : "810000000",//中档小费
                "safePriorityFee" : "500000000",//低档小费
                "fastPriorityFee" : "3360000000"//高档小费
            }
       }     
    ],
    "msg": ""
}

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