Skip to content

Rename swap isNewrequiresTrustline (descriptor + telemetry)#915

Merged
CassioMG merged 2 commits into
mainfrom
cg-rename-isnew-requirestrustline
Jun 29, 2026
Merged

Rename swap isNewrequiresTrustline (descriptor + telemetry)#915
CassioMG merged 2 commits into
mainfrom
cg-rename-isnew-requirestrustline

Conversation

@CassioMG

@CassioMG CassioMG commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

DestinationTokenDescriptor.isNew was vague ("new" how?). Renames it to
requiresTrustline, which reads as it is used: when true, the swap bundles a
changeTrust op. All swap-related isNew was introduced in #879, so the scope is
contained to the Swap feature.

  • Rename DestinationTokenDescriptor.isNewrequiresTrustline and every
    read / literal / comment / error message across SwapScreen/** and
    transactionService.ts.
  • Rename the shouldShowXlmReservePreflight param destinationIsNew
    destinationRequiresTrustline.
  • Update docs/swap-to-new-token-design.md to match.

Telemetry (wire-format change)

The SWAP_DESTINATION_SELECTED Amplitude payload field is renamed isNew
requiresTrustline. Any dashboards/queries keyed on isNew for that event need
updating. (Intentional — done for cross-platform consistency.)

👆 this should be fine as Swap to New Token has not been released on mobile yet.

Why

Keeps freighter-mobile in sync with the browser-extension design doc, which makes
the same rename: stellar/freighter#2868 (comment)

Testing

  • Full unit suite green locally: 2526 passed / 2528 (2 skipped).
  • Scoped swap suites: 21 suites / 272 tests passing.

🤖 Generated with Claude Code

The DestinationTokenDescriptor.isNew flag was vague. requiresTrustline
reads as it is used: when true, the swap bundles a changeTrust op.

- Rename DestinationTokenDescriptor.isNew -> requiresTrustline and all
  reads / literals / comments across SwapScreen + transactionService.
- Rename the shouldShowXlmReservePreflight param destinationIsNew ->
  destinationRequiresTrustline.
- Telemetry: the SWAP_DESTINATION_SELECTED payload field isNew ->
  requiresTrustline (wire-format change; dashboards keyed on isNew must
  be updated).
- Update docs/swap-to-new-token-design.md to match.

Keeps freighter-mobile in sync with the extension design doc
(stellar/freighter#2868). Swap unit suites green (272 tests).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 24, 2026 19:05

Copilot AI 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.

Pull request overview

This PR clarifies swap destination semantics by renaming DestinationTokenDescriptor.isNew to requiresTrustline, aligning the name with actual behavior (whether a changeTrust op is required) and updating related telemetry and documentation across the Swap feature.

Changes:

  • Renamed swap destination descriptor flag isNewrequiresTrustline across Swap screens/hooks/helpers and transactionService.
  • Updated XLM reserve preflight wiring/parameter name (destinationIsNewdestinationRequiresTrustline) and adjusted call sites.
  • Updated the swap design doc and Jest tests to reflect the rename, including the Amplitude payload field rename for SWAP_DESTINATION_SELECTED.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/services/transactionService.ts Updates swap builder docs to reference requiresTrustline.
src/components/screens/SwapScreen/screens/SwapToScreen.tsx Renames Amplitude payload field to requiresTrustline for destination selection.
src/components/screens/SwapScreen/screens/SwapAmountScreen.tsx Updates reserve/fee logic to key off requiresTrustline and threads renamed preflight param.
src/components/screens/SwapScreen/hooks/useTrendingTokenDetail.ts Renames Amplitude payload field to requiresTrustline.
src/components/screens/SwapScreen/hooks/useSwapTransaction.ts Renames trustline-derivation flag and related error message text.
src/components/screens/SwapScreen/hooks/useSwapForXlmReserve.ts Updates descriptor literals to use requiresTrustline.
src/components/screens/SwapScreen/helpers/types.ts Renames the descriptor field in the type definition.
src/components/screens/SwapScreen/helpers/swapPreflight.ts Renames preflight param to destinationRequiresTrustline and updates the guard.
src/components/screens/SwapScreen/helpers/descriptors.ts Renames descriptor projection field and updates derivation logic (!record.hasTrustline).
src/components/screens/SwapScreen/components/SwapReviewBottomSheet.tsx Uses requiresTrustline to gate the trustline banner.
docs/swap-to-new-token-design.md Updates design doc terminology and telemetry field name.
tests/ducks/swap.test.ts Updates migration/test fixtures for renamed descriptor field.
tests/components/screens/SwapScreen/useSwapTransaction.test.ts Updates includeTrustline wiring tests and expected error text.
tests/components/screens/SwapScreen/SwapToScreen.test.tsx Updates swap destination fixture to use requiresTrustline.
tests/components/screens/SwapScreen/SwapReviewBottomSheet.test.tsx Updates banner gating tests for renamed field.
tests/components/screens/SwapScreen/SwapAmountScreen.test.tsx Updates mocked swap store types/fixtures and reserve preflight tests.
tests/components/screens/SwapScreen/hooks/useSwapSecurityAssessments.test.ts Updates descriptor fixtures to use requiresTrustline.
tests/components/screens/SwapScreen/hooks/useSwapAmountError.test.ts Updates descriptor fixtures to use requiresTrustline.
tests/components/screens/SwapScreen/helpers/swapPreflight.test.ts Updates preflight arg name to destinationRequiresTrustline.
tests/components/screens/SwapScreen/helpers/descriptors.test.ts Updates descriptor projection tests for renamed field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/screens/SwapScreen/screens/SwapAmountScreen.tsx
Comment thread src/components/screens/SwapScreen/helpers/types.ts
Comment thread docs/swap-to-new-token-design.md
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

iOS Simulator preview build is ready: https://github.com/stellar/freighter-mobile/releases/tag/untagged-1f624d540455463892d3 (SDF collaborators only — install instructions in the release description)

@CassioMG CassioMG merged commit 6d83f99 into main Jun 29, 2026
59 of 61 checks passed
@CassioMG CassioMG deleted the cg-rename-isnew-requirestrustline branch June 29, 2026 23:54
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