ethers.js/src.ts/constants/numbers.ts

36 lines
1.2 KiB
TypeScript
Raw Permalink Normal View History

2022-09-05 16:14:43 -04:00
/**
* A constant for the order N for the secp256k1 curve.
2022-12-09 18:21:45 -05:00
*
* (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)
2022-09-05 16:14:43 -04:00
*/
2022-11-27 21:54:09 -05:00
export const N: bigint = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
2022-09-05 16:14:43 -04:00
/**
* A constant for the number of wei in a single ether.
2022-12-09 18:21:45 -05:00
*
* (**i.e.** ``1000000000000000000n``)
2022-09-05 16:14:43 -04:00
*/
2022-11-27 21:54:09 -05:00
export const WeiPerEther: bigint = BigInt("1000000000000000000");
2022-09-05 16:14:43 -04:00
/**
* A constant for the maximum value for a ``uint256``.
2022-12-09 18:21:45 -05:00
*
* (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
2022-09-05 16:14:43 -04:00
*/
2022-11-27 21:54:09 -05:00
export const MaxUint256: bigint = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
2022-09-05 16:14:43 -04:00
/**
* A constant for the minimum value for an ``int256``.
2022-12-09 18:21:45 -05:00
*
* (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)
2022-09-05 16:14:43 -04:00
*/
2022-11-27 21:54:09 -05:00
export const MinInt256: bigint = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1);
2022-09-05 16:14:43 -04:00
/**
* A constant for the maximum value for an ``int256``.
2022-12-09 18:21:45 -05:00
*
* (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
2022-09-05 16:14:43 -04:00
*/
2022-11-27 21:54:09 -05:00
export const MaxInt256: bigint = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");