Elements Provider

For elements to work, use need to use the ElementsProvider.

Elements Provider takes care of wallet connections, signing transactions, etc... inside elements.

Usage

import { ElementsProvider } from '@leapwallet/elements'

Web3 Wallet Connect Support

If your dApp supports web3 wallet connect, you must pass in the walletConnectOptions prop.

Capsule Support

If your dApp supports social login via capsule, you must pass in the capsuleConfig prop.

Props

* Denotes required props

PropTypeDescription

primaryChainId

string

The primary chain your dApp's user will connect to.

connectWallet*

() => void

Method to trigger your dApps' connect wallet flow.

connectedWalletType*

WalletType

Which wallet is connected on the dApp.

walletConnectOptions

Wallet Connect (WC) options.

capsuleConfig

Social Login options.

Migrating from WalletClientContextProvider

We have removed the WalletClientContextProvider for the following reasons

  1. Makes it difficult to integrate elements

  2. Hard to set up correctly

  3. Needs maintenance/updates if any wallet related code changes

We want dApps' to be able to integrate Elements seamlessly, and hence we introduced a new, simpler ElementsProvider. Elements Provider handles everything for you and requires minimal setup.

Follow these steps for the migration -

  1. Replace WalletClientContextProvider with ElementsProvider

  2. Pass in the only two required props

    1. connectWallet - triggers the wallet connect flow of your dApp

    2. connectedWalletType - which wallet is currently connected to your dApp

And that's it! If you're using Web3 Wallet Connect or Capsule, please setup the respective configs accordingly.

Last updated