Move and verify

SDK reference

Catalogue, router, decision and proof

pg.catalogue, pg.router, pg.decision and pg.proof — the networks, signed quotes and routes with their guarantee level, payment to a PATH address or an alias, route decisions, and Proof verdicts.

pg.catalogue

Scope router.

CallReturns
networks(filter?)Network[]The networks of the catalogue: slug, rails, assets, speed, routers, availability and the ids of their endpoint formats
network(slug)Network & { engine: NetworkEngine }One network, with the profile of its engine (finality, reversal, hours)
networkDetails(slug)NetworkDetailsOne network in full: parameters, rails, routers, typed assets, endpoint formats with what Path Global issues in each, and its engine
endpointFormats(filter?)RegisterOrigin & { formats: CatalogueEndpointFormat[] }The endpoint formats of the catalogue
endpointFormat(format)CatalogueEndpointFormat & RegisterOriginOne format, with each network of the catalogue that carries it
networkEndpointFormats(slug)RegisterOrigin & { network, formats: CatalogueNetworkEndpointFormat[] }The formats of one network
networkEndpointFormat(slug, format)CatalogueNetworkEndpointFormat & RegisterOriginOne format on one network
validate(slug, identifier, options?){ valid, kind?, reason?, format?, formats? }Whether an identifier is well formed for a network; with options.format, for that endpoint format, with options.memo and options.fields. It does not say the account exists

engines() and partners() answer how Path Global reaches each network; in test mode they list the simulated partners of the sandbox.

RegisterOrigin is { register_version, register_source }: the version of the register data set the register entries come from, and register or built_in for where they were read.

networks takes { category?, zone?, asset?, rail?, product?, availability?, issuable? }, and endpointFormats takes { network?, rail?, kind?, type?, status?, asset?, category?, alias_kind?, reach?, origin?, issuable? }. Each filter but origin and the boolean issuable of endpointFormats takes one value or a list: values of one filter are alternatives, filters combine. networkDetails throws a PathGlobalApiError with code pathglobal.core.internal when the API answers without expanded.

const sepa = await pg.catalogue.networkDetails('sepa-inst');
// sepa.rails, sepa.assets, sepa.params, sepa.routers, sepa.endpoint_formats, sepa.engine

const { formats } = await pg.catalogue.endpointFormats({ network: ['pix', 'upi'], kind: 'alias', issuable: true });

const check = await pg.catalogue.validate('tempo', address, { format: 'tempo-address-memo', memo });
// { valid: true, kind: 'chain_address_memo', format: 'tempo-address-memo' }

The fields of each answer are on Router and decision.

pg.router

Scope router. A quote and a route are read by the client they were made for only.

CallReturns
quote(intent)QuoteA firm, signed quote. Nothing moves. Takes no idempotency key
getQuote(id)QuoteOne quote
execute(quote, opts?)RouteExecutes a quote, by id. A quote executes once, before expires_at
route(intent, opts?)Route & { quoted: Quote }Quotes and executes in one call
get(id)RouteOne route
list()Route[]The caller's routes
release(id, verdict)RouteResumes a route in review, with the Proof verdict that decided it

The intent

FieldType
amountMoneyWhat is sent
sourceSource{ omni_account }, { path: 'path:…' }, { network, identifier, holder? }, or { connection, delegation? }
destinationEndpoint{ omni_account }, { path }, { alias }, or { network, identifier, holder? }
deliver{ asset, network? }The asset delivered, and its network when it is fixed
router'path-flash-1.0' | stringpath-flash-1.0 (PATHGLOBAL_FLASH_ROUTER), the default: the router of Path Global, powered by the decision model path-flash-1.0, chooses the route. Any other value is a router of the catalogue
constraintsConstraintsmax_delay_seconds, max_fee, max_hops (1 to 8, the collection and the pay-out included), prefer: 'cost' | 'speed'
purposestringUp to 64 characters
referencestringUp to 140 characters
payer, payee{ name?, path_id? }, { name? }The parties, as Proof reads them

A route from an Omni Account draws on its holding: in test mode the balance is enforced, so fund the holding first with accounts.fund.

A PATH address or an alias

{ path } is a PATH address, path: and 12 to 64 hexadecimal digits, read in lower case (PathAddressEndpoint). { alias } is an alias, alias:<network>:<name>, or @name and name in the network of the PATH member Path Global reaches (AliasEndpoint); an alias is a destination, not a Source. Path Global pays either as a PATH member: SONAR, RESOLVER at the holding member, the commitment of the terms, and a payment instruction of that member at execution. The route pays an entry of the payee's accepts, in the payee's order, within its limits, on a rail a payment instruction can name.

const quote = await pg.router.quote({
  amount: { value: '250.00', asset: 'EUR' },
  source: { omni_account: account.id },
  destination: { path: 'path:4a91c2f7e8d3' },
  deliver: { asset: 'EUR' },
});
quote.route.destination;
// { network: 'sepa-inst', path_address: 'path:4a91c2f7e8d3',
//   capability: { rail: 'sepa-inst', asset_type: 'fiat', asset_code: 'EUR' }, commitment: '…', intent_version: 1 }

path:4a91c2f7e8d3 is a fixture payee of test mode. The rules and errors are on Router and decision.

The quote and the route

