SDK reference
Liquidity
pg.liquidity — provider corridors and quotes, the pools, pool quotes and positions, and where an amount can be delivered now.
Scope liquidity. This is the liquidity of Path Global's API. It is not the reserved Liquidity
pillar of PATH, which no operator's API fills.
A node is an asset on a network, written ASSET@network.
Providers
| Call | Returns | |
|---|---|---|
corridors() | Corridor[] | What each provider converts: the pair, min and max, the networks it receives and delivers on, its funding terms |
quotes({ from, to, amount, deliver_on? }) | LiquidityQuote[] | Firm quotes from every provider that fills the pair for the amount, each with valid_until |
from and to are assets. No provider for the pair and amount is
400 pathglobal.liquidity.no_liquidity.
Pools
A pool is prefunded liquidity in one asset on one network.
| Call | Returns | |
|---|---|---|
pools() | Pool[] | Every pool: asset, network, balance, available, level, status (open or paused) |
pool(id) | Pool | One pool |
poolTrades(id) | PoolTrade[] | The trades of a pool |
poolQuote({ from, to, amount, deliver_on?, receive_on? }) | PoolQuote | What a conversion through the pools costs and delivers: rate, reference_rate, fee_bps, fee, sell, buy. Reserves nothing |
positions() | PoolPosition[] | The caller's positions: what it supplied to each pool and the fees it earned |
supply(pool, amount) | PoolPosition | Test mode only. Supplies a pool from the sandbox bank |
withdraw(pool, amount) | PoolPosition | Test mode only. Pays the position out at once, fees first, then what was supplied |
proposeWithdrawal(pool, amount, destination) | PoolWithdrawal | Proposes a withdrawal to an allowlisted destination: a defunding transfer that waits for a person (202). The position changes once the transfer has settled |
level is what a pool holds against what was supplied; 1 is balanced. In poolQuote, from and
to are assets and amount is in the asset of from; receive_on and deliver_on name the
networks.
const price = await pg.liquidity.poolQuote({
from: 'USD',
to: 'EUR',
amount: { value: '1000.00', asset: 'USD' },
receive_on: 'fednow',
deliver_on: 'sepa-inst',
});
price.rate; // the rate applied
price.fee_bps; // the fee of this conversion
price.buy; // what is delivered| Code | Status | When |
|---|---|---|
pathglobal.liquidity.no_liquidity | 400 | The pools do not fill the pair for the amount |
pathglobal.liquidity.pool_unavailable | 400, 409 | The pool is paused or cannot pay out the amount now |
pathglobal.accounts.insufficient_funds | 422 | The position does not hold the amount beyond its pending withdrawals |
Offers
| Call | Returns | |
|---|---|---|
offers(query) | DiscoveryAnswer | Where an amount can be delivered on a node now: deliverable, the offers and what is excluded, with its reason. Reserves nothing. discover(query) is its name in 0.3.0 |
paths(from, to, amount) | LiquidityPath[] | Paths between two nodes, ASSET@network, with their cost and time; amount is a decimal string in the asset of from |
depth(asset, network) | Depth | What the sources of a node can deliver now |
DiscoveryQuery is { asset, network, amount, from?, at?, max_cost_bps?, max_seconds? }. An
Offer names its source (kind and id), what it delivers, its cost, its
seconds, the network kind, its guarantee level, whether it
is open and firm, and valid_until.
Depths, ladders and amounts short of the request are given in bands, except to a key that also
carries the treasury scope.
Operator calls
These need the treasury scope as well. In live mode they carry the operator signature.
| Call | Returns | |
|---|---|---|
poolMovements(id) | PoolMovement[] | The movements of a pool: supply, withdraw, trade_in, trade_out, fee |
pause(id, cause) | Pool | The pool stops quoting and its liquidity cannot be reserved. Applies at once |
resume(id, approval?) | Pool | ApprovalWaiting | Resumes a pool under an approval pool_resume: without approval the call requests it |
The routes are on Liquidity. The recipe is USD to EUR through the pools.
Treasury
pg.treasury — positions and the treasury view, policies, transfers under dual control, expected fundings, the allowlist, reconciliation, inbound items, refuel cycles and the ledger.
Clearing
pg.clearing — the participant a key acts for, obligations and proposals, positions and the queue, netting sets, periods and their signed reports.