Skip to content

fix(ada):token recovery build#8227

Merged
dgm003 merged 1 commit intomasterfrom
fix/ada-token-recovery-CSHLD-133
Mar 4, 2026
Merged

fix(ada):token recovery build#8227
dgm003 merged 1 commit intomasterfrom
fix/ada-token-recovery-CSHLD-133

Conversation

@dgm003
Copy link
Contributor

@dgm003 dgm003 commented Mar 3, 2026

Ticket: CSHLD-133

Description

Recovery transactions for ADA wallets holding native tokens were dropping
the tokens entirely, producing only a single ADA output instead of the
expected token output + ADA remainder output.

Root cause: 'recover()' function in 'ada.ts' called 'changeAddress()' without
passing the token asset list from the UTXO set, so the transaction builder
had no knowledge of tokens. Additionally, the 'buildImplementation()' gate
in 'transactionBuilder.ts' did not route token recovery into the refactored
build path ('processTokenBuild') which handles token outputs correctly.

Fix:

  • Aggregate 'asset_list' from all UTxOs in 'recover()' into a
    fingerprint-keyed map and pass it as the 3rd argument to 'changeAddress()'
  • Call 'txBuilder.isTokenTransaction()' when the aggregated asset list is
    non-empty, so the builder routes through 'processTokenBuild()' →
    'addChangeOutput()' which produces both a token output (1.5 ADA + tokens)
    and an ADA remainder output

Issue Number

CSHLD-133

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added two unit tests in test/unit/ada.ts:

  • ADA-only recovery — asserts 1 output, correct ADA amount, no multiAssets
  • ADA + token recovery — asserts 2 outputs: one token output (1.5 ADA +
    correct token quantity/policy) and one ADA remainder output (totalBalance - minADA - fee)

Ran locally with:
npx mocha
All the 160 test cases passed.

@dgm003 dgm003 force-pushed the fix/ada-token-recovery-CSHLD-133 branch 3 times, most recently from d924f69 to 80243f8 Compare March 3, 2026 09:27
@dgm003 dgm003 marked this pull request as ready for review March 3, 2026 10:13
@dgm003 dgm003 requested a review from a team as a code owner March 3, 2026 10:13
@sachushaji
Copy link
Contributor

@claude

@dgm003 dgm003 marked this pull request as draft March 3, 2026 13:15
@dgm003 dgm003 force-pushed the fix/ada-token-recovery-CSHLD-133 branch from 80243f8 to a8f5e6e Compare March 3, 2026 15:09
@dgm003 dgm003 marked this pull request as ready for review March 4, 2026 05:22
@dgm003 dgm003 merged commit 9f4f7ec into master Mar 4, 2026
25 checks passed
@dgm003 dgm003 self-assigned this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants