feat(core): add dedicated payment requests api#109
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43b12900a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const response = await fetch(transaction.request.transport.url, { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify(token), |
There was a problem hiding this comment.
Preserve legacy HTTP wrapper payload shape
The deprecated compatibility path now posts a different payload shape for HTTP payment requests: this code sends JSON.stringify(token) where token is the raw Cashu token, but the previous wrapper behavior sent the full sendOperationService.execute() result ({ operation, token }). Because wallet.handleHttpPaymentRequest() is explicitly kept for backward compatibility, integrations that previously consumed body.token will break after this change. Keep the legacy wrapper contract stable or explicitly transform the body in the deprecated path.
Useful? React with 👍 / 👎.
43b1290 to
f2d0238
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #109 +/- ##
===========================================
+ Coverage 63.99% 75.62% +11.62%
===========================================
Files 18 110 +92
Lines 786 11961 +11175
===========================================
+ Hits 503 9045 +8542
- Misses 283 2916 +2633
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2d02382eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| type PaymentRequest, | ||
| type Token, | ||
| } from '@cashu/cashu-ts'; | ||
| import { getEncodedToken, getTokenMetadata, type Token } from '@cashu/cashu-ts'; |
There was a problem hiding this comment.
Import cashu PaymentRequest type in WalletApi
The updated import removed PaymentRequest from @cashu/cashu-ts, but encodePaymentRequest(...) still uses that identifier. This changes the public type surface to an unresolved/global PaymentRequest instead of Cashu’s class, which breaks typechecking for consumers (and already fails this repo’s core typecheck run). Re-adding type PaymentRequest to the import keeps the API signature valid.
Useful? React with 👍 / 👎.
| await manager.disableMintQuoteWatcher(); | ||
| await manager.disableProofStateWatcher(); | ||
| await manager.disableMintQuoteProcessor(); |
There was a problem hiding this comment.
Use valid Manager disable methods in new test
This test now calls disableMintQuoteWatcher()/disableMintQuoteProcessor(), but Manager exposes disableMintOperationWatcher()/disableMintOperationProcessor(). Executing test/unit/Manager.test.ts throws TypeError: manager.disableMintQuoteWatcher is not a function, so the PR introduces a deterministic unit-test failure.
Useful? React with 👍 / 👎.
Expose payment request parsing, preparation, and execution through a dedicated manager API while keeping the legacy wallet wrappers compatible.
Document the new paymentRequests API and mark the wallet payment request helpers as deprecated so integrations can migrate cleanly.
0d57637 to
58b8374
Compare
Summary
manager.paymentRequestsAPI for parsing, preparing, and executing NUT-18 payment requestswalletpayment request helpers working as deprecated compatibility wrappers to avoid breaking existing integrations