Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. let bootStrappedWeb3;
  2.  
  3. // Checking if Web3 has been injected by the browser (Mist/MetaMask)
  4. if (typeof web3 !== 'undefined') {
  5. bootStrappedWeb3 = new Web3(web3.currentProvider);
  6. } else {
  7. console.log('No Web3 Detected... falling back to using default mainnet HTTP Provider');
  8. bootStrappedWeb3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/<MY_API_KEY>"));
  9. }
  10. window.web3 = bootStrappedWeb3;
  11.  
  12. // Listen for when web3 is connected and then bootstrap the app
  13. window.web3.eth.net.isListening()
  14. .then(() => {
  15. console.log('is connected');
  16.  
  17. // Bootstrap the full app
  18. this.$store.dispatch(actions.INIT_APP, bootStrappedWeb3);
  19. })
  20. .catch(e => console.log('Something went wrong', e));
  21.  
  22. MyContract.deployed()
  23. .then((contract) => {
  24. // Do stuff
  25. }).catch((error) => console.log("Something went bang!", error));
  26.  
  27. Something went bang! TypeError: Cannot read property 'apply' of undefined
  28. at Provider.sendAsync (contract.js?6b6f:24)
  29. at RequestManager.sendAsync (requestmanager.js?e4d9:80)
  30. at Object.get [as getNetwork] (property.js?7a8c:116)
  31. at eval (contract.js?6b6f:512)
  32. at new Promise (<anonymous>)
  33. at Function.detectNetwork (contract.js?6b6f:503)
  34. at Function.deployed (contract.js?6b6f:451)
  35. at Store.eval (index.js?e3b1:444)
  36. at Array.wrappedActionHandler (vuex.esm.js?edaa:704)
  37. at Store.dispatch (vuex.esm.js?edaa:426)
  38. at boundDispatch (vuex.esm.js?edaa:332)
  39. at eval (index.js?e3b1:273)
  40. at tryCatcher (bluebird.js?e531:5063)
  41. at Promise._settlePromiseFromHandler (bluebird.js?e531:3095)
  42. at Promise._settlePromise (bluebird.js?e531:3153)
  43. at Promise._settlePromise0 (bluebird.js?e531:3198)
  44. at Promise._settlePromises (bluebird.js?e531:3281)
  45. at eval (bluebird.js?e531:162)
  46. at MutationObserver.eval (bluebird.js?e531:4330)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement