Shared EVM JSON-RPC helpers used by hash, authorization, and transaction paths.
Summary
Functions
Normalize a 0x-prefixed transaction hash to lowercase.
Require a non-negative integer chain_id in method config.
Build Onchain.RPC options from an RPC URL and optional Req overrides.
Fetch a transaction's recipient and value by hash (eth_getTransactionByHash).
Functions
Normalize a 0x-prefixed transaction hash to lowercase.
@spec require_chain_id(map()) :: {:ok, non_neg_integer()} | {:error, MPP.Errors.t()}
Require a non-negative integer chain_id in method config.
Build Onchain.RPC options from an RPC URL and optional Req overrides.
@spec transaction_by_hash(String.t(), keyword()) :: {:ok, %{to: binary() | nil, value: non_neg_integer()} | nil} | {:error, term()}
Fetch a transaction's recipient and value by hash (eth_getTransactionByHash).
Reads only to and value from the raw result rather than decoding a full
Ethereum signing envelope, so chain-specific transaction types (OP Stack
deposits, zkSync, Celo) still verify. Both fields are validated strictly:
to is nil or a 20-byte address, value a hex quantity.
An unknown hash is {:ok, nil}.