Skip to content

useEvents

Usage

connect() must be called and WalletConnect session must be initiated before account information will be returned.

The useEvents hook is a React Hook wrapper around the createEvent function

import { EventsFilter, useEvents, UseEventsOptions } from '@puzzlehq/sdk';
const filter: EventsFilter = {
type: 'Send',
programId: 'credits.aleo',
functionId: 'transfer_private'
}
const options: UseEventsOptions = {
filter,
page: 2
}
const { fetchPage, events, loading, error, page, pageCount } = useEvents(options);

Return Value

{
fetchPage: () => void,
events?: Event[],
loading: boolean,
error?: string,
page?: number,
pageCount?: number
};

Additional related types can be found on the events page.