IBC Only Swaps Modal

If you want to have the IBCSwaps component inside a modal on your dApp, we recommend you to use the IBCSwapsModal component. We handle all the states and edge-cases, so you can focus on your dApp!

Usage

import {
  IBCSwapsModal,
  type IBCSwapsModalProps,
  WalletClientContextProvider
} from '@leapwallet/elements'
import { useState } from 'react'
import { useElementsWalletConfig } from './use-elements-wallet-config'

import '@leapwallet/elements/styles.css'

const YourDapp = () => {
  const [isOpen, setIsOpen] = useState(false)
  const walletClientConfig = useElementsWalletConfig()

  return (
    <div className="leap-ui">
      <button onClick={() => setIsOpen(true)}>
        Open IBC Swaps Modal
      </button>
      <WalletClientContextProvider value={walletClientConfig}>
        <IBCSwapsModal
          isOpen={isOpen}
          setIsOpen={setIsOpen}
        />
      </WalletClientContextProvider>
    </div>
  )
}

Props

isOpen (required)

A state variable for the open state of the modal

setIsOpen (required)

A function to change the open state of the modal.

All props of the IBCSwaps component are supported in IBCSwapsModal

Last updated