Sui.

Post

Share your knowledge.

0xduckmove.
Jul 14, 2025
Expert Q&A

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
2
2
Share
Comments
.

Answers

2
24p30p.
Jul 14 2025, 17:47

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:


Option 1: Drop the object if you don’t need it

tx.moveCall({
  target: '0x2::object::drop',
  arguments: [returnReceip],
});

Option 2: Transfer it to the sender if it holds useful info

tx.transferObjects([returnReceip], tx.pure.address(sender));

✅ Final fixed code:

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));
tx.moveCall({
  target: '0x2::object::drop',
  arguments: [returnReceip],
});

This will resolve the UnusedValueWithoutDrop error. You can also inspect the structure of returnReceip using devInspectTransactionBlock() to decide whether to drop or keep it.

🔗 Read more on object handling in Sui Move

0
Comments
.
harry phan.
Jul 15 2025, 04:42

You 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

0
Comments
.

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.

420Posts611Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

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

Reward CampaignJuly