amm.watchFeeSwap
Watches for fee swap events on the Fee AMM.
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
ts
type ReturnType = () => voidReturns a function to unsubscribe from the event.
Parameters
onFeeSwap
- Type:
function
ts
declare function onFeeSwap(args: Args, log: Log): void
type Args = {
/** Address of the user token */
userToken: Address
/** Address of the validator token */
validatorToken: Address
/** Amount of user token swapped in */
amountIn: bigint
/** Amount of validator token received */
amountOut: bigint
}Callback to invoke when a fee swap occurs.
userToken (optional)
- Type:
Address | bigint
Address or ID of the user token to filter events.
validatorToken (optional)
- Type:
Address | bigint
Address or ID of the validator token to filter events.
fromBlock (optional)
- Type:
bigint
Block to start listening from.
onError (optional)
- Type:
(error: Error) => void
The 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.