Introduction

Smart Swap refers to a feature set that improves swap speed, price, and control.

It currently allows for:

If you’re using the deprecated @skip-router library, you must use version v4.0.0+ to enable Smart Swap.

We strongly reccomend using the @skip-go/client TypeScript package, which is actively maintained.

The rest of this document will show you how to use Smart Swap with the @skip-go/client library. The only changes you’ll notice between this context and the REST API are naming conventions.

Smart Swap Features

Set your Smart Swap settings in your skipClient function call or REST API request body.

Feature: Use External Routers to Improve Price Execution

The Skip Go API considers multiple internal and external routers to find the route with the best price execution.

Currently supported external swap routers:

  1. Skip Go API’s in-house Router
  2. Hallswap’s Dex Aggregator
  3. Osmosis’s Sidecar Query Service (SQS) (Used in the Osmosis frontend)

Usage

Pass an empty smartSwapOptions object into your route request.

That’s it! Skip Go API will now consider supported external routers and return the best available option.

Feature: Route Splitting

Route splitting involves dividing a user’s trade into multiple parts and swapping them through different pools. This reduces price impact and can increase the user’s output compared to using a single route. It works especially well when one or both tokens being swapped are commonly paired with other assets on a DEX (e.g., OSMO on Osmosis).

Usage

Pass the splitRoutes flag in the smartSwapOptions object.

Response Changes when using Split Routes

We’ve added a new swapType called SmartSwapExactCoinIn that’s returned in the routeResponse and msgsDirectResponse when the provided route is a split route. This new swapType has fields that allow for multiple routes, across multiple swap venues.

export type SmartSwapExactCoinIn = {
  swapVenue: SwapVenue;
  swapRoutes: SwapRoute[];
};

export type SwapRoute = {
  swapAmountIn: string;
  denomIn: string;
  swapOperations: SwapOperation[];
};

Feature: EVM Swaps

Smart Swap supports bidrectional EVM swaps: go from any asset on an EVM chain to any asset on a Cosmos chain and back again. With EVM swaps, users can onboard to your IBC connected chain in 1 transaction from a broad range of EVM assets, including the memecoins retail loves to hold!

Currently, the API supports swapping on official Uniswap V3 deployments on the following chains:

NetworkChain ID
Ethereum1
Polygon137
Optimism10
Arbitrum One42161
Base8453
BNB Chain56
Avalanche43114
Blast81457
Celo42220

Usage

Set the evmSwaps flag to true in the smartSwapOptions object. If using the deprecated @skip-router library, you must be on v5.1.0+ (we strongly recommend migrating to @skip-go/client as soon as possible).

How do EVM Swaps Change the route Response?

When an EVM swap occurs in a route, a new operation of type evm_swap is returned in the array of operations in the v2/route and v2/msgs_direct response.

If your API use follows the v2/route then v2/msgs call pattern, this new operation type must be passed to the v2/msgs endpoint, so make sure you use the latest Skip Go Client version and decode the operation properly.

The evm_swap operation type is as follows:

How does this Change the /msgs and /status Response?

Nothing new in particular! The msg_type used for EVM swaps is the same evm_tx type used for all of our EVM transactions. Similarly, there is no new transfer_event type; the swap is atomic with the bridging action (Axelar or CCTP), so the same types are used (axelar_transfer_info and cctp_transfer_info respectively).

Have questions or feedback? Help us get better!

Join our Discord and select the “Skip Go Developer” role to share your questions and feedback.