-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugVerified to be an issue.Verified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v6Issues regarding v6Issues regarding v6
Description
Ethers Version
6.3.0
Search Terms
No response
Describe the Problem
When i used parseUnits with number string larger than uint128 range it throw exception with
/Users/trungdv/Documents/trungdv/position-es/node_modules/ethers/src.ts/utils/errors.ts:660
error = new RangeError(message);
^
RangeError: overflow (operation="fromString", fault="overflow", value=1231231232131231231231000000000000000000, code=NUMERIC_FAULT, version=6.3.0)
at makeError (/Users/trungdv/Documents/trungdv/position-es/node_modules/ethers/src.ts/utils/errors.ts:660:21)
at assert (/Users/trungdv/Documents/trungdv/position-es/node_modules/ethers/src.ts/utils/errors.ts:680:25)
at checkValue (/Users/trungdv/Documents/trungdv/position-es/node_modules/ethers/src.ts/utils/fixednumber.ts:86:15)
at Function.fromString (/Users/trungdv/Documents/trungdv/position-es/node_modules/ethers/src.ts/utils/fixednumber.ts:611:9)
at parseUnits (/Users/trungdv/Documents/trungdv/position-es/node_modules/ethers/src.ts/utils/units.ts:75:24)
at Object.<anonymous> (/Users/trungdv/Documents/trungdv/position-es/ethers6.ts:3:23)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1597:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1600:12) {
code: 'NUMERIC_FAULT',
operation: 'fromString',
fault: 'overflow',
value: 1231231232131231231231000000000000000000n
}
exception happened when upgrade from v5 to v6 look like in v6 we have number fixed width = 128
Code Snippet
import { parseUnits } from 'ethers';
parseUnits('1231231232131231231231', 18)
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
ShawTim and lazarmitic
Metadata
Metadata
Assignees
Labels
bugVerified to be an issue.Verified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v6Issues regarding v6Issues regarding v6