GraphQL
GraphQL read surface — POST /graphql for escrow and escrows queries.
GraphQL reads go through POST /graphql. Prefer this when you want escrow + financial + deposits + events in one round-trip.
Import from @trustless-work/escrow-js or @trustless-work/escrow-js/graphql.
Methods
Method
Query
getEscrow
escrow(contractId) + financial / deposits / events
listEscrows
escrows(...) (same filters as REST list)
Documents: GRAPHQL_GET_ESCROW, GRAPHQL_LIST_ESCROWS.
Quick example
import { TrustlessWorkClient, development } from "@trustless-work/escrow-js";
const client = new TrustlessWorkClient({
baseURL: development,
apiKey: process.env.API_KEY,
});
const detail = await client.graphql.getEscrow({
contractId,
eventsLimit: 20,
});
const page = await client.graphql.listEscrows({
scope: "mine",
limit: 20,
});Wire types
GraphQL wire types (GraphqlEscrow, GraphqlEscrowPage, GraphqlEscrowFinancial, …) live on @trustless-work/escrow-js / @trustless-work/escrow-js/graphql.
See also REST Reads and Types.