eth_subscribe

To subscribe to real-time data feeds

This method will use 20 Compute Units.


Reference: Here

Parameters

  1. subscription type - string - The type of event you want to subscribe to (e.g. newHeads). For Monad, this method supports the following subscription types:

subscription type
description

newHeads

Fires a notification each time a new header is appended to the chain, after the block is Finalized. Unlike in geth, no reorgs are possible.

logs

Returns logs (that match the given filter criteria) in a new block, after the block is Finalized. Unlike in geth, no reorgs are possible.

monadNewHeads

Same as newHeads, but as soon as the block is Proposed and the node has a chance to speculatively execute.

monadLogs

Same as logs, but as soon as the block is Proposed and the node has a chance to speculatively execute.

  1. data - object - (Optional) - Arguments such as an address, multiple addresses, and topics. Note, only logs that are created from these addresses or match the specified topics will return logs.

params: [
  "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
]

Returns

result - string - Hex encoded subscription ID. This ID will be attached to all received events and can also be used to cancel the subscription using eth_unsubscribe.

Last updated

Was this helpful?