Fix/invoice wallet select v2#487
Merged
ralyodio merged 3 commits intoJun 18, 2026
Merged
Conversation
… invoice Fixes profullstack#478. When the poster initiates an invoice on behalf of the worker, the frontend no longer forces the poster to select a CoinPay receiving wallet (which they wouldn't have access to). The backend API now automatically falls back to selecting the worker's CoinPay wallet matching the gig's payment coin.
Comment on lines
+353
to
+361
| if (preferred) { | ||
| selectedCurrency = preferred.currency; | ||
| selectedAddress = preferred.address; | ||
| } else { | ||
| return NextResponse.json( | ||
| { error: "Select a CoinPay receiving wallet before sending the invoice" }, | ||
| { status: 400 } | ||
| ); | ||
| } |
There was a problem hiding this comment.
The else block that returns a 400 "Select a CoinPay receiving wallet" error can never execute. preferred is assigned as workerWallets.find(...) || workerWallets[0], and the earlier guard at line 332 already short-circuits with a 409 when workerWallets is empty, so workerWallets[0] is always a valid object at this point. The if (preferred) check and its else branch are therefore dead code and can be removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧪 Testing
• The frontend compiles successfully without Cannot find name 'isWorker' errors.
• Submitting an invoice as a poster properly queries and assigns the worker's correct cryptocurrency receiving wallet.