[SOLVED] Provided address [object Promise] is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted

image

It said that the address is invalid and here is my code
first I try with checksum the {from: address} here and if I put check some it will not remember address anymore so if I not put checksum in artW then it also said invalid argument.

export const mint = async(_data:string, _artistN:string, _artistW:string, _chain:string) => {
    const abi = await token_abi.art_abi;
    const web3 = await Moralis.Web3.enable();
    const contract = new web3.eth.Contract(abi, CONTRACT_ADDRESS);
    let user = Moralis.User.current();
    console.log("UISER: ", user);
    
    let account = getAddress();
    try {const artW=web3.utils.toChecksumAddress(_artistW);
        console.log(artW);
        const res = await contract.methods.createArt(_artistN, artW, _data)
        .send({from: account})
        console.log("done: ",res.event.Paint);
    } catch (error) {
        console.log('====Contract createArt =============');
        console.log(error);
        console.log('====================================');
    }
}

export const getAddress = async () => {
    let user = Moralis.User.current();
    if (user == null){
        getlogin();
    }
    try {
        // const account = user.get('ethAddress');
        const address = await Moralis.User.currentAsync().then(function(user) {
            return user.get("ethAddress")
        });
        return address;
    } catch (error) {   
        //TODO: ADD ERROR
    }
}

what parameters has that createArt function in solidity?

function createArt(
string memory _artist,
address _artistWallet,
string memory _data)

did you try with lower case version of that address?

nope

but

checksum with manual string is work

maybe the account I get is object

@cryptokid Oh! after refresh the server and now it working :smiley:

Thank you

1 Like