@xylabs/hex 5.0.25 → 5.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,9 @@
1
- export * from './Brand.ts';
2
- export * from './index-internal.ts';
1
+ export * from './address/index.ts';
2
+ export * from './assert.ts';
3
+ export * from './ethAddress.ts';
4
+ export * from './hash/index.ts';
5
+ export * from './hex/index.ts';
6
+ export * from './HexRegEx.ts';
7
+ export * from './hexToBigInt.ts';
3
8
  export * from './zod.ts';
4
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/hex",
3
- "version": "5.0.25",
3
+ "version": "5.0.26",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "hex",
@@ -32,11 +32,6 @@
32
32
  "source": "./src/index.ts",
33
33
  "default": "./dist/neutral/index.mjs"
34
34
  },
35
- "./internal": {
36
- "types": "./dist/neutral/index-internal.d.ts",
37
- "source": "./src/index-internal.ts",
38
- "default": "./dist/neutral/index-internal.mjs"
39
- },
40
35
  "./package.json": "./package.json"
41
36
  },
42
37
  "module": "./dist/neutral/index.mjs",
@@ -47,13 +42,13 @@
47
42
  "src"
48
43
  ],
49
44
  "dependencies": {
50
- "@xylabs/typeof": "~5.0.25",
45
+ "@xylabs/typeof": "~5.0.26",
51
46
  "zod": "^4.1.12"
52
47
  },
53
48
  "devDependencies": {
54
49
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
55
50
  "@xylabs/tsconfig": "~7.2.8",
56
- "@xylabs/vitest-extended": "~5.0.25",
51
+ "@xylabs/vitest-extended": "~5.0.26",
57
52
  "typescript": "~5.9.3",
58
53
  "vitest": "~4.0.9"
59
54
  },
package/src/index.ts CHANGED
@@ -1,3 +1,8 @@
1
- export * from './Brand.ts'
2
- export * from './index-internal.ts'
1
+ export * from './address/index.ts'
2
+ export * from './assert.ts'
3
+ export * from './ethAddress.ts'
4
+ export * from './hash/index.ts'
5
+ export * from './hex/index.ts'
6
+ export * from './HexRegEx.ts'
7
+ export * from './hexToBigInt.ts'
3
8
  export * from './zod.ts'
