token.watchCreate
Watches for new TIP20 token creation events on the TIP20 Factory.
Usage
ts
import { } from 'wagmi/tempo'
import { } from './config'
const = ..(, {
(, ) {
.('args:', )
},
})
// Later, stop watching
()ts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'
export const config = createConfig({
connectors: [
webAuthn({
keyManager: KeyManager.localStorage(),
}),
],
chains: [tempoTestnet],
multiInjectedProviderDiscovery: false,
transports: {
[tempoTestnet.id]: http(),
},
})Return Type
() => void
Returns a function to unsubscribe from the event.
Parameters
onTokenCreated
- Type:
function
ts
declare function onTokenCreated(args: Args, log: Log): void
type Args = {
/** Address of the created token */
token: Address
/** ID of the created token */
tokenId: bigint
/** Name of the token */
name: string
/** Symbol of the token */
symbol: string
/** Currency of the token */
currency: string
/** Quote token address */
quoteToken: Address
/** Admin address */
admin: Address
}Callback to invoke when a new TIP20 token is created.
args (optional)
- Type:
object
ts
type Args = {
/** Filter by token address(es) */
token?: Address | Address[] | null
/** Filter by token ID(s) */
tokenId?: bigint | bigint[] | null
}Optional filter arguments to watch for specific tokens.
fromBlock (optional)
- Type:
bigint
Block to start listening from.
onError (optional)
- Type:
function
ts
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
Enable polling mode.
pollingInterval (optional)
- Type:
number
Polling frequency (in ms). Defaults to Client's pollingInterval config.