Skip to content

Conversation

@aelmanaa
Copy link
Collaborator

@aelmanaa aelmanaa commented Jun 24, 2025

This pull request refactors the src/config/data/ccip/utils.ts file to replace BigNumber.js with ethers.js for handling large number formatting and conversions. The changes simplify the codebase and improve precision in formatting token values and rates. Below are the most important changes:

Removal of BigNumber.js and adoption of ethers.js

  • Removed the normalizeNumber utility function, which used BigNumber.js for decimal normalization, and replaced its functionality with ethers.js's formatUnits method for precise and modern handling of large numbers. ([[1]](https://github.com/smartcontractkit/documentation/pull/2765/files#diff-479c37d0bd4d99190fb1ecc4bb36ae338e0db8caa7cd2f7b3da63daec1e959d4L119-L125), [[2]](https://github.com/smartcontractkit/documentation/pull/2765/files#diff-479c37d0bd4d99190fb1ecc4bb36ae338e0db8caa7cd2f7b3da63daec1e959d4R150-R189))
  • Updated the displayCapacity function to use ethers.js's formatUnits for converting token capacities with decimals, ensuring cleaner and more accurate formatting. ([src/config/data/ccip/utils.tsR150-R189](https://github.com/smartcontractkit/documentation/pull/2765/files#diff-479c37d0bd4d99190fb1ecc4bb36ae338e0db8caa7cd2f7b3da63daec1e959d4R150-R189))
  • Refactored the displayRate function to use ethers.js's formatUnits for rate and capacity conversions, improving readability and precision. ([src/config/data/ccip/utils.tsR150-R189](https://github.com/smartcontractkit/documentation/pull/2765/files#diff-479c37d0bd4d99190fb1ecc4bb36ae338e0db8caa7cd2f7b3da63daec1e959d4R150-R189))

Code cleanup and modernization

  • Removed the unused import of BigNumber.js and added the formatUnits import from ethers.js to streamline dependencies. ([src/config/data/ccip/utils.tsL5-R6](https://github.com/smartcontractkit/documentation/pull/2765/files#diff-479c37d0bd4d99190fb1ecc4bb36ae338e0db8caa7cd2f7b3da63daec1e959d4L5-R6))
  • Enhanced the output formatting in displayCapacity and displayRate by cleaning up trailing zeros and unnecessary decimal points for better user readability. ([src/config/data/ccip/utils.tsR150-R189](https://github.com/smartcontractkit/documentation/pull/2765/files#diff-479c37d0bd4d99190fb1ecc4bb36ae338e0db8caa7cd2f7b3da63daec1e959d4R150-R189))

@aelmanaa aelmanaa requested a review from a team as a code owner June 24, 2025 06:17
@vercel
Copy link

vercel bot commented Jun 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
documentation ✅ Ready (Inspect) Visit Preview Jun 24, 2025 6:23am

@aelmanaa aelmanaa merged commit d9ade62 into main Jun 24, 2025
21 checks passed
@aelmanaa aelmanaa deleted the cccip/fix-display-drawer branch June 24, 2025 12:33
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.

2 participants