Skip to content

refactor(tokens): replace Token.Info's origin flags with TokenInfoEntry - #1533

Merged
bmc08gt merged 2 commits into
code/cashfrom
refactor/token-info-entry
Sep 23, 2026
Merged

bmc08gt merged 2 commits into
code/cashfrom
refactor/token-info-entry

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

AppRoute.Token.Info carried four parameters that each encoded where the screen was opened from: shortfall, fromDeeplink, asPush and returnAfterBuy. Callers could combine them in ways that mean nothing, such as a deeplink that returns after a buy, and TokenInfoScreen decided inline, without tests, whether a finished buy should pop.

Token.Info(mint, entry = TokenInfoEntry.Wallet) now names the origin, and each origin declares its presentation and what happens after a buy of its currency:

Entry Presentation After buy Analytics source
Wallet (default) CardExpand Stay Wallet
Deeplink CardExpand Stay Deeplink
Discovery Push Stay Wallet
Chat Push Stay Wallet
ChatGate Push ReturnToOpener Wallet

TokenInfoEntry.afterSwap(mint, purpose, result) in core turns the entry and a returning swap into Stay, Pop or OpenDeposit, and the screen only executes it. The check from #1532 that only a buy of this currency counts, not the USDF top-up from Add Money, moves into that function. TokenInfoEntryTest covers the table for every origin plus the Add Money, sell, convert, cancel and deposit cases.

Analytics sources are unchanged. Discovery, Chat and ChatGate still report Wallet, as they did before.

shortfall is dropped rather than modelled as a Give origin. Nothing has passed it since 6419a95, when Give's shortfall started going straight to Token.Swap. The shortfall plumbing inside TokenInfoViewModel and CurrencyInfoContentV2 now only ever receives null and is left for a follow-up.

AppContent still picks the card-expand transition by matching the scene key's toString(), now against entry=<name> for each Push origin in TokenInfoEntry.all. A test checks all against the serializer's subclass list, so an origin missing from it fails the build instead of quietly getting the card transition.

Token.Info carried four parameters that each encoded where the screen was
opened from: shortfall, fromDeeplink, asPush and returnAfterBuy. Nothing
stopped a caller from combining them in ways that mean nothing, such as a
deeplink that returns after a buy.

TokenInfoEntry names the origin instead (Wallet, Deeplink, Discovery, Chat,
ChatGate), and each origin decides whether the screen is pushed and whether
a successful buy pops back. Analytics sources are unchanged: Deeplink still
reports Deeplink, and every other origin reports Wallet, as before.

shortfall is dropped rather than modelled as a Give origin. Nothing has
passed it since 6419a95, when Give's shortfall started going straight to
Token.Swap.

AppContent still matches the scene key's toString(), now on the entry name
instead of "asPush=true".
…r a swap

The entries exposed asPush and returnAfterBuy as booleans with defaults, so
reading an origin didn't tell you how it behaves, and TokenInfoScreen still
decided inline, untested, whether a buy should pop.

Each origin now declares its presentation (CardExpand or Push) and afterBuy
(Stay or ReturnToOpener) with no defaults. afterSwap() in core turns the
entry, the swap purpose and its result into Stay, Pop or OpenDeposit, and
the screen only executes that. The rule that only a buy of this currency
counts, not the USDF top-up from Add Money, moves with it.

TokenInfoEntryTest covers the presentation and after-buy table for every
origin and checks TokenInfoEntry.all against the serializer's subclass
list. AppContent now reads that list to pick the transition, so an origin
left out of it would have got the card-expand transition without anyone
noticing.
@bmc08gt bmc08gt self-assigned this Sep 23, 2026
@github-actions github-actions Bot added type: refactor Code restructuring, no behavior change area: scanner QR/Kikcode scanning, camera area: tokens Token accounts, balances, token info area: deeplinks Deep link handling, URL routing, and link parsing and removed type: refactor Code restructuring, no behavior change labels Sep 23, 2026
@bmc08gt
bmc08gt merged commit ee0dcb4 into code/cash Sep 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: deeplinks Deep link handling, URL routing, and link parsing area: scanner QR/Kikcode scanning, camera area: tokens Token accounts, balances, token info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant