获取 Gas Price#
动态获取各个链的预估 gas gasPrice。
请求路径#
GET https://web3.okx.com/api/v6/dex/pre-transaction/gas-price
请求参数#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识。(如 1代表Ethereum。更多可查看这里。) | 
响应参数#
EVM & Tron#
| Parameter | Type | Description | 
|---|---|---|
| normal | String | 中档 gasPrice。对于EVM,单位为 wei。对于Tron,单位是 SUN | 
| min | String | 低档 gasPrice。对于EVM,单位为 wei。对于Tron,单位是 SUN | 
| max | String | 高档 gasPrice。对于EVM,单位为 wei。对于Tron,单位是 SUN | 
| supporteip1559 | Boolean | 是否支持 1559 | 
| eip1559Protocol | Object | 1559 协议 | 
eip1559 Protocol#
| Parameter | Type | Description | 
|---|---|---|
| eip1559Protocol | Object | 1559 协议结构 | 
| >baseFee | String | 基础费用,单位为 wei | 
| >proposePriorityFee | String | 中档小费,单位为 wei | 
| >safePriorityFee | String | 低档小费,单位为 wei | 
| >fastPriorityFee | String | 高档小费,单位为 wei | 
Solana#
| Parameter | Type | Description | 
|---|---|---|
| priorityFee | String | 优先费。只适用于 Solana | 
| >proposePriorityFee | String | 中档优先费,单位是 microlamports。80 分位 | 
| >safePriorityFee | String | 低档优先费,单位是 microlamports。60 分位 | 
| >fastPriorityFee | String | 低档优先费,单位是 microlamports。95 分位 | 
| >extremePriorityFee | String | 低档优先费,单位是 microlamports。99 分位 | 
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/pre-transaction/gas-price?chainIndex=1' \
--header 'Content-Type: application/json' \
--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",
    "data": [
        {
            "normal" : "21289500000", //中档gasPrice
            "min" : "15670000000",//低档gasPrice
            "max" : "29149000000", //高档gasPrice            
            "supportEip1559" : true,//是否支持1559
            "erc1599Protocol": {
                "suggestBaseFee" : "15170000000",//建议基础费用
                "baseFee" : "15170000000",//基础费用
                "proposePriorityFee" : "810000000",//中档小费
                "safePriorityFee" : "500000000",//低档小费
                "fastPriorityFee" : "3360000000"//高档小费
            },
            "priorityFee":{}
       }     
    ],
    "msg": ""
}
