Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 修改第十讲 ethers.getBigInt 参数范围 #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 10_Units/Units.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const oneGwei = ethers.getBigInt("1000000000"); // 从十进制字符串生成
console.log(oneGwei)
console.log(ethers.getBigInt("0x3b9aca00")) // 从hex字符串生成
console.log(ethers.getBigInt(1000000000)) // 从数字生成
// 不能从js最大的安全整数之外的数字生成BigNumber,下面代码会报错
// ethers.getBigInt(Number.MAX_SAFE_INTEGER);
// Number 类型的参数不能超过 js 最大安全数,下面代码会报错
// ethers.getBigInt(Number.MAX_SAFE_INTEGER + 1);
console.log("js中最大安全整数:", Number.MAX_SAFE_INTEGER)

// 运算
Expand Down
4 changes: 2 additions & 2 deletions 10_Units/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const oneGwei = ethers.getBigInt("1000000000"); // 从十进制字符串生成
console.log(oneGwei)
console.log(ethers.getBigInt("0x3b9aca00")) // 从hex字符串生成
console.log(ethers.getBigInt(1000000000)) // 从数字生成
// 不能从js最大的安全整数之外的数字生成BigNumber,下面代码会报错
// ethers.getBigInt(Number.MAX_SAFE_INTEGER);
// Number 类型的参数不能超过 js 最大安全数,下面代码会报错
// ethers.getBigInt(Number.MAX_SAFE_INTEGER + 1);
console.log("js中最大安全整数:", Number.MAX_SAFE_INTEGER)
```

Expand Down