useListEscrowEvents
useListEscrowEvents
Paginated escrow event timeline (GET /escrows/:contractId/events).
Import
import { useListEscrowEvents } from "@trustless-work/escrow/hooks/rest";Signature
function useListEscrowEvents(): {
listEscrowEvents: (
contractId: string,
params?: ListEscrowEventsParams,
) => Promise<ListEscrowEventsResponse>;
};ListEscrowEventsParams: { limit?, order?: "asc" | "desc", cursor? }.
Returns KeysetPage<EscrowEvent> → { data, hasMore, nextCursor }.
Example
import { useListEscrowEvents } from "@trustless-work/escrow/hooks/rest";
import { useQuery } from "@tanstack/react-query";
const { listEscrowEvents } = useListEscrowEvents();
const { data } = useQuery({
queryKey: ["escrow-events", contractId],
queryFn: () =>
listEscrowEvents(contractId, { limit: 30, order: "desc" }),
enabled: !!contractId,
});