nonce.watchNonceIncremented
Watches for nonce incremented events. This event is emitted whenever a transaction is executed using a specific nonce key.
Usage
import { } from './viem.config'
const = .nonce.watchNonceIncremented({
: (, ) => {
.('Account:', .account)
.('Nonce key:', .nonceKey)
.('New nonce:', .newNonce)
},
})
// Later, stop watching
()Return Type
type ReturnType = () => voidReturns a function to unsubscribe from the event.
Parameters
onNonceIncremented
- Type:
function
declare function onNonceIncremented(args: Args, log: Log): void
type Args = {
/** Address of the account */
account: Address
/** Nonce key that was incremented */
nonceKey: bigint
/** New nonce value after increment */
newNonce: bigint
}Callback to invoke when a nonce is incremented.
args (optional)
- Type:
object
type Args = {
/** Address of the account to filter by */
account?: Address | Address[] | null
/** Nonce key to filter by */
nonceKey?: bigint | bigint[] | null
}Optional filters for the event.
fromBlock (optional)
- Type:
bigint
Block to start listening from.
onError (optional)
- Type:
function
declare function onError(error: Error): voidThe callback to call when an error occurred when trying to get for a new block.
poll (optional)
- Type:
true
Whether to use polling.
pollingInterval (optional)
- Type:
number
Polling frequency (in ms). Defaults to Client's pollingInterval config.