refactor(scannable): introduce Scannable hierarchy replacing Bill#1116
Merged
Conversation
…rough assertions - Convert positional GoldBar/CashBill constructor calls in forToken to named arguments to prevent silent field-order drift - Extend forToken passthrough test to assert every forwarded field (disableGestures, confirmationDelay, data, nonce) with non-default values - Assert bar.token survives stamped copy in GoldBar stamped test
Replaces the single-variant Bill sealed interface with Scannable.Payable (CashBill/GoldBar). renderAsBill removed; USDF->GoldBar decided by the forToken factory. presentBillToUser uses stamped(); customization guards narrow to Scannable.CashBill. Signed-off-by: Brandon McAnsh <brandon@bmcreations.dev>
…test, doc/comment cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the single-variant
Billsealed interface with aScannableancestor that holds only the scannable code, and payment-bearing children underScannable.Payable:Scannable— holds onlydata(the encoded KikCode bytes)Scannable.Payable— token/amount/didReceive/…,metadata,stamped()Scannable.CashBill,Scannable.GoldBarScannable.TipCard— directly underScannable(non-payment)Why
Billconflated three things: the domain concept, the render choice (therenderAsBillflag), and a payment sub-kind. Hoisting aScannableparent turns the render choice into a real type distinction and lets non-payment scannables (tip cards) reuse the bill pipeline later without dragging payment concerns along.Changes
forTokenfactory — the USDF→GoldBarrule (formerly the runtimerenderAsBillflag) is now decided once at construction;renderAsBillis removed.stamped(code, nonce)replaces.copy(data =, nonce =)at the sealed-interface seam inpresentBillToUser(a data-classcopyisn't callable on aPayablereference).RenderedBilldispatches on type (is CashBill/is GoldBar) instead of the boolean flag.AnimatedBill, and the three customization guards (narrowed toScannable.CashBill).ScannableTestcoversforTokenrouting +stampedtype-preservation; the airdrop path now assertsawaitGrabis never called.Testing
./gradlew :apps:flipcash:app:assembleDebug— BUILD SUCCESSFUL (standalone):apps:flipcash:coreand:apps:flipcash:shared:sessionunit tests pass