Conversation
packages/core-mobile/app/new/features/notifications/screens/SwapActivityDetailScreen.tsx
Dismissed
Show dismissed
Hide dismissed
There was a problem hiding this comment.
Pull request overview
Implements “refunded / partial failure” support in the Fusion swap UI (notifications list + swap detail), including new status mapping, display copy, and persistence updates needed for bigint-safe transfer storage.
Changes:
- Bump
@avalabs/fusion-sdkto0.11.0and adapt fee estimation/tests to the updated API (totalUpfrontFee). - Add “refunded” handling across swap notifications: status mapping, list item/title/icon updates, and swap detail UI (notes, confirmations, error reason).
- Rework Zustand MMKV persistence exports and add a custom persist adapter for Fusion transfers using
stringifyTransfer/parseTransferto preserve bigints.
Reviewed changes
Copilot reviewed 32 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates lockfile for fusion-sdk bump. |
| packages/k2-alpine/src/theme/tokens/Icons.ts | Registers new Restart custom icon. |
| packages/k2-alpine/src/assets/icons/restart_alt.svg | Adds restart SVG used for refunded swaps. |
| packages/core-mobile/polyfills/index.js | Removes BigInt JSON polyfill import from polyfills entrypoint. |
| packages/core-mobile/polyfills/bigInt_to_string.js | Deletes BigInt toJSON global polyfill. |
| packages/core-mobile/patches/reactotron-core-client+2.9.9.patch | Patches reactotron serialization behavior related to BigInt toJSON. |
| packages/core-mobile/package.json | Bumps fusion-sdk dependency version. |
| packages/core-mobile/app/utils/mmkv/storages.ts | Renames/exports MMKV instance and standardized Zustand persist adapter. |
| packages/core-mobile/app/store/posthog/slice.ts | Adjusts Solana swap gating logic. |
| packages/core-mobile/app/new/features/track/store.ts | Switches persisted storage adapter import/name. |
| packages/core-mobile/app/new/features/swap/services/FusionService.test.ts | Updates tests for fee estimation return shape. |
| packages/core-mobile/app/new/features/swap/screens/SwapScreen.tsx | Navigates to swap detail notification for successful cross-chain swaps. |
| packages/core-mobile/app/new/features/swap/hooks/useZustandStore.ts | Adds custom persist adapter for Fusion transfers using stringify/parse helpers. |
| packages/core-mobile/app/new/features/swap/hooks/useZustandStore.test.ts | Adds unit tests for Fusion transfer persistence + store actions. |
| packages/core-mobile/app/new/features/swap/hooks/useFeeEstimation.ts | Uses totalUpfrontFee for fee estimation calculations. |
| packages/core-mobile/app/new/features/swap/contexts/SwapContext.tsx | Tracks successTransferId to support post-success routing behavior. |
| packages/core-mobile/app/new/features/portfolio/store.ts | Switches persisted storage adapter import/name. |
| packages/core-mobile/app/new/features/portfolio/assets/components/TokenActivityListItemTitle.tsx | Improves swap title generation for cross-chain / ambiguous token visibility cases. |
| packages/core-mobile/app/new/features/notifications/utils.ts | Adds refunded as terminal state and maps it into UI statuses. |
| packages/core-mobile/app/new/features/notifications/utils.test.ts | Adds tests for refunded status mapping + terminal-state behavior. |
| packages/core-mobile/app/new/features/notifications/types.ts | Extends swap notification status union with refunded and incomplete. |
| packages/core-mobile/app/new/features/notifications/screens/SwapActivityDetailScreen.tsx | Adds refunded/confirmations/error reason display and updates titles/buttons. |
| packages/core-mobile/app/new/features/notifications/screens/NotificationsScreen.tsx | Allows navigating into swap activity detail from list items. |
| packages/core-mobile/app/new/features/notifications/hooks/useSwapActivityDisplay.ts | Adds refund note, error reason, and confirmation progress fields. |
| packages/core-mobile/app/new/features/notifications/components/SwapStatusIcon.tsx | Updates status icon rendering (failed/incomplete styling). |
| packages/core-mobile/app/new/features/notifications/components/SwapStatusCard.tsx | Adds confirmations progress UI and optional note row. |
| packages/core-mobile/app/new/features/notifications/components/SwapIcon.tsx | Adds refunded icon variant (restart icon). |
| packages/core-mobile/app/new/features/notifications/components/RetrySwapButton.tsx | Removes inline retry button accessory from list items. |
| packages/core-mobile/app/new/features/notifications/components/FusionTransferItem.tsx | Updates list item title/subtitle/accessory/timestamp behavior incl. refunded. |
| packages/core-mobile/app/new/features/ledger/store.ts | Switches persisted storage adapter import/name. |
| packages/core-mobile/app/new/features/appReview/store.ts | Switches persisted storage adapter import/name. |
| packages/core-mobile/app/new/features/activity/store.ts | Switches persisted storage adapter import/name. |
| packages/core-mobile/app/new/features/accountSettings/store.ts | Switches persisted storage adapter import/name. |
| packages/core-mobile/app/new/common/utils/createZustandStore.ts | Updates default persist adapter to zustandPersistStorage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
packages/core-mobile/app/new/features/notifications/screens/NotificationsScreen.tsx
Show resolved
Hide resolved
packages/core-mobile/app/new/features/notifications/screens/SwapActivityDetailScreen.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR updates Core Mobile’s Fusion swap activity/notification UX to support a new refunded (partial failure) terminal state, including improved persistence of Fusion transfers and SDK alignment.
Changes:
- Bump
@avalabs/fusion-sdkto0.11.0and update fee estimation usage tototalUpfrontFee. - Add refunded/partial-failure handling across notifications list + swap detail UI (statuses, icons, notes, confirmations).
- Improve swap transfer persistence by adding BigInt-safe serialization for persisted Fusion transfers and standardizing Zustand MMKV storage exports.
Reviewed changes
Copilot reviewed 32 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Locks updated dependency graph for Fusion SDK bump. |
| packages/k2-alpine/src/theme/tokens/Icons.ts | Registers new Icons.Custom.Restart icon token. |
| packages/k2-alpine/src/assets/icons/restart_alt.svg | Adds restart icon asset used for refunded swap UI. |
| packages/core-mobile/polyfills/index.js | Removes BigInt-to-JSON polyfill import from polyfill bundle. |
| packages/core-mobile/polyfills/bigInt_to_string.js | Deletes BigInt toJSON prototype patch polyfill. |
| packages/core-mobile/patches/reactotron-core-client+2.9.9.patch | Adjusts Reactotron serialization patch (disables BigInt toJSON injection). |
| packages/core-mobile/package.json | Bumps @avalabs/fusion-sdk to 0.11.0. |
| packages/core-mobile/app/utils/mmkv/storages.ts | Renames MMKV instance export and introduces zustandPersistStorage adapter. |
| packages/core-mobile/app/store/posthog/slice.ts | Removes Keystone-specific Solana swap block in selector. |
| packages/core-mobile/app/new/features/track/store.ts | Migrates persisted storage usage to zustandPersistStorage. |
| packages/core-mobile/app/new/features/swap/services/FusionService.test.ts | Updates fee estimate mock shape for new SDK field name. |
| packages/core-mobile/app/new/features/swap/screens/SwapScreen.tsx | Navigates to swap detail after success for cross-chain swaps using stored transfer info. |
| packages/core-mobile/app/new/features/swap/hooks/useZustandStore.ts | Adds custom persist storage for Fusion transfers using stringifyTransfer/parseTransfer to preserve BigInts. |
| packages/core-mobile/app/new/features/swap/hooks/useZustandStore.test.ts | Adds unit tests for Fusion transfer persistence + store actions. |
| packages/core-mobile/app/new/features/swap/hooks/useFeeEstimation.ts | Switches fee estimate field from totalFee to totalUpfrontFee. |
| packages/core-mobile/app/new/features/swap/contexts/SwapContext.tsx | Tracks successTransferId for post-success navigation decisions. |
| packages/core-mobile/app/new/features/portfolio/store.ts | Migrates persisted storage usage to zustandPersistStorage. |
| packages/core-mobile/app/new/features/portfolio/assets/components/TokenActivityListItemTitle.tsx | Improves swap title fallback logic for cross-chain/visibility edge cases. |
| packages/core-mobile/app/new/features/notifications/utils.ts | Renames terminal check to isSwapTerminal and adds refunded status mapping. |
| packages/core-mobile/app/new/features/notifications/utils.test.ts | Expands tests to cover refunded/incomplete/terminal behavior. |
| packages/core-mobile/app/new/features/notifications/types.ts | Extends NotificationSwapStatus with refunded and incomplete. |
| packages/core-mobile/app/new/features/notifications/screens/SwapActivityDetailScreen.tsx | Adds refunded titles/notes, confirmations, error reason UI; adjusts footer actions. |
| packages/core-mobile/app/new/features/notifications/screens/NotificationsScreen.tsx | Uses new terminal logic and makes swap items navigable to detail screen. |
| packages/core-mobile/app/new/features/notifications/hooks/useSwapActivityDisplay.ts | Adds refund note, errorReason, and confirmation progress mapping for UI. |
| packages/core-mobile/app/new/features/notifications/components/SwapStatusIcon.tsx | Updates icon rendering for new target-leg incomplete state. |
| packages/core-mobile/app/new/features/notifications/components/SwapStatusCard.tsx | Displays confirmations progress + note; supports incomplete status label/coloring. |
| packages/core-mobile/app/new/features/notifications/components/SwapIcon.tsx | Adds refunded icon treatment (restart) in swap list items. |
| packages/core-mobile/app/new/features/notifications/components/RetrySwapButton.tsx | Removes inline retry button from list items. |
| packages/core-mobile/app/new/features/notifications/components/FusionTransferItem.tsx | Adjusts titles/subtitles/accessories to support refunded state and new UX. |
| packages/core-mobile/app/new/features/ledger/store.ts | Migrates persisted storage usage to zustandPersistStorage. |
| packages/core-mobile/app/new/features/appReview/store.ts | Migrates persisted storage usage to zustandPersistStorage. |
| packages/core-mobile/app/new/features/activity/store.ts | Migrates persisted storage usage to zustandPersistStorage and keeps migration logic. |
| packages/core-mobile/app/new/features/accountSettings/store.ts | Migrates persisted storage usage to zustandPersistStorage. |
| packages/core-mobile/app/new/common/utils/createZustandStore.ts | Updates default persist storage to zustandPersistStorage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
packages/core-mobile/app/new/features/notifications/screens/SwapActivityDetailScreen.tsx
Show resolved
Hide resolved
packages/core-mobile/app/new/features/notifications/components/SwapIcon.tsx
Show resolved
Hide resolved
packages/core-mobile/app/new/features/notifications/screens/NotificationsScreen.tsx
Show resolved
Hide resolved
B0Y3R-AVA
left a comment
There was a problem hiding this comment.
few more nits as i think constants for swap statuses could clean up some of the ui logic nicely
| const isCompleted = status === 'completed' | ||
| const isFailed = status === 'failed' | ||
| const isIncomplete = status === 'incomplete' |
There was a problem hiding this comment.
seeing use of these status screens everywhere, would love for these to be consts defined in one place
| color: isCompleted | ||
| ? colors.$textSuccess | ||
| : isFailed | ||
| : isFailed || isIncomplete | ||
| ? colors.$textDanger | ||
| : colors.$textSecondary |
There was a problem hiding this comment.
NIT this is starting to get messy, worth moving to above and using a switch to build out an object?
`
const COMPLETED = 'completed'
const INCOMPLETE = 'incomplete'
const FAILED = 'failed'
const titleColorAndText: { title: string, color: string } = {}
switch(status):
case COMPLETED:
titleColorAndText = {title: 'Complete', color: colors.$textSuccess}
case FAILED
titleColorAndText = {title: 'Failed', color: colors.$textDanger}
case INCOMPLETE:
titleColorAndText = {title: 'Failed', color: colors.$textDanger}
default:
titleColorAndText = {title: 'Pending...', color: colors.$textSecondary}
`
That way we can use textAndTitleColor.text and textAndTitleColor.color here
packages/core-mobile/app/new/features/notifications/components/FusionTransferItem.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR adds full UI support for refunded Fusion swaps (list + detail), improves swap activity interactions (all items navigable), and fixes BigInt persistence by switching Fusion transfer storage to SDK-backed stringifyTransfer/parseTransfer serialization (plus associated dependency/polyfill adjustments).
Changes:
- Add “refunded” swap state across notifications list + swap detail UI (icons, titles, status mapping, notes, confirmations, error display).
- Make all swap activity items tappable (chevron) and adjust detail-screen footer actions/styles by status.
- Fix swap transfer persistence (BigInt-safe) by removing
BigInt.prototype.toJSONoverrides and persisting Fusion transfers via Fusion SDKstringifyTransfer/parseTransfer; bump Fusion SDK to0.11.0.
Reviewed changes
Copilot reviewed 32 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Bumps @avalabs/fusion-sdk resolution to 0.11.0. |
| packages/core-mobile/package.json | Bumps @avalabs/fusion-sdk to 0.11.0. |
| packages/k2-alpine/src/theme/tokens/Icons.ts | Registers new Restart icon token. |
| packages/k2-alpine/src/assets/icons/restart_alt.svg | Adds refunded-state icon asset. |
| packages/core-mobile/polyfills/index.js | Removes BigInt JSON polyfill import. |
| packages/core-mobile/polyfills/bigInt_to_string.js | Deletes BigInt.prototype.toJSON override polyfill. |
| packages/core-mobile/patches/reactotron-core-client+2.9.9.patch | Disables Reactotron’s BigInt toJSON override to preserve custom BigInt tagging. |
| packages/core-mobile/app/utils/mmkv/storages.ts | Renames/exports MMKV-backed Zustand storage adapters (zustandStorageMMKV, zustandPersistStorage). |
| packages/core-mobile/app/store/posthog/slice.ts | Adjusts Solana swap gating logic (removes Keystone special-case from swap gate). |
| packages/core-mobile/app/new/common/utils/createZustandStore.ts | Updates default persist storage to zustandPersistStorage. |
| packages/core-mobile/app/new/features/track/store.ts | Uses new zustandPersistStorage adapter. |
| packages/core-mobile/app/new/features/portfolio/store.ts | Uses new zustandPersistStorage adapter. |
| packages/core-mobile/app/new/features/ledger/store.ts | Uses new zustandPersistStorage adapter. |
| packages/core-mobile/app/new/features/appReview/store.ts | Uses new zustandPersistStorage adapter. |
| packages/core-mobile/app/new/features/activity/store.ts | Uses new zustandPersistStorage adapter. |
| packages/core-mobile/app/new/features/accountSettings/store.ts | Uses new zustandPersistStorage adapter. |
| packages/core-mobile/app/new/features/swap/hooks/useFeeEstimation.ts | Updates fee estimate field name to totalUpfrontFee. |
| packages/core-mobile/app/new/features/swap/services/FusionService.test.ts | Updates tests for new fee estimate shape (totalUpfrontFee). |
| packages/core-mobile/app/new/features/swap/contexts/SwapContext.tsx | Tracks successTransferId to enable post-submit navigation behavior. |
| packages/core-mobile/app/new/features/swap/screens/SwapScreen.tsx | Navigates directly to swap detail after successful cross-chain submission. |
| packages/core-mobile/app/new/features/swap/hooks/useZustandStore.ts | Adds custom MMKV persist adapter for Fusion transfers using stringifyTransfer/parseTransfer. |
| packages/core-mobile/app/new/features/swap/hooks/useZustandStore.test.ts | Adds unit tests validating BigInt-safe persistence and store actions. |
| packages/core-mobile/app/new/features/portfolio/assets/components/TokenActivityListItemTitle.tsx | Improves swap title rendering for edge cases (missing output, identical symbols). |
| packages/core-mobile/app/new/features/notifications/types.ts | Replaces swap status string union with NotificationSwapStatus enum (adds Refunded/Incomplete). |
| packages/core-mobile/app/new/features/notifications/utils.ts | Renames terminal helper to isSwapTerminal and adds refunded/incomplete status mapping. |
| packages/core-mobile/app/new/features/notifications/utils.test.ts | Updates/extends tests for refunded + enum-based statuses. |
| packages/core-mobile/app/new/features/notifications/screens/NotificationsScreen.tsx | Makes swap items always tappable; updates terminal logic for swipe/clear-all. |
| packages/core-mobile/app/new/features/notifications/components/RetrySwapButton.tsx | Removes list-item retry button (navigation now via detail screen). |
| packages/core-mobile/app/new/features/notifications/components/FusionTransferItem.tsx | Updates titles/subtitles/icons/chevron behavior; adds refunded title formatting. |
| packages/core-mobile/app/new/features/notifications/components/SwapIcon.tsx | Adds refunded icon rendering (Restart). |
| packages/core-mobile/app/new/features/notifications/components/SwapStatusIcon.tsx | Distinguishes failed (filled) vs incomplete (outline) status icons. |
| packages/core-mobile/app/new/features/notifications/components/SwapStatusCard.tsx | Adds confirmations progress bar + optional note row; status rendering via enum. |
| packages/core-mobile/app/new/features/notifications/hooks/useSwapActivityDisplay.ts | Adds refund note, error reason, and confirmations data for detail UI. |
| packages/core-mobile/app/new/features/notifications/screens/SwapActivityDetailScreen.tsx | Updates titles (2-line), footer actions (Hide/Dismiss), confirmations/note rows, and error reason display. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Description
Ticket: CP-13626
Swap Activity Notifications — UI Polish & Refunded State
refundedtransfers — dedicated icon (restart_alt), list item title showing refunded amount/token, and detail screen showing "Swap partial failure" with refund note on the target cardRetrySwapButtonfrom the listwas/werepluralization from swap item titlesSwap successfultitle renders on two linestertiarystyle (plain text)Confirmationsrow with green/gray progress bar added toSwapStatusCardNoterow on target card for refunded swapsisSwapCompletedOrFailed→isSwapTerminalto accurately reflect that it now includesrefundedbigInt_to_string.jspolyfill — it was overridingBigInt.prototype.toJSONwhich causedJSON.stringifyto emit plain strings beforestringifyTransfer's replacer could tag them as{__type:"bigint"}. Removing the polyfill letsstringifyTransfer/parseTransferfrom the Fusion SDK work correctly, ensuring BigInt fields (amountIn,amountOut,fees[].amount, etc.) persist and rehydrate with full precision.Screenshots/Videos
Swap Details



Notification Items


Testing
{amount} {from} swapped for {to}(no was/were), chevron is shown, tapping opens detail; button reads "Hide"!); dismiss button is plain text ("Dismiss"){amount} {token} refunded to your wallet,restart_alticon, no subtitle, chevron shown; detail screen title reads "Swap partial failure"; target card shows "Incomplete" status with outlined error icon and a refund noteChecklist
Please check all that apply (if applicable)