在链下调用public函数的时候,怎么给该函数传在合约内定义好的结构体参数

struct Arrtibute{
        Options trait_type;
        uint256 tokenId;
        address contractAddr;
    }

// 在这个函数中如果想要在链下调用,第二个参数该怎么传呢?
function SafeMint(address to,Arrtibute[totalArrtibutes] memory arrtibutes )public virtual{

}
请先 登录 后评论

最佳答案 2021-09-04 11:20

在前端先拼成类似这样的对象:

{ trait_type: 1, 
  tokenId: 1, 
  contractAddr: 0x }

然后把对象放入一个数组里,即可。

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,1576 浏览
  • c_hacker 提出于 2021-09-03 00:08

相似问题