SetCodeTxBuilder class
A builder responsible for constructing type 0x04 EIP-7702
transactions that update an externally owned account’s code to the
designated delegation stub.
A SetCodeTxBuilder uses the shared context provided by Eip7702Base and helper utilities from Eip7702Common to:
- estimate gas and fees for the
setCodetransaction, - resolve the correct nonce for the sender,
- include the appropriate authorization tuple(s),
- build an Unsigned7702Tx representing the complete transaction,
- optionally sign and serialize the transaction for broadcast.
The resulting transaction is a typed transaction (0x04) as defined
by EIP-7702 and is typically submitted via eth_sendRawTransaction.
Example
final builder = SetCodeTxBuilder(ctx);
final unsigned = await builder.buildUnsigned(eoa: signer.address);
final signed = await builder.buildAndSign(
signer: signer,
unsigned: unsigned,
);
final raw = parseRawTransaction(signed);
This builder does not perform signing itself; instead, it delegates signature creation to a Signer passed into higher-level methods.
- Inheritance
-
- Object
- Eip7702Base
- SetCodeTxBuilder
- Mixed-in types
Constructors
Properties
- ctx → Eip7702Context
-
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildSignAndEncodeRaw(
{required Signer signer, required HexString to, BigInt? value, Uint8List? data, List< AuthorizationTuple> authorizationList = const []}) → Future<HexString> -
Builds, signs, and encodes a complete EIP-7702 transaction into a
raw hex string suitable for submission via
eth_sendRawTransaction. -
buildUnsigned(
{required HexString sender, required HexString to, BigInt? value, Uint8List? data, List< AuthorizationTuple> authorizationList = const [], BigInt? nonceOverride}) → Future<Unsigned7702Tx> - Constructs an Unsigned7702Tx for a EIP-7702 transaction, resolving nonce, gas parameters, and optional call data before returning a fully prepared unsigned transaction object.
-
getDelegatedImpl(
EthereumAddress eoa) → Future< Uint8List?> -
Reads the on-chain bytecode of an externally owned account (EOA) and
extracts the delegated implementation address if the account has been
upgraded via EIP-7702.
inherited
-
getFeeData(
[TransactionSpeed speed = TransactionSpeed.normal]) → Future< ({BigInt maxFeePerGas, BigInt maxPriorityFeePerGas})> -
Retrieves EIP-1559 fee parameters (
maxFeePerGasandmaxPriorityFeePerGas) from the network and returns a preset based on the requested TransactionSpeed.inherited -
getNonce(
EthereumAddress address) → Future< BigInt> -
Returns the next available transaction nonce for the given Ethereum
address.
inherited
-
isDelegatedTo(
EthereumAddress eoa, EthereumAddress impl) → Future< bool> -
Checks whether the given externally owned account (EOA) is currently
delegated to the specified implementation address.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prepareUnsigned(
HexString sender, HexString to, [BigInt? nonceOverride]) → Future< Future< Unsigned7702Tx> Function(BigInt?, Uint8List?, int)> -
Prepares the base components of an unsigned EIP-7702 transaction and
returns a closure that finalizes the transaction once
valueanddataare provided. -
resolveChainId(
) → Future< BigInt> -
Resolves and returns the active chain ID for the current context.
inherited
-
resolveNonce(
EthereumAddress eoa, [Executor? executor, BigInt? nonceOverride]) → Future< BigInt> -
Resolves the next transaction nonce for the given externally owned account (EOA).
inherited
-
signUnsigned(
{required Signer signer, required Unsigned7702Tx unsignedTx}) → Future< Signed7702Tx> - Signs an Unsigned7702Tx using the provided Signer and returns a fully formed Signed7702Tx.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited