Move.

帖子

分享您的知识。

doodee.
Feb 17, 2025
专家问答

How to properly pass BCS serialized struct parameters in Sui?

I've been trying to pass BCS serialized struct parameters to a move module in the Sui blockchain, but I'm hitting an InvalidUsageOfPureArg error. Can Sui handle BCS serialized struct parameters directly, or do I need to create a struct object first and pass it to the move module? How should I structure my code to achieve this?

  • Move CLI
1
2
分享
评论
.

答案

2
DRAMA.
Feb 17 2025, 15:38

要传递 BCS 序列化结构参数,您无法直接创建新的结构实例,因为它们必须通过移动调用创建. 这是因为允许直接创建可以不受限制地传入任意物体或硬币. 为了使移动模块管理其结构的创建方式,您的合约需要实现专门用于构造结构的方法. 这样可以确保对创建过程的控制并保持完整性.

1
评论
.
skywinder.
Feb 17 2025, 15:38

您可以参阅本指南中有关向交易传递输入的更多详细说明:将输入传递给交易.

0
评论
.

你知道答案吗?

请登录并分享。

我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息