리액트 메타마스크 연동관련
159
작성한 질문수 5
삭제된 글입니다
답변 2
0
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Web3 from 'web3'; class App extends Component { componentDidMount = async () => { await this.initWeb3(); } initWeb3 = async () => { if (window.ethereum) { console.log('recent mode'); this.web3 = new Web3(window.ethereum); try { // Request account access if needed await window.ethereum.enable(); // Acccounts now exposed //this.eth.sendTransaction({/* ... */}); } catch (error) { // User denied account access... console.log('user denied account access error: ' + error); } } // Legacy dapp browsers... else if (window.web3) { console.log('legacy mode'); this.web3 = new Web3(window.web3.currentProvider); // Acccounts always exposed //web3.eth.sendTransaction({/* ... */}); } // Non-dapp browsers... else { console.log('Non-Ethereum browser detected. You should consider trying MetaMask!'); } } render(){ return ( <div className="App"> <header className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <p> Edit <code>src/App.js</code> and save to reload. </p> <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > Learn React </a> </header> </div> ); } } export default App;
truffle project 세팅관련
0
302
1
gas 계산하는 부분이 이해가 되지 않습니다.
0
325
1
Lottery Bet 함수 테스트 강의 중 4:36에서 'from' 관련 오류가 발생합니다.
1
597
3
폴더 안에 파일이 없습니다.
0
343
0
address payable error
0
361
1
migrations 내의 js파일에서 artifacts 객체를 불러올 수 없습니다
1
320
0
안녕하세요 강의 잘 따라와서 끝까지 잘 해냈습니다!!
0
224
0
안녕하세요 강의 정말 잘듣고있습니다.
1
489
1
안녕하세요. Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
1
252
0
setState 사용에 대해서 질문입니다.
0
303
1
bootstrap library 설치 error
0
300
0
web3.eth.sendTransaction()
0
367
0
잘 쫓아가고 있습니다만 왜 저는 빨간선이 나올까요?
0
266
0
React js 환경설정 강의 질문
0
287
1
web3오류
0
380
2
코드 원본을 받을 수 있을까요?
0
352
2
ganache-cli 명령어 질문
0
351
1
recent mode 질문
0
267
1
Gas 부족 에 대한 질문입니다.
0
301
2
geth 채굴시 unlock 이외의 방법이 있을까요?
0
294
2
테스트 코드 작성 중 오류가 발생합니다.
0
316
2
truffle migrate
0
277
1
질문입니다
0
305
2
8:22 에러
0
290
2





