Skip to content

feat(core): add dedicated payment requests api#109

Merged
Egge21M merged 3 commits intomasterfrom
new-paymentrequest-api
Mar 27, 2026
Merged

feat(core): add dedicated payment requests api#109
Egge21M merged 3 commits intomasterfrom
new-paymentrequest-api

Conversation

@Egge21M
Copy link
Copy Markdown
Collaborator

@Egge21M Egge21M commented Mar 12, 2026

Summary

  • add a dedicated manager.paymentRequests API for parsing, preparing, and executing NUT-18 payment requests
  • keep the legacy wallet payment request helpers working as deprecated compatibility wrappers to avoid breaking existing integrations
  • update core tests, adapter integration coverage, and docs to reflect the new payment request flow and migration path

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 12, 2026

⚠️ No Changeset found

Latest commit: 58b8374

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Egge21M Egge21M moved this from Backlog to Needs Review in coco Mar 12, 2026
@Egge21M Egge21M marked this pull request as ready for review March 12, 2026 16:00
@Egge21M Egge21M added this to the stable v1 milestone Mar 12, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +154 to +157
const response = await fetch(transaction.request.transport.url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(token),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@ye0man ye0man moved this from Needs Review to In Review in coco Mar 18, 2026
@Egge21M Egge21M force-pushed the new-paymentrequest-api branch from 43b1290 to f2d0238 Compare March 27, 2026 14:32
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.62%. Comparing base (9cfbf51) to head (58b8374).
⚠️ Report is 1 commits behind head on master.

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     
Flag Coverage Δ
core-integration 63.99% <ø> (ø)
core-unit 76.43% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread packages/core/api/WalletApi.ts Outdated
type PaymentRequest,
type Token,
} from '@cashu/cashu-ts';
import { getEncodedToken, getTokenMetadata, type Token } from '@cashu/cashu-ts';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread packages/core/test/unit/Manager.test.ts Outdated
Comment on lines +59 to +61
await manager.disableMintQuoteWatcher();
await manager.disableProofStateWatcher();
await manager.disableMintQuoteProcessor();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Egge21M added 3 commits March 27, 2026 19:54
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.
@Egge21M Egge21M force-pushed the new-paymentrequest-api branch from 0d57637 to 58b8374 Compare March 27, 2026 18:57
@Egge21M Egge21M merged commit c3635f4 into master Mar 27, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in coco Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants