buildUnsigned method
Constructs an Unsigned7702Tx for a EIP-7702 transaction, resolving nonce, gas parameters, and optional call data before returning a fully prepared unsigned transaction object.
This method delegates the core preparation work to prepareUnsigned, which resolves:
- the sender’s nonce (unless
nonceOverrideis provided), - gas fee parameters (EIP-1559),
- base transaction metadata such as
to,value, anddata.
After preparation, the provided authorizationList is attached to the
transaction. These values typically come from an
AuthorizationBuilder and represent the EIP-7702 authorization tuples
required for this transaction.
Parameters:
sender— the EOA submitting the transaction.to— the execution target.value— optional ether value transferred with the call.data— optional calldata for contract execution.authorizationList— one or more AuthorizationTuple values to embed in the transaction’sauthorizationList.nonceOverride— explicitly sets the nonce, bypassing automatic nonce lookup (primarily for testing).
Example
final unsigned = await builder.buildUnsigned(
sender: signer.ethPrivateKey.address,
to: target,
value: EtherAmount.zero(),
authorizationList: [authTuple],
);
Implementation
Future<Unsigned7702Tx> buildUnsigned({
required HexString sender,
required HexString to,
BigInt? value,
Uint8List? data,
List<AuthorizationTuple> authorizationList = const [],
BigInt? nonceOverride,
}) async {
final prepareTxFn = await prepareUnsigned(sender, to, nonceOverride);
final preparedTx = await prepareTxFn(value, data, authorizationList.length);
preparedTx.authorizationList = authorizationList;
return preparedTx;
}