Last active
July 7, 2019 21:59
-
-
Save pedrouid/ce4c35ad587e84167cb01febdd2d3d7d to your computer and use it in GitHub Desktop.
Integrating Web3Connect with Core Module
This file contains hidden or 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 Web3Connect from "web3connect"; | |
| const web3Connect = new Web3Connect.Core({ | |
| providerOptions: { | |
| portis: { | |
| id: "PORTIS_ID", // required | |
| network: "mainnet" // optional | |
| }, | |
| fortmatic: { | |
| key: "FORTMATIC_KEY", // required | |
| network: "mainnet" // optional | |
| } | |
| } | |
| }); | |
| // subscribe to connect | |
| web3Connect.on("connect", (provider: any) => { | |
| const web3 = new Web3(provider); // add provider to web3 | |
| }); | |
| // subscribe to close | |
| web3Connect.on("close", () => { | |
| console.log("Web3Connect Modal Closed"); // modal has closed | |
| }); | |
| web3Connect.toggleModal(); // open modal on button click |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment