월 22,000원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결탈중앙화 eBay 개발!: 실리콘밸리 개발자와 함께
index.js 질문입니다.
import Web3 from "web3"; import "./app.css"; import ecommerceStoreArtifact from "../../build/contracts/EcommerceStore.json"; var EcommerceStore = contract(ecommerce_store_artifacts); const App = { web3: null, account: null, start: async function() { const { web3 } = this; try { // get contract instance const networkId = await web3.eth.net.getId(); const deployedNetwork = ecommerceStoreArtifact.networks[networkId]; this.meta = new web3.eth.Contract( ecommerceStoreArtifact.abi, deployedNetwork.address ); // get accounts const accounts = await web3.eth.getAccounts(); this.account = accounts[0]; } catch (error) { console.error("Could not connect to contract or chain."); } } }; window.App = { start: function() { var self = this; //Bootstrap the Metacoin abstraction for use. EcommerceStore.setProvider(web3.currentProvider); renderStore(); } }; function renderStore() { //get the product count //loop through and fetch all products by id var instance; return EcommerceStore.deployed() .then(function(f) { instance = f; return instance.productIndex.call(); }) .then(function(count) { for (var i = 1; i <= count; i++) { renderProduct(instance, i); } }); } function renderProduct(instance, index) { instance.getProduct.call(index).then(function(f) { let node = $("<div/>"); console.log(f); }); } window.addEventListener("load", function() { if (window.ethereum) { // use MetaMask's provider App.web3 = new Web3(window.ethereum); window.ethereum.enable(); // get permission to access accounts } else { console.warn( "No web3 detected. Falling back to http://127.0.0.1:9545. You should remove this fallback when you deploy live" ); // fallback - use your fallback strategy (local node / hosted node + in-dapp id mgmt / fail) App.web3 = new Web3( new Web3.providers.HttpProvider("http://127.0.0.1:9545") ); } App.start(); }); index.js 너무 많이 바꼈네요.. ㅜ 이렇게 하면 앞에서 했던 iphoneX 크롬 개발자 도구로 ㅜ쿼리가 되던데 바뀐 index.js 코드에선 안되네요. 뭐가 잘못된 건가요?
- 미해결탈중앙화 eBay 개발!: 실리콘밸리 개발자와 함께
예제 파일좀 올려주세요
index.js가 최신버젼이 너무 달라서 적응이 잘 안되네요 혹시 예제파일은 없나요??