Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeSDK

event.decode

Normalizes the ENS events in logs or transaction receipts. Parameters, return value, errors and examples for event.decode in @ensforge/sdk.

ReadBatchablestable
Since v1.0.0View source

Normalizes the ENS events in logs or transaction receipts.

When to use

Use to read what a write did from its receipts, or to classify logs you fetched yourself.

Details

  • Each event carries the indexer's type and action (bigname's model), the Solidity event name, protocol, emitter, decoded arguments and, when the event spells it, the name.
  • Logs that are not ENS events (token transfers, other contracts) are skipped.
  • No RPC calls.

Signature

function decode(client: Like, options: decode.Options): Promise<decode.ReturnType>

Call it as ens.event.decode(options) on a client, or Actions.event.decode(client, options).

event.decode.request(options) builds a deferred read for Actions.batch. See Look up many at once.

Parameters

OptionTypeDefaultDescription
logsreadonly Log[]Logs to decode.
receiptsreadonly TransactionReceipt[]Receipts whose logs to decode.

Returns

Resolves to readonly Event[]. The ENS events, in log order.

FieldTypeDescription
typeEventType
actionEventAction
eventstringSolidity event name, e.g. LabelRegistered.
protocol"v1" | "v2" | nullProtocol of the emitting contract; null for resolvers ensforge does not know.
contractAddressEmitting contract.
namestring | nullThe name the event is about, when the event or the query reveals it.
nodeHex | nullENS node the event is keyed by, for node-keyed events.
argsReadonly<Record<string, unknown>>Decoded event arguments.
blockNumberbigint
transactionHashHex
logIndexnumber

Errors

ErrorCodesWhen
InternalErrorUNEXPECTEDmalformed logs.
NetworkErrorRPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITEDthe RPC request fails.

It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).

See How errors work.

Examples

Decoding a write's receipts
const events = await ens.event.decode({ receipts })

See also

Was this page helpful?