SDK reference
Settlement
pg.settlement — SETTLs, signed receipts, executions, guarantee levels, and payment versus payment or delivery versus payment exchanges.
Scope settlement. A SETTL, its receipt and its execution are read by the client its route
belongs to; the execution of an exchange by the client that submitted it. Another client's object
is 404 pathglobal.core.not_found.
| Call | Returns | |
|---|---|---|
get(id) | Settlement | One SETTL: the settlement obligation of one route |
find(reference) | Settlement[] | The SETTLs a reference belongs to: a rail reference, a route, the reference of an intent, or the PATH instruction a route pays. At least 4 characters |
receipt(id) | Receipt | The signed settlement receipt of a settled route |
execution(id) | Execution | One execution: its legs, where its value sits, its state |
executions(settl) | Execution[] | The executions behind a SETTL |
guarantees(query) | GuaranteeAnswer | The guarantee level of an exchange received on one kind of network and delivered on another |
exchange(input) | Execution | A payment versus payment or a delivery versus payment |
instruction(id) and instructions(settl) are the names of execution and executions in 0.3.0,
and answer the same.
SETTLs
A Settlement names its route, its funding, its execution, its guarantee, the legs and
their rail references, and holding: where its value sits, one entry per asset. When a route does
not deliver, held gives the value it stopped with, and failure_reason the reason of the first leg
that failed (a RailReason), provider for a conversion that failed, or expired. refs holds the
route, the reference of the intent, the PATH instruction a route to a PATH destination pays, and
every rail reference.
Receipt is Path Global's settlement receipt. A route to a PATH destination also has a payer
path.receipt, named by route.payer_receipt (pg.router).
| State | |
|---|---|
funded, review, routed, liquidity_locked, executing, sent | On its way |
in_doubt | The outcome of a leg is not known yet; holds stay, nothing is sent again |
confirmed, final | Delivered |
closed | Terminal |
provider_failed, settlement_failed, rerouting | A leg failed; the route is carried another way or refunded |
refund_required, refunding, manual_review | refund_required is not terminal: it moves to refunding, closed or manual_review |
expired | Terminal |
history lists each state with its instant.
Executions
An Execution (kind: 'pathglobal.execution') is how a SETTL, a clearing period, a treasury
transfer or an exchange is carried out by Path Global. It is not a payment instruction of the PATH
protocol: that is route.path_instruction. Instruction, InstructionKind and InstructionState
are the names of Execution, ExecutionKind and ExecutionState in 0.3.0.
| Field | |
|---|---|
type | payment, pvp, dvp, transfer, net_settlement, return |
mode | capture_on_final (the pay-in is captured when the pay-out is final) or commit_first |
guarantee | The level of the execution |
legs | SettlementLeg[]: role (pay_in, exchange, pay_out, move, pay_provider), amount, state |
holding | SettlementHolding[]: where the value sits, one account per asset |
state | ExecutionState |
history | Each state, its instant and its cause |
SettlementHolding is where the value of an execution sits. It is not the holding of an Omni
Account (Holding).
Execution states: created, admitted, review, awaiting_funds, preparing, prepared,
committed, delivering, in_doubt, rerouting, settled, aborting, aborted,
abort_blocked, delivery_blocked, unwinding, unwound. Leg states: pending, securing,
secured, submitted, unknown, final, failed, released, returning, returned,
blocked.
Guarantee levels
const answer = await pg.settlement.guarantees({ in: 'book', out: 'irrevocable_instant' });
answer.guarantee; // 'atomic' | 'conditional' | 'receipt_first' | 'value_dated' | 'bounded_exposure'GuaranteeQuery takes in and out, and the flags lockable_in, lockable_out, same_chain_tx,
out_final_within_hold and provider_delivers, with network kinds book, blockchain, irrevocable_instant, deferred
and revocable. The level of an exchange is the weaker of its two directions.
Guarantee levels gives what each level promises.
Exchanges
exchange takes an ExchangeRequest:
| Field | |
|---|---|
type | pvp or dvp |
reference | Up to 140 characters. The same request under one reference returns the same execution |
timeout_seconds | Up to 86400 |
a, b | One ExchangeSide each |
An ExchangeSide is { party, gives, on, from, receives_at, asset_role?, verdict, subject }:
| Field | |
|---|---|
party | Who gives this side |
gives, on | The amount, and the node it is given on ({ asset, network }) |
from | client:-:<holding>:<asset> for a holding of the caller, participant:<network>:<participant>:<asset> for the participant the caller acts for, or { network, identifier, holder? } |
receives_at | An account reference of the same form, or an endpoint |
asset_role | cash or asset, for a dvp |
verdict | A passing Proof verdict for this side |
subject | { amount, from, to, networks?, partners?, providers?, payer?, payee?, destination_digest?, client? }: what the verdict was given for |
const execution = await pg.settlement.exchange({
type: 'pvp',
reference: 'fx-2026-0042',
a: {
party: 'acme', gives: { value: '1000.00', asset: 'USD' }, on: { asset: 'USD', network: 'book' },
from: `client:-:${usd.id}:USD`, receives_at: `client:-:${eur.id}:EUR`,
verdict: verdictA.id, subject: { amount: { value: '1000.00', asset: 'USD' }, from: { asset: 'USD', network: 'book' }, to: { asset: 'EUR', network: 'book' } },
},
b: { /* the other side, in EUR */ },
});
execution.guarantee; // 'atomic' when both pay-ins are on the bookexchange takes no idempotency key: it is idempotent per caller and reference.
| Code | Status | When |
|---|---|---|
pathglobal.core.conflict | 409 | Other content under a reference already used |
pathglobal.core.not_found | 404 | A from the caller does not own |
pathglobal.settlement.guarantee_unavailable | 422 | A leg cannot be secured at the level the exchange needs |
pathglobal.risk.verdict_invalid | 422 | A verdict is not valid for its side |
The guide is Settlement and exchanges, the recipe A payment versus payment. The routes are on Settlement.
Clearing
pg.clearing — the participant a key acts for, obligations and proposals, positions and the queue, netting sets, periods and their signed reports.
Risk
pg.risk — corridors, limits, exposures and breakers, approvals and their decision signature, approval rules, operators, identities, cases and the audit log.