& { enabled?: boolean | undefined }
>
}
/**
* Hook for watching TIP20 token quote token update events.
*
* @example
* ```tsx
* import { Hooks } from 'wagmi/tempo'
*
* function App() {
* Hooks.token.useWatchUpdateQuoteToken({
* onUpdateQuoteToken(args) {
* if (args.completed)
* console.log('quote token update completed:', args.newQuoteToken)
* else
* console.log('quote token update proposed:', args.newQuoteToken)
* },
* })
*
* return Watching for quote token updates...
* }
* ```
*
* @param parameters - Parameters.
*/
export function useWatchUpdateQuoteToken<
config extends Config = ResolvedRegister['config'],
>(parameters: useWatchUpdateQuoteToken.Parameters = {}) {
const { enabled = true, onUpdateQuoteToken, token, ...rest } = parameters
const config = useConfig({ config: parameters.config })
const configChainId = useChainId({ config })
const chainId = parameters.chainId ?? configChainId
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
useEffect(() => {
if (!enabled) return
if (!onUpdateQuoteToken) return
if (!token) return
return Actions.token.watchUpdateQuoteToken(config, {
...rest,
chainId,
onUpdateQuoteToken,
token,
})
}, [
config,
enabled,
chainId,
token,
onUpdateQuoteToken,
rest.fromBlock,
rest.onError,
rest.poll,
rest.pollingInterval,
])
}
export declare namespace useWatchUpdateQuoteToken {
type Parameters = UnionCompute<
ExactPartial> &
ConfigParameter & { enabled?: boolean | undefined }
>
}