Skip to content

fix(sdk-coin-ada): mark change outputs with change:true in explainTransaction#8943

Closed
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/wci-633-ada-change-outputs-explain-transaction
Closed

fix(sdk-coin-ada): mark change outputs with change:true in explainTransaction#8943
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/wci-633-ada-change-outputs-explain-transaction

Conversation

@bitgo-ai-agent-dev
Copy link
Copy Markdown

Summary

  • Transaction now tracks a _changeAddress field set by TransactionBuilder after each build path (standard, token, and explicit-output paths).
  • explainTransaction() uses _changeAddress to add change: true on matching outputs, so intent verification can distinguish change from recipient outputs.
  • ExplainTransactionOptions gains an optional changeAddress field — callers that only have raw hex can supply the wallet's base address to get correct change marking.

Root Cause

sdk-coin-ada explainTransaction() returned all outputs in a flat outputs[] array with no change marker. changeOutputs was always []. The intent verification parser reads output.change || output.isChange to detect change outputs; since ADA set neither, change outputs were counted as recipients, producing a recipients.count CRITICAL mismatch (intent: 1, transaction: 2).

Fixes recurring false-positive TransactionFailsIntentVerification alerts for ADA self-custodial transactions.

Related: WCI-633, WAL-1464

Test plan

  • New tests in transactionBuilder.ts verify change: true is set on the change output for a standard transfer, absent when no changeAddress is provided, and set for consolidation transactions.
  • yarn unit-test --scope @bitgo/sdk-coin-ada — 102 passing, 3 pre-existing env-var failures (unrelated to this change).

🤖 Generated with Ralph

…nsaction

ADA's explainTransaction() returned all outputs in a flat outputs[]
array with no change marker, causing intent verification to count
change outputs as recipients and trigger false-positive
TransactionFailsIntentVerification alerts.

Fix: add a _changeAddress field to Transaction. TransactionBuilder sets
it after building. explainTransaction() uses it to add change:true on
matching outputs. ExplainTransactionOptions accepts an optional
changeAddress so callers with only raw hex can supply the wallet address.

Ticket: WCI-633
Session-Id: 9d7a233b-1b25-4206-87ef-85d2a74410a4
Task-Id: 2eafb02e-6fe8-44a3-a0e9-1825491a8e31
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 4, 2026

WCI-633

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the fix/wci-633-ada-change-outputs-explain-transaction branch from 01b4683 to a1dd601 Compare June 4, 2026 10:32
@Marzooqa
Copy link
Copy Markdown
Contributor

Marzooqa commented Jun 4, 2026

Using #8945 instead

@Marzooqa Marzooqa closed this Jun 4, 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.

1 participant