Skip to content

Explorer Account page revamp: Balances, Summary and Assets - #1245

Merged
kuan121 merged 47 commits into
stagingfrom
explorer-account-page-refactoring
Oct 9, 2025
Merged

kuan121 merged 47 commits into
stagingfrom
explorer-account-page-refactoring

Conversation

@kuan121

@kuan121 kuan121 commented Oct 1, 2025 •

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Refactoring the Explorer Account page

  1. Add a Balance section showing XRP Balance, XRP Balance (USD) and Reserve Balance
  2. Group account information, flags and Signer into a Account Properties section
  3. Replace Balance Dropdown and Asset Tab with two Assets sections
    • Held Assets: IOUs, MPTs, LP Tokens and NFTs
    • Issued Assets: IOUs, MPTs and NFTs

Context of Change

The current XRPL Explorer Account page provides functional access to raw ledger data and transaction history, but lacks the clarity, structure, and usability expected by both casual users and developers. Key information—such as account properties, AMM participation, trustlines, and assets held/issued—is presented in a fragmented way, making it difficult to interpret an account's status, asset relationships, and overall activity at a glance.

This is a revamp of the Explorer Account page to deliver a more organized, performant, and informative experience.

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

Codebase Modernization

  • Updated files to React Hooks
  • Updated files to TypeScript
  • Updated tests to React Testing Library

Before / After

Before - Account Information and XRP Balance

Before - Account Information and XRP Balance

After - Account Information and XRP Balance

After - Account Information and XRP Balance

Before - Account Assets

Before - Account Assets

After - Account Assets

After - Account Assets

Test Plan

  • Unit Tests
  • Manual Tests
    1. npm run build && npm start
    2. Visit account page for various accounts containing different types of assets and confirm that the page and data show as expected.

@kuan121
kuan121 force-pushed the explorer-account-page-refactoring branch from adfe2d8 to 0384079 Compare October 2, 2025 12:35
@kuan121
kuan121 marked this pull request as ready for review October 2, 2025 14:46
Comment thread public/locales/en-US/translations.json
Comment thread src/containers/Accounts/AccountAsset/FutureDataIcon.tsx Outdated
Comment thread src/containers/Accounts/AccountAsset/assetTables/HeldIOUs.tsx Outdated
Comment thread src/containers/Accounts/AccountAsset/assetTables/HeldIOUs.tsx Outdated
Comment thread src/containers/Accounts/AccountAsset/assetTables/HeldIOUs.tsx Outdated
Comment thread src/containers/Accounts/AccountAsset/assetTables/HeldIOUs.tsx Outdated
Comment thread .env.example
@@ -28,3 +28,6 @@ VITE_DATA_URL=https://data.xrpl.org/v1/network
# Whether to use ws instead of wss (boolean)
# Only used locally (the deployed Explorer requires wss)
VITE_INSECURE_WS=0

# LOS Endpoint URL
VITE_LOS_URL=https://los.dev.ripplex.io

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.

nit: could we update the example to the prod url just in the rare case that someone tries to use it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For testing purpose, I think dev endpoint should be sufficient. In general, it's not a good idea to expose prod endpoint even though we have DDoS protection in place.

cursor: default;

