动态获取各个链的预估 gas price,支持 EIP-1559,覆盖 EVM、UTXO 模型的网络。
GET https://www.okx.com/api/v5/wallet/pre-transaction/gas-price
Parameter | Type | Required | Description |
---|---|---|---|
chainIndex | String | Yes | 链唯一标识 |
Parameter | Type | Description |
---|---|---|
>normal | String | 中档 gasPrice,单位为 wei |
>min | String | 低档 gasPrice,单位为 wei |
>max | String | 高档 gasPrice,单位为 wei |
>supporteip1559 | Boolean | 是否支持 1559 |
>eip1559Protocol | Object | 1559 协议 |
Parameter | Type | Description |
---|---|---|
eip1559Protocol | Object | 1559 协议结构 |
>baseFee | String | 基础费用,单位为 wei |
>proposePriorityFee | String | 中档小费,单位为 wei |
>safePriorityFee | String | 低档小费,单位为 wei |
>fastPriorityFee | String | 高档小费,单位为 wei |
Parameter | Type | Description |
---|---|---|
normalFeeRate | String | 中档位费率 |
maxFeeRate | String | 高档位费率 |
minFeeRate | Object | 低档位费率 |
inscriptionOutput | String | 铭文输出大小 |
minOutput | String | 铭文最小输出大小,单位为聪(通常为 546 聪) |
normalCost | String | 单笔铭刻交易的消耗,单位为聪 |
maxCost | String | 单笔铭刻交易的最大消耗,单位为聪 |
minCost | String | 单笔铭刻交易的最小消耗,单位为聪 |
curl --location --request GET 'https://www.okx.com/api/v5/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'
// 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": ""
}