buildAndSign method

Future<AuthorizationTuple> buildAndSign({
  1. required Signer signer,
  2. Executor? executor,
  3. BigInt? nonceOverride,
})

Builds an unsigned EIP-7702 authorization for the signer’s address and returns a fully signed AuthorizationTuple.

This method:

  1. Constructs an UnsignedAuthorization using buildUnsigned, resolving the appropriate nonce unless nonceOverride is provided.
  2. Signs the resulting authorization preimage using the given Signer.
  3. Wraps the fields and signature into a complete AuthorizationTuple.

The authorization produced here is typically inserted into the authorizationList of a type 0x04 EIP-7702 transaction.

The optional nonceOverride parameter may be used during testing or custom workflows to supply a specific authorization nonce.

Example:

final tuple = await builder.buildAndSign(
  signer: signer,
);

See also:

  • buildUnsigned – constructs the unsigned authorization fields.

Implementation

Future<AuthorizationTuple> buildAndSign({
  required Signer signer,
  Executor? executor,
  BigInt? nonceOverride,
}) async {
  final unsigned = await buildUnsigned(
    eoa: signer.ethPrivateKey.address,
    executor: executor,
    nonceOverride: nonceOverride,
  );
  return signAuthorization(signer, unsigned);
}