This commit is contained in:
2025-05-19 20:36:21 -05:00
commit f5303487be
1865 changed files with 260387 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
/**
* A constant for the zero address.
*
* (**i.e.** ``"0x0000000000000000000000000000000000000000"``)
*/
export const ZeroAddress: string = "0x0000000000000000000000000000000000000000";
+7
View File
@@ -0,0 +1,7 @@
/**
* A constant for the zero hash.
*
* (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``)
*/
export const ZeroHash: string = "0x0000000000000000000000000000000000000000000000000000000000000000";
+16
View File
@@ -0,0 +1,16 @@
/**
* Some common constants useful for Ethereum.
*
* @_section: api/constants: Constants [about-constants]
*/
export { ZeroAddress } from "./addresses.js";
export { ZeroHash } from "./hashes.js";
export {
N,
WeiPerEther,
MaxUint256,
MinInt256,
MaxInt256
} from "./numbers.js";
export { EtherSymbol, MessagePrefix } from "./strings.js";
+35
View File
@@ -0,0 +1,35 @@
/**
* A constant for the order N for the secp256k1 curve.
*
* (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)
*/
export const N: bigint = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
/**
* A constant for the number of wei in a single ether.
*
* (**i.e.** ``1000000000000000000n``)
*/
export const WeiPerEther: bigint = BigInt("1000000000000000000");
/**
* A constant for the maximum value for a ``uint256``.
*
* (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
*/
export const MaxUint256: bigint = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
/**
* A constant for the minimum value for an ``int256``.
*
* (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)
*/
export const MinInt256: bigint = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1);
/**
* A constant for the maximum value for an ``int256``.
*
* (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
*/
export const MaxInt256: bigint = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
+16
View File
@@ -0,0 +1,16 @@
// NFKC (composed) // (decomposed)
/**
* A constant for the ether symbol (normalized using NFKC).
*
* (**i.e.** ``"\\u039e"``)
*/
export const EtherSymbol: string = "\u039e"; // "\uD835\uDF63";
/**
* A constant for the [[link-eip-191]] personal message prefix.
*
* (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``)
*/
export const MessagePrefix: string = "\x19Ethereum Signed Message:\n";