Created
July 21, 2022 17:06
-
-
Save taycaldwell/e4b452d6d8f41caadcad96b73b575270 to your computer and use it in GitHub Desktop.
Multiple Web3Modal Instances.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Web3Modal from "web3modal"; | |
import WalletConnect from "@walletconnect/web3-provider"; | |
import CoinbaseWalletSDK from "@coinbase/wallet-sdk"; | |
import Portis from "@portis/web3"; | |
// Metmamask (Injected Provider) Web3Modal Instance | |
export const metamaskModal = new Web3Modal({ | |
cacheProvider: true, // optional | |
providerOptions: { | |
// Example with injected providers | |
injected: { | |
display: { | |
name: "Injected", | |
description: "Connect with the provider in your Browser" | |
} | |
} | |
} | |
}); | |
// CoinbaseWallet Web3Modal Instance | |
export const coinbaseWalletModal = new Web3Modal({ | |
disableInjectedProvider: true, | |
cacheProvider: true, // optional | |
providerOptions: { | |
walletlink: { | |
package: CoinbaseWalletSDK, // Required | |
options: { | |
appName: "My App", // Required | |
infuraId: process.env.INFURA_ID // Required unless you provide a JSON RPC url; see `rpc` below | |
} | |
} | |
} | |
}); | |
// Other Web3Modal Instance | |
export const otherModal = new Web3Modal({ | |
disableInjectedProvider: true, | |
cacheProvider: true, // optional | |
providerOptions: { | |
walletconnect: { | |
package: WalletConnect, // required | |
options: { | |
infuraId: process.env.INFURA_ID // required | |
} | |
}, | |
portis: { | |
package: Portis, // required | |
options: { | |
id: process.env.PORTIS_ID // required | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment