Skip to content

feat(chat): offer All Currencies as a group's balance requirement - #1558

Merged
bmc08gt merged 4 commits into
code/cashfrom
feat/group-create-all-currencies
Sep 24, 2026
Merged

bmc08gt merged 4 commits into
code/cashfrom
feat/group-create-all-currencies

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

The group create form could only set a minimum balance in one token, and it opened on the creator's largest holding. StartChat already treats an empty mints list as "any currency": the server (chat/rules.go, balance.GetTotalUsdfBalance) measures it against every holding added up in USD, USDF included. GroupAccess.evaluate sums for empty mints since #1551, so only the create UI was missing.

Changes

  • Draft: mint and mintChosen are replaced by a GroupCurrency (All | Specific(mint)), and the form opens on All. For All, rules emits MinimumBalance(amount, emptyList()). The self-check still goes through GroupAccess, so it uses the summed balance.
  • Idempotency: GroupDraft holds the GroupCurrency, so an All draft and a one-token draft get different keys.
  • Currency sheet: an All Currencies card sits in 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).
  • Form: the currency row shows the coins glyph, "All Currencies" and the chevron (node 10364:1059).
  • Heading: the form heading and the custom amount sheet's title always read "Minimum Balance Required". The switch to "Balance Requirement" and its string are gone.
  • Sheet dismissal: the currency and custom amount sheets popped their flow entry directly, so they vanished instead of sliding down. Both now exit through LocalBottomSheetDismissDispatcher, as the chat flow's sheets do.
  • Refusal: "You Need More %1$s" has no token to name for an All rule, so that case gets error_title_groupRuleNotSelfSatisfiedTotal, "You Need a Higher Balance".

Tests

CreateGroupStateTest covers:

  • the form defaulting to All, and not moving when balances arrive
  • switching between All and a token
  • All emitting empty mints
  • the summed self-check, met and short

CreateGroupViewModelErrorTest checks that an All create sends mints = [] to StartChat, and that an All refusal uses the new title. GroupCreateAttemptTest checks that All and a token get different keys. The proto mapping for an empty list was already covered by ChatRulesProtoMappingTest.

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.
@bmc08gt bmc08gt self-assigned this Sep 24, 2026
@github-actions github-actions Bot added the type: feature New functionality label Sep 24, 2026
… 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.
@bmc08gt
bmc08gt merged commit f0c2e00 into code/cash Sep 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant