feat(core): Support P2PK payment request sends#309
Conversation
🦋 Changeset detectedLatest commit: cfb2822 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f1d158e to
0292b92
Compare
Egge21M
left a comment
There was a problem hiding this comment.
Thank you fr taking this on. The direction is great and this is almost good to go. There are a could docs missing and an issue with how cashu-ts' P2PKOptions behave currently. Please take a look at the comments
| ) { | ||
| if ( | ||
| spendingCondition?.kind === 'P2PK' && | ||
| !(await this.mintService.supportsNut(mintUrl, 11)) |
There was a problem hiding this comment.
This can throw if a single mint is offline and take the whole call with it. I think we should catch single mint failures and simply exclude them from the request.
Thanks for the review, I'll attend to all the comments now |
9d203c7 to
4d5c474
Compare
4d5c474 to
ef343f3
Compare
Egge21M
left a comment
There was a problem hiding this comment.
Thanks for the quick changes. Unfortunately I did find one more issue, which is a bit of a gotcha introduced by CTS.
| } | ||
| | { | ||
| /** Full NUT-11 P2PK options accepted by cashu-ts output builders. */ | ||
| options: P2PKOptions; |
There was a problem hiding this comment.
Cashu-TS lets you add a hashLock on a P2PK construction, which turns the resulting data into HTLC (NUT-14) data. HTLC is out-of-scope for now, so we should make sure that consumers can't add it here.
There was a problem hiding this comment.
Great, addressing it now
ef343f3 to
cfb2822
Compare
Description
This pull request adds payer-side NUT-18 P2PK payment request support using cashu-ts NUT-10/NUT-11 normalization. #286
Problem
Coco could parse and pay normal payment requests, but P2PK requests needed explicit NUT-11 mint support checks, locked-output send preparation, and clear failure behavior for malformed or unsupported spending conditions before funds move.
Summary
Verification
bun run --filter='@cashu/coco-core' test -- test/unit/PaymentRequestService.test.tsbun run --filter='@cashu/coco-core' test -- test/unit/P2pkSendHandler.test.ts test/unit/SendOpsApi.test.ts test/unit/MintService.test.tsbun run --filter='@cashu/coco-core' test:unitbun run typecheckbun run docs:buildgit diff --checkChangeset
.changeset/p2pk-payment-requests.md.