Add Leap to existing Keplr integration

If Connect to Keplr already exists on your dapp, adding Leap is easy because we've followed a similar API structure

Similar to Keplr, you can find an object named 'leap' in the window object, which can be accessed using window.leap

To support Leap cosmos wallet on a dapp where Keplr is already integrated, follow these steps:

  • A Modal will be required for a user to select Leap or Keplr.

  • The dapp will have to maintain a persistent state to store which wallet is connected.

  • Based on the connected wallet, set

window.wallet = window.leap

  • Also, add the following event accordingly:

window.addEventListener('leap_keystorechange', reconnectWallet)
  • Now replace window.keplr with window.wallet in the whole application

  • Replace the following:

window.getOfflineSigner
window.getOfflineSignerOnlyAmino
window.getOfflineSignerAuto
window.getEnigmaUtils

with

window.leap.getOfflineSigner
window.leap.getOfflineSignerOnlyAmino
window.leap.getOfflineSignerAuto
window.leap.getEnigmaUtils

For Leap assets, such as the wallet name, logo, and redirection link, please refer to our documentation here. These assets are useful in case Leap wallet is not installed.

Last updated