I'm, trying to connect a front-end to my smart contract but whenever I call the function from the UI I get this error:

Uncaught (in promise) Error: 
Provided address [object Promise] is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted.

I'm completely lost. I guess this has something to do with the contract address but I'm not sure what I did wrong. Other answers regarding this error didn't help me. Here is the code:

    <script type="text/javascript">
        var abi = contractAbi;
        var address = "0x773e94b3394913FD7D1562ADf21A2D8e0720c38F";

        async function loadWeb3() {
            if (window.ethereum) {
                window.web3 = new Web3(window.ethereum);


        async function loadContract(){
            return await new window.web3.eth.Contract(abi,address);

        async function load() {
            await loadWeb3();
            window.contract = await loadContract();

        async function getCurrentAccount() {
            const accounts = await window.web3.eth.getAccounts();
            return accounts[0];


        async function listNFT(){
            var buyerAddress = document.getElementById('buyer-address').value;
            var tokenId = document.getElementById('sell-tokenId').value;
            var price = document.getElementById('selling-price').value;
            const account = getCurrentAccount();
            await window.contract.methods.listNFT(buyerAddress,price,tokenId).send({from: account, value:100000});

        async function buy(){
            var sellerAddress = document.getElementById('seller-address').value;
            var tokenId = document.getElementById('tokenId').value;
            var price = document.getElementById('price').value;
            const account = await getCurrentAccount();
            await window.contract.methods.buy(sellerAddress,tokenId,price).send({from: account});





Any tips ?

2 Answers 2


I was missing an await when calling getCurrentAccount


that error is due to some changes in recent update of ethers package, so you have to go back to previous packages of ethers to do that :

  1. npm uninstall ethers
  2. npm i -S [email protected]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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