feat: add custom message support for subwallet transfers#2069
feat: add custom message support for subwallet transfers#2069naveenkumar29052006 wants to merge 1 commit intogetAlby:masterfrom
Conversation
- 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
📝 WalkthroughWalkthroughThe 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
Sequence DiagramsequenceDiagram
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
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
api/transactions.go (1)
147-153: Consider validating or limiting the message length.The
messagestring is passed directly as an invoice description toMakeInvoice. 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.
|
@rolznz sir i have made this feature could u please check this |
🚀 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:
"transfer""transfer"No context in transaction history.
✅ Solution
Users can now optionally add a custom message when transferring funds.
Examples:
If no message is provided, it automatically defaults to
"transfer"(same behavior as before).🔧 Backend Changes
api/models.go
Message *stringfield toTransferRequestapi/transactions.go
Transfer(...)to acceptmessageparameter"transfer"if message is emptyhttp/http_service.go
transfersHandlerto extract and pass messagewails/wails_handlers.go
🎨 Frontend Changes
Added optional message input field in:
frontend/src/components/IsolatedAppTopupDialog.tsxfrontend/src/components/IsolatedAppDrawDownDialog.tsxUX Details
🧪 Testing
Test 1 – With Custom Message
"Monthly allowance"Test 2 – Without Message
"transfer"Test 3 – Both Directions
🔄 Backward Compatibility
🎯 Result
Summary by CodeRabbit