Represents a type-1 EIP-2930 access-list transaction.
Examples
iex> tx =
...> Cartouche.Transaction.V_2930.new(
...> 1,
...> {1, :gwei},
...> 100_000,
...> <<1::160>>,
...> {2, :wei},
...> <<1, 2, 3>>,
...> [],
...> :goerli
...> )
...> tx = Cartouche.Transaction.V_2930.add_signature(tx, true, <<0x01::256>>, <<0x02::256>>)
iex> {:ok, decoded} = tx |> Cartouche.Transaction.V_2930.encode() |> Cartouche.Transaction.V_2930.decode()
iex> decoded == tx
true
Summary
Functions
Adds a signature to a transaction from a packed binary (r <> s <> v).
Adds explicit signature fields to a transaction.
Decodes an EIP-2930 typed RLP transaction.
Build an EIP-2718 typed RLP-encoded access-list transaction.
Decodes an EIP-2930 (type 1) transaction object from block JSON-RPC.
Recovers a signature from a transaction, if it has been signed.
Hashes the typed transaction bytes.
Constructs an unsigned EIP-2930 access-list transaction.
Recovers the signer from a signed type-1 transaction.
Signs a type-1 transaction with the given signer process.
Types
@type access_list() :: [{<<_::160>>, [<<_::256>>]}]
@type t() :: %Cartouche.Transaction.V_2930{ access_list: access_list(), amount: non_neg_integer(), chain_id: non_neg_integer(), data: binary(), destination: <<_::160>> | nil, gas_limit: non_neg_integer(), gas_price: non_neg_integer(), nonce: non_neg_integer(), signature_r: <<_::256>> | nil, signature_s: <<_::256>> | nil, signature_y_parity: boolean() | nil }
Functions
Adds a signature to a transaction from a packed binary (r <> s <> v).
Adds explicit signature fields to a transaction.
Decodes an EIP-2930 typed RLP transaction.
Build an EIP-2718 typed RLP-encoded access-list transaction.
Signed payloads are 0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, yParity, r, s]) per EIP-2930. If any signature
field is nil, the encoded payload omits yParity, r, and s and is the
signing preimage 0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList]).
Decodes an EIP-2930 (type 1) transaction object from block JSON-RPC.
Recovers a signature from a transaction, if it has been signed.
@spec hash(t()) :: <<_::256>>
Hashes the typed transaction bytes.
@spec new( non_neg_integer(), non_neg_integer() | {non_neg_integer(), :wei | :gwei}, non_neg_integer(), <<_::160>>, non_neg_integer() | {non_neg_integer(), :wei | :gwei}, binary(), access_list(), atom() | integer() | nil ) :: t()
Constructs an unsigned EIP-2930 access-list transaction.
Recovers the signer from a signed type-1 transaction.
@spec sign(t(), GenServer.server()) :: {:ok, t()} | {:error, String.t()}
Signs a type-1 transaction with the given signer process.