Skip to content
docs

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.

getSupportedChains(): Promise<Swap2SupportedChain[]>

Defined in: protocols/swap2.ts:173

Chains this provider can swap on or to.

Promise<Swap2SupportedChain[]>


getSupportedTokens(options?): Promise<Swap2SupportedToken[]>

Defined in: protocols/swap2.ts:175

Tokens this provider can swap, optionally narrowed by Swap2SupportedTokensOptions.

Swap2SupportedTokensOptions

Promise<Swap2SupportedToken[]>


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.

string

Swap2StatusOptions

Promise<Swap2StatusResult>


quoteSwap2(options): Promise<Swap2Quote>

Defined in: protocols/swap2.ts:164

Price a swap. Signs nothing and works on a read-only account.

Swap2Options

Promise<Swap2Quote>

Swap2QuoteError (from protocol-swap2-core) with a named reason when there is no route.


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

Swap2Options

Swap2ProtocolConfig

Promise<Swap2Result>