Skip to content

Amm rankings explorer page#1295

Open
cybele-ripple wants to merge 56 commits intoamm-object-pagefrom
amm-rankings-explorer-page
Open

Amm rankings explorer page#1295
cybele-ripple wants to merge 56 commits intoamm-object-pagefrom
amm-rankings-explorer-page

Conversation

@cybele-ripple
Copy link
Copy Markdown

High Level Overview of Change

These changes add an AMM page to the explorer.

Context of Change

The new AMMs page includes:

  • a graph for TVL and volume
    • toggle for USD and XRP
    • selectable timeframe (1D, 1M, 6M, 1Y, 5Y)
    • color coded superimposed graphs
  • top 1000 AMMs
    • entry includes: pair, clickable AMM account ids, TVL, number of LPs, volume in past 24 hours, feed in past 24 hours, and APR in past 24 hours
    • toggle switch from USD and WRP
    • filters for AMMs (RWA, Stablecoins, Memes, DeFi)
    • search box for specific AMM
  • general info section to show current TVL, total number of AMMs, total number of LPs and the current 24 hour volume
Screenshot 2026-03-16 at 12 07 28 PM

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Translation Updates
  • Release

@semgrep-code-ripple-github-org
Copy link
Copy Markdown

Semgrep found 10 ssc-7ae6e5c3-b6de-4d40-8faa-c9762551977a findings:

Risk: Affected versions of axios are vulnerable to Improper Check for Unusual or Exceptional Conditions. It fails to correctly validate configuration keys during merging. This allows a crafted proto property to trigger an internal TypeError, causing the application to crash.

Fix: Upgrade this library to at least version 1.13.5 at explorer/package-lock.json:27214.

Reference(s): GHSA-43fc-jf86-j433, CVE-2026-25639

* GET /api/v1/amms
* Fetch top AMMs with sorting
*/
const getAMMs = async (req, res) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You should cache these results so that Explorer server will not make a call to LOS on every page load (rate limiting)
See this example: https://github.com/ripple/explorer/blob/main/server/routes/v1/tokens.js#L85-L119

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

log.info(`Fetched ${response.data.results?.length || 0} AMMs`)

return res.status(200).json(response.data)
} catch (error) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also with caching if the call failed we can still use stale data

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

* Fetch aggregated AMM statistics
* This fetches the special "aggregated" document from the amms index
*/
const getAggregatedStats = async (req, res) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, this should be cached

Copy link
Copy Markdown
Author

@cybele-ripple cybele-ripple Apr 7, 2026

Choose a reason for hiding this comment

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

* Fetch historical trends for AMM data
*/
const getHistoricalTrends = async (req, res) => {
try {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ditto

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

api.use('/metrics', getCurrentMetrics)
api.use('/tokens/search/:query', getTokensSearch)
api.post('/tokens/batch-get', batchGetTokens)
api.use('/tokens/:tokenId', getTokenById)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a reason for this to be done server-side? For single token fetching without the need for caching I would prefer doing it on client-side to avoid rate limiting (IP of user browser vs IP of Explorer server)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@cybele-ripple cybele-ripple force-pushed the amm-rankings-explorer-page branch from f1682aa to ec81759 Compare April 3, 2026 23:04
@cybele-ripple cybele-ripple changed the base branch from main to amm-object-page April 3, 2026 23:08
kuan121 added 20 commits April 6, 2026 09:37
## High Level Overview of Change
react-test-renderer isn't used in our code and has been deprecated (see
[details](https://github.com/facebook/react/tree/HEAD/packages/react-test-renderer)).
Relevant dependabot PR #1256

<!--
Please include a summary/list of the changes.
If too broad, please consider splitting into multiple PRs.
-->

### Context of Change

<!--
Please include the context of a change.
If a bug fix, when was the bug introduced? What was the behavior?
If a new feature, why was this architecture chosen? What were the
alternatives?
If a refactor, how is this better than the previous implementation?

If there is a design document for this feature, please link it here.
-->

### Type of Change

<!--
Please check relevant options, delete irrelevant ones.
-->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new
feature included in this PR)
- [ ] Documentation Updates
- [ ] Translation Updates
- [ ] Release

### Codebase Modernization

<!--
In an effort to modernize the codebase, you should convert the files
that you work with to React Hooks and TypeScript If this is not possible
(e.g. it's too many changes, touching too many files, etc.) please
explain why here.
-->

- [ ] Updated files to React Hooks
- [ ] Updated files to TypeScript

## Before / After

<!--
If just refactoring / back-end changes, this can be just an in-English
description of the change at a technical level.
If a UI change, screenshots should be included.
-->

## Test Plan

<!--
Please describe the tests that you ran to verify your changes and
provide instructions so that others can reproduce.
-->

<!--
## Future Tasks
For future tasks related to PR.
-->
@cybele-ripple cybele-ripple force-pushed the amm-rankings-explorer-page branch from b6341b2 to c030e5b Compare April 6, 2026 21:03
['ammRankings', sortField, sortOrder],
() => fetchAMMRankings(sortField, sortOrder),
{
refetchInterval: 60 * 1000,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: you can set a common refetch interval variable

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added here

@@ -911,5 +911,15 @@
"asset_2": "Asset 2",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once you’ve finalized all the new keys for the AMM Ranking page, please add the same keys to translations.json for the other languages and set their values to null (you can refer to the AMM Object PR for examples).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added changes from this translations.json to the following:
ca-CA
es-ES
fr-FR
ja-JP
ko-KR
my-MM

color: $white;
font-size: 14px;
white-space: nowrap;
@include semibold;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The asset pair name, e.g., CRYPTO/XRP, isn't semibold or bold according to the Figma design.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed
Screenshot 2026-04-08 at 4 14 10 PM

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.

3 participants