vechain / vechain-sdk-js

The official JavaScript SDK for VeChain.
19 stars 6 forks source link

refactor: 666 pure and secure units.ts #874

Closed lucanicoladebiasi closed 1 month ago

lucanicoladebiasi commented 1 month ago

Description

The code at packages/core/src/utils/units delivers a drop-in replacement for the ethers lib functions parsing and formatting wei units.

The code promotes the use of MIT licensed bignumber.js library to provide fixed precision math to deal with monetary amounts.

The test code at packages/core/tests/utils/units/units.unit.test.ts splits test loops in independent tests easy the tests of fixed precision math and librieries.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Test Configuration:

Checklist:

github-actions[bot] commented 1 month ago

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
99.82% (3363/3369) 99.35% (769/774) 99.71% (688/690)
Title Tests Skipped Failures Errors Time
core 478 0 :zzz: 0 :x: 0 :fire: 1m 11s :stopwatch:
network 641 0 :zzz: 0 :x: 0 :fire: 3m 49s :stopwatch:
errors 48 0 :zzz: 0 :x: 0 :fire: 10.607s :stopwatch:
socket-security[bot] commented 1 month ago

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/bignumber.js@9.1.2 None 0 351 kB mikemcl

View full report↗︎