buildUnsigned method
Constructs an UnsignedAuthorization record for the specified EOA, resolving the required chain ID, nonce, and delegate address.
This method performs:
- Network chain ID resolution via resolveChainId.
- Nonce resolution for the given
eoaunlessnonceOverrideis provided, using getNonce. - Delegate resolution using the provided
delegateOverrideor 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,
);
}