Skip to the article
Chain Today

Reporting on crypto's moving parts

Find and Recover Input Left After a Partial Swap

A partial swap can leave input in your wallet, an open order or a protocol balance. Trace the fill, identify where funds sit, then cancel or withdraw the remainder.

The Chain Today Desk4 min read

Cover artwork for Find and Recover Input Left After a Partial Swap

To recover input left after a partial swap, first find out whether it is still in your wallet, tied to an open order, or held in a protocol balance. A swap request can set an amount to trade, but the amount actually filled is recorded separately. Start with the transaction receipt or the exchange’s order history; the wallet’s current token balance alone may not explain what happened.

The basic sequence is: the wallet authorises a contract to use a token, the swap or order is submitted, and the venue records how much matched or executed. In a transaction-based swap, the receipt and token transfers show what moved. In an order book, the fill record shows what traded and the order status shows whether a remainder is still active. For a closer walkthrough of wallet execution, see the fuller fermi swap explainer.

How do you tell where the unspent input went?

Compare the requested amount with the filled amount, then check the transaction status and the venue’s order or balance screen. If the transaction failed or reverted, the swap did not execute; the input should remain in the wallet, though a network fee may still have been charged. If it succeeded, inspect its token transfers and the venue’s records to see whether the input was spent, returned, or credited internally.

These are the common cases:

  • Input still in the wallet: The swap used less than expected, or the transaction never completed. Confirm the token and network, then refresh the wallet balance.
  • Remainder on an open order: A limit order may have filled only in part and still be waiting for another match. Its unfilled amount is not necessarily available to trade again.
  • Funds in a protocol balance: Some venues credit assets to an internal account or vault. Check the venue’s balance and withdrawal controls.
  • Input transferred to the contract: Use the transaction record and the venue’s documented recovery or refund path. Do not assume a token transfer can be reversed by sending another transaction.

An order book works a little like a shop counter that fills only the quantity a buyer can take: the rest of the order can remain on the counter until it is cancelled or matched. A wallet swap can behave differently. Its contract may return unused input as part of execution, or it may leave funds in a venue balance. The receipt and protocol interface determine which happened.

How do you cancel an unfilled remainder?

Cancel the order through the same venue that placed it, then wait for the cancellation to register before treating the remainder as free. A cancellation stops future matching if it succeeds; it does not undo the portion already filled. Check the order status and resulting balance after the cancellation, since some systems require a separate withdrawal to move credited funds back to the wallet.

If the venue shows no active order and no withdrawable balance, look up the transaction by its hash and verify the destination contract and token transfers. A token approval is permission for a contract to spend up to an allowance; it is not proof that the contract took the full amount. You can revoke an approval you no longer need using a trusted wallet or the chain’s recognised tools, but revoking permission does not recover tokens already transferred.

When should you try the swap again?

Retry only after confirming where the first input sits and whether any remainder can still be matched. If the assets are in the wallet, check the quoted amount, minimum output, network fee and token pair before submitting another swap. If they remain in an open order, cancel it first or decide knowingly to leave it active. If funds are credited to a venue balance, withdraw them through that venue’s normal withdrawal flow.

The useful distinction is between unspent input and unavailable input. Unspent input remains under your wallet’s control or can be returned by the executing contract. Unavailable input may still belong to you but be committed to an order or held in a protocol account. Read the fill, order status and balance together; then use the matching cancellation or withdrawal action.