Skip to content

feat: custom memo for superuser wallet credit/debit - #2

Merged
DoktorShift merged 2 commits into
devfrom
Admin_memo_Credit_Debit
Sep 8, 2026
Merged

DoktorShift merged 2 commits into
devfrom
Admin_memo_Credit_Debit

Conversation

@DoktorShift

@DoktorShift DoktorShift commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

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/balance now accepts an optional memo
(max 640 chars, same cap as invoice memos):

{ "id": "wallet_id", "amount": 1000, "memo": "Beer for the Horde" }

Omitting memo keeps 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 the
payment list shows the familiar yellow #admin badge — the same mechanism
extensions 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 in
CSV exports and extra.tag for API consumers.

Bildschirmfoto 2026-09-08 um 12 29 06

UI

The credit/debit popup (users area + wallet page) now has a memo field, plus
some small UX fixes:

  • opens below its button with a soft transition instead of covering it
  • visible action button that shows Credit and flips to a red Debit
    when the amount is negative — Enter still submits
  • amount field starts empty instead of a prefilled 0 that had to be
    deleted before typing a negative value; empty/zero submits are blocked
  • removed the decorative pencil icon, numeric input on both popup variants
  • the wallets table in the users area refreshes after a credit/debit
Bildschirmfoto 2026-09-08 um 12 28 40

The admin notification for balance updates now includes the memo as well.

Tests cover default and custom memos on both credit and debit, the admin
tag, and memo length validation.

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
@DoktorShift
DoktorShift merged commit 0d62448 into dev Sep 8, 2026
57 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Allow custom memo for wallet balance updates

1 participant