Skip to content

Amm rankings explorer page#1295

Merged
cybele-ripple merged 52 commits intoamm-object-pagefrom
amm-rankings-explorer-page
Apr 15, 2026
Merged

Amm rankings explorer page#1295
cybele-ripple merged 52 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

Comment thread server/routes/v1/amms.js
* 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.

Comment thread server/routes/v1/amms.js
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.

Comment thread server/routes/v1/amms.js
* 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.

Comment thread server/routes/v1/amms.js
* 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.

Comment thread server/routes/v1/index.js Outdated
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.

Comment thread src/containers/AMMRankings/TVLVolumeChart.tsx Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread src/containers/AMMRankings/TVLVolumeChart.tsx Outdated
Comment thread src/containers/AMMRankings/svg.d.ts
Comment thread src/containers/App/legacyRedirects.tsx Outdated
Comment thread server/routes/v1/index.js Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/GeneralInfoCard.tsx
Comment thread src/containers/AMMRankings/index.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread server/routes/v1/amms.js
@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
@cybele-ripple cybele-ripple force-pushed the amm-rankings-explorer-page branch from b6341b2 to c030e5b Compare April 6, 2026 21:03
Comment thread src/containers/AMMRankings/index.tsx Outdated
['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

Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
@@ -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

Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx
Comment thread src/containers/AMMRankings/ammRankings.scss Outdated
Comment thread src/containers/AMMRankings/ammRankings.scss Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread src/containers/AMMRankings/AMMRankingsTable.tsx Outdated
Comment thread public/locales/ca-CA/translations.json Outdated
Comment thread server/lib/rippled.js
Comment thread src/containers/AMMRankings/ammRankings.scss Outdated
<span>{CATEGORY_LABELS[cat]}</span>
</button>
))}
<div className="search-wrapper">
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.

Sorry, I meant the search box "Search AMMs" in the Top 1,000 AMMs section. I don't see it in the screenshot.

Comment thread public/locales/en-US/translations.json Outdated
Comment thread src/containers/AMMRankings/index.tsx
@cybele-ripple cybele-ripple requested review from kuan121 and pdp2121 April 9, 2026 21:25
@@ -2,6 +2,7 @@
"action": "acció",
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.

This comment applies to all the non en-US translation.json files. We introduce the following 11 new translation keys in the en-US/translation.json file:

  "asset_pair"
  "amms"
  "top_1000_amms"
  "general_info"
  "number_of_amms"
  "number_of_lps"
  "number_of_amms_tooltip"
  "number_of_lps_tooltip"
  "search_amms"
  "tvl_tooltip"
  "volume_24h_all_tooltip"

What I expect are

  1. They will show up in other non en-US files
  2. No other changes are needed, but I'm seeing lots of other key addition/removals as well. Is it a result of running some sort of formatter? If that's the case, just make sure we don't accidentally delete/add any used/unused keys, then we are good.

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.

It is a formaI did use a formatter. I just confirmed that the changes made in the file are all cosmetic OR part of the list you gave above. Those 11 translation keys are the only additive change between this branch and your branch

? formatCurrencyAmount(getFees24h(amm))
: DEFAULT_EMPTY_VALUE}
</td>
<td className="apr">
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 APR value doesn't need to be bold or semi-bold.

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.

APR is no longer bold

Comment thread server/lib/rippled.js
@kuan121 kuan121 force-pushed the amm-object-page branch 2 times, most recently from e8b65ba to e09b907 Compare April 10, 2026 20:21
@cybele-ripple cybele-ripple force-pushed the amm-rankings-explorer-page branch from 8f44fb4 to b04fbe0 Compare April 10, 2026 23:42
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread public/locales/en-US/translations.json Outdated
Comment thread package.json Outdated
Comment thread package-lock.json
Comment thread src/containers/AMMRankings/TVLVolumeChart.tsx Outdated
@cybele-ripple cybele-ripple requested a review from kuan121 April 14, 2026 23:16
@cybele-ripple cybele-ripple merged commit 7eee154 into amm-object-page Apr 15, 2026
5 checks passed
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