Move.

Post

Share your knowledge.

doodee.
Feb 17, 2025
Expert Q&A

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
Share
Comments
.

Answers

2
DRAMA.
Feb 17 2025, 15:38

To pass BCS serialized struct parameters, you cannot directly create new struct instances as they must be created through move calls. This is because allowing direct creation would enable arbitrary objects or coins to be passed in without restrictions. For a move module to manage how its structs are created, your contract needs to implement a method specifically for constructing the struct. This ensures control over the creation process and maintains integrity.

1
Comments
.
skywinder.
Feb 17 2025, 15:38

You can refer to more detailed instructions on passing inputs to a transaction in this guide: Passing Inputs to a Transaction.

0
Comments
.

Do you know the answer?

Please log in and share it.

We use cookies to ensure you get the best experience on our website.
More info