nonce.watchNonceIncremented
Watches for nonce incremented events. This event is emitted whenever a transaction is executed using a specific nonce key.
Usage
example.ts
import { Actions } from 'tempo.ts/wagmi'
import { config } from './wagmi.config'
const unwatch = Actions.nonce.watchNonceIncremented(config, {
onNonceIncremented: (args, log) => {
console.log('Account:', args.account)
console.log('Nonce key:', args.nonceKey)
console.log('New nonce:', args.newNonce)
},
})
// Later, stop watching
unwatch()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.