Skip to content

fix(widget): preserve refund status and transaction hashes in history - #888

Open
BiscuitCoder wants to merge 1 commit into
lifinance:mainfrom
BiscuitCoder:codex/preserve-refund-history
Open

BiscuitCoder wants to merge 1 commit into
lifinance:mainfrom
BiscuitCoder:codex/preserve-refund-history

Conversation

@BiscuitCoder

Copy link
Copy Markdown

Which Linear task is linked to this PR?

No Linear task; this is an external bug-fix contribution.

Why was it implemented this way?

Transaction history currently discards the API's substatus and substatusMessage. A DONE / REFUNDED transfer is reconstructed as COMPLETED, so isRouteRefunded returns false. When the refund returns to the source chain, the same-chain shortcut also collapses the sending and receiving transactions into one SWAP action, losing the refund transaction hash and link.

Preserve the reported substatus and explanation, retaining the existing defaults when they are absent. Exclude refunds from the same-chain shortcut so both transactions remain available. This also preserves PARTIAL outcomes for the existing partial-completion detection. Ordinary same-chain swaps keep their single action.

The production change is limited to four substitutions in the history converter. No new dependencies or public API changes. Includes a patch changeset for @lifi/widget.

Validation:

  • Added seven regression cases covering source-chain refunds, refunds on a different receiving chain, partial completion, ordinary same-chain swaps, and legacy records without substatus fields.
  • Before the fix: four regression cases failed; three passed.
  • After the fix: all 282 Widget tests passed across 21 files.
  • Widget TypeScript check, production workspace build, changed-file Biome check, and changeset status passed.
  • Repository pre-commit checks passed: Biome, workspace type checks, circular-dependency checks, Knip, and commitlint.
  • Validated with the upstream frozen lockfile, Node 24.19.0 and pnpm 12.5.1.

Visual showcase (Screenshots or Videos)

Deterministic converter regression, using synthetic history data:

Input Before After
DONE / REFUNDED, both transactions on chain 1 One SWAP / COMPLETED action, source hash only CROSS_CHAIN and RECEIVING_CHAIN / REFUNDED actions, source and refund hashes
DONE / PARTIAL COMPLETED PARTIAL, with the API explanation
Legacy history without substatus Existing fallback Existing fallback retained

No visual components were changed.

Checklist before requesting a review

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Widget API or adds new features that require documentation, I have updated the documentation in the public-docs repository. (Not applicable: internal bug fix.)

@changeset-bot

changeset-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0015fd2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@lifi/widget Patch
@lifi/widget-checkout Patch
nft-checkout Patch
tanstack-router-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@BiscuitCoder
BiscuitCoder force-pushed the codex/preserve-refund-history branch from 2342576 to 0015fd2 Compare September 29, 2026 15:16

This branch has not been deployed

No deployments
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