fix: adding web3 to window

This commit is contained in:
Richard Ramos 2019-02-08 10:55:25 -04:00
parent 86441aadd9
commit b5f2838aef
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,12 @@ import utils from "./utils.js";
import mailservers from "./mailservers"; import mailservers from "./mailservers";
import constants from "./constants"; import constants from "./constants";
declare global {
interface Window { web3: any; }
}
if(typeof window !== "undefined") window.web3 = window.web3 || {};
const Web3 = typeof window !== "undefined" && window.web3 ? new web3Lib(window.web3.currentProvider) : web3Lib; const Web3 = typeof window !== "undefined" && window.web3 ? new web3Lib(window.web3.currentProvider) : web3Lib;
const { utils: { asciiToHex, hexToAscii } } = Web3; const { utils: { asciiToHex, hexToAscii } } = Web3;