Ganache 在合约部署后不更新账户余额

问题描述

我使用 Ganache 和 nodeJS。每当我努力使用 JavaScript 部署我的合约时,都会挖掘相关块,这表明已部署给定的合约,但不会更新发件人帐户(或部署者帐户)的余额。我能看到有什么问题。

JavaScript 代码

    const Web3 = require("web3");
    web3 = new Web3(new Web3.providers.HttpProvider(Web3.currentProvider));

        .
        .
        .

    const cid = <a value>;
    const pid = <a value>;
    
    
    const source2='path of my solidity file';
    const compiledMyContract = solc.compile(source2);
    const myContractJson="path of json version of my solidity file";
    const myContractJs = JSON.parse(fs.readFileSync(myContractJson));
    const contractByteCode="...";
    const gasEstimate = await web3.eth.estimateGas({data: contractByteCode});
    const myContract = new web3.eth.Contract(myContractJs.abi,null,{data: contractByteCode});
          myContract.deploy().send({from:<address>,gas: gasEstimate,gasPrice: 
    200}).then((instance) => {
        console.log("Contract mined at " + instance.options.address);
        instance.methods.function_A(cid,pid).send({
            from:<address>,gas: 2000000,gasPrice: 200
        });
        .
        .
        .

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...