Gas
getGasPriceEstimate
Gas price levels from recent transactions, optionally for given shared objects.
Details
- Endpoint
- POST getGasPriceEstimate (JSON-RPC)
- Credits
- 1
- Rate class
- Light. Counts against your light requests per second.
Returns the reference gas price of the current epoch (the lowest price a transaction can pay) and gas price percentiles over the last lookbackCheckpoints checkpoints: min, low (p25), medium (p50), high (p75), veryHigh (p95) and unsafeMax (p99), all in MIST per computation unit. Pass objectIds (shared objects such as a hot pool) to measure only transactions that touched them, which shows congestion on that object. gasPriceEstimate is the level you ask for with level (default medium), never below the reference price.
Parameters
| Name | Type | Description |
|---|---|---|
| objectIds | array of string | Up to 10 shared object ids. Only transactions that changed one of them are sampled.Up to 10 items. |
| lookbackCheckpoints | integer | How many recent checkpoints to sample, default 150 (about one minute).From 10 to 1000. |
| level | string | Which level gasPriceEstimate reports, default medium.One of "min", "low", "medium", "high", "veryHigh", "unsafeMax". |
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl -X POST "https://api.tide.ad/" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getGasPriceEstimate",
"params": {
"objectIds": [
"0x0000000000000000000000000000000000000000000000000000000000000006"
],
"lookbackCheckpoints": 100
}
}'const res = await fetch("https://api.tide.ad/", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getGasPriceEstimate",
"params": {
"objectIds": [
"0x0000000000000000000000000000000000000000000000000000000000000006"
],
"lookbackCheckpoints": 100
}
}),
});
const data = await res.json();Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"referenceGasPrice": 100,
"gasPriceEstimate": 100
}
}