PollarPollarDemo

Products

AuthenticationWalletTransactions

Integrations

KYCSoonRampNewSwapNewEarnNew

Wallet Adapters

Stellar Wallets KitPrivyNewCosmos WalletNew

Adapters

Trustless Work

Built with Pollar

LumenWipeNew
OverviewImplementationAdapter

Escrow

Trustless Work adapter — the SDK signs and submits the unsigned XDR with the connected wallet, so your code only deals with business params.

POST /deployer/single-release — creates the escrow contract.

Defaults to your wallet address.

Defaults to your wallet address.

Defaults to your wallet address.

Defaults to your wallet address.

Defaults to your wallet address.

Defaults to your wallet address.

milestones
one-time adapter setup
// adapter.ts — register once in your app
export const trustlessWorkAdapter: TrustlessWorkAdapter = {
  // single-release
  deploySingle:  (p) => tw('/deployer/single-release', p),
  fundSingle:    (p) => tw('/escrow/single-release/fund-escrow', p),
  releaseSingle: (p) => tw('/escrow/single-release/release-funds', p),
  resolveSingle: (p) => tw('/escrow/single-release/resolve-dispute', p),
  // …approve / change-status / dispute / extend-ttl

  // multi-release
  deployMulti:   (p) => tw('/deployer/multi-release', p),
  releaseMulti:  (p) => tw('/escrow/multi-release/release-milestone-funds', p),
  withdrawMulti: (p) => tw('/escrow/multi-release/withdraw-remaining-funds', p),
  // …fund / approve / change-status / dispute / resolve / extend-ttl
};

// each adapter fn returns { unsignedTransaction: string }.
// Pollar then signs + submits with the user's wallet automatically.

export const useEscrow =
  createPollarAdapterHook<TrustlessWorkAdapter>('escrow');
@pollar/core— framework-agnostic
import { PollarClient } from '@pollar/core';
import { trustlessWorkAdapter, sendTransaction } from './adapter';

const client = new PollarClient({ apiKey, baseUrl });
await client.ready();

// the adapter hits Trustless Work → returns an unsigned XDR
const { unsignedTransaction } =
  await trustlessWorkAdapter.deploySingle({
  signer: '',
  engagementId: '',
  title: '',
  description: '',
  roles: {
    approver: '',
    serviceProvider: '',
    platformAddress: '',
    releaseSigner: '',
    disputeResolver: '',
    receiver: '',
  },
  amount: 0,
  platformFee: 0,
  milestones: [
    {
      description: 'Design the wireframe',
    },
  ],
  trustline: {
    address: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
    symbol: 'USDC',
  },
});

// Pollar signs only — TW submits + indexes via its helper
const { signedXdr } = await client.signTx(unsignedTransaction);
const res = await sendTransaction(signedXdr);
@pollar/react— hooks & components
const { signTx } = usePollar();

// adapter hits Trustless Work → returns the unsigned XDR
const { unsignedTransaction } =
  await trustlessWorkAdapter.deploySingle({
  signer: '',
  engagementId: '',
  title: '',
  description: '',
  roles: {
    approver: '',
    serviceProvider: '',
    platformAddress: '',
    releaseSigner: '',
    disputeResolver: '',
    receiver: '',
  },
  amount: 0,
  platformFee: 0,
  milestones: [
    {
      description: 'Design the wireframe',
    },
  ],
  trustline: {
    address: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
    symbol: 'USDC',
  },
});

// Pollar signs it (custodial → /tx/sign, external → wallet adapter)
const { signedXdr } = await signTx(unsignedTransaction);

// TW broadcasts AND indexes the escrow → shows in the dashboard
const res = await sendTransaction(signedXdr);
tx.stepidle

Trigger an operation to see signing progress.

@pollar/react — hook & values used

All of these come from the usePollar() hook (plus the adapter factory) — the react layer built on top of getClient().

  • usePollar()hook

    params: No arguments. Call it at the top level of a component — it reads React context, so it must run during render.

    returns: PollarContextValue — the whole SDK surface: reactive state values, modal openers, and getClient() to drop down to core.

  • createPollarAdapterHook(key)factory

    params: key: string — the adapter slot registered on the provider (e.g. 'escrow'). Call it once at module scope.

    returns: A typed hook (e.g. useEscrow) whose methods each return Promise<SubmitOutcome> — adapter → unsigned XDR → auto sign + submit.

  • openTxModal()sync

    params: No arguments.

    returns: void — opens the prebuilt review/sign modal for the in-flight escrow tx.

  • txreactive value

    params: Not a function — a value of type TransactionState read from usePollar().

    returns: Re-renders through the auto sign-and-submit flow (building → signing → submitting → success).

@pollar/core — functions used

All of these are methods on the client returned by getClient() — the underlying PollarClient instance.

  • signAndSubmitTx(unsignedXdr?)async

    params: unsignedXdr?: string — the unsigned XDR the escrow adapter returns from Trustless Work. Omit it for custodial flows.

    returns: Promise<SubmitOutcome> — signs the XDR with the connected wallet and broadcasts it; { status, hash, … }.

  • getTransactionState()sync

    params: No arguments.

    returns: TransactionState — the auto-sign-and-submit progress; null before any tx runs.

Indexer & helpers

Read-only Trustless Work endpoints — no signing. These back the dashboard's escrow lists and balances.

GET /helper/get-escrows-by-signer — escrows this wallet deployed.