Configure Route Settings

Configure Bridges, Swap Venues, Smart Swap options for querying Swap routes.

By default, Elements supports all bridges and swap venues supported by Skip API. Check out the following links to get the same

However, if you'd like to restrict either of them, you can use RouteSettingsProvider component.

Here's an example where we want to allow IBC and AXELAR Bridges and Swaps via Osmosis DEX and Terra Astroport.

import {
  Swaps,
  RouteSettingsProvider,
  BRIDGES
} from '@leapwallet/elements'

const bridges = [BRIDGES.IBC, BRIDGES.AXELAR]

const swapVenues = [
  {
    chain_id: 'osmosis-1',
    name: 'osmosis-poolmanager'
  },
  {
    chain_id: 'phoenix-1',
    name: 'terra-astroport'
  }
]

const YourDapp = () => {
  // trigger the dApp's connect wallet flow
  const connectWallet = () => {}
  
  // set this to the currently connected wallet
  const connectedWalletType = WalletType.LEAP

  return (
    <RouteSettingsProvider bridges={bridges} swapVenues={swapVenues}>
      <ElementsProvider
        connectWallet={connectWallet}
        connectedWalletType={connectedWalletType}
      >
        <Swaps />
      </ElementsProvider>
    </RouteSettingsProvider>
  )
}

Props

bridges (optional)

Accepts an array of bridges. Bridges are defined in the BRIDGES enum.

swapVenues (optional)

Accepts an array of swap venues. SwapVenue is an object with a chain_id and name. You can get all possible swap venues from Skip API - https://api-docs.skip.money/reference/getvenues.

enableSmartSwaps (optional) - default false

Enables third party routers for swaps. To know more about how Skip API does this, check this out.

Last updated