resolveNonce method
Resolves the next transaction nonce for the given externally owned account (EOA).
The returned nonce is computed as the current on-chain nonce (retrieved via
getNonce) plus an optional offset supplied by the executor parameter.
If nonceOverride is provided, it is returned immediately without
querying the network.
The executor parameter defaults to Executor.self, which automatically increments the nonce by 1.
Other Executor values may be used to reserve sequential nonces.
Example:
final nonce = await resolveNonce(myEoa, executor: Executor.relayer);
print('Next usable nonce: $nonce');
See also:
Implementation
Future<BigInt> resolveNonce(
EthereumAddress eoa, [
Executor? executor,
BigInt? nonceOverride,
]) async {
if (nonceOverride != null) {
return nonceOverride;
}
final nonce = await getNonce(eoa);
return nonce + (executor?.value ?? BigInt.zero);
}