Javascript 将部署的协定地址传递给另一个协定构造函数时卡住
我成功地部署了我的第一个契约以及该契约的get实例 第二个合同把第一个合同作为论点,这让我犯了错误。 我传递了第一个合同或对象(第一个合同的实例)的地址。每次它都给我错误Javascript 将部署的协定地址传递给另一个协定构造函数时卡住,javascript,ethereum,solidity,truffle,web3js,Javascript,Ethereum,Solidity,Truffle,Web3js,我成功地部署了我的第一个契约以及该契约的get实例 第二个合同把第一个合同作为论点,这让我犯了错误。 我传递了第一个合同或对象(第一个合同的实例)的地址。每次它都给我错误 当作为地址传递时,它给出了无效的地址或类似这样的Iban地址格式。请在此处输入代码 和错误 Uncaught (in promise) Error: Provided address "[object Promise]" is invalid, the capitalization checksum tes
Uncaught (in promise) Error: Provided address "[object Promise]" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
at Object.d [as inputAddressFormatter]
您能否尝试web3.utils.checkAddressChecksum(Dhi.options.address),然后将address作为参数传递?这个问题肯定与Dhi.options.address.web3,tuils.checkAddressChecksum([address])的错误解释有关,我尝试此方法,它返回true。抱歉,我的意思是。toChecksumAddress,但无论如何,如果结果为true,它应该有效。否,它对我无效。我仍在搜索答案。您能显示Dhi.options.address的console.log结果吗
let DhiSaleJsonInterface = await $.getJSON("DhiSale.json");
//create new object of DhiSale Contract.
let instance = new web3.eth.Contract(DhiSaleJsonInterface.abi);
//added meta data or required options
instance.options.address = "";
instance.options.from = account;
instance.options.gas = 1000000;
instance.options.gasPrice = '1000000000';
//add bytecode required for deployement.
instance.options.data = DhiSaleJsonInterface.bytecode;
//deploy the DhiSale contract
//Dhi is an already deployed contract object.
//it gives the error
return instance.deploy({ arguments: [Dhi.options.address, 1000000000] }).send({ from: account }).then((contractInstance) => {
console.log("Dhi Sale address :" + contractInstance.options.address);
return contractInstance;
})`]