Skip to content

Comments

feat: add custom message support for subwallet transfers#2069

Open
naveenkumar29052006 wants to merge 1 commit intogetAlby:masterfrom
naveenkumar29052006:feature/custom-transfer-message
Open

feat: add custom message support for subwallet transfers#2069
naveenkumar29052006 wants to merge 1 commit intogetAlby:masterfrom
naveenkumar29052006:feature/custom-transfer-message

Conversation

@naveenkumar29052006
Copy link

@naveenkumar29052006 naveenkumar29052006 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 optional message field to transfer dialogs, allowing users to include a description with their transfers.
    • Transfer messages are now captured and transmitted through the API layer.

- 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
Contributor

coderabbitai bot commented Feb 16, 2026

📝 Walkthrough

Walkthrough

The changes implement functionality to support custom messages during subwallet transfers. The Transfer method signature is updated across the API layer, backend, and frontend handlers to accept a message parameter. Frontend dialogs add UI inputs for the optional message, which is then passed through the request payload and ultimately used as the transaction description.

Changes

Cohort / File(s) Summary
API Interface & Models
api/models.go
Updated Transfer method signature to accept message parameter; added optional Message field to TransferRequest struct.
Backend Transfer Implementation
api/transactions.go
Implemented Transfer to accept message parameter and use it as transaction description, defaulting to "transfer" when empty.
HTTP & Wails Handlers
http/http_service.go, wails/wails_handlers.go
Updated transfer handlers to extract message from request data and pass to Transfer method invocation.
Frontend Dialogs
frontend/src/components/IsolatedAppTopupDialog.tsx, frontend/src/components/IsolatedAppDrawDownDialog.tsx
Added message state management and optional Message input UI field; message conditionally included in API payload when non-empty.

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 message
    Frontend->>Handler: POST request with amount, fromAppId, toAppId, message
    Handler->>API: Transfer(ctx, fromAppId, toAppId, amountMsat, message)
    API->>Txn: Compute description from message (default: "transfer")
    Txn->>Txn: MakeInvoice with custom description
    Txn-->>API: Invoice created
    API-->>Handler: Success
    Handler-->>Frontend: Response OK
    Frontend->>Frontend: Reset form and message state
    Frontend-->>User: Transfer complete
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A message flows through the transfer, a note of intent,
From front to back, the custom words are sent,
No longer trapped in "transfer" plain and small,
Now messages dance through wallets, carried by all!

🚥 Pre-merge checks | ✅ 5 | ❌ 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 (5 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 change: adding custom message support for transfers between main wallet and subwallets.
Linked Issues check ✅ Passed The PR fully implements the requirement from issue #2066 to replace hardcoded 'transfer' with custom message support, with fallback to 'transfer' when empty.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing custom message support for subwallet transfers as specified in issue #2066.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

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

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

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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
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.

@naveenkumar29052006
Copy link
Author

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

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

1 participant