LogoLogo
  • Introduction to the Muse DAO
  • Developer Vision
  • DAPPS
    • Fast Dapp
      • Tutorials
        • Getting started
          • Make an ERC20 transfer app
      • Components
        • Contract Read
        • Contract Write
        • APICall
        • Events
        • Address Display
        • Block Number
        • Ethereum Balance
        • PleaseConnect (Request user connection)
        • Token Balance (ERC20)
        • WatchEvents
        • AirStack
        • Sweep NFT floor
        • Token amount (ERC20)
        • Token name (ERC20)
        • Uniswap tradebox
        • Moment (display date/time)
      • Variables
        • userAddress
        • ABIs
        • connectedChain
        • Passing arbitrary data in query URL parameters
        • location
        • Toast
      • Templates
        • ERC20 Token transfer
        • Nouns Auction
        • AAVE V3
        • Lido Staking page
        • DAI Saving Rate
        • ERC6551
        • Popular NFT collections buy button
        • Non Fungible Message
        • No Shit Sherlock
      • Style
    • Launch
      • How to Launch a project
      • How to buy from a Launch
      • How to sell into a Launch
      • FAQ
    • NFT20
      • Use Cases
      • Liquidity Incentives
      • Guides
        • Adding a project
          • Create Pool
      • Contracts
        • NFT20Factory
          • Source
        • NFT20Pair
          • Source
      • API
      • Fees
    • ETHCMD
    • RolodETH
    • The Very Nifty Gallery
    • CUDL Game
      • Pets
      • $CUDL
      • MILK
      • Bazaar
      • Battles and weapons
    • Feather NFT
    • Dreams of EVM NFT
    • Sudoswap,js
    • The Quest (Sword & Shield)
    • Royal Game
    • Space Goo
    • NFT API
    • Pepesea NFT Marketplace
  • Tokenomics
    • $MUSE
    • Treasury
  • Other resources
    • Governance
    • Links
Powered by GitBook
On this page
  • Events
  • Example​
  • Full example​
  1. DAPPS
  2. Fast Dapp
  3. Components

WatchEvents

PreviousToken Balance (ERC20)NextAirStack

Last updated 1 year ago

Events

Retrieve events in live from a smart contract and display them.

Properties:

  • address

  • abi

  • eventName

  • args optional

For convenience the properties are same as the .

Example

This examples display USDC transfers as Toas notifications.

<WatchEvents
  address="0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
  abi={ABIs.ERC20}
  eventName="Transfer"
  onReceivedLogs={async function (logs) {
    console.log("Received logs", logs);
    for (const log of logs) {
      await sleep(400);
      Toast.success(
        formatAddress(log.args.from) +
          " sent " +
          parseInt(log.args.value) / 10e8 +
          " to " +
          formatAddress(log.args.to),
        {
          position: "bottom-left",
        }
      );
    }
  }}
/>

Full example

viem/wagmi libraries
​
​
USDC transfers live