0

I am ready with my frontend design. I have only 3 files HTML, CSS, and JAVASCRIPT. So, I didn't create any project or DAPP to have other files. Now next step is to connect with metamask and smart contract for payment. I am not getting exactly what I need to do now. Do I need node js files? If yes, then how? or any other files? How to connect with metamask? I searched for many codes but didn't get anything. Can somebody explain to me?

0

maybe this could help

window.addEventListener('load', function() {
    if (typeof web3 !== 'undefined') {
      window.web3 = new Web3(web3.currentProvider);
      console.log('Connected to Metamask!')
    } else {
      console.log('Injected web3 Not Found!!!')
      var provider = 'http://localhost:8545';
      window.web3 = new Web3(new Web3.providers.HttpProvider(provider));
      console.log('Connected without Metamask!')

    } 
    console.log("account: " +  web3.eth.coinbase);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.