首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >松露-已部署合同上的合同错误

松露-已部署合同上的合同错误
EN

Ethereum用户
提问于 2018-11-01 21:08:31
回答 1查看 567关注 0票数 0

使用gnosis multisig,使用松露-契约与已经部署的MultiSigWallet交互使用松露迁移。

我试图运行的文件的内容:

代码语言:javascript
复制
var contract = require('truffle-contract');

var fs = require('fs');
var Web3 = require('web3');
var web3 = new Web3('http://localhost:9545');
var provider = new Web3.providers.HttpProvider('http://localhost:9545');

var fileData = fs.readFileSync('./build/contracts/MultiSigWallet.json');
var jsonData = JSON.parse(fileData.toString());

var myContract = contract(jsonData);
myContract.setProvider(provider);

myContract.deployed().then(function(instance) {
        var deployed = instance;
        return deployed.address;
})
.then(function(result) {
        console.log(result);
})
.catch(err => { 
        console.log(err);  
});

当我使用节点运行时,获取错误:

代码语言:javascript
复制
TypeError: Cannot read property 'apply' of undefined
    at Provider.sendAsync (/home/delphi/MultiSigWallet/node_modules/truffle-contract/contract.js:24:36)
    at RequestManager.sendAsync (/home/delphi/MultiSigWallet/node_modules/truffle-contract/node_modules/web3/lib/web3/requestmanager.js:80:19)
    at Object.get [as getNetwork] (/home/delphi/MultiSigWallet/node_modules/truffle-contract/node_modules/web3/lib/web3/property.js:116:33)
    at /home/delphi/MultiSigWallet/node_modules/truffle-contract/contract.js:512:27
    at new Promise (<anonymous>)
    at Function.detectNetwork (/home/delphi/MultiSigWallet/node_modules/truffle-contract/contract.js:503:14)
    at Function.deployed (/home/delphi/MultiSigWallet/node_modules/truffle-contract/contract.js:451:19)
    at Object.<anonymous> (/home/delphi/MultiSigWallet/test.js:14:12)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

错误中提到的未定义的是myContract.deployed()。但我不明白为什么会这样。简单的控制台输出显示,myContract不是未定义的。有人能帮我弄清楚是怎么回事吗?

EN

回答 1

Ethereum用户

发布于 2020-02-23 15:09:36

代码语言:javascript
复制
import contract from 'truffle-contract'

但是,节点此文件将报告错误“SyntaxError:意外标识符”

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/61611

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档