牢固地在struct中使用数组

时间:2019-03-08 09:02:02

标签: solidity web3js

我有一个类似下面的结构:

struct Document {
    address[] haveAccess;
}

mapping(uint => Document) public documents;
address[] public arr;

 constructor() {
    documentsCount++;
    documents[documentsCount] = Document(arr);
 }

从松露编译后从web3 js访问不会返回地址数组 haveAccess 。甚至不返回空数组。 web3呼叫就像这样

instance.documents(0).then(document=>{
    //dosomething with document
});

我需要访问数组haveAccess。

1 个答案:

答案 0 :(得分:0)

尝试用括号而不是括号进行呼叫。并且您还需要添加.call。看看here

相关问题