ISwap2Protocol
Defined in: protocols/swap2.ts:157
The swap-and-bridge interface every swap module implements, and the router too. One call shape covers same-chain swaps and cross-chain transfers.
Methods
Section titled “Methods”getSupportedChains()
Section titled “getSupportedChains()”getSupportedChains():
Promise<Swap2SupportedChain[]>
Defined in: protocols/swap2.ts:173
Chains this provider can swap on or to.
Returns
Section titled “Returns”Promise<Swap2SupportedChain[]>
getSupportedTokens()
Section titled “getSupportedTokens()”getSupportedTokens(
options?):Promise<Swap2SupportedToken[]>
Defined in: protocols/swap2.ts:175
Tokens this provider can swap, optionally narrowed by Swap2SupportedTokensOptions.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise<Swap2SupportedToken[]>
getSwap2Status()
Section titled “getSwap2Status()”getSwap2Status(
id,options?):Promise<Swap2StatusResult>
Defined in: protocols/swap2.ts:171
State of a swap by the id from Swap2Result. Poll it until a final status.
Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”Promise<Swap2StatusResult>
quoteSwap2()
Section titled “quoteSwap2()”quoteSwap2(
options):Promise<Swap2Quote>
Defined in: protocols/swap2.ts:164
Price a swap. Signs nothing and works on a read-only account.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise<Swap2Quote>
Throws
Section titled “Throws”Swap2QuoteError (from protocol-swap2-core) with a named reason when there is no
route.
swap2()
Section titled “swap2()”swap2(
options,config?):Promise<Swap2Result>
Defined in: protocols/swap2.ts:169
Quote again, check the quote (amounts, recipient, refund address, fee ceilings in config),
then sign and broadcast the source transaction (and an approval when one is needed).
Parameters
Section titled “Parameters”options
Section titled “options”config?
Section titled “config?”Returns
Section titled “Returns”Promise<Swap2Result>