.clock-icon {
width: px;

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.

nit: looks like there is a missing px value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

Comment on lines +52 to +64
const fetchAccountHeldIOUs = async (
rippledSocket: any,
accountId: string,
): Promise<IOU[]> => {
let balancesResponse
try {
balancesResponse = await getBalances(rippledSocket, accountId)
} catch (error) {
log.error(
`Error calling 'gatewayBalances' for account ${accountId}: ${JSON.stringify(error)}`,
)
return []
}

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.

I've seen these types of functions saved in the rippled folder in this repo. I don't feel strongly here but might be worth adding this there and importing for consistency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

getBalances is defined in rippled/. Here, we have a special use case of finding held IOUs from the response of getBalances. I don't think it's generic enough, unlike getBalances, to be in rippled/`

Comment on lines +237 to +243
for (const issuer of uniqueIssuers) {
try {
// eslint-disable-next-line no-await-in-loop
const accountInfo = await getAccountInfo(rippledSocket, issuer, false)

const transferFee = formatTransferFee(accountInfo?.TransferRate, 'IOU')

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.

could some sort of parallelism here save time? not sure how long this process takes currently from a UI experience

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Based on my tests, parallel requests quickly get throttled by Clio. It’s fine to make these calls sequentially here: we display the Held IOU table with other fields almost immediately, then fetch the transfer fee and frozen status one by one, updating the columns as the data arrives. From the user’s perspective, the table shows up immediately, so the experience isn’t blocked.

Comment on lines +174 to +175
account={token.issuer}
shortAccount={shortenAccount(token.issuer)}

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.

nit: passing both of these in seems redundant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not redundant since the caller of <Account /> can pass in a short version of account, e.g., rK2Y8ng...ZkyFm or an issuer name like Ripple as shortAccount. I will rename shortAccount to displayText since issuer name like Ripple is definitely not a short account.

Comment on lines +181 to +183
<td>
<FutureDataIcon />
</td>

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.

how come we are unable to provide the usd prices right now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unlike IOU, MPT isn't being traded on the ledger at the moment. We need to have MPT DEX in mainnet so that MPT can be traded. Only after that will we have an MPT price in XRP and USD.

Comment thread src/containers/Accounts/AccountAsset/assetTables/HeldNFTs.tsx
Comment on lines +149 to +151
log.error(
`Error fetching offers for NFT ${nft.nftId}: ${JSON.stringify(error)}`,
)

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.

should we add retry mechanisms here? or would a page reload be sufficient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Based on my tests, we don't need a retry for now since I have tested some accounts with large number of tokens and I don't see any throttle. I plan to add retry as a follow-up.

Comment on lines +85 to +97
export const formatUsdBalance = (balance: number, lang: string): string => {
if (balance === 0) {
return '--'
}

let options
if (balance >= 1) {
options = USD_CURRENCY_OPTIONS
} else if (balance >= 0.0001) {
options = USD_SMALL_BALANCE_CURRENCY_OPTIONS
} else {
options = USD_EXTRA_SMALL_BALANCE_CURRENCY_OPTIONS
}

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.

I do believe there are exisitng utils in this repo to display amounts, were you able to try those / is this logic significantly different?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You’re right — we already have localizeNumber, and the functions in this file use it under the hood. However, I’ve added some custom logic, after discussed with Julian, to control how many decimals we display for different prices and balances. We can also update the Token and Token Ranking pages to use these functions for consistency.

Here’s the custom logic:
Token balance:

  1. If the balance is greater than 999, keep 2 decimals (e.g., 100,001.94)
  2. If the balance is less than or equal to 999, keep 2 to 4 decimals, (e.g., 151.194)

USD price or balance:

  1. If the value is greater than 1, keep at most 2 decimals (e.g., $1.02).
  2. If the value is between 0.0001 and 1, keep 2–4 decimals (e.g., $0.004, $0.02).
  3. If the value is less than 0.0001, keep up to 10 decimals (e.g., $0.00004).

@achowdhry-ripple achowdhry-ripple left a comment

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.

Great job with this, was a large change and looks very clean! Mainly small questions and nits, and main concern is over the large number of api calls and the lack of parallelism/retries. Not a big issue though, seems like it works great overall but I would be curious to understand more there.

Comment thread package.json Outdated
@kuan121
kuan121 force-pushed the explorer-account-page-refactoring branch from b182c1c to 60db069 Compare October 8, 2025 15:18

@Patel-Raj11 Patel-Raj11 left a comment

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.

LGTM!

@achowdhry-ripple achowdhry-ripple left a comment

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.

thanks for addressing the comments, lgtm!

…ogressively add non-LP tokens starting with 03 after confirming they aren’t LP tokens.
@kuan121
kuan121 force-pushed the explorer-account-page-refactoring branch from 88cef2b to e9debef Compare October 9, 2025 12:43
…USD after a `03` token is added to the table
@kuan121 kuan121 changed the title Explorer account page refactoring Explorer account page revamp Oct 9, 2025
@kuan121 kuan121 changed the title Explorer account page revamp Explorer account page revamp: Balance, Summary and Assets Oct 9, 2025
@kuan121 kuan121 changed the title Explorer account page revamp: Balance, Summary and Assets Explorer Account page revamp: Balance, Summary and Assets Oct 9, 2025
@kuan121 kuan121 changed the title Explorer Account page revamp: Balance, Summary and Assets Explorer Account page revamp: Balances, Summary and Assets Oct 9, 2025
@kuan121
kuan121 merged commit 1d1f100 into staging Oct 9, 2025
5 checks passed
@kuan121
kuan121 deleted the explorer-account-page-refactoring branch October 9, 2025 14:08
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