1

I was trying to listen an event from bsc chain testnet

Contract address : 0x99ab1685b4227087ec776fdf75947537f2a150e1

Event : AuctionStart

i have created the contract using abi and contract address and this is working fine.

final ContractEvent transferEvent = contract!.event("AuctionStart");

web3client
        .events(FilterOptions.events(contract: contract, event: transferEvent))
        .listen((event) {print(event);});

but i am not getting anything though i have an event. https://testnet.bscscan.com/address/0x21a7e36c3610c98a485ae3f5f34d9db6423bbcbf#events

TylerH
  • 20,799
  • 66
  • 75
  • 101
Tanjin Alam
  • 1,728
  • 13
  • 15

1 Answers1

1

First initialize your contract Abi file from asset. Then configure filter options as below.

final DeployedContract? contract = await anchorContract(contractToken);

    final auctionEvent = contract!.event('Transfer');
    
    FilterOptions options = FilterOptions(
      address: contract.address,
      fromBlock: BlockNum.genesis(),
      toBlock: BlockNum.current(),
      topics: [
        [bytesToHex(auctionEvent.signature, padToEvenLength: true, include0x: true)],
      ],
    );
    var event = web3client.events(options);
    event.listen((e) {
      print("Event: $e");
    });