Batch transaction

Hello! I am interested in utilizing the exchange’s smart contract for token swapping, but I have encountered some challenges related to batch transactions.

In the context of the exchange, there is a user interface that facilitates the seamless exchange of tokens. Upon analyzing a recent transaction, it appears that three operations were executed: token splitting, sending tokens to one’s own wallet, and interacting with the blockchain’s smart contract.
Trx example: https://suiexplorer.com/txblock/ARLoJ6xkgZVP51oh1BXSMTkjzWrh4TBbc8hycZo74FeZ

In attempting to replicate a similar batch transaction, I discovered that the second transaction - involving sending tokens to oneself - may not be essential for the successful execution of the swap operation with the smart contract.
Trx example: https://suiexplorer.com/txblock/6u4VXDsptBJdbWGaLcnY4HvepNd2f3dGr4hmjnxuGa4C

I am curious to understand if the operation of sending tokens to oneself after a split serves a specific purpose, perhaps related to security considerations?

Additionally, I have a second inquiry. Could you kindly provide assistance with a JSON example request where the outcome of the first transaction is utilized in the second transaction within the context of a batch transaction? I mean is it possible to use “NestedResult” via JSON?

Thank you!

2 Likes