你如何使用特松露编码函数数据?在安全帽中,我可以使用:
const encodedFunctionCall = smartcontract.interface.encodeFunctionData("functionName", [data]);
如果我尝试同样的在特鲁弗,它告诉我的界面是未定义的,它是如何工作的?
这就是我如何在测试文件中部署智能契约的方式:
smartcontract = await Smartcontract.deployed();
发布于 2022-03-16 21:08:24
对于松露,您必须使用web3's encodeABI
,从本期https://github.com/trufflesuite/truffle/issues/1230:
const encodedFunctionCall = smartcontract.contract.methods.functionName(data).encodeABI();
https://ethereum.stackexchange.com/questions/123977
复制相似问题