0

I'm developing a smart contract on the Avalanche network and I do not receive data from subscribed events on the app frontend. During development, I tested everything on Fuji test network and received data from each subscribed event every time. I checked the activity on the Snowtrace and events are normally logged. Do you have any idea why it does not work on the mainnet? Frontend is a Nuxt3 app and I'm using Web3.js library to subscribe to the contract events. Subscribing works like this:

async subscribeToContractEvents() {
   
      const web3 = useWeb3()
      if (!web3.provider) return
      web3?.testContract?.events.allEvents({}, async (error: any, event: any) => {
        console.log("EVENT", event)
        switch (event.event) {
          case "testStarted":
            await this.gettestState()
            break
          case "testEntered":
            this.participants = editParticipants(
              this.participants,
              event.returnValues.player,
              event.returnValues.friends
            )
            break

I've tried different ways of subscribing to contract events but the result was still the same. I've received no data on my app front end.

TylerH
  • 20,799
  • 66
  • 75
  • 101

0 Answers0