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

useGetEscrow

useGetEscrow

Get a single escrow detail (GET /escrows/:contractId).

Import

import { useGetEscrow } from "@trustless-work/escrow/hooks/rest";

Signature

function useGetEscrow(): {
  getEscrow: (contractId: string) => Promise<GetEscrowResponse>;
};

GetEscrowResponse = EscrowDetail{ escrow, events, deposits }.

Example

import { useGetEscrow } from "@trustless-work/escrow/hooks/rest";
import { useQuery } from "@tanstack/react-query";

const { getEscrow } = useGetEscrow();

const { data } = useQuery({
  queryKey: ["escrow", contractId],
  queryFn: () => getEscrow(contractId),
  enabled: !!contractId,
});

// data?.escrow → EscrowSummary
// data?.events / data?.deposits

After submit with STELLAR_TX_SUBMITTED_INDEXER_LAGGING, poll this endpoint until the indexer catches up. balance is eventually consistent.