Configure Swap Venues and Bridges

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'
import { useElementsWalletConfig } from './use-elements-wallet-config'

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

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

const YourDapp = () => {
  const walletConfig = useElementsWalletConfig()

  return (
    <RouteSettingsProvider bridges={bridges} swapVenues={swapVenues}>
      <WalletClientContextProvider value={walletConfig}>
        <Swaps />
      </WalletClientContextProvider>
    </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.

Last updated