Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

connect metamask with react app


    async function connectMetamask() {
        window.ethereum.enable()
            .then(async (rs) => {
                setMyAccount(rs[0])
                let balance = await web3.current.eth.getBalance(accounts[0]);
                setBalance(web3.current.utils.fromWei(balance))
            })
    }
 
PREVIOUS NEXT
Tagged: #connect #metamask #react #app
ADD COMMENT
Topic
Name
2+6 =