@ethereumjs/tx / EOACode7702Tx
Defined in: 7702/tx.ts:53
Typed transaction with the ability to set codes on EOA accounts
TransactionInterface<typeof EOACodeEIP7702>new EOACode7702Tx(
txData,opts):EOACode7702Tx
Defined in: 7702/tx.ts:95
This constructor takes the values, validates them, assigns them and freezes the object.
It is not recommended to use this constructor directly. Instead use the static factory methods to assist in creating a Transaction object from varying data types.
TxOptions = {}
EOACode7702Tx
readonlyaccessList:AccessListBytes
Defined in: 7702/tx.ts:62
readonlyauthorizationList:EOACode7702AuthorizationListBytes
Defined in: 7702/tx.ts:63
readonlycache:TransactionCache={}
Defined in: 7702/tx.ts:79
readonlychainId:bigint
Defined in: 7702/tx.ts:64
readonlycommon:Common
Defined in: 7702/tx.ts:75
readonlydata:Uint8Array
Defined in: 7702/tx.ts:60
readonlygasLimit:bigint
Defined in: 7702/tx.ts:58
readonlymaxFeePerGas:bigint
Defined in: 7702/tx.ts:66
readonlymaxPriorityFeePerGas:bigint
Defined in: 7702/tx.ts:65
readonlynonce:bigint
Defined in: 7702/tx.ts:57
readonlyoptionalr:bigint
Defined in: 7702/tx.ts:70
readonlyoptionals:bigint
Defined in: 7702/tx.ts:71
readonlyoptionalto:Address
Defined in: 7702/tx.ts:61
readonlytxOptions:TxOptions
Defined in: 7702/tx.ts:77
TransactionInterface.txOptions
type:
4=TransactionType.EOACodeEIP7702
Defined in: 7702/tx.ts:54
readonlyoptionalv:bigint
Defined in: 7702/tx.ts:69
readonlyvalue:bigint
Defined in: 7702/tx.ts:59
addSignature(
v,r,s):EOACode7702Tx
Defined in: 7702/tx.ts:341
Adds the provided signature values and returns a new transaction instance.
bigint
Recovery parameter
Signature r value
bigint |
Uint8Array<ArrayBufferLike> |
Signature s value
bigint |
Uint8Array<ArrayBufferLike> |
EOACode7702Tx
New EOACode7702Tx that includes the signature
TransactionInterface.addSignature
errorStr():
string
Defined in: 7702/tx.ts:445
Return a compact error string representation of the object
string
getDataGas():
bigint
Defined in: 7702/tx.ts:197
The amount of gas paid for the data in this tx
bigint
TransactionInterface.getDataGas
getEffectivePriorityFee(
baseFee):bigint
Defined in: 7702/tx.ts:205
Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas
bigint
Base fee retrieved from block
bigint
getHashedMessageToSign():
Uint8Array
Defined in: 7702/tx.ts:303
Returns the hashed serialized unsigned tx, which can be used to sign the transaction (e.g. for sending to a hardware wallet).
Note: in contrast to the legacy tx the raw message format is already serialized and doesn’t need to be RLP encoded any more.
Uint8Array
Keccak hash of the unsigned transaction payload
TransactionInterface.getHashedMessageToSign
getIntrinsicGas():
bigint
Defined in: 7702/tx.ts:223
The minimum gas limit which the tx to have to be valid. This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), the optional creation fee (if the transaction creates a contract), and if relevant the gas to be paid for access lists (EIP-2930) and authority lists (EIP-7702).
bigint
TransactionInterface.getIntrinsicGas
getMessageToSign():
Uint8Array
Defined in: 7702/tx.ts:291
Returns the raw serialized unsigned tx, which can be used to sign the transaction (e.g. for sending to a hardware wallet).
Note: in contrast to the legacy tx the raw message format is already serialized and doesn’t need to be RLP encoded any more.
const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input
Uint8Array
Serialized unsigned transaction payload
TransactionInterface.getMessageToSign
getMessageToVerifySignature():
Uint8Array
Defined in: 7702/tx.ts:322
Computes a sha3-256 hash which can be used to verify the signature
Uint8Array
Hash used when verifying the signature
TransactionInterface.getMessageToVerifySignature
getSenderAddress():
Address
Defined in: 7702/tx.ts:415
Returns the recovered sender address.
Address
Sender Address
TransactionInterface.getSenderAddress
getSenderPublicKey():
Uint8Array
Defined in: 7702/tx.ts:330
Returns the public key of the sender
Uint8Array
Sender public key
TransactionInterface.getSenderPublicKey
getUpfrontCost(
baseFee):bigint
Defined in: 7702/tx.ts:213
The up front amount that an account must have for this transaction to be valid
bigint = BIGINT_0
The base fee of the block (will be set to 0 if not provided)
bigint
TransactionInterface.getUpfrontCost
getValidationErrors():
string[]
Defined in: 7702/tx.ts:392
Returns the list of validation errors, if any.
string[]
Array of validation error messages
TransactionInterface.getValidationErrors
hash():
Uint8Array
Defined in: 7702/tx.ts:314
Computes a sha3-256 hash of the serialized tx.
This method can only be used for signed txs (it throws otherwise). Use EOACode7702Transaction.getMessageToSign to get a tx hash for the purpose of signing.
Uint8Array
Hash of the serialized signed transaction
isSigned():
boolean
Defined in: 7702/tx.ts:433
Indicates whether the transaction already carries signature data.
boolean
true if signature parts are present
isValid():
boolean
Defined in: 7702/tx.ts:399
boolean
true if the transaction has no validation issues
raw():
EOACode7702TxValuesArray
Defined in: 7702/tx.ts:247
Returns a Uint8Array Array of the raw Bytes of the EIP-7702 transaction, in order.
Format: [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data,
accessList, authorizationList, signatureYParity, signatureR, signatureS]
Use EOACode7702Transaction.serialize to add a transaction to a block with createBlockFromBytesArray.
For an unsigned tx this method uses the empty Bytes values for the
signature parameters v, r and s for encoding. For an EIP-155 compliant
representation for external signing use EOACode7702Transaction.getMessageToSign.
EOACode7702TxValuesArray
serialize():
Uint8Array
Defined in: 7702/tx.ts:275
Returns the serialized encoding of the EIP-7702 transaction.
Format: 0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data,
accessList, authorizationList, signatureYParity, signatureR, signatureS])
Note that in contrast to the legacy tx serialization format this is not valid RLP any more due to the raw tx type preceding and concatenated to the RLP encoding of the values.
Uint8Array
TransactionInterface.serialize
sign(
privateKey,extraEntropy):EOACode7702Tx
Defined in: 7702/tx.ts:425
Signs the transaction and returns the signed instance.
Uint8Array
32-byte private key
Optional entropy supplied to the signing routine
boolean |
Uint8Array<ArrayBufferLike> |
EOACode7702Tx
Newly signed transaction
supports(
capability):boolean
Defined in: 7702/tx.ts:190
Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.
Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.
This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).
See Capabilities in the types module for a reference
on all supported capabilities.
number
boolean
toCreationAddress():
never
Defined in: 7702/tx.ts:230
EOACode7702Tx cannot create contracts
never
TransactionInterface.toCreationAddress
toJSON():
JSONTx
Defined in: 7702/tx.ts:370
Returns an object with the JSON representation of the transaction
JSON encoding of the transaction
verifySignature():
boolean
Defined in: 7702/tx.ts:407
Verifies the embedded signature.
boolean
true if signature verification succeeds