Skip to content

Commit

Permalink
add changelog and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Luu committed May 21, 2024
1 parent 077bb3a commit 29626e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/web3-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,5 @@ Documentation:

### Fixed

- `toWei` support numbers in scientific notation (#6908)
- `toWei` support numbers in scientific notation (#6908)
- `toWei` and `fromWei` trims according to ether unit successfuly (#7044)
10 changes: 8 additions & 2 deletions packages/web3-utils/test/fixtures/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,17 @@ const conversionBaseData: [[Numbers, EtherUnits], string][] = [
[['879123456788877661', 'tether'], '0.000000000000879123456788877661'],
];

export const fromWeiValidData: [[Numbers, EtherUnits], string][] = [
export const fromWeiValidData: [[Numbers, EtherUnits], Numbers][] = [
...conversionBaseData,
[['0xff', 'wei'], '255'],
[[1e+22, 'ether'], '10000'],
[[19999999999999991611392, 'ether'], '19999.999999999991611392'],
[[1.9999999999999991611392e+22, 'ether'], '19999.999999999991611392'],
[['1000000', 'ether'], 0.000000000001],
[['1123456789123456789', 'ether'], '1.123456789123456789'],
[['1123', 'kwei'], '1.123'],
[['1234100' ,'kwei'], '1234.1'],
[['3308685546611893', 'ether'], '0.003308685546611893']
];

export const toWeiValidData: [[Numbers, EtherUnits], Numbers][] = [
Expand All @@ -309,7 +314,8 @@ export const toWeiValidData: [[Numbers, EtherUnits], Numbers][] = [
[['1123456789123456789', 'ether'], '1.123456789123456789123'],
[['1123', 'kwei'], '1.12345'],
[['1234100' ,'kwei'], '1234.1'],
[['3308685546611893', 'ether'], '0.0033086855466118933']
[['3308685546611893', 'ether'], '0.0033086855466118933'],
[['1123', 'kwei'], 1.12345],

];

Expand Down

0 comments on commit 29626e5

Please sign in to comment.