0.3.0 • Published 12 months ago

@tokenscript/web3modal-walletconnect-v2 v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Web3Modal WalletConnect V2

Background

This is a custom provider option of Wallect Connect V2 for Web3Modal, as it's not natively supported yet. The plan is to reuse this module in other place where we need to use wallet connect provider v2 with Web3Modal.

Usage

Add the package to your project

npm install --save @tokenscript/web3modal-walletconnect-v2

Configure Web3Modal with a custom provider by providing

  • chains: The chain ids to be used by your dapp, e.g. 1 (for mainnet)
  • projectId: WallectConnect projectId, which can be found on WalletConnect dashboard
  • infuraId: Infura id for rpc server
  • methods: A list of methods to be used with the provider, e.g. "eth_signTypedData_v4"
  • events(optional): A list of events to be used with the provider, default: "chainChanged", "accountsChanged"
  • displayName(optional): Customize the provider name shown in Web3Modal, default: "WalletConnect"
import { getProviderOption } from "@tokenscript/web3modal-walletconnect-v2"

const providerOptions = {
  "custom-walletconnect": getUniversalProviderOption(
    chains,
    projectId,
    infuraId,
    methods
  ),
  // ...otherProviderOptions,
};

const web3Modal = new Web3Modal({
  ...
  providerOptions,
});