Class: CanonicalSymbols
The offline resolver for apps that already hold the backend's canonical trading symbols (from
/quote, /add-liq-estimate, a position row) and must not make a registry request of their own.
resolveaccepts a bare trading symbol and returns it as is; a class key (object,$or|form) is not a symbol and is refused asUNKNOWN_TOKEN.createPoolrelies on that refusal to fall back to the symbols its caller supplies.orderPairorders two symbols by plain string comparison, as the contract does.- Reads are pass-through (see TokenResolver.passthrough): the caller's references go on the wire verbatim, composite keys included, and the backend orients the pair.
unknown token create pool order pair
Example
const swaps = new Swaps(gateway, new CanonicalSymbols(), signer, walletAddress);
await swaps.swap('GALA', 'GUSDC', 3000, { exactIn: '10' });
Implements
token resolver
Constructors
Constructor
new CanonicalSymbols():
CanonicalSymbols
Returns
CanonicalSymbols
canonical symbols
Properties
Methods
invalidate()
invalidate():
void
There is no registry state to drop.
Returns
void
orderPair()
orderPair(
a,b):Promise<{flipped:boolean;token0:TradingSymbol;token1:TradingSymbol; }>
Put two symbols in canonical (string) order.
Parameters
| Parameter | Type |
|---|---|
a | TokenRef |
b | TokenRef |
Returns
Promise<{ flipped: boolean; token0: TradingSymbol; token1: TradingSymbol; }>
order pair trading symbol token ref
resolve()
resolve(
ref):Promise<TradingSymbol>
Resolve a bare trading symbol to itself.
Parameters
| Parameter | Type |
|---|---|
ref | TokenRef |
Returns
Promise<TradingSymbol>
Implementation of
trading symbol token ref resolver