Gas
The RPC API enables you to query the gas price for a specific block or hash.
Gas Price
Returns gas price for a specific
block_height
orblock_hash
.
- Using
[null]
will return the most recent block's gas price.
- method:
gas_price
- params:
[block_height]
,["block_hash"]
, or[null]
[block_height]
- JSON
- JavaScript
- HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "gas_price",
"params": [17824600]
}
const response = await near.connection.provider.gasPrice(17824600);
http post https://rpc.testnet.near.org jsonrpc=2.0 method=gas_price params:='[17824600]' id=dontcare
["block_hash"]
- JSON
- JavaScript
- HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "gas_price",
"params": ["AXa8CHDQSA8RdFCt12rtpFraVq4fDUgJbLPxwbaZcZrj"]
}
const response = await near.connection.provider.gasPrice(
"AXa8CHDQSA8RdFCt12rtpFraVq4fDUgJbLPxwbaZcZrj"
);
http post https://rpc.testnet.near.org jsonrpc=2.0 method=gas_price params:='["AXa8CHDQSA8RdFCt12rtpFraVq4fDUgJbLPxwbaZcZrj"]' id=dontcare
[null]
- JSON
- JavaScript
- HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "gas_price",
"params": [null]
}