@@ -1,4 +0,0 @@
1
- import type { Brand as TypeOfBrand } from '@xylabs/typeof';
2
- /** @deprecated use from @xylabs/typeof instead */
3
- export type Brand<T, B> = TypeOfBrand<T, B>;
4
- //# sourceMappingURL=Brand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Brand.d.ts","sourceRoot":"","sources":["../../src/Brand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE1D,kDAAkD;AAClD,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA"}
@@ -1,8 +0,0 @@
1
- export * from './address/index.ts';
2
- export * from './assert.ts';
3
- export * from './ethAddress.ts';
4
- export * from './hash/index.ts';
5
- export * from './hex/index.ts';
6
- export * from './HexRegEx.ts';
7
- export * from './hexToBigInt.ts';
8
- //# sourceMappingURL=index-internal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-internal.d.ts","sourceRoot":"","sources":["../../src/index-internal.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
@@ -1,373 +0,0 @@
1
- // src/assert.ts
2
- import { isString, isUndefined } from "@xylabs/typeof";
3
- var assertError = (value, assert, defaultMessage) => {
4
- if (!isUndefined(assert)) {
5
- const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
6
- if (isString(assertString) || assertString === true) {
7
- throw new Error(assertString === true ? defaultMessage : assertString);
8
- }
9
- }
10
- return void 0;
11
- };
12
-
13
- // src/hex/from/fromHexString.ts
14
- import { isNumber } from "@xylabs/typeof";
15
-
16
- // src/HexRegEx.ts
17
- var HexRegExMinMax = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
18
- return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`);
19
- };
20
- var HexRegExMinMaxMixedCaseWithPrefix = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
21
- return new RegExp(`^0x[a-fA-F0-9]{${minBytes * 2},${maxBytes * 2}}$`);
22
- };
23
- var HexRegEx = /^[0-9a-f]+$/;
24
- var HexRegExWithPrefix = /^0x[0-9a-f]+$/;
25
-
26
- // src/hex/nibble.ts
27
- var bitsToNibbles = (value) => {
28
- const nibbles = value >> 2;
29
- if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4");
30
- return nibbles;
31
- };
32
- var nibblesToBits = (value) => {
33
- return value << 2;
34
- };
35
-
36
- // src/hex/is.ts
37
- var isHex = (value, config) => {
38
- if (typeof value !== "string") return false;
39
- const valueCharLength = config?.prefix ? value.length - 2 : value.length;
40
- if (config?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config?.bitLength)) return false;
41
- return config?.prefix ? HexRegExWithPrefix.test(value) : HexRegEx.test(value);
42
- };
43
-
44
- // src/hex/from/fromHexString.ts
45
- var hexFromHexString = (value, config = {}) => {
46
- const {
47
- prefix = false,
48
- byteSize = 8,
49
- bitLength
50
- } = config;
51
- const nibbleBoundary = bitsToNibbles(byteSize);
52
- const unEvened = (value.startsWith("0x") ? value.slice(2) : value).toLowerCase();
53
- if (isHex(unEvened)) {
54
- const evenCharacters = unEvened.padStart(unEvened.length + unEvened.length % nibbleBoundary, "0");
55
- const padded = isNumber(bitLength) ? evenCharacters.padStart(bitLength / 4, "0") : evenCharacters;
56
- return (prefix ? `0x${padded}` : padded).toLowerCase();
57
- } else {
58
- throw new Error("Received string is not a value hex");
59
- }
60
- };
61
-
62
- // src/hex/from/fromArrayBuffer.ts
63
- var hexFromArrayBuffer = (buffer, config) => {
64
- const unPadded = [...new Uint8Array(buffer)].map((x) => x.toString(16).padStart(2, "0")).join("");
65
- return hexFromHexString(unPadded, config);
66
- };
67
-
68
- // src/hex/from/fromBigInt.ts
69
- var hexFromBigInt = (value, config = {}) => {
70
- const unPadded = value.toString(16);
71
- return hexFromHexString(unPadded, config);
72
- };
73
-
74
- // src/hex/from/fromNumber.ts
75
- var hexFromNumber = (value, config) => {
76
- return hexFromBigInt(BigInt(value), config);
77
- };
78
-
79
- // src/hex/from/from.ts
80
- var hexFrom = (value, config) => {
81
- switch (typeof value) {
82
- case "string": {
83
- return hexFromHexString(value, config);
84
- }
85
- case "bigint": {
86
- return hexFromBigInt(value, config);
87
- }
88
- case "number": {
89
- return hexFromNumber(value, config);
90
- }
91
- case "object": {
92
- return hexFromArrayBuffer(value, config);
93
- }
94
- default: {
95
- throw new Error(`Invalid type: ${typeof value}`);
96
- }
97
- }
98
- };
99
-
100
- // src/hex/as.ts
101
- function asHex(value, assert) {
102
- let stringValue = void 0;
103
- switch (typeof value) {
104
- case "string": {
105
- stringValue = hexFromHexString(value);
106
- break;
107
- }
108
- default: {
109
- return assertError(value, assert, `Unsupported type [${typeof value}]`);
110
- }
111
- }
112
- return isHex(stringValue) ? stringValue : assertError(value, assert, `Value is not Hex [${value}]`);
113
- }
114
-
115
- // src/hex/hex.ts
116
- import z from "zod";
117
- var UntypedHexZod = z.string().regex(HexRegEx, { message: "Invalid hex format" });
118
- var HexZod = UntypedHexZod.transform((val) => val);
119
-
120
- // src/hex/isHexZero.ts
121
- import { isString as isString2 } from "@xylabs/typeof";
122
- var isHexZero = (value) => {
123
- return isString2(value) ? BigInt(hexFromHexString(value, { prefix: true })) === 0n : void 0;
124
- };
125
-
126
- // src/hex/legacy.ts
127
- var toHexLegacy = (buffer) => {
128
- return [...new Uint8Array(buffer)].map((x) => x.toString(16).padStart(2, "0")).join("");
129
- };
130
-
131
- // src/hex/to.ts
132
- var toHex = (value, config = {}) => {
133
- const { prefix = false } = config;
134
- return hexFrom(value, { prefix, ...config });
135
- };
136
-
137
- // src/address/address.ts
138
- var ZERO_ADDRESS = "0000000000000000000000000000000000000000";
139
- var ADDRESS_LENGTH = 40;
140
- var AddressRegEx = HexRegExMinMax(ADDRESS_LENGTH / 2, ADDRESS_LENGTH / 2);
141
- var UnTypedAddressZod = UntypedHexZod.regex(AddressRegEx);
142
- var AddressZod = UnTypedAddressZod.transform((v) => v);
143
-
144
- // src/address/addressDeprecated.ts
145
- import z4 from "zod";
146
-
147
- // src/address/AddressTransformZod.ts
148
- import z3 from "zod";
149
-
150
- // src/address/AddressValidationZod.ts
151
- import z2 from "zod";
152
- var AddressValidationZod = z2.string().refine((x) => HexZod.safeParse(x)).refine((x) => x.length === ADDRESS_LENGTH, { error: (e) => new Error(`Address must have 40 characters [${e.input}]`) }).transform((v) => v);
153
-
154
- // src/address/AddressTransformZod.ts
155
- var AddressTransformZod = z3.union([z3.string(), z3.bigint(), z3.number()]).transform((value) => {
156
- switch (typeof value) {
157
- case "bigint": {
158
- return value.toString(16).padStart(ADDRESS_LENGTH, "0");
159
- }
160
- case "string": {
161
- if (value.startsWith("0x")) {
162
- return value.slice(2);
163
- }
164
- return value;
165
- }
166
- case "number": {
167
- return BigInt(value).toString(16).padStart(ADDRESS_LENGTH, "0");
168
- }
169
- }
170
- }).refine((x) => AddressValidationZod.safeParse(x).data).transform((x) => x);
171
-
172
- // src/address/to.ts
173
- var toAddress = (value, config = {}) => {
174
- const { bitLength = 160, prefix = false } = config;
175
- return hexFrom(value, {
176
- bitLength,
177
- prefix,
178
- ...config
179
- });
180
- };
181
- function toAddressV2(value, assert = false) {
182
- return assert ? AddressTransformZod.parse(value) : AddressTransformZod.safeParse(value).data;
183
- }
184
-
185
- // src/address/addressDeprecated.ts
186
- var AddressToStringZod = z4.string().regex(AddressRegEx);
187
- var AddressToStringSchema = AddressToStringZod;
188
- var AddressFromStringZod = z4.string().toLowerCase().regex(AddressRegEx).transform((v) => toAddress(v));
189
- var AddressFromStringSchema = AddressFromStringZod;
190
-
191
- // src/address/as.ts
192
- import { isObject } from "@xylabs/typeof";
193
-
194
- // src/address/is.ts
195
- var isAddress = (value, config = {}) => {
196
- const { bitLength = 160, prefix = false } = config;
197
- return isHex(value, { bitLength, prefix });
198
- };
199
- function isAddressV2(value) {
200
- return AddressValidationZod.safeParse(value).success;
201
- }
202
-
203
- // src/address/as.ts
204
- function asAddress(value, assert) {
205
- try {
206
- let stringValue = void 0;
207
- switch (typeof value) {
208
- case "string": {
209
- stringValue = hexFromHexString(value, { prefix: false });
210
- break;
211
- }
212
- default: {
213
- return isObject(assert) ? assertError(value, assert, `Unsupported type [${typeof value}]`) : void 0;
214
- }
215
- }
216
- return isAddress(stringValue) ? stringValue : assertError(value, assert, `Value is not an Address [${value}]`);
217
- } catch (ex) {
218
- const error = ex;
219
- return assertError(void 0, assert, error.message);
220
- }
221
- }
222
- function asAddressV2(value, assert = false) {
223
- return assert ? AddressValidationZod.parse(value) : AddressValidationZod.safeParse(value).data;
224
- }
225
-
226
- // src/ethAddress.ts
227
- import z5 from "zod";
228
- var EthAddressRegEx = HexRegExMinMaxMixedCaseWithPrefix(20, 20);
229
- var EthAddressToStringZod = z5.string().regex(EthAddressRegEx);
230
- var EthAddressToStringSchema = EthAddressToStringZod;
231
- var EthAddressFromStringZod = z5.string().regex(EthAddressRegEx).transform((v) => toEthAddress(v));
232
- var EthAddressFromStringSchema = EthAddressFromStringZod;
233
- var ETH_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
234
- var toEthAddress = (value, config = {}) => {
235
- const { bitLength = 160, prefix = false } = config;
236
- return `0x${hexFrom(value, {
237
- bitLength,
238
- prefix,
239
- ...config
240
- })}`;
241
- };
242
- var isEthAddress = (value, config = {}) => {
243
- const { bitLength = 160, prefix = true } = config;
244
- const loweredValue = typeof value === "string" ? value.toLowerCase() : value;
245
- return isHex(loweredValue, { bitLength, prefix });
246
- };
247
- var EthAddressZod = z5.string().regex(EthAddressRegEx, { message: "Invalid address format" }).refine(
248
- isEthAddress
249
- );
250
- function asEthAddress(value, assert) {
251
- try {
252
- let stringValue = void 0;
253
- switch (typeof value) {
254
- case "string": {
255
- stringValue = hexFromHexString(value, { prefix: true, byteSize: 4 });
256
- break;
257
- }
258
- default: {
259
- if (value !== void 0) {
260
- return assertError(value, assert, `Unsupported type [${typeof value}]`);
261
- }
262
- }
263
- }
264
- return isEthAddress(stringValue) ? stringValue : assertError(value, assert, `Value is not an EthAddress [${value}]`);
265
- } catch (ex) {
266
- const error = ex;
267
- return assertError(void 0, assert, error.message);
268
- }
269
- }
270
-
271
- // src/hash/as.ts
272
- import { isUndefined as isUndefined2 } from "@xylabs/typeof";
273
-
274
- // src/hash/is.ts
275
- var isHash = (value, bitLength = 256) => {
276
- return isHex(value, { bitLength });
277
- };
278
-
279
- // src/hash/as.ts
280
- function asHash(value, assert) {
281
- let stringValue = void 0;
282
- switch (typeof value) {
283
- case "string": {
284
- stringValue = hexFromHexString(value);
285
- break;
286
- }
287
- default: {
288
- return isUndefined2(assert) ? void 0 : assertError(value, assert, `Unsupported type [${typeof value}]`);
289
- }
290
- }
291
- return isHash(stringValue) ? stringValue : assertError(value, assert, `Value is not a Hash [${value}]`);
292
- }
293
-
294
- // src/hash/hash.ts
295
- import z6 from "zod";
296
- var HASH_LENGTH = 32;
297
- var HashRegEx = HexRegExMinMax(HASH_LENGTH, HASH_LENGTH);
298
- var ZERO_HASH = "0000000000000000000000000000000000000000000000000000000000000000";
299
- var HashBitLength = [32, 64, 128, 256, 512, 1024, 2048, 4096];
300
- var isHashBitLength = (value) => {
301
- return typeof value === "number" && HashBitLength.includes(value);
302
- };
303
- var HashZod = z6.string().regex(HashRegEx, { message: "Invalid hex format" }).transform((val) => val);
304
-
305
- // src/hash/zod.ts
306
- import z7 from "zod";
307
- var HashToJsonZod = HashZod.transform((v) => v);
308
- var JsonToHashZod = z7.string().transform((v) => asHash(v, true));
309
-
310
- // src/hexToBigInt.ts
311
- function hexToBigInt(hex) {
312
- return BigInt(hexFromHexString(hex, { prefix: true }));
313
- }
314
- export {
315
- ADDRESS_LENGTH,
316
- AddressFromStringSchema,
317
- AddressFromStringZod,
318
- AddressRegEx,
319
- AddressToStringSchema,
320
- AddressToStringZod,
321
- AddressTransformZod,
322
- AddressValidationZod,
323
- AddressZod,
324
- ETH_ZERO_ADDRESS,
325
- EthAddressFromStringSchema,
326
- EthAddressFromStringZod,
327
- EthAddressRegEx,
328
- EthAddressToStringSchema,
329
- EthAddressToStringZod,
330
- EthAddressZod,
331
- HASH_LENGTH,
332
- HashBitLength,
333
- HashRegEx,
334
- HashToJsonZod,
335
- HashZod,
336
- HexRegEx,
337
- HexRegExMinMax,
338
- HexRegExMinMaxMixedCaseWithPrefix,
339
- HexRegExWithPrefix,
340
- HexZod,
341
- JsonToHashZod,
342
- UnTypedAddressZod,
343
- UntypedHexZod,
344
- ZERO_ADDRESS,
345
- ZERO_HASH,
346
- asAddress,
347
- asAddressV2,
348
- asEthAddress,
349
- asHash,
350
- asHex,
351
- assertError,
352
- bitsToNibbles,
353
- hexFrom,
354
- hexFromArrayBuffer,
355
- hexFromBigInt,
356
- hexFromHexString,
357
- hexFromNumber,
358
- hexToBigInt,
359
- isAddress,
360
- isAddressV2,
361
- isEthAddress,
362
- isHash,
363
- isHashBitLength,
364
- isHex,
365
- isHexZero,
366
- nibblesToBits,
367
- toAddress,
368
- toAddressV2,
369
- toEthAddress,
370
- toHex,
371
- toHexLegacy
372
- };
373
- //# sourceMappingURL=index-internal.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/assert.ts","../../src/hex/from/fromHexString.ts","../../src/HexRegEx.ts","../../src/hex/nibble.ts","../../src/hex/is.ts","../../src/hex/from/fromArrayBuffer.ts","../../src/hex/from/fromBigInt.ts","../../src/hex/from/fromNumber.ts","../../src/hex/from/from.ts","../../src/hex/as.ts","../../src/hex/hex.ts","../../src/hex/isHexZero.ts","../../src/hex/legacy.ts","../../src/hex/to.ts","../../src/address/address.ts","../../src/address/addressDeprecated.ts","../../src/address/AddressTransformZod.ts","../../src/address/AddressValidationZod.ts","../../src/address/to.ts","../../src/address/as.ts","../../src/address/is.ts","../../src/ethAddress.ts","../../src/hash/as.ts","../../src/hash/is.ts","../../src/hash/hash.ts","../../src/hash/zod.ts","../../src/hexToBigInt.ts"],"sourcesContent":["import { isString, isUndefined } from '@xylabs/typeof'\n\ntype AssertCallback = (value: unknown, message: string) => string | boolean\n\nexport type AssertConfig = string | AssertCallback | boolean\n\nexport const assertError = (value: unknown, assert: AssertConfig | undefined, defaultMessage: string) => {\n if (!isUndefined(assert)) {\n const assertString\n = typeof assert === 'string'\n ? assert\n : typeof assert === 'boolean'\n ? defaultMessage\n : assert(value, defaultMessage)\n if (isString(assertString) || assertString === true) {\n throw new Error(assertString === true ? defaultMessage : assertString)\n }\n }\n // eslint-disable-next-line unicorn/no-useless-undefined\n return undefined\n}\n","import { isNumber } from '@xylabs/typeof'\n\nimport type { Hex, HexConfig } from '../hex.ts'\nimport { isHex } from '../is.ts'\nimport { bitsToNibbles } from '../nibble.ts'\n\nexport const hexFromHexString = (value: string, config: HexConfig = {}): Hex => {\n const {\n prefix = false, byteSize = 8, bitLength,\n } = config\n const nibbleBoundary = bitsToNibbles(byteSize)\n const unEvened = (value.startsWith('0x') ? value.slice(2) : value).toLowerCase()\n if (isHex(unEvened)) {\n const evenCharacters = unEvened.padStart(unEvened.length + (unEvened.length % nibbleBoundary), '0')\n const padded = isNumber(bitLength) ? evenCharacters.padStart(bitLength / 4, '0') : evenCharacters\n return (prefix ? `0x${padded}` : padded).toLowerCase() as Hex\n } else {\n throw new Error('Received string is not a value hex')\n }\n}\n","export const HexRegExMinMax = (minBytes = 0, maxBytes: number = (Number.MAX_SAFE_INTEGER / 2)) => {\n return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`)\n}\n\nexport const HexRegExMinMaxMixedCaseWithPrefix = (minBytes = 0, maxBytes: number = (Number.MAX_SAFE_INTEGER / 2)) => {\n return new RegExp(`^0x[a-fA-F0-9]{${minBytes * 2},${maxBytes * 2}}$`)\n}\n\nexport const HexRegEx = /^[0-9a-f]+$/\nexport const HexRegExWithPrefix = /^0x[0-9a-f]+$/\n","// determine the number of nibbles for a given number of bits\nexport const bitsToNibbles = (value: number): number => {\n const nibbles = value >> 2\n if (value !== nibbles << 2) throw new Error('Bits for nibbles must multiple of 4')\n return nibbles\n}\n\n// determine the number of nibbles for a given number of bits\nexport const nibblesToBits = (value: number): number => {\n return value << 2\n}\n","import { HexRegEx, HexRegExWithPrefix } from '../HexRegEx.ts'\nimport type { Hex, HexConfig } from './hex.ts'\nimport { bitsToNibbles } from './nibble.ts'\n\nexport const isHex = (value: unknown, config?: HexConfig): value is Hex => {\n // Is it a string?\n if (typeof value !== 'string') return false\n\n const valueCharLength = config?.prefix ? value.length - 2 : value.length\n\n // If a bitLength specified, does it conform?\n if (config?.bitLength !== undefined && valueCharLength !== bitsToNibbles(config?.bitLength)) return false\n\n // Does it only has hex values?\n return config?.prefix ? HexRegExWithPrefix.test(value) : HexRegEx.test(value)\n}\n","import type { Hex, HexConfig } from '../hex.ts'\nimport { hexFromHexString } from './fromHexString.ts'\n\n/** Convert an ArrayBuffer to a hex string */\nexport const hexFromArrayBuffer = (\n /** The buffer to be converted */\n buffer: ArrayBufferLike,\n /** Configuration of output format and validation */\n config?: HexConfig,\n): Hex => {\n const unPadded = [...new Uint8Array(buffer)].map(x => x.toString(16).padStart(2, '0')).join('')\n return hexFromHexString(unPadded, config)\n}\n","import type { Hex, HexConfig } from '../hex.ts'\nimport { hexFromHexString } from './fromHexString.ts'\n\n/** Convert a bigint to a hex string */\nexport const hexFromBigInt = (\n /** The bigint to be converted */\n value: bigint,\n /** Configuration of output format and validation */\n config: HexConfig = {},\n): Hex => {\n const unPadded = value.toString(16)\n return hexFromHexString(unPadded, config)\n}\n","import type { Hex, HexConfig } from '../hex.ts'\nimport { hexFromBigInt } from './fromBigInt.ts'\n\nexport const hexFromNumber = (value: number, config?: HexConfig): Hex => {\n return hexFromBigInt(BigInt(value), config)\n}\n","import type { Hex, HexConfig } from '../hex.ts'\nimport { hexFromArrayBuffer } from './fromArrayBuffer.ts'\nimport { hexFromBigInt } from './fromBigInt.ts'\nimport { hexFromHexString } from './fromHexString.ts'\nimport { hexFromNumber } from './fromNumber.ts'\n\n/** Takes unknown value and tries our best to convert it to a hex string */\nexport const hexFrom = (\n /** Supported types are string, number, bigint, and ArrayBuffer */\n value: string | number | bigint | ArrayBufferLike,\n /** Configuration of output format and validation */\n config?: HexConfig,\n): Hex => {\n switch (typeof value) {\n case 'string': {\n return hexFromHexString(value, config)\n }\n case 'bigint': {\n return hexFromBigInt(value, config)\n }\n case 'number': {\n return hexFromNumber(value, config)\n }\n case 'object': {\n return hexFromArrayBuffer(value, config)\n }\n default: {\n throw new Error(`Invalid type: ${typeof value}`)\n }\n }\n}\n","import type { AssertConfig } from '../assert.ts'\nimport { assertError } from '../assert.ts'\nimport { hexFromHexString } from './from/index.ts'\nimport type { Hex } from './hex.ts'\nimport { isHex } from './is.ts'\n\nexport function asHex(value: unknown): Hex | undefined\nexport function asHex(value: unknown, assert: AssertConfig): Hex\nexport function asHex(value: unknown, assert?: AssertConfig): Hex | undefined {\n let stringValue: string | undefined = undefined\n\n switch (typeof value) {\n case 'string': {\n stringValue = hexFromHexString(value)\n break\n }\n default: {\n return assertError(value, assert, `Unsupported type [${typeof value}]`)\n }\n }\n\n return isHex(stringValue) ? stringValue : assertError(value, assert, `Value is not Hex [${value}]`)\n}\n","import type { Brand } from '@xylabs/typeof'\nimport z from 'zod'\n\nimport { HexRegEx } from '../HexRegEx.ts'\n\nexport type Hex = Brand<Lowercase<string>, { readonly __hex: true }>\n\nexport const UntypedHexZod = z.string()\n .regex(HexRegEx, { message: 'Invalid hex format' })\n\nexport const HexZod = UntypedHexZod.transform(val => val as Hex)\n\n/** Configuration of validation and output format */\nexport interface HexConfig {\n bitLength?: number\n byteSize?: number\n prefix?: boolean\n}\n","import { isString } from '@xylabs/typeof'\n\nimport { hexFromHexString } from './from/index.ts'\n\nexport const isHexZero = (value?: string) => {\n return isString(value) ? BigInt(hexFromHexString(value, { prefix: true })) === 0n : undefined\n}\n","export const toHexLegacy = (buffer: ArrayBuffer) => {\n return [...new Uint8Array(buffer)].map(x => x.toString(16).padStart(2, '0')).join('')\n}\n","import { hexFrom } from './from/index.ts'\nimport type { HexConfig } from './hex.ts'\n\n/** takes any value and tries our best to convert it to a hex string */\nexport const toHex = (\n /** Supported types are string, number, bigint, and ArrayBuffer */\n value: string | number | bigint | ArrayBufferLike,\n /** Configuration of output format and validation */\n config: HexConfig = {},\n) => {\n const { prefix = false } = config\n return hexFrom(value, { prefix, ...config })\n}\n","import type { Brand } from '@xylabs/typeof'\n\nimport { type Hex, UntypedHexZod } from '../hex/index.ts'\nimport { HexRegExMinMax } from '../HexRegEx.ts'\n\nexport const ZERO_ADDRESS = '0000000000000000000000000000000000000000' as Address\nexport const ADDRESS_LENGTH = 40 as const\n\nexport const AddressRegEx = HexRegExMinMax(ADDRESS_LENGTH / 2, ADDRESS_LENGTH / 2)\n\nexport type Address = Brand<Hex, { readonly __address: true }>\n\nexport const UnTypedAddressZod = UntypedHexZod.regex(AddressRegEx)\nexport const AddressZod = UnTypedAddressZod.transform<Address>(v => v as Address)\n","import z from 'zod'\n\nimport { AddressRegEx } from './address.ts'\nimport { toAddress } from './to.ts'\n\n/** @deprecated use AddressZod */\nexport const AddressToStringZod = z.string().regex(AddressRegEx)\n\n/** @deprecated use AddressZod */\n// eslint-disable-next-line sonarjs/deprecation\nexport const AddressToStringSchema = AddressToStringZod\n\n/** @deprecated use AddressZod */\nexport const AddressFromStringZod = z.string().toLowerCase().regex(AddressRegEx).transform(v => toAddress(v))\n\n/** @deprecated use AddressZod */\n// eslint-disable-next-line sonarjs/deprecation\nexport const AddressFromStringSchema = AddressFromStringZod\n","import z from 'zod'\n\nimport { type Address, ADDRESS_LENGTH } from './address.ts'\nimport { AddressValidationZod } from './AddressValidationZod.ts'\n\nexport const AddressTransformZod = z.union([z.string(), z.bigint(), z.number()])\n .transform((value) => {\n switch (typeof value) {\n case 'bigint': {\n return value.toString(16).padStart(ADDRESS_LENGTH, '0')\n }\n case 'string': {\n if (value.startsWith('0x')) {\n return value.slice(2)\n }\n return value\n }\n case 'number': {\n return BigInt(value).toString(16).padStart(ADDRESS_LENGTH, '0')\n }\n }\n })\n .refine(x => AddressValidationZod.safeParse(x).data)\n .transform(x => x as Address)\n\nexport type AddressTransformZodType = z.infer<typeof AddressTransformZod>\n","import z from 'zod'\n\nimport { HexZod } from '../hex/index.ts'\nimport type { Address } from './address.ts'\nimport { ADDRESS_LENGTH } from './address.ts'\n\nexport const AddressValidationZod = z.string()\n .refine(x => HexZod.safeParse(x))\n .refine(x => x.length === ADDRESS_LENGTH, { error: e => new Error(`Address must have 40 characters [${e.input}]`) })\n .transform(v => v as Address)\n\nexport type AddressValidationZodType = z.infer<typeof AddressValidationZod>\n","import type { HexConfig } from '../hex/index.ts'\nimport { hexFrom } from '../hex/index.ts'\nimport type { Address } from './address.ts'\nimport { AddressTransformZod } from './AddressTransformZod.ts'\n\nexport const toAddress = (value: string | number | bigint | ArrayBufferLike, config: HexConfig = {}): Address => {\n const { bitLength = 160, prefix = false } = config\n return hexFrom(value, {\n bitLength, prefix, ...config,\n }) as unknown as Address\n}\n\n/** @alpha */\nexport function toAddressV2(value: unknown, assert: boolean = false): Address | undefined {\n return assert\n ? AddressTransformZod.parse(value)\n : AddressTransformZod.safeParse(value).data\n}\n","import { isObject } from '@xylabs/typeof'\n\nimport type { AssertConfig } from '../assert.ts'\nimport { assertError } from '../assert.ts'\nimport { hexFromHexString } from '../hex/index.ts'\nimport type { Address } from './address.ts'\nimport { AddressValidationZod } from './AddressValidationZod.ts'\nimport { isAddress } from './is.ts'\n\nexport function asAddress(value: unknown): Address | undefined\nexport function asAddress(value: unknown, assert: AssertConfig): Address\nexport function asAddress(value: unknown, assert?: AssertConfig): Address | undefined {\n try {\n let stringValue: string | undefined = undefined\n\n switch (typeof value) {\n case 'string': {\n stringValue = hexFromHexString(value, { prefix: false })\n break\n }\n default: {\n return isObject(assert) ? assertError(value, assert, `Unsupported type [${typeof value}]`) : undefined\n }\n }\n return isAddress(stringValue) ? stringValue : assertError(value, assert, `Value is not an Address [${value}]`)\n } catch (ex) {\n const error = ex as Error\n return assertError(undefined, assert, error.message)\n }\n}\n\n/** @alpha */\nexport function asAddressV2(value: unknown, assert: boolean = false): Address | undefined {\n return assert\n ? AddressValidationZod.parse(value)\n : AddressValidationZod.safeParse(value).data\n}\n","import type { HexConfig } from '../hex/index.ts'\nimport { isHex } from '../hex/index.ts'\nimport type { Address } from './address.ts'\nimport { AddressValidationZod } from './AddressValidationZod.ts'\n\nexport const isAddress = (value: unknown, config: HexConfig = {}): value is Address => {\n const { bitLength = 160, prefix = false } = config\n return isHex(value, { bitLength, prefix })\n}\n\n/** @alpha */\nexport function isAddressV2(value: unknown): value is Address {\n return AddressValidationZod.safeParse(value).success\n}\n","import type { Brand } from '@xylabs/typeof'\nimport z from 'zod'\n\nimport type { AssertConfig } from './assert.ts'\nimport { assertError } from './assert.ts'\nimport type { HexConfig } from './hex/index.ts'\nimport {\n hexFrom, hexFromHexString, isHex,\n} from './hex/index.ts'\nimport { HexRegExMinMaxMixedCaseWithPrefix } from './HexRegEx.ts'\n\nexport const EthAddressRegEx = HexRegExMinMaxMixedCaseWithPrefix(20, 20)\n\nexport const EthAddressToStringZod = z.string().regex(EthAddressRegEx)\n\n/** @deprecated use EthAddressToStringZod */\nexport const EthAddressToStringSchema = EthAddressToStringZod\n\nexport const EthAddressFromStringZod = z.string().regex(EthAddressRegEx).transform(v => toEthAddress(v))\n\n/** @deprecated use EthAddressFromStringZod */\nexport const EthAddressFromStringSchema = EthAddressFromStringZod\n\n// using true instead of unique symbol to avoid conflicts with other versions of library\nexport type EthAddress = Brand<string, { readonly __eth_address: true }>\n\nexport const ETH_ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as EthAddress\n\nexport const toEthAddress = (value: string | number | bigint | ArrayBufferLike, config: HexConfig = {}): EthAddress => {\n const { bitLength = 160, prefix = false } = config\n return `0x${hexFrom(value, {\n bitLength, prefix, ...config,\n })}` as EthAddress\n}\n\nexport const isEthAddress = (value: unknown, config: HexConfig = {}): value is EthAddress => {\n const { bitLength = 160, prefix = true } = config\n const loweredValue = typeof value === 'string' ? value.toLowerCase() : value\n return isHex(loweredValue, { bitLength, prefix })\n}\n\nexport const EthAddressZod = z.string()\n .regex(EthAddressRegEx, { message: 'Invalid address format' })\n .refine(\n isEthAddress,\n )\n\nexport function asEthAddress(value: unknown): EthAddress | undefined\nexport function asEthAddress(value: unknown, assert: AssertConfig): EthAddress\nexport function asEthAddress(value: unknown, assert?: AssertConfig): EthAddress | undefined {\n try {\n let stringValue: string | undefined = undefined\n\n switch (typeof value) {\n case 'string': {\n stringValue = hexFromHexString(value, { prefix: true, byteSize: 4 })\n break\n }\n default: {\n if (value !== undefined) {\n return assertError(value, assert, `Unsupported type [${typeof value}]`)\n }\n }\n }\n return isEthAddress(stringValue) ? stringValue : assertError(value, assert, `Value is not an EthAddress [${value}]`)\n } catch (ex) {\n const error = ex as Error\n return assertError(undefined, assert, error.message)\n }\n}\n","import { isUndefined } from '@xylabs/typeof'\n\nimport type { AssertConfig } from '../assert.ts'\nimport { assertError } from '../assert.ts'\nimport { hexFromHexString } from '../hex/index.ts'\nimport { type Hash } from './hash.ts'\nimport { isHash } from './is.ts'\n\nexport function asHash(value: unknown): Hash | undefined\nexport function asHash(value: unknown, assert: AssertConfig): Hash\nexport function asHash(value: unknown, assert?: AssertConfig): Hash | undefined {\n let stringValue: string | undefined = undefined\n\n switch (typeof value) {\n case 'string': {\n stringValue = hexFromHexString(value)\n break\n }\n default: {\n return isUndefined(assert) ? undefined : assertError(value, assert, `Unsupported type [${typeof value}]`)\n }\n }\n return isHash(stringValue) ? stringValue : assertError(value, assert, `Value is not a Hash [${value}]`)\n}\n","import { isHex } from '../hex/index.ts'\nimport type { Hash, HashBitLength } from './hash.ts'\n\nexport const isHash = (value: unknown, bitLength: HashBitLength = 256): value is Hash => {\n return isHex(value, { bitLength })\n}\n","import type { Brand } from '@xylabs/typeof'\nimport z from 'zod'\n\nimport type { Hex } from '../hex/index.ts'\nimport { HexRegExMinMax } from '../HexRegEx.ts'\n\nexport const HASH_LENGTH = 32 as const\n\nexport const HashRegEx = HexRegExMinMax(HASH_LENGTH, HASH_LENGTH)\n\nexport const ZERO_HASH = '0000000000000000000000000000000000000000000000000000000000000000' as Hash\n\nexport type HashBitLength = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096\nexport const HashBitLength: HashBitLength[] = [32, 64, 128, 256, 512, 1024, 2048, 4096]\n\nexport const isHashBitLength = (value: unknown): value is HashBitLength => {\n return typeof value === 'number' && HashBitLength.includes(value as HashBitLength)\n}\n\nexport type Hash = Brand<Hex, { readonly __hash: true }>\n\nexport const HashZod = z.string()\n .regex(HashRegEx, { message: 'Invalid hex format' }).transform(val => val as Hash)\n","import z from 'zod'\n\nimport { asHash } from './as.ts'\nimport type { Hash } from './hash.ts'\nimport { HashZod } from './hash.ts'\n\nexport const HashToJsonZod = HashZod.transform<string>(v => v)\nexport const JsonToHashZod = z.string().transform<Hash>(v => asHash(v, true))\n","import { type Hex, hexFromHexString } from './hex/index.ts'\n\nexport function hexToBigInt(hex: Hex): bigint {\n return BigInt(hexFromHexString(hex, { prefix: true }))\n}\n"],"mappings":";AAAA,SAAS,UAAU,mBAAmB;AAM/B,IAAM,cAAc,CAAC,OAAgB,QAAkC,mBAA2B;AACvG,MAAI,CAAC,YAAY,MAAM,GAAG;AACxB,UAAM,eACF,OAAO,WAAW,WAChB,SACA,OAAO,WAAW,YAChB,iBACA,OAAO,OAAO,cAAc;AACpC,QAAI,SAAS,YAAY,KAAK,iBAAiB,MAAM;AACnD,YAAM,IAAI,MAAM,iBAAiB,OAAO,iBAAiB,YAAY;AAAA,IACvE;AAAA,EACF;AAEA,SAAO;AACT;;;ACpBA,SAAS,gBAAgB;;;ACAlB,IAAM,iBAAiB,CAAC,WAAW,GAAG,WAAoB,OAAO,mBAAmB,MAAO;AAChG,SAAO,IAAI,OAAO,aAAa,WAAW,CAAC,IAAI,WAAW,CAAC,IAAI;AACjE;AAEO,IAAM,oCAAoC,CAAC,WAAW,GAAG,WAAoB,OAAO,mBAAmB,MAAO;AACnH,SAAO,IAAI,OAAO,kBAAkB,WAAW,CAAC,IAAI,WAAW,CAAC,IAAI;AACtE;AAEO,IAAM,WAAW;AACjB,IAAM,qBAAqB;;;ACR3B,IAAM,gBAAgB,CAAC,UAA0B;AACtD,QAAM,UAAU,SAAS;AACzB,MAAI,UAAU,WAAW,EAAG,OAAM,IAAI,MAAM,qCAAqC;AACjF,SAAO;AACT;AAGO,IAAM,gBAAgB,CAAC,UAA0B;AACtD,SAAO,SAAS;AAClB;;;ACNO,IAAM,QAAQ,CAAC,OAAgB,WAAqC;AAEzE,MAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,QAAM,kBAAkB,QAAQ,SAAS,MAAM,SAAS,IAAI,MAA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
- import type { Brand as TypeOfBrand } from '@xylabs/typeof'
2
-
3
- /** @deprecated use from @xylabs/typeof instead */
4
- export type Brand<T, B> = TypeOfBrand<T, B>
@@ -1,7 +0,0 @@
1
- export * from './address/index.ts'
2
- export * from './assert.ts'
3
- export * from './ethAddress.ts'
4
- export * from './hash/index.ts'
5
- export * from './hex/index.ts'
6
- export * from './HexRegEx.ts'
7
- export * from './hexToBigInt.ts'