Fee Estimator Streaming
Using this method, you can enable the fee estimation stream. For requesting fee estimates without streaming, use get_eth_estimated_fee_per_gas.
Parameter* = required | Type | Description |
---|---|---|
client_id* | integer | This ID can be used to access data (e.g. via http://localhost:7783/event-stream?id=1) |
coin* | string | The coin or token to enable the fee estimation stream for. |
Parameter* = required | Type | Description |
---|---|---|
streamer_id | string | Optional. An identifier for the data stream. This can be used later to disable streaming for the event with stream::disable. |
fee_estimator_enable
{
"userpass": "RPC_UserP@SSW0RD",
"method": "stream::fee_estimator::enable",
"mmrpc": "2.0",
"params": {
"client_id": 1,
"coin": "MATIC",
"config": {
"estimate_every": 33.4,
"estimator_type": "Provider"
}
}
}
{
"mmrpc": "2.0",
"result": {
"streamer_id": "FEE_ESTIMATION:MATIC"
},
"id": null
}
Here is an example of the stream data you should be able to see in http://localhost:7783/event-stream?id=1 at each estimate interval:
data: {"_type":"FEE_ESTIMATION:MATIC","message":{"base_fee":"0.000000281","low":{"max_priority_fee_per_gas":"30","max_fee_per_gas":"30.000000309","min_wait_time":null,"max_wait_time":null},"medium":{"max_priority_fee_per_gas":"32.633147189","max_fee_per_gas":"32.633147519","min_wait_time":null,"max_wait_time":null},"high":{"max_priority_fee_per_gas":"38.9999999","max_fee_per_gas":"39.000000251","min_wait_time":null,"max_wait_time":null},"source":"simple","base_fee_trend":"","priority_fee_trend":"","units":"Gwei"}}
Parameter* = required | Type | Description |
---|---|---|
ClientAlreadyListening | string | Optional. The requested events are already being sent to the client_id |
CoinNotFound | string | Optional. The specified coin was not found or is not activated yet |
CoinNotSupported | string | Optional. Currently only EVM coins/tokens support fee estimation |
InvalidRequest | string | Optional. Error parsing request or invalid configuration parameters |
UnknownClient | string | Optional. No client has an open connection using this client_id |
{
"mmrpc": "2.0",
"error": "CoinNotFound",
"error_path": "fee_estimation",
"error_trace": "fee_estimation:42]",
"error_type": "CoinNotFound",
"id": null
}
{
"mmrpc": "2.0",
"error": "CoinNotSupported",
"error_path": "fee_estimation",
"error_trace": "fee_estimation:56]",
"error_type": "CoinNotSupported",
"id": null
}
{
"mmrpc": "2.0",
"error": "UnknownClient",
"error_path": "fee_estimation",
"error_trace": "fee_estimation:54]",
"error_type": "EnableError",
"error_data": "UnknownClient",
"id": null
}
{
"mmrpc": "2.0",
"error": "ClientAlreadyListening",
"error_path": "fee_estimation",
"error_trace": "fee_estimation:54]",
"error_type": "EnableError",
"error_data": "ClientAlreadyListening",
"id": null
}
{
"mmrpc": "2.0",
"error": "Error parsing request: unknown variant `Complex`, expected `Simple` or `Provider`",
"error_path": "dispatcher",
"error_trace": "dispatcher:122]",
"error_type": "InvalidRequest",
"error_data": "unknown variant `Complex`, expected `Simple` or `Provider`",
"id": null
}