event.get
Reads the ENS events of one name over a block range, across ENSv1 and ENSv2. Parameters, return value, errors and examples for event.get in @ensforge/sdk.
Reads the ENS events of one name over a block range, across ENSv1 and ENSv2.
When to use
Use to show a name's recent activity, or to follow a write's effects, straight from the chain.
Details
- Scans the name's own contracts: the ENSv1 registry,
.ethregistrar and controllers, NameWrapper, resolver and DNS registrar; the ENSv2 registry holding it (following token regenerations), the ETHRegistrar, its resolver (record links) and its subregistry. - Ranges the RPC provider rejects are split; past
maxRequestsrequests the read fails withLOG_RANGE_TOO_LARGEinstead of sending more. - Address-wide and full history needs an indexer (
indexer.getHistory).
Signature
function get(client: Like, options: get.Options): Promise<get.ReturnType>Call it as ens.event.get(options) on a client, or Actions.event.get(client, options).
event.get.request(options) builds a deferred read for Actions.batch. See Look up many at once.
Parameters
| Option | Type | Default | Description |
|---|---|---|---|
name (required) | string | ENS name. Normalized automatically. | |
fromBlock (required) | bigint | First block, inclusive. | |
toBlock | bigint | "latest" | "latest" | Last block, inclusive. |
types | readonly EventType[] | Only these event types. | |
maxRequests | number | 500 | Most eth_getLogs requests to send. |
Also takes the read options.
Returns
Resolves to readonly Event[]. The name's ENS events, in chain order.
| Field | Type | Description |
|---|---|---|
type | EventType | |
action | EventAction | |
event | string | Solidity event name, e.g. LabelRegistered. |
protocol | "v1" | "v2" | null | Protocol of the emitting contract; null for resolvers ensforge does not know. |
contract | Address | Emitting contract. |
name | string | null | The name the event is about, when the event or the query reveals it. |
node | Hex | null | ENS node the event is keyed by, for node-keyed events. |
args | Readonly<Record<string, unknown>> | Decoded event arguments. |
blockNumber | bigint | |
transactionHash | Hex | |
logIndex | number |
Errors
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_NAME, INVALID_RECORD_VALUE | invalid input. |
NetworkError | LOG_RANGE_TOO_LARGE | the provider's log limits make the range too expensive. |
NetworkError | RPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITED | the RPC request fails. |
It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).
See How errors work.
Examples
const events = await ens.event.get({ name: "nick.eth", fromBlock: 26_000_000n })See also
event.watchto follow new events
Was this page helpful?