Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 9e02d00

Browse files
author
Dan Forbes
committed
feat(docs): upgrade-bn
Add a section in "Upgrade from 1.x" for `BN` vs `BigInt` Closes #6705
1 parent 9b32205 commit 9e02d00

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/docs/guides/web3_upgrade_guide/1.x/web3_utils_migration_guide.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ import web3Utils from 'web3-utils';
1717
import * as web3Utils from 'web3-utils';
1818
```
1919

20+
## No `BN` property
21+
22+
The `web3-utils` package no longer includes a `BN` property for using the [the `bn.js` package](https://github.com/indutny/bn.js/) for working with (big) numbers. In 4.x, [the native JavaScript `BigInt` type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is used.
23+
24+
```ts
25+
// 1.x
26+
new Web3.utils.BN(1);
27+
28+
// 4.x
29+
BigInt(4);
30+
```
31+
2032
## Unit conversion functions
2133

2234
The `toWei` does not have an optional second parameter. You have to pass the source unit explicitly.

0 commit comments

Comments
 (0)