Post
Share your knowledge.
which runs successfully through devInspectTransactionBlock()
Hi all, I am using the Type Script SDK and receiving the error "UnusedValueWithoutDrop" after a tx.moveCall (flash_swap on MMT LP). I assume that I have to drop or transfer back the returned coins after the swap. Can someone tell me, how to efficiently drop / transfer the returned objects (currently NestedResult) after my moveCall? Appreciate any help, thanks!
Here is the code, which runs successfully through devInspectTransactionBlock()
let [returnCoinA, returnCoinB, returnReceip] = tx.moveCall({
target: targetFunctionLP2,
typeArguments: [suiTokenType, usdcTokenType],
arguments: [
tx.object(poolAddressLP2),
tx.pure.bool(false),
tx.pure.bool(true),
tx.pure.u64(amountOutUSDNormalized),
tx.pure.u128(limit_sqrt_priceB),
tx.object(clockObjectAddressLP2),
tx.object(versionAddressLP2),
],
});
tx.transferObjects([returnCoinA, returnCoinB], tx.pure.address(sender))
- Sui
Answers
3You need to do something with returnReceipt. I don't know what these objects are, but you can probably just add them to transferObjects if they aren't expected to be passed into another call
You're getting the UnusedValueWithoutDrop error because every object returned from a Move call must be either transferred, used, destroyed, or explicitly dropped — otherwise, Sui throws that error to ensure safe and deterministic object handling.
In your case, you’re handling returnCoinA and returnCoinB correctly by transferring them back to the sender. But you’re not doing anything with returnReceip, which is why the error is triggered.
To fix this, you should explicitly drop returnReceip if it’s not needed, or transfer it if it contains data the user should keep. Here's how you can handle it depending on the case:
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
- How to Maximize Profit Holding SUI: Sui Staking vs Liquid Staking616
- Why does BCS require exact field order for deserialization when Move structs have named fields?65
- Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution55
- Sui Move Error - Unable to process transaction No valid gas coins found for the transaction419
- Sui Transaction Failing: Objects Reserved for Another Transaction410