跳到主要内容

cfx_estimateGasAndCollateral

Return estimated gas and collateral usage.

Params

(2)

1. request (required)

accessList
array[CfxAccessListItem] or null
address
string
Match pattern:
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
storageKeys
array[string]
data
string or null
Match pattern:
^0x[0-9a-f]*$
from
string or null
Match pattern:
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
gas
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasPrice
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
maxFeePerGas
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
maxPriorityFeePerGas
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
nonce
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
storageLimit
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$
to
string or null
Match pattern:
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
transactionType
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$
value
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$

2. epoch_number (required)

(one of)
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$

Result

(cfx_estimateGasAndCollateral_result)
gasLimit
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasUsed
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
storageCollateralized
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$

Endpoint

Params

request

accessList

epoch_number


Request

curl -X POST --data \
'{
"method": "cfx_estimateGasAndCollateral",
"params": [
null,
null
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
https://test.confluxrpc.com