daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Feb 17th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Modern dapp browsers...
  2.     if (window.ethereum) {
  3.         window.web3 = new Web3(ethereum);
  4.         try {
  5.             // Request account access if needed
  6.             console.log("window.ethereum");
  7.             ethereum.enable();
  8.         } catch (error) {
  9.             // User denied account access...
  10.         }
  11.     }
  12.     // Legacy dapp browsers...
  13.     else if (window.web3) {
  14.         window.web3 = new Web3(web3.currentProvider);
  15.         console.log("window.currentProvider");
  16.         // Acccounts always exposed
  17.  
  18.     }
  19.     // Non-dapp browsers...
  20.     else {
  21.         console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
  22.     }
  23.  
  24.     console.log("version");
  25.     var version = web3.version;
  26.     console.log(version);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top