BootNodeDev / dAppBooster

A modern blockchain boilerplate built to quickly get you started with your next project.
https://dappbooster.dev
MIT License
5 stars 1 forks source link

Remove uniswap/conedison #200

Closed fernandomg closed 4 months ago

fernandomg commented 4 months ago

Is your feature request related to a problem? Please describe. With the inclusion of react-number-format library, we have a tool to format number, aside from the main functionality that it provides of formatting the input field.

Describe the solution you'd like This task will attempt to remove the whole code included around number formatting that is related to uniswap/conedison and replace the functionality with react-number-format

Maybe this will lead to a different way to format numbers, but will be concise across the whole app.

Describe alternatives you've considered none

Additional context none

fernandomg commented 4 months ago

I played with it and we'll lose a lot of handy formatting rules.

First of all, to get the same result in thousands and trailing zeroes, these are the changes:

-    const formattedAmount = formatNumberOrString(
-      formatUnits(amount, tokenUSDC_sepolia.decimals),
-      NumberType.TokenTx,
-    )
+    const formattedAmount = numericFormatter(formatUnits(amount, tokenUSDC_sepolia.decimals), {
+      decimalScale: 2,
+      fixedDecimalScale: true,
+      thousandSeparator: ',',
+    })

Then, we need to re-create all the rules for representing values like formatter: '>999T' or formatter: '<0.001'.

So I'll close it, as it's not worth the effort and we may end up with a greater codebase and a complete dependency on the library.

/cc @gabitoesmiapodo