Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sui TypeScript SDK: Add formatAmount() util #17791

Closed
kkomelin opened this issue May 17, 2024 · 1 comment
Closed

Sui TypeScript SDK: Add formatAmount() util #17791

kkomelin opened this issue May 17, 2024 · 1 comment
Assignees
Labels

Comments

@kkomelin
Copy link
Contributor

kkomelin commented May 17, 2024

Problem/Motivation

It would be good to have a standard way to format Sui amounts with TypeScript SDK, like existing formatDigest() or formatAddress().
It's a very trivial operation and it's necessary for many projects, so it deserves to be standardised, in my opinion.

And, moreover, you already have it implemented here: formatAmount()

Look how even example projects now have to copy&paste the code. Not the best way because you cannot pull the latest bug fixes and updates automatically.

Proposed resolution

Move formatAmount() function from apps to TypeScript SDK utils.

kkomelin added a commit to kkomelin/sui that referenced this issue Jul 18, 2024
…dk/typescript (MystenLabs#17791)

    ## Description

    Moved formatAmount and formatAmountParts utils from the apps/core
    package to the sdk/typescript.

    Set deprecation warnings for the older versions.

    Added the corresponding  automated tests.

    ## Test plan

    Run the automated tests for the @mysten/sui package.
    Make sure the transaction amount is displayed properly in the wallet.
@kkomelin
Copy link
Contributor Author

Considering @hayes-mysten point in the related PR, I think we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants