Repository navigation
feat: custom memo for superuser wallet credit/debit - #2
Merged
Merged
Conversation
The superuser endpoint PUT /users/api/v1/balance always created the internal payment with a hardcoded "Admin credit" or "Admin debit" memo, leaving no way to tell the affected user why their balance changed. - add an optional memo field to UpdateBalance (max 640 chars, same cap as invoice memos) and pass it through update_wallet_balance for both the credit and the debit path - tag these payments with extra.tag = "admin" so the payment list shows the #admin badge, exactly like extension payments; provenance is carried by the tag, so the default memos slim down to "Credit" and "Debit" instead of duplicating the badge - include the memo in the balance_update admin notification
Extend the superuser credit/debit popup with an optional memo input and polish the interaction: - popup opens below its trigger button with a soft jump-down transition instead of covering it - visible sign-aware action button: shows Credit (primary) and flips to Debit (negative) when the amount is negative, with Enter kept as the keyboard shortcut; submission is guarded against empty and zero amounts - amount field starts empty instead of a prefilled 0 that had to be deleted before typing a negative value, and both popup variants use a numeric input - remove the decorative pencil icon that suggested an action it did not have - emit credit-value on success so the users page refreshes the wallets table, and show the parsed amount in the success notification
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.
Closes lnbits#4155
Custom memo for superuser credit/debit
Superusers could not set a custom memo when crediting or debiting a wallet —
the memo was hardcoded to "Admin credit" / "Admin debit", and users had no
way of knowing why their balance changed.
API
PUT /users/api/v1/balancenow accepts an optionalmemo(max 640 chars, same cap as invoice memos):
{ "id": "wallet_id", "amount": 1000, "memo": "Beer for the Horde" }Omitting
memokeeps a sensible default, so existing calls work unchanged.Recognition in the user's wallet
Admin credit/debit payments are now tagged (
extra.tag = "admin"), so thepayment list shows the familiar yellow
#adminbadge — the same mechanismextensions use. Since the badge carries the provenance, the default memos are
now simply "Credit" / "Debit" instead of repeating it; with a custom memo the
row reads
#admin Beer for the Horde. The tag is searchable and included inCSV exports and
extra.tagfor API consumers.UI
The credit/debit popup (users area + wallet page) now has a memo field, plus
some small UX fixes:
when the amount is negative — Enter still submits
0that had to bedeleted before typing a negative value; empty/zero submits are blocked
The admin notification for balance updates now includes the memo as well.
Tests cover default and custom memos on both credit and debit, the
admintag, and memo length validation.