get_eth_estimated_fee_per_gas
The get_eth_estimated_fee_per_gas method allows you to get the estimated gas priority fee for an active coin of your choice.
| parameter | Type | Description |
|---|---|---|
| coin | string | Ticker of the coin/asset for which we want to start the gas fee estimator. |
| estimator_type | string | Simple or Provider. If set to Provider, users must set the gas_api setting in their MM2.json file to source recommended fee values from third party providers Infura or Blocknative. |
Request (simple)
POST get_eth_estimated_fee_per_gas
{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Simple"
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Simple"
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Simple"
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Simple"
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Simple"
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"get_eth_estimated_fee_per_gas","mmrpc":"2.0","params":{"coin":"ETH","estimator_type":"Simple"}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Simple"
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response
{
"mmrpc": "2.0",
"result": {
"base_fee": "10.890879158",
"low": {
"max_priority_fee_per_gas": "0.1101",
"max_fee_per_gas": "11.949818698",
"min_wait_time": null,
"max_wait_time": null
},
"medium": {
"max_priority_fee_per_gas": "1.258084291",
"max_fee_per_gas": "13.905056537",
"min_wait_time": null,
"max_wait_time": null
},
"high": {
"max_priority_fee_per_gas": "2.495532249",
"max_fee_per_gas": "15.949758042",
"min_wait_time": null,
"max_wait_time": null
},
"source": "simple",
"base_fee_trend": "",
"priority_fee_trend": "",
"units": "Gwei"
},
"id": null
}
Request (provider)
POST get_eth_estimated_fee_per_gas
{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Provider"
}
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Provider"
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Provider"
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Provider"
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Provider"
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"get_eth_estimated_fee_per_gas","mmrpc":"2.0","params":{"coin":"ETH","estimator_type":"Provider"}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "get_eth_estimated_fee_per_gas",
"mmrpc": "2.0",
"params": {
"coin": "ETH",
"estimator_type": "Provider"
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response
{
"mmrpc": "2.0",
"result": {
"base_fee": "0.629465419",
"low": {
"max_priority_fee_per_gas": "0.008999999",
"max_fee_per_gas": "1.27",
"min_wait_time": null,
"max_wait_time": null
},
"medium": {
"max_priority_fee_per_gas": "0.049",
"max_fee_per_gas": "1.31",
"min_wait_time": null,
"max_wait_time": null
},
"high": {
"max_priority_fee_per_gas": "0.089",
"max_fee_per_gas": "1.35",
"min_wait_time": null,
"max_wait_time": null
},
"source": "blocknative",
"base_fee_trend": "",
"priority_fee_trend": "",
"units": "Gwei"
},
"id": null
}
Show Error Responses
Error - missing parameter
{
"mmrpc": "2.0",
"error": "Error parsing request: missing field `estimator_type`",
"error_path": "dispatcher",
"error_trace": "dispatcher:122]",
"error_type": "InvalidRequest",
"error_data": "missing field `estimator_type`",
"id": null
}Error - Coin not active
{
"mmrpc": "2.0",
"error": "No such coin DOGE",
"error_path": "get_estimated_fees.lp_coins",
"error_trace": "get_estimated_fees:244] lp_coins:4767]",
"error_type": "NoSuchCoin",
"error_data": {
"coin": "DOGE"
},
"id": null
}Error - Coin not supported
{
"mmrpc": "2.0",
"error": "Gas fee estimation not supported for this coin",
"error_path": "get_estimated_fees",
"error_trace": "get_estimated_fees:206]",
"error_type": "CoinNotSupported",
"id": null
}