Network

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

CallReturns
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.

CallReturns
pools()Pool[]Every pool: asset, network, balance, available, level, status (open or paused)
pool(id)PoolOne pool
poolTrades(id)PoolTrade[]The trades of a pool
poolQuote({ from, to, amount, deliver_on?, receive_on? })PoolQuoteWhat 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)PoolPositionTest mode only. Supplies a pool from the sandbox bank
withdraw(pool, amount)PoolPositionTest mode only. Pays the position out at once, fees first, then what was supplied
proposeWithdrawal(pool, amount, destination)PoolWithdrawalProposes 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
CodeStatusWhen
pathglobal.liquidity.no_liquidity400The pools do not fill the pair for the amount
pathglobal.liquidity.pool_unavailable400, 409The pool is paused or cannot pay out the amount now
pathglobal.accounts.insufficient_funds422The position does not hold the amount beyond its pending withdrawals

Offers

CallReturns
offers(query)DiscoveryAnswerWhere 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)DepthWhat 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.

CallReturns
poolMovements(id)PoolMovement[]The movements of a pool: supply, withdraw, trade_in, trade_out, fee
pause(id, cause)PoolThe pool stops quoting and its liquidity cannot be reserved. Applies at once
resume(id, approval?)Pool | ApprovalWaitingResumes 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.

On this page