Architecture
Entry points, client layers, and the build → sign → send flow.
Package entry points
@trustless-work/escrow-js
Client, config helpers, services, types, errors
@trustless-work/escrow-js/rest
EscrowRestService
@trustless-work/escrow-js/graphql
GraphQL service, documents, GraphQL types
@trustless-work/escrow-js/types
Payloads, responses, read-model, entities
import { TrustlessWorkClient } from "@trustless-work/escrow-js";
import { EscrowRestService } from "@trustless-work/escrow-js/rest";
import { EscrowGraphqlService } from "@trustless-work/escrow-js/graphql";
const client = new TrustlessWorkClient({ baseURL, apiKey });
const rest = client.rest; // operate + GET /escrows*
const graphql = client.graphql; // POST /graphqlLayers
TrustlessWorkClient
├─ HttpTransport (native fetch + auth + Problem Details)
├─ EscrowRestService (operate builds + REST reads)
└─ EscrowGraphqlService (POST /graphql)Optional module-level helpers (configureTrustlessWork / escrowRest / escrowGraphql) wrap a default TrustlessWorkClient — the vanilla counterpart to React’s TrustlessWorkConfig.
Build → sign → send
Every mutate method returns an unsigned transaction. You sign with the wallet, then submit via sendTransaction.
Operate response shapes
Deploy build
DeployEscrowResponse
{ unsignedXdr, txHash, contractId }
Other builds
BuildTransactionResponse
{ unsignedXdr, txHash }
Submit
SendTransactionResponse
{ txHash, ledger, contractId?, escrow?, code?, message? }
code may be STELLAR_TX_SUBMITTED or STELLAR_TX_SUBMITTED_INDEXER_LAGGING.
Identity & amounts
Escrow identity is
contractIdonly (no UUIDid/escrowId).Deploy trustline:
{ contractId, symbol }(Soroban SACC…+ asset code).Read amounts are decimal strings; operate payloads use numbers.
See Types and Errors for the full catalog.