For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 }.

EscrowEvent has no UUID event id. Use indexer fields (kind, topics, payload, …) as your keys.

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,
});