refactor: use the SDK payment link pay flow contract - #1242
Draft
TaprootFreak wants to merge 1 commit into
Draft
Conversation
🤖 PR Review Bot❌ TypeScript: 37 errorsThis is an automated review. Please address the issues above. |
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.
Consumer side of step 3 of DFXswiss/packages#198: use the payment link pay-flow contract from
@dfx.swiss/reactand drop the local copies.Depends on DFXswiss/packages#201.
Changes
src/dto/payment-link.dto.tskeeps only what is genuinely local —WalletInfo,MetaMaskInfo, theUI-only
NoPaymentLinkPaymentStatus/ExtendedPaymentLinkStatus, and the LNURL wait shape. Everythingthat describes the wire now comes from the package, under the package's names:
TransferInfoTransferAmountAmountPaymentAmountRecipientInfoPaymentLinkRecipientQuotePaymentQuoteWhat the corrected types surfaced
The local copy had
PaymentLinkPayRequest extends PaymentLinkPayTerminal, so error fields and quotefields lived on one type and every access typechecked. The package models them as the two shapes the
API actually returns, which made four real assumptions visible:
fetchPayRequestdeclared its response as a pay request and then readstatusCode/messageoffit — the error case it was handling could not occur under its own type. It now reads
PaymentLinkPayResponseand narrows withhasPaymentQuote.statusCodewithout narrowing; same fix.routeandcurrencyare optional on a pay request. The public-payment form passedrouteintoURLSearchParamsas a string and interpolatedcurrencyinto a label — both assumed a value theAPI does not promise.
routeis now only sent when present.Tagdetail row readpayRequest.tag, which only exists on a quoted response.C2BPaymentMethod.KUCOINPAYisKUCOIN_PAYin the package.Before this can go green
The package pin in
package.jsonstill points at the published@dfx.swiss/react. CI stays reduntil DFXswiss/packages#201 is merged and published and the pin is raised here. Verified locally
against a build of that branch:
tscclean,npm run lintclean, full suite at 673 passing with nonew failures (the two suites failing on
developtoday still fail, unchanged).Overlap
#1223 touches the same two contexts (wait-endpoint polling). The textual conflict is routine, but
worth a look when the second of the two lands: any code it adds that reads
statusCode,message,tag,routeorcurrencyoff a pay request needs the same narrowing this PR introduces —the compiler will say so, but only once both are in.