options.jsonInterface - 合约JSON接口

优质
小牛编辑
132浏览
2023-12-01

jsonInterface配置项基于合约的ABI信息生成。

调用:

myContract.options.jsonInterface

属性:

jsonInterface - Array: 合约的json接口。重新设置该属性将重新生成合约实例的方法和事件。

示例代码:

myContract.options.jsonInterface;
> [{
    "type":"function",
    "name":"foo",
    "inputs": [{"name":"a","type":"uint256"}],
    "outputs": [{"name":"b","type":"address"}]
},{
    "type":"event",
    "name":"Event"
    "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"bytes32","indexed":false}],
}]

// 设置一个新的接口
myContract.options.jsonInterface = [...];