Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let bootStrappedWeb3;
- // Checking if Web3 has been injected by the browser (Mist/MetaMask)
- if (typeof web3 !== 'undefined') {
- bootStrappedWeb3 = new Web3(web3.currentProvider);
- } else {
- console.log('No Web3 Detected... falling back to using default mainnet HTTP Provider');
- bootStrappedWeb3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/<MY_API_KEY>"));
- }
- window.web3 = bootStrappedWeb3;
- // Listen for when web3 is connected and then bootstrap the app
- window.web3.eth.net.isListening()
- .then(() => {
- console.log('is connected');
- // Bootstrap the full app
- this.$store.dispatch(actions.INIT_APP, bootStrappedWeb3);
- })
- .catch(e => console.log('Something went wrong', e));
- MyContract.deployed()
- .then((contract) => {
- // Do stuff
- }).catch((error) => console.log("Something went bang!", error));
- Something went bang! TypeError: Cannot read property 'apply' of undefined
- at Provider.sendAsync (contract.js?6b6f:24)
- at RequestManager.sendAsync (requestmanager.js?e4d9:80)
- at Object.get [as getNetwork] (property.js?7a8c:116)
- at eval (contract.js?6b6f:512)
- at new Promise (<anonymous>)
- at Function.detectNetwork (contract.js?6b6f:503)
- at Function.deployed (contract.js?6b6f:451)
- at Store.eval (index.js?e3b1:444)
- at Array.wrappedActionHandler (vuex.esm.js?edaa:704)
- at Store.dispatch (vuex.esm.js?edaa:426)
- at boundDispatch (vuex.esm.js?edaa:332)
- at eval (index.js?e3b1:273)
- at tryCatcher (bluebird.js?e531:5063)
- at Promise._settlePromiseFromHandler (bluebird.js?e531:3095)
- at Promise._settlePromise (bluebird.js?e531:3153)
- at Promise._settlePromise0 (bluebird.js?e531:3198)
- at Promise._settlePromises (bluebird.js?e531:3281)
- at eval (bluebird.js?e531:162)
- at MutationObserver.eval (bluebird.js?e531:4330)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement