Skip to content

[READY] handle the response when quote exceeds the pool size#661

Merged
ebma merged 12 commits into
stagingfrom
628-handle-quotes-500-error-when-the-input-amount-exceeds-the-swap-pool-reserves
Jun 6, 2025
Merged

[READY] handle the response when quote exceeds the pool size#661
ebma merged 12 commits into
stagingfrom
628-handle-quotes-500-error-when-the-input-amount-exceeds-the-swap-pool-reserves

Conversation

@Sharqiewicz
Copy link
Copy Markdown
Member

@Sharqiewicz Sharqiewicz commented May 22, 2025

Update the output to visually and textually show that the quote is loaded, even if an error message about exceeding the pool size is returned.

@Sharqiewicz Sharqiewicz linked an issue May 22, 2025 that may be closed by this pull request
1 task
@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2025

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit 7d90a1e
🔍 Latest deploy log https://app.netlify.com/projects/pendulum-pay/deploys/6842bc06d6d40400080d265c
😎 Deploy Preview https://deploy-preview-661--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Sharqiewicz Sharqiewicz requested review from a team and Copilot May 22, 2025 11:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors several UI components to improve their handling of loading states and cleans up unused code. Key changes include the removal of an unused import in the ramp hook, conditional class adjustments in the AssetButton component, and the introduction of a loading prop in the NumericInput and AssetNumericInput components.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
frontend/src/hooks/offramp/useSubmitRamp.ts Removed an unused constant import and fixed a trailing comma
frontend/src/components/buttons/AssetButton/index.tsx Refactored className handling using a helper for conditional classes
frontend/src/components/NumericInput/index.tsx Added a new loading prop with updated conditional rendering for spinner
frontend/src/components/AssetNumericInput/index.tsx Passed loading prop down to NumericInput and updated prop references
Comments suppressed due to low confidence (1)

frontend/src/components/buttons/AssetButton/index.tsx:16

  • Consider adding an accessible label (e.g., 'aria-label') to the button element in AssetButton to improve screen reader support.
      <button

Comment thread frontend/src/components/NumericInput/index.tsx Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I think we should still allow changing the asset when the quote does not load. It could be that for a different output asset, we can get a quote. Otherwise the user would first have to edit their input amount which could be confusing again.

We could also consider adding an error message.

@Sharqiewicz Sharqiewicz changed the title handle the response when quote exceeds the pool size [READY] handle the response when quote exceeds the pool size May 30, 2025
Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

The deploy preview crashes for me, probably because we are passing undefined to a bignumber initializer somewhere.
image

@Sharqiewicz
Copy link
Copy Markdown
Member Author

@ebma fixed

Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I can now still change the output token which is great. We are still not telling the user what's wrong though.
To keep it simple, how about we just check the response code instead of looking at the contained error? If it's a 500 we assume that the quote cannot be served because the input amount is too low.

image

The ideal solution would be to change the responses of the backend to tell the frontend what exactly is wrong. This is a little trickier and maybe not worth it just for this. Your call @Sharqiewicz but we need to have at least some messaging telling the user what's wrong and what they can do.

Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Works, let's go ✅

@ebma ebma merged commit 9212b94 into staging Jun 6, 2025
5 checks passed
@ebma ebma deleted the 628-handle-quotes-500-error-when-the-input-amount-exceeds-the-swap-pool-reserves branch June 6, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle /quotes 500 error when the input amount exceeds the swap-pool reserves

3 participants