Skip to content

fix(sdk-coin-flr): auto-detect atomic export txs in explainTransaction#9112

Merged
ArunBala-Bitgo merged 1 commit into
masterfrom
CECHO-1445/fix-flr-export-recipient-address
Jun 25, 2026
Merged

fix(sdk-coin-flr): auto-detect atomic export txs in explainTransaction#9112
ArunBala-Bitgo merged 1 commit into
masterfrom
CECHO-1445/fix-flr-export-recipient-address

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown

What

  • In Flr.explainTransaction, auto-detect Avalanche/Flare atomic transactions by their codec prefix (0x00000000) and route them to explainAtomicTransaction even when crossChainType is not explicitly set by the caller.
  • Add a regression test in sdk-coin-flr verifying that explaining an atomic export tx without crossChainType returns the P-chain recipient address.
  • Add a regression test in sdk-coin-flrp verifying that explainTransaction on a C-chain export returns a non-empty P-chain recipient address in outputs[0].address.

Why

  • When the wallet platform calls explainTransaction on the FLR coin for a cross-chain export transaction without passing crossChainType, the method falls through to the EVM explain path. The EVM TransactionBuilder cannot parse atomic transaction hex and fails, leaving the P-chain recipient address missing from the explain result. The UI then displays a blank "Recipient address" field.
  • Avalanche/Flare atomic transactions have a deterministic codec prefix (0000) that distinguishes them from EVM RLP-encoded transactions (which start with f8). Using this prefix for auto-detection makes the routing robust regardless of whether the caller sets crossChainType.

Test plan

  • sdk-coin-flr unit tests: 61 passing — new test confirms outputs[0].address is set to the P-chain destination when explaining an atomic export without crossChainType.
  • sdk-coin-flrp unit tests: 361 passing — new test confirms outputs[0].address is non-empty and P-chain-prefixed for a C-chain export explain.
  • Lint passes for both modules.

Ticket: CECHO-1445

When the FLR wallet platform calls explainTransaction for a cross-chain
export without setting crossChainType, the method falls through to the
EVM explain path which cannot parse atomic transaction hex, causing the
recipient P-chain address to be missing from the result.

Avalanche/Flare atomic transactions are identified by their codec prefix
(0x00000000). Add auto-detection: if the tx hex starts with '0000'
(after stripping any 0x prefix), route to explainAtomicTransaction even
when crossChainType is not supplied. This ensures the P-chain recipient
address always appears in outputs[0].address for export transactions,
regardless of whether the caller sets crossChainType explicitly.

Add regression tests in both sdk-coin-flr and sdk-coin-flrp that verify
outputs[0].address is non-empty for C-chain export transactions.

Ticket: CECHO-1445
Session-Id: 9552a57f-ade5-43df-b67b-d19aa62e6e32
Task-Id: 1785a314-e5c6-4b30-b86e-46e56c9206ed
@linear-code

linear-code Bot commented Jun 25, 2026

Copy link
Copy Markdown

CECHO-1445

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the CECHO-1445/fix-flr-export-recipient-address branch from 2de4b27 to d3a368a Compare June 25, 2026 02:49
@ArunBala-Bitgo ArunBala-Bitgo marked this pull request as ready for review June 25, 2026 05:14
@ArunBala-Bitgo ArunBala-Bitgo requested a review from a team as a code owner June 25, 2026 05:14

@mohd-kashif mohd-kashif left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ArunBala-Bitgo ArunBala-Bitgo merged commit decf227 into master Jun 25, 2026
25 checks passed
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.

2 participants