-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(backend): estimate ILP quote receive amount, and fail early #2783
Conversation
✅ Deploy Preview for brilliant-pasca-3e80ec canceled.
|
20dc3c7
to
4ce6353
Compare
if ( | ||
err instanceof PaymentMethodHandlerError && | ||
err.code === PaymentMethodHandlerErrorCode.QuoteNonPositiveReceiveAmount | ||
) { | ||
return QuoteError.NonPositiveReceiveAmount | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle gracefully, avoid returning 500 for an unhandled PaymentMethodHandlerError
.
This is also prepping for having better error codes in the RS in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one curiosity question
receiver: receiver.incomingPayment!.id, | ||
method: 'ilp', | ||
debitAmount: { | ||
value: 2n, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does that end up being non-positive? Because of slippage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We mock the call to paymentMethodHandlerService.getQuote
so this value doesn't matter too much.
Main test is here
1897492
1897492
to
83493b1
Compare
Changes proposed in this pull request
Error during quoting if the ILP quote will not fulfil at least a single unit of the receiving asset. See #2770 for detailed explanation.
Context
Fixes #2770
Checklist
fixes #number