From 7c2b6900bfff04dda5b8a4a56d1123cdd938e38c Mon Sep 17 00:00:00 2001 From: b00l Date: Sun, 12 May 2024 23:37:30 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9=E7=AC=AC=E5=8D=81?= =?UTF-8?q?=E8=AE=B2=20ethers.getBigInt=20=E5=8F=82=E6=95=B0=E8=8C=83?= =?UTF-8?q?=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10_Units/Units.js | 4 ++-- 10_Units/readme.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/10_Units/Units.js b/10_Units/Units.js index c5262d2..75032cb 100644 --- a/10_Units/Units.js +++ b/10_Units/Units.js @@ -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) // 运算 diff --git a/10_Units/readme.md b/10_Units/readme.md index 83f3534..dc4e036 100644 --- a/10_Units/readme.md +++ b/10_Units/readme.md @@ -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) ```