useRecords
Usage
connect()
must be called and a connection must be initiated before account information will be returned.
The useRecords
hook is a React Hook wrapper around the getRecords function
If an address is provided, the wallet will return that address’ records if that address is in the wallet. Otherwise, it will return the currently selected account’s records.
If the multisig flag is true, the sdk will not fetch until an address is present.
import { EventsFilter, useEvents, UseEventsOptions } from '@puzzlehq/sdk';
type UseRecordsParams = { address?: string; multisig?: boolean; filter?: RecordsFilter, page?: number,}
const filter: RecordsFilter = { programId: 'credits.aleo'; type: 'unspent';}
const { fetchPage, records, error, loading, page, pageCount } = useRecords({filter});
Types
See the records page for types.