buildAndSign method
Builds an unsigned EIP-7702 authorization for the signer’s address and returns a fully signed AuthorizationTuple.
This method:
- Constructs an UnsignedAuthorization using buildUnsigned,
resolving the appropriate
nonceunlessnonceOverrideis provided. - Signs the resulting authorization preimage using the given Signer.
- 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);
}