Skip to content

Instantly share code, notes, and snippets.

@xpluscal
Created October 22, 2021 17:58
Show Gist options
  • Save xpluscal/39e4e128b715cfe0207c2236c0e72eb0 to your computer and use it in GitHub Desktop.
Save xpluscal/39e4e128b715cfe0207c2236c0e72eb0 to your computer and use it in GitHub Desktop.
web3modal
let web3Modal = new Web3Modal({
cacheProvider: false, // optional
providerOptions: {
walletconnect: {
package: WalletConnectProvider,
options: {
infuraId: Infura_Project_ID
}
},
fortmatic: {
package: Fortmatic, // required
options: {
key: Fortmatic_Key // required
}
},
authereum: {
package: Authereum // required
},
torus: {
package: Torus // required
// options: {
// networkParams: {
// host: "https://localhost:8545", // optional
// chainId: 1337, // optional
// networkId: 1337 // optional
// },
// config: {
// buildEnv: "development" // optional
// }
// }
}
},
disableInjectedProvider: false,
})
try {
provider = await web3Modal.connect()
} catch (e) {
return;
}
// Then set the provider for web3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment