Skip to content

feat: add custom message support for subwallet transfers#2069

Merged
rolznz merged 4 commits intogetAlby:masterfrom
naveendhaterwal:feature/custom-transfer-message
Feb 28, 2026
Merged

feat: add custom message support for subwallet transfers#2069
rolznz merged 4 commits intogetAlby:masterfrom
naveendhaterwal:feature/custom-transfer-message

Conversation

@naveendhaterwal
Copy link
Copy Markdown
Contributor

@naveendhaterwal naveendhaterwal commented Feb 16, 2026

🚀 Custom Transfer Messages (Closes #2066)

🧩 Problem

When transferring funds between the main wallet and subwallets, the description was always hardcoded as:

"transfer"

This made the transaction history unclear and not meaningful.

Example:

  • Moving funds for rent → shown as "transfer"
  • Weekly allowance → shown as "transfer"

No context in transaction history.


✅ Solution

Users can now optionally add a custom message when transferring funds.

Examples:

  • "Weekly allowance"
  • "Rent payment"
  • "Emergency withdrawal"

If no message is provided, it automatically defaults to "transfer" (same behavior as before).


🔧 Backend Changes

  • api/models.go

    • Added optional Message *string field to TransferRequest
  • api/transactions.go

    • Updated Transfer(...) to accept message parameter
    • Fallback to "transfer" if message is empty
  • http/http_service.go

    • Updated transfersHandler to extract and pass message
  • wails/wails_handlers.go

    • Updated Wails handler to extract and pass message

🎨 Frontend Changes

Added optional message input field in:

  • frontend/src/components/IsolatedAppTopupDialog.tsx
  • frontend/src/components/IsolatedAppDrawDownDialog.tsx

UX Details

  • Label: Message (optional)
  • Helpful placeholder examples
  • Field resets when dialog closes
  • Message only included in request if provided

🧪 Testing

Test 1 – With Custom Message

  • Created transfer with message "Monthly allowance"
  • Verified message appears correctly in transaction history

Test 2 – Without Message

  • Created transfer with empty message field
  • Verified it defaults to "transfer"

Test 3 – Both Directions

  • Main → Subwallet
  • Subwallet → Main
  • Verified custom messages work correctly in both cases

🔄 Backward Compatibility

  • Fully backward compatible
  • Existing API calls still work
  • Empty message behaves exactly as before

🎯 Result

  • Clearer transaction history
  • Better user context
  • No breaking changes
Screenshot 2026-02-16 at 10 14 03 AM

Summary by CodeRabbit

  • New Features
    • Added an optional Description field to transfer and top-up dialogs so users can include a note with transfers.
    • Transfer requests now send and preserve the provided description; if none is entered, a default description ("transfer") is applied.
    • Description input is cleared after submission and included in receipts/processing for clearer transaction context.

- Add optional message field to TransferRequest model
- Update Transfer function to use custom message with 'transfer' as fallback
- Update HTTP and Wails handlers to extract and pass message parameter
- Add message input field to IsolatedAppTopupDialog and IsolatedAppDrawDownDialog
- Maintains backward compatibility with empty message defaulting to 'transfer'

Closes getAlby#2066
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40659d4 and cea1a01.

📒 Files selected for processing (3)
  • api/models.go
  • http/http_service.go
  • wails/wails_handlers.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • api/models.go
  • wails/wails_handlers.go
  • http/http_service.go

📝 Walkthrough

Walkthrough

Adds an optional transfer description end-to-end: Transfer signatures and request model include a description string; backend uses the provided description (defaulting to "transfer" when empty) when creating invoices; HTTP/Wails handlers and frontend dialogs collect and forward the description.

Changes

Cohort / File(s) Summary
API Models
api/models.go
Added Description string json:"description"`` field to TransferRequest and adjusted field ordering.
Backend Transfer Logic
api/transactions.go
Updated Transfer signature to accept description string; defaults to "transfer" when empty and passes description to MakeInvoice.
HTTP / Wails Handlers
http/http_service.go, wails/wails_handlers.go
Handlers extract description from request payload and pass it as the new argument to api.Transfer.
Frontend Dialogs
frontend/src/components/IsolatedAppDrawDownDialog.tsx, frontend/src/components/IsolatedAppTopupDialog.tsx
Added description state and input UI; include description in POST body to /api/transfers; reset description on form reset.

Sequence Diagram

sequenceDiagram
    participant User
    participant Frontend as Frontend Dialog
    participant Handler as HTTP / Wails Handler
    participant API as API Layer
    participant Txn as Transaction Handler

    User->>Frontend: Enter amount and optional description
    Frontend->>Handler: POST /api/transfers { fromAppId, toAppId, amount, description }
    Handler->>API: Transfer(ctx, fromAppId, toAppId, amountMsat, description)
    API->>Txn: Use provided description or default "transfer"
    Txn->>Txn: MakeInvoice(description)
    Txn-->>API: Invoice created
    API-->>Handler: Success
    Handler-->>Frontend: Response OK
    Frontend->>Frontend: Reset form and description state
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped a note into the wire, soft and clear,

A tiny description for transfers to hear.
From dialog to invoice it hops with delight,
Carrying meaning on a spark of light.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature being added: custom message support for subwallet transfers, matching the changeset's primary objective.
Linked Issues check ✅ Passed The PR successfully implements the requirement from issue #2066 to allow custom messages for subwallet transfers instead of hardcoded 'transfer' description.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective of adding custom message support for transfers, with no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
api/transactions.go (1)

147-153: Consider validating or limiting the message length.

The message string is passed directly as an invoice description to MakeInvoice. BOLT-11 invoices have practical limits on description length, and an excessively long message could cause invoice creation to fail or produce unexpected behavior at the protocol level. Consider adding a reasonable length cap (e.g., 255 characters) with a clear error message.

@naveendhaterwal
Copy link
Copy Markdown
Contributor Author

@rolznz sir i have made this feature could u please check this

Copy link
Copy Markdown
Contributor

@rolznz rolznz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@rolznz rolznz merged commit 6795640 into getAlby:master Feb 28, 2026
6 of 15 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.

Allow setting a custom message when doing a subwallet transfer

3 participants