Post
Share your knowledge.
Creating tx_bytes Based on sui_getNormalizedMoveFunction Output: Move modue examples
I am looking for examples or guidance on how to create tx_bytes after receiving data from sui_getNormalizedMoveFunction
in Golang, PHP, and JavaScript. Essentially, I want to populate Move function parameters using the output from sui_getNormalizedMoveFunction
, prepare/sign the transaction, and then send it using sui_executeTransactionBlock
. Is this the correct flow for executing Move functions, and if so, how can I generate the necessary parameters? For example, I am trying to call the mint method from the Move package 0xf5b55a91957b68f23107522abf96634a0d58ccad6ff9ecd6daf3eba8808b3dd9
, and the function requires parameters such as MintApp, Clock, Coinsui_getNormalizedMoveFunction
, but I am uncertain about the approach.
- Move
Answers
2It seems you're looking to execute a Move Sui transaction, and the sui_getNormalizedMoveFunction
provides some data about the Move package. To make a transaction, you can use the unsafe_*** JSON RPC calls documented in the Sui JSON RPC documentation. This call will return the transaction bytes (tx_bytes) that you can then sign and execute the transaction with.
Here are a few suggestions to help you proceed:
- Use the TypeScript SDK: If possible, start with the TypeScript SDK provided by the project. Using the SDK can help you by providing types and function arguments, making it easier to work with the Move functions without having to call
unsafe_moveCall
. You can find more information and resources in the SUI TypeScript documentation. - Object IDs and Addresses: For some parameters, you'll need to know the object IDs. For example, if you're dealing with a Kiosk, you should know the Kiosk's ObjectID. Similarly, if you're the KioskOwnerCap, you'll need its ObjectID. The Clock object has a fixed ObjectID of 0x6.
- Argument Types for
unsafe_payMove
: When callingunsafe_payMove
, provide the required arguments in the arguments type, which takes a list of JSON values. These values should be strings representing the IDs or addresses. For instance, "0x2::sui::SUI" represents an address. By following these steps and understanding the parameters and object IDs, you can create the necessary tx_bytes and execute your Move Sui transactions.
The process you're describing is generally correct for executing Move functions on the Sui blockchain. Here's a step-by-step guide on how you might approach this:
- Call
sui_getNormalizedMoveFunction
: This function returns the normalized form of a Move function, which includes the function's name, parameters, and return type. You can use this information to understand what parameters the function requires. - Generate the necessary parameters: The parameters required for the function call will depend on the function itself. In your case, you're trying to call the mint function in the
0xf5b55a91957b68f23107522abf96634a0d58ccad6ff9ecd6daf3eba8808b3dd9
Sui package. You've mentioned that you can retrieve MintApp and Clock from other transaction examples. For the other parameters (Coin, Kiosk, KioskOwnerCap, and TransferPolicy<SuiFren >), you may need to retrieve these from the Sui blockchain or generate them yourself. - Prepare and sign the Sui transaction: Once you have all the necessary parameters, you can prepare the transaction. This will involve creating a transaction block that includes the function call and its parameters. You'll then need to sign this transaction block using your private key.
- Send the transaction using
sui_executeTransactionBlock
: Finally, you can send the signed transaction block to the Sui blockchain using thesui_executeTransactionBlock
function.
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.

- ... SUIderiss+5
- ... SUIRamirez+5
- ... SUIElvin CLONE +5
- ... SUI
- ... SUI
- ... SUI
- ... SUIBritain+2