Onchain.Transaction.Info (onchain v0.16.0)

Copy Markdown View Source

Inclusion metadata for an execution-apis transaction object, plus the typed transaction.

from_json/1 on each envelope drops blockHash, blockNumber, blockTimestamp, from, hash, and transactionIndex (TransactionInfo in execution-apis v1.0.0-beta.7, src/schemas/transaction.yaml). Those fields live here. Block fields are nil when the transaction is pending. block_timestamp is also nil when the node omits blockTimestamp. Alchemy mainnet sometimes does that for mined transactions (observed 2026-10-01), even though the beta.7 schema lists the field as required.

Summary

Functions

Decodes a JSON-RPC transaction object into an envelope.

Types

t()

@type t() :: %Onchain.Transaction.Info{
  block_hash: <<_::256>> | nil,
  block_number: non_neg_integer() | nil,
  block_timestamp: non_neg_integer() | nil,
  from: <<_::160>>,
  hash: <<_::256>>,
  transaction: transaction(),
  transaction_index: non_neg_integer() | nil
}

transaction()

Functions

decode(params)

@spec decode(term()) :: {:ok, t()} | {:error, term()}

Decodes a JSON-RPC transaction object into an envelope.

Returns {:error, reason} for a missing required field, an unknown type, or a field the envelope decoder cannot read. Does not raise.