Post
Share your knowledge.
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
Answers
2To 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.
You can refer to more detailed instructions on passing inputs to a transaction in this guide: Passing Inputs to a Transaction.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.