帖子
分享您的知识。
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
答案
2您的备用代码片段建议添加先决条件函数调用coinWithBalance
和另一种方法transferObjects
来处理硬币转移,这看起来更符合标准惯例. 仔细检查有关金额转换和交易对象操作的逻辑,以确保正确的显示和执行. 此外,请确保在环境变量中准确定义收件人地址. 另一个关键方面是交易中发件人的分配:tx.setSender(currentAccount!.address);
.确保currentAccount
设置正确,因为不正确的账户处理可能会导致钱包预览中出现意外结果.
看来您的交易设置存在误解,这可能会导致SUI金额似乎有所增加,而不是像预期的那样减少. 在您共享的第一个函数中,确保您正确初始化了交易,并且转账执行正确. 在创建交易时,您可能需要仔细检查如何处理金额的转换.
你知道答案吗?
请登录并分享。
Move is an executable bytecode language used to implement custom transactions and smart contracts.