buildUnsigned method

Future<UnsignedAuthorization> buildUnsigned({
  1. required EthereumAddress eoa,
  2. Executor? executor,
  3. HexString? delegateOverride,
  4. BigInt? nonceOverride,
})

Constructs an UnsignedAuthorization record for the specified EOA, resolving the required chain ID, nonce, and delegate address.

This method performs:

  1. Network chain ID resolution via resolveChainId.
  2. Nonce resolution for the given eoa unless nonceOverride is provided, using getNonce.
  3. Delegate resolution using the provided delegateOverride or the default Eip7702Context.delegateAddress.

The resulting unsigned authorization record may be signed using signAuthorization or passed to higher-level builders such as buildAndSign or buildAndSignIfNeeded.

Example

final unsigned = await builder.buildUnsigned(
  eoa: myAddress,
);
print(unsigned.chainId);

Parameters:

  • eoa — the externally owned account performing the authorization.
  • delegateOverride — optional implementation address to override the default delegation target.
  • nonceOverride — optional nonce to bypass automatic nonce discovery (useful for testing).

See also:

Implementation

Future<UnsignedAuthorization> buildUnsigned({
  required EthereumAddress eoa,
  Executor? executor,
  HexString? delegateOverride,
  BigInt? nonceOverride,
}) async {
  final resolvedChainId = await resolveChainId();
  final resolvedNonce = await resolveNonce(eoa, executor, nonceOverride);
  final delegateAddress = delegateOverride ?? ctx.delegateAddress.with0x;
  return (
    chainId: resolvedChainId,
    delegateAddress: delegateAddress,
    nonce: resolvedNonce,
  );
}