Skip to main content

estimateGas

Submits an order to the node to estimate the required gas fee. The node returns an object containing both the gas units and the calculated gas cost based on the current conversion rate.

Note: The gas fee is expressed as a fixed value in gwei. Future updates may refine this to reflect actual gas consumption more accurately.

Parameters

ParameterTypeDescription
is_bookboolIs the gas for a book order or a top of block order.
is_internalboolIs the order going to use deposited tokens to trade.
token_0Addressthe quote asset of the pair wanted to be traded.
token_1Addressthe base asset of the pair wanted to be traded.

Result

{ "Ok": ["0x23123", 232342] | "Err": msg } — Returns an internal status containing:

  • Ok: The request was successful, gives the amount of gas in token0 needed to be included in the next block, and the block this was calculated for.
  • Err: Internal message explaining failure.

Code Sample

 curl "NODE_URL" -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 0,
"method": "angstrom_estimateGas",
"params": [
true, false, "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"
]
}
'

Response

{
"jsonrpc": "2.0",
"id": "0",
"result": {
"Ok": ["0x7f6f8", 23027061]
}
}