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