feat: add custom message support for subwallet transfers#2069
feat: add custom message support for subwallet transfers#2069rolznz merged 4 commits 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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds 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
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 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
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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