Move.

Post

Share your knowledge.

andreweth..
Jan 28, 2025
Expert Q&A

Why is my SUI transaction showing increased amount in preview?

I'm working on a function to facilitate user transaction signing with a dApp kit, specifically to transfer a set amount of SUI from a user's wallet to our wallet for a purchase. The code seems to be ready for the task, but when previewing the transaction in the user's wallet, the SUI amount oddly increases. Did I overlook any details, or is there a typical fix for this oddity?

  • Move CLI
  • Move
3
2
Share
Comments
.

Answers

2
DuAn.
Jan 29 2025, 05:26

Your alternative code snippet suggests adding a prerequisite function call coinWithBalance and another method transferObjects to handle the coin transfer, which looks more aligned with standard practices. Double-check your logic around amount conversion and transaction object manipulation to ensure correct display and execution. Also, make sure the recipient address is accurately defined in your environment variables. Another key aspect is the assignment of the sender within the transaction: tx.setSender(currentAccount!.address);. Ensure that currentAccount is set correctly, as incorrect account handling could lead to unexpected results in the wallet preview.

3
Best Answer
Comments
.
Tawhid.
Jan 28 2025, 23:37

It appears that there's a misunderstanding in your transaction setup which might be causing the SUI amount to appear augmented instead of decremented as expected. In the first function you shared, ensure that you're correctly initializing the transaction and that the transfer is being executed properly. You might want to double-check how you handle the conversion of the amount when creating the transaction.

2
Comments
.

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.

148Posts231Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

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