buildUnsigned method

Future<Unsigned7702Tx> buildUnsigned({
  1. required HexString sender,
  2. required HexString to,
  3. BigInt? value,
  4. Uint8List? data,
  5. List<AuthorizationTuple> authorizationList = const [],
  6. BigInt? nonceOverride,
})

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 nonceOverride is provided),
  • gas fee parameters (EIP-1559),
  • base transaction metadata such as to, value, and data.

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’s authorizationList.
  • 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;
}