Function useContractEvents

  • Beta

    Get or subscribe to contract events

    Parameters

    • contract: RequiredParam<ValidContractInstance>

      the ValidContractInstance instance of the contract to listen to events for

    • Optional eventName: string

      the name of the event to query for (omit this or pass undefined to query for all events)

    • Optional options: {
          queryFilter?: EventQueryOptions<Record<string, any>>;
          subscribe?: boolean;
      }

      options includes the filters (QueryAllEvents) for the query as well as if you want to subscribe to real-time updates (default: true)

      • Optional queryFilter?: EventQueryOptions<Record<string, any>>
      • Optional subscribe?: boolean

    Returns UseQueryResult<ContractEvent<Record<string, any>>[], unknown>

    a response object that includes the contract events

    Example

    const { data: contractEvents, isLoading } = useContractEvents(contract);
    

    See

    Documentation

Generated using TypeDoc