웹3 충전 소기

import Web3 from 'web3'if(window.ethereum){ window.web3 = new Web3(window.ethereum); try{
window.ethereum.enable();

}catch(error){
console.error('awdawd')

}} else if(window.web3){ window.web3 = new Web3(window.web3.currentProvider);}else{ window.web3 = new Web3.providers.HttpProvider(' http://네이티브 IP 테스트 ')}
//충전 try {
        await web3.eth.getAccounts((err,res) =>{
            let addr = res[0];
            web3.eth.sendTransaction({
              from: addr,
              to: '',// 
              value: Web3.utils.toWei(/ /, "ether")
            }).on('transactionHash', function(hash){
                console.log(hash,'-----hash-----')
            })
            .on('receipt', function(receipt){
              console.log(receipt,'-----receipt-----')
            }).on('confirmation', function(confirmationNumber, receipt){
              console.log(confirmationNumber, receipt,'-----confirmationNumber, receipt-----')
            }).on('error', console.error);
        })
        this.show2 = false
      } catch (error) {
        // User denied account access
      }

좋은 웹페이지 즐겨찾기