Repository navigation
feat(chat): offer All Currencies as a group's balance requirement - #1558
Merged
Merged
Conversation
The create form could only set a minimum balance in one token, and it opened on the largest holding the creator had. StartChat already accepts an empty mints list as "any currency", which the server measures against every holding added up in USD, USDF included. GroupAccess.evaluate sums for that case too, so only the create UI was missing. The draft's mint and mintChosen are replaced by a GroupCurrency, either All or Specific(mint), and the form opens on All. For All, rules carries MinimumBalance(amount, emptyList()), and the self-check runs through the same GroupAccess predicate. GroupDraft holds the GroupCurrency, so an All draft and a one-token draft never share an idempotency key. The currency sheet puts an All Currencies card above the token list (node 10370:997), with a "Specific Currency" label over the tokens. The card's subtitle gives the total and whether it meets the chosen amount, in the error colour when it does not (node 10372:1126). The card and the tokens share one selection, so no token is marked while All is chosen. The form's currency row shows the coins glyph and "All Currencies" (node 10364:1059). The heading used to switch from "Minimum Balance Required" to "Balance Requirement" once a mint was picked. With no default mint left to tell apart from a pick, it now switches once a token is picked or an amount is set. That keeps nodes 10127:118057 and 10127:118194 as they were and matches 10364:1059. An All rule names no token, so the "You Need More %1$s" refusal gets a title of its own for that case.
… bar The card took the list's inset and its own on top, so it sat narrower than the row dividers.
…t heading fixed SelectGroupCurrencySheet and NewGroupCustomAmountSheet popped their flow entry directly, which deletes the scene mid-frame, so the sheet vanished instead of sliding down. Both now exit through LocalBottomSheetDismissDispatcher, as the chat flow's sheets do. The form heading and the custom amount sheet's title now always read "Minimum Balance Required". The switch to "Balance Requirement" is gone, along with the requirementStarted flag and the string.
The sheet padded the list by `inset` on top of the padding the token rows already apply, so every row sat further in than in other token sheets. The list now takes only the scaffold padding. The card keeps a small margin and pads its contents by the rest of `inset`, so its icon and check line up with the rows' icons and radios.
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.
The group create form could only set a minimum balance in one token, and it opened on the creator's largest holding.
StartChatalready treats an emptymintslist as "any currency": the server (chat/rules.go,balance.GetTotalUsdfBalance) measures it against every holding added up in USD, USDF included.GroupAccess.evaluatesums for empty mints since #1551, so only the create UI was missing.Changes
mintandmintChosenare replaced by aGroupCurrency(All|Specific(mint)), and the form opens onAll. ForAll,rulesemitsMinimumBalance(amount, emptyList()). The self-check still goes throughGroupAccess, so it uses the summed balance.GroupDraftholds theGroupCurrency, so an All draft and a one-token draft get different keys.TokenList's header slot (node 10370:997), with a "Specific Currency" label over the tokens. The label is hidden when the list is empty. The card's subtitle reads "You have $X total · meets $Y", and turns to "· need $Y" in the error colour when the total is short (node 10372:1126). The card and the tokens share one selection, so no token is marked while All is chosen (node 10372:1015).LocalBottomSheetDismissDispatcher, as the chat flow's sheets do.error_title_groupRuleNotSelfSatisfiedTotal, "You Need a Higher Balance".Tests
CreateGroupStateTestcovers:CreateGroupViewModelErrorTestchecks that an All create sendsmints = []toStartChat, and that an All refusal uses the new title.GroupCreateAttemptTestchecks that All and a token get different keys. The proto mapping for an empty list was already covered byChatRulesProtoMappingTest.