Quote is a signed PATH envelope (protocol_version, signed_at, kid, signature) and carries route (the chosen Candidate, its legs and path), alternatives, decision, proof (the verdict and its outcome), guarantee, final_by, commit_mode, expires_at and mode. The guarantee level states what the exchange promises.

Route.status is review, executing, settled, failed or refund_required. A route can answer executing and settle later: read it again with get. A settled route names its settlement (the SETTL) and its receipt; pg.settlement reads both. A failed route carries failure: { code, message, details? }.

A route to a PATH destination carries path_instruction ({ reference, expires_at }), the payment instruction of the payee's member it pays, and payer_receipt (PayerReceipt): the payer path.receipt Path Global states, pending once the SETTL exists, failed with a PayerReason when the route is refunded or its SETTL expires. pg.tools.readObject(reference) reads either.

const quote = await pg.router.quote(intent);
let route = await pg.router.execute(quote.id, { idempotencyKey: `payout-${order.id}` });

while (route.status === 'executing') {
  await new Promise((r) => setTimeout(r, 2_000));
  route = await pg.router.get(route.id);
}
if (route.status === 'settled') {
  const receipt = await pg.settlement.receipt(route.receipt!);
}

Signed objects are PATH envelopes, verified against the keys at GET /.well-known/path-keys. verifySigned(object) reads the keys and answers { valid: true } or { valid: false, reason }, with reason unknown_kid, bad_signature or keys_unavailable; an unknown kid is read again once. verifyEnvelope(object, publicKeyHex) verifies against a key you hold. The client itself does not fetch the keys.

import { verifySigned } from '@pathglobal/sdk';

const receipt = await pg.settlement.receipt(route.receipt!);
if (!(await verifySigned(receipt)).valid) throw new Error('the receipt does not verify');

Thrown by quote, execute, route and release:

CodeStatusWhen
pathglobal.router.quote_expired409The quote is past expires_at
pathglobal.router.quote_already_used409The quote has been executed
pathglobal.router.no_route422No route delivers the intent, or none respects the constraints
pathglobal.router.router_unknown400, 404router is neither path-flash-1.0 nor a router of the catalogue (details.routers, path-flash-1.0 first), or not a router of the network
pathglobal.router.payee_unknown404The PATH address or the alias does not resolve
pathglobal.router.payee_unavailable503The payee's member did not answer; details.path_code when it answered
pathglobal.router.terms_unverifiable502What the payee's member published does not verify; details.check
pathglobal.router.instruction_refused409The payee's member refused the instruction, or it does not fit the route; details.path_code or details.reason
pathglobal.addresses.revoked, pathglobal.addresses.moved410The PATH address is revoked, or its holder replaced it
pathglobal.proof.failed422The route does not pass Proof
pathglobal.proof.review409release: the verdict is still in review
pathglobal.core.not_found404The quote or the route is not the caller's

Carried in route.failure.code of a route that ends failed:

CodeWhen
pathglobal.accounts.insufficient_fundsThe holding does not hold the amount
pathglobal.accounts.frozenThe holding is frozen
pathglobal.risk.corridor_closedThe corridor of the payment is closed
pathglobal.risk.corridor_throttledThe corridor is throttled and has reached its rate
pathglobal.risk.exposure_exceededThe payment passes a bound of its corridor or a limit
pathglobal.risk.velocity_exceededThe client or the destination has reached its bound for the window
pathglobal.risk.breaker_openA breaker on the path of the payment is open
pathglobal.risk.identity_restrictedA party is restricted or blocked
pathglobal.risk.verdict_invalidThe verdict is not valid for this payment or its subject
pathglobal.risk.haltedNew work is paused
pathglobal.router.instruction_refused, pathglobal.router.terms_unverifiable, pathglobal.router.payee_unavailableA PATH destination: the payment instruction is refused or does not verify at execution

pg.decision

Scope decision.

CallReturns
models(){ default: string; models: string[] }The decision models and the default one, path-flash-1.0 (PATHGLOBAL_DECISION_MODEL)
route(input){ kind: 'decision.route'; decision: Decision; route: Candidate; candidates: CandidateSummary[] }The route a model chooses between two networks, with the candidates it considered

route takes { model?, from: { network, asset }, to: { network, asset }, amount, constraints? }; model defaults to path-flash-1.0. An unknown model is 400 pathglobal.decision.model_unknown; no candidate within the constraints is 422 pathglobal.router.no_route. Nothing is quoted or moved.

pg.proof

Scope proof. A caller reads its own verdicts only.

CallReturns
check(input)VerdictRuns the checks of a ProofRequest; the verdict is signed
get(id)VerdictOne verdict
list()Verdict[]The caller's verdicts
decide(id, outcome)VerdictOperator call. Decides a verdict in review, pass or fail; returns a new signed verdict

ProofRequest takes address?, route?, payer?, payee?, amount?, networks?, deliver_asset?, purpose? and checks?, a list of identity, sanctions, route_risk, travel_rule, payee, network_risk, corridor and fraud. A Verdict is pass, review or fail, with one result per check.

decide needs the risk scope as well, and a credential other than the one that asked for the checks (403 pathglobal.risk.self_approval). In live mode it carries the operator signature.

The guide is Route a payment. The routes are on Router and decision and Proof.

On this page