I have the following code:
var account = web3.utils.toChecksumAddress("0x249eb..")
const accounts = await web3.eth.getAccounts();
let Contr = new web3.eth.Contract(abi, {from: account, gas: 47000, data: bytecode})
await Contr.deploy({ data: bytecode }).send({ from: account, gas: '1500000', gasPrice: '30000000000000'})
.then(function(newContractInstance){ console.log(newContractInstance) });
And I am getting the following error when I try to deploy().send()
the contract:
Script failed: Error: Provided address "[object Object]" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
The provided address is the same one than the one used for getting the contract Contr by new web3.eth.Contract
but, in this case, I dont get any error and the output is correct.
I have been checking another questions related with this error and I didnt get any solution.
I tried with account
, accounts[0]
, and the address directly '0x249..'. I am using web3 1.0.0. Any idea how to solve this?
var account = await web3.utils.toChecksumAddress("0x249eb..")
0x249eb..
Provided address "[object Object]"
, it seems like you're passing a Javascript object where a string (with the address) should be. It's implicitly converting the object to the string "[object Object]" and then that isn't an address obviously. Are you omitting anything from the code you provided?