Skip to content

amm.watchMint

Watches for liquidity mint 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 = () => void

Returns a function to unsubscribe from the event.

Parameters

onMint

  • Type:
ts
declare function onMint(args: Args, log: Log): void

type Args = {
  /** Amount of LP tokens minted */
  liquidity: bigint
  /** Address that added liquidity */
  sender: Address
  /** User token details */
  userToken: {
    /** Address of the user token */
    address: Address
    /** Amount of user token added */
    amount: bigint
  }
  /** Validator token details */
  validatorToken: {
    /** Address of the validator token */
    address: Address
    /** Amount of validator token added */
    amount: bigint
  }
}

Callback to invoke when liquidity is added.

sender (optional)

  • Type: Address | bigint

Address or ID of the sender to filter events.

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

Enable polling mode for watching events.

pollingInterval (optional)

  • Type: number

Polling frequency (in ms). Defaults to Client's pollingInterval config.

Viem

Released under the MIT License.