Each state-changing operation on Ethereum requires a transaction.
TYPES
<src>AccessListEntry⇒ { address: string , storageKeys: Array< string > } A single AccessList entry of storage keys (slots) for an address.
<src>AccessListish⇒ AccessList | Array< tuple< string, Array< string > > > | Record< string, Array< string > > Any ethers-supported access list structure.
FUNCTIONS
Returns a AccessList from any ethers-supported access-list structure.
Returns the address for the key.
The key may be any standard form of public key or a private key.
Returns the recovered address for the private key that was used to sign digest that resulted in signature.
A Transaction describes an operation to be executed on Ethereum by an Externally Owned Account (EOA). It includes who (the to address), what (the data) and how much (the value in ether) the operation should entail.
tx = new Transaction()
// Transaction {}
tx.data = "0x1234";
// '0x1234'
PROPERTIES
The access list.
An access list permits discounted (but pre-paid) access to bytecode and state variable access within contract execution.
<src>transaction.chainId⇒ bigint The chain ID this transaction is valid on.
<src>transaction.data⇒ string The transaction data. For init transactions this is the deployment code.
<src>transaction.from⇒ null | stringread-only The sending address, if signed. Otherwise, null.
<src>transaction.fromPublicKey⇒ null | stringread-only The public key of the sender, if signed. Otherwise, null.
<src>transaction.gasLimit⇒ bigint <src>transaction.gasPrice⇒ null | bigint The gas price.
On legacy networks this defines the fee that will be paid. On EIP-1559 networks, this should be null.
<src>transaction.hash⇒ null | stringread-only The transaction hash, if signed. Otherwise, null.
<src>transaction.maxFeePerGas⇒ null | bigint The maximum total fee per unit of gas to pay. On legacy networks this should be null.
<src>transaction.maxPriorityFeePerGas⇒ null | bigint The maximum priority fee per unit of gas to pay. On legacy networks this should be null.
<src>transaction.nonce⇒ number <src>transaction.serialized⇒ stringread-only The serialized transaction.
This throws if the transaction is unsigned. For the pre-image, use unsignedSerialized.
If signed, the signature for this transaction.
<src>transaction.to⇒ null | string The to address for the transaction or null if the transaction is an init transaction.
<src>transaction.type⇒ null | number The transaction type.
If null, the type will be automatically inferred based on explicit properties.
<src>transaction.typeName⇒ null | stringread-only The name of the transaction type.
<src>transaction.unsignedHash⇒ stringread-only The pre-image hash of this transaction.
This is the digest that a Signer must sign to authorize this transaction.
<src>transaction.unsignedSerialized⇒ stringread-only The transaction pre-image.
The hash of this is the digest which needs to be signed to authorize this transaction.
<src>transaction.value⇒ bigint The amount of ether (in wei) to send in this transactions.
CREATING INSTANCES
Creates a new Transaction with default values.
Create a Transaction from a serialized transaction or a Transaction-like object.
METHODS
Create a copy of this transaciton.
<src>transaction.inferType()⇒ number Return the most "likely" type; currently the highest supported transaction type.
<src>transaction.inferTypes()⇒ Array< number > Validates the explicit properties and returns a list of compatible transaction types.
<src>transaction.isBerlin()⇒ boolean Returns true if this transaction is berlin hardform transaction (i.e. type === 1).
This provides a Type Guard that the related properties are non-null.
<src>transaction.isLegacy()⇒ boolean Returns true if this transaction is a legacy transaction (i.e. type === 0).
This provides a Type Guard that the related properties are non-null.
<src>transaction.isLondon()⇒ boolean Returns true if this transaction is london hardform transaction (i.e. type === 2).
This provides a Type Guard that the related properties are non-null.
<src>transaction.isSigned()⇒ boolean Returns true if signed.
This provides a Type Guard that properties requiring a signed transaction are non-null.
<src>transaction.toJSON()⇒ any Return a JSON-friendly object.
interface TransactionLike
A TransactionLike is an object which is appropriate as a loose input for many operations which will populate missing properties of a transaction.
PROPERTIES
The access list for berlin and london transactions.
The chain ID the transaction is valid on.
<src>transactionLike.data⇒ null | string <src>transactionLike.from⇒ null | A The maximum amount of gas that can be used.
The gas price for legacy and berlin transactions.
<src>transactionLike.hash⇒ null | string The maximum total fee per gas for london transactions.
The maximum priority fee per gas for london transactions.
<src>transactionLike.nonce⇒ null | number The signature provided by the sender.
<src>transactionLike.to⇒ null | A The recipient address or null for an init transaction.
<src>transactionLike.type⇒ null | number The value (in wei) to send.