Skip to content

Conversation

@ckeshava
Copy link
Contributor

High Level Overview of Change

The MPToken balances are not scaled appropriately. This commit fixes this issue in the HeldMPTs section of an AccountPage. Furthermore, some of the legacy jest test matchers have been updated to pass the CI requirements.

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

Test Plan

Existing test has been updated to validate the scaled asset price scenario.

// MPT balance must be scaled by the appropriate asset_scale exponent.
// Please refer to this documentation for more details:
// https://xrpl.org/docs/references/protocol/transactions/types/mptokenissuancecreate#mptokenissuancecreate-fields
balance: mpToken.mptAmount * 10 ** -(mptIssuance?.assetScale ?? 0),
Copy link
Contributor

@kuan121 kuan121 Nov 12, 2025

Choose a reason for hiding this comment

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

  1. We need to apply this to all MPT amounts. The outstandingAmt field is used in IssuedMPTs.tsx#L62.
  2. Can we reuse convertScaledPrice to avoid duplicating the scaling logic and related comments in multiple places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. These concerns have been addressed in this commit: d8471d7

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. Can you remove the unnecessary comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok. 3cab005

…e Account Page

refactor: use the convertScaledPrice method to scale the MPT balance values
Comment on lines 94 to 97
// MPT balance must be scaled by the appropriate asset_scale exponent.
// Please refer to this documentation for more details:
// https://xrpl.org/docs/references/protocol/transactions/types/mptokenissuancecreate#mptokenissuancecreate-fields
// balance: mpToken.mptAmount * 10 ** -(mptIssuance?.assetScale ?? 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove these comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ckeshava ckeshava merged commit 99596c4 into ripple:staging Nov 12, 2025
5 checks passed
@ckeshava
Copy link
Contributor Author

Thanks for the quick reviews @kuan121 @pdp2121

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