@xylabs/hex 5.0.95 → 5.0.97

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.
package/README.md CHANGED
@@ -1,130 +1,76 @@
1
1
  # @xylabs/hex
2
2
 
3
- [![logo][]](https://xylabs.com)
3
+ [![npm][npm-badge]][npm-link]
4
+ [![license][license-badge]][license-link]
4
5
 
5
- [![main-build][]][main-build-link]
6
- [![npm-badge][]][npm-link]
7
- [![npm-downloads-badge][]][npm-link]
8
- [![jsdelivr-badge][]][jsdelivr-link]
9
- [![npm-license-badge][]](LICENSE)
10
- [![codacy-badge][]][codacy-link]
11
- [![codeclimate-badge][]][codeclimate-link]
12
- [![snyk-badge][]][snyk-link]
13
- [![socket-badge][]][socket-link]
6
+ > Base functionality used throughout XY Labs TypeScript/JavaScript libraries
14
7
 
8
+ ## Install
15
9
 
16
- Base functionality used throughout XY Labs TypeScript/JavaScript libraries
10
+ Using npm:
11
+
12
+ ```sh
13
+ npm install {{name}}
14
+ ```
15
+
16
+ Using yarn:
17
+
18
+ ```sh
19
+ yarn add {{name}}
20
+ ```
21
+
22
+ Using pnpm:
23
+
24
+ ```sh
25
+ pnpm add {{name}}
26
+ ```
27
+
28
+ Using bun:
29
+
30
+ ```sh
31
+ bun add {{name}}
32
+ ```
17
33
 
18
34
 
35
+ ## License
36
+
37
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
19
38
 
20
39
  ## Reference
21
40
 
22
- **@xylabs/hex**
23
-
24
- ***
25
-
26
- ## Interfaces
27
-
28
- | Interface | Description |
29
- | ------ | ------ |
30
- | [HexConfig](#interfaces/HexConfig) | Configuration of validation and output format |
31
-
32
- ## Type Aliases
33
-
34
- | Type Alias | Description |
35
- | ------ | ------ |
36
- | [AddressTransformZodType](#type-aliases/AddressTransformZodType) | The output type of AddressTransformZod after parsing and transformation. |
37
- | [AddressValidationZodType](#type-aliases/AddressValidationZodType) | The output type of AddressValidationZod after parsing. |
38
- | [Address](#type-aliases/Address) | A validated 20-byte address string type, inferred from the AddressZod schema. |
39
- | [EthAddress](#type-aliases/EthAddress) | Branded type representing a validated Ethereum address with 0x prefix. |
40
- | [HashBitLength](#type-aliases/HashBitLength) | Valid bit lengths for hash values. |
41
- | [BrandedHash](#type-aliases/BrandedHash) | Branded type representing a validated hash hex string. |
42
- | [Hash](#type-aliases/Hash) | A validated hash string type, inferred from the HashZod schema. |
43
- | [BrandedHex](#type-aliases/BrandedHex) | Branded type representing a validated lowercase hex string. |
44
- | [Hex](#type-aliases/Hex) | A validated hex string type, inferred from the HexZod schema. |
45
-
46
- ## Variables
47
-
48
- | Variable | Description |
49
- | ------ | ------ |
50
- | [HexRegEx](#variables/HexRegEx) | Regular expression matching a lowercase hex string without prefix. |
51
- | [HexRegExWithPrefix](#variables/HexRegExWithPrefix) | Regular expression matching a lowercase hex string with a 0x prefix. |
52
- | [AddressTransformZod](#variables/AddressTransformZod) | Zod schema that accepts a string, bigint, or number and transforms it into a validated Address. |
53
- | [AddressValidationZod](#variables/AddressValidationZod) | Zod schema that validates a string is a properly formatted 40-character hex address. |
54
- | [ZERO\_ADDRESS](#variables/ZERO_ADDRESS) | A 160-bit zero address constant. |
55
- | [ADDRESS\_LENGTH](#variables/ADDRESS_LENGTH) | The character length of an address hex string (40 hex characters / 20 bytes). |
56
- | [AddressRegEx](#variables/AddressRegEx) | Regular expression matching a 20-byte (40 hex character) address string. |
57
- | [AddressZod](#variables/AddressZod) | Zod schema that validates and transforms a string into a branded Address type. |
58
- | [EthAddressRegEx](#variables/EthAddressRegEx) | Regular expression matching a 20-byte Ethereum address with 0x prefix (mixed case). |
59
- | [EthAddressToStringZod](#variables/EthAddressToStringZod) | Zod schema that validates a string is a properly formatted Ethereum address. |
60
- | [~~EthAddressToStringSchema~~](#variables/EthAddressToStringSchema) | - |
61
- | [EthAddressFromStringZod](#variables/EthAddressFromStringZod) | Zod schema that validates and transforms a string into an EthAddress type. |
62
- | [~~EthAddressFromStringSchema~~](#variables/EthAddressFromStringSchema) | - |
63
- | [ETH\_ZERO\_ADDRESS](#variables/ETH_ZERO_ADDRESS) | The zero Ethereum address constant (0x followed by 40 zero characters). |
64
- | [EthAddressZod](#variables/EthAddressZod) | Zod schema that validates a string as a properly formatted Ethereum address using regex and type guard. |
65
- | [HASH\_LENGTH](#variables/HASH_LENGTH) | The byte length of a standard hash (32 bytes / 256 bits). |
66
- | [HashRegEx](#variables/HashRegEx) | Regular expression matching a 32-byte (64 hex character) hash string. |
67
- | [ZERO\_HASH](#variables/ZERO_HASH) | A 256-bit zero hash constant. |
68
- | [HashBitLength](#variables/HashBitLength) | Array of all valid hash bit lengths for runtime validation. |
69
- | [HashZod](#variables/HashZod) | Zod schema that validates and transforms a string into a branded Hash type. |
70
- | [HashToJsonZod](#variables/HashToJsonZod) | Zod schema that transforms a Hash to a plain string for JSON serialization. |
71
- | [JsonToHashZod](#variables/JsonToHashZod) | Zod schema that parses a JSON string into a validated Hash, throwing on invalid input. |
72
- | [HexZod](#variables/HexZod) | Zod schema that validates and transforms a string into a branded Hex type. |
73
- | [BigIntToJsonZod](#variables/BigIntToJsonZod) | Zod schema that transforms a non-negative BigInt into a hex string for JSON serialization. |
74
- | [JsonToBigIntZod](#variables/JsonToBigIntZod) | Zod schema that parses a JSON hex string into a BigInt. |
75
-
76
- ## Functions
77
-
78
- | Function | Description |
79
- | ------ | ------ |
80
- | [HexRegExMinMax](#functions/HexRegExMinMax) | Creates a RegExp matching lowercase hex strings with a byte length in the given range. |
81
- | [HexRegExMinMaxMixedCaseWithPrefix](#functions/HexRegExMinMaxMixedCaseWithPrefix) | Creates a RegExp matching mixed-case hex strings with a 0x prefix and a byte length in the given range. |
82
- | [asAddress](#functions/asAddress) | Attempts to coerce a value into an Address type, returning undefined or throwing based on the assert config. |
83
- | [asAddressV2](#functions/asAddressV2) | - |
84
- | [isAddress](#functions/isAddress) | Type guard that checks whether a value is a valid 160-bit address. |
85
- | [isAddressV2](#functions/isAddressV2) | - |
86
- | [toAddress](#functions/toAddress) | Converts a value to a 160-bit Address hex string. |
87
- | [toAddressV2](#functions/toAddressV2) | - |
88
- | [toEthAddress](#functions/toEthAddress) | Converts a value to a 0x-prefixed Ethereum address string. |
89
- | [isEthAddress](#functions/isEthAddress) | Type guard that checks whether a value is a valid 0x-prefixed Ethereum address. |
90
- | [asEthAddress](#functions/asEthAddress) | Attempts to coerce a value into an EthAddress, returning undefined or throwing based on the assert config. |
91
- | [asHash](#functions/asHash) | Attempts to coerce a value into a Hash type, returning undefined or throwing based on the assert config. |
92
- | [isHashBitLength](#functions/isHashBitLength) | Type guard that checks whether a value is a valid hash bit length. |
93
- | [isHash](#functions/isHash) | Type guard that checks whether a value is a valid hash of the specified bit length. |
94
- | [asHex](#functions/asHex) | Attempts to coerce a value into a Hex type, returning undefined or throwing based on the assert config. |
95
- | [hexFrom](#functions/hexFrom) | Takes unknown value and tries our best to convert it to a hex string |
96
- | [hexFromArrayBuffer](#functions/hexFromArrayBuffer) | Convert an ArrayBuffer to a hex string |
97
- | [hexFromBigInt](#functions/hexFromBigInt) | Convert a bigint to a hex string |
98
- | [hexFromHexString](#functions/hexFromHexString) | Normalizes a hex string by stripping an optional 0x prefix, lowercasing, and padding to byte/bit boundaries. |
99
- | [hexFromNumber](#functions/hexFromNumber) | Converts a number to a hex string by converting to BigInt first. |
100
- | [isHex](#functions/isHex) | Type guard that checks whether a value is a valid hex string. |
101
- | [isHexZero](#functions/isHexZero) | Checks whether a hex string represents a zero value. |
102
- | [toHexLegacy](#functions/toHexLegacy) | Converts an ArrayBuffer to a hex string without padding or normalization. |
103
- | [bitsToNibbles](#functions/bitsToNibbles) | Converts a bit count to the equivalent number of hex nibbles (4 bits each). |
104
- | [nibblesToBits](#functions/nibblesToBits) | Converts a nibble count to the equivalent number of bits. |
105
- | [toHex](#functions/toHex) | takes any value and tries our best to convert it to a hex string |
106
- | [hexToBigInt](#functions/hexToBigInt) | Converts a Hex string to a BigInt. |
107
-
108
- ### functions
109
-
110
- ### <a id="HexRegExMinMax"></a>HexRegExMinMax
41
+ ### packages
42
+
43
+ ### hex
44
+
45
+ ### .temp-typedoc
46
+
47
+ ### functions
48
+
49
+ ### <a id="HexRegExMinMax"></a>HexRegExMinMax
111
50
 
112
51
  [**@xylabs/hex**](#../README)
113
52
 
114
53
  ***
115
54
 
116
55
  ```ts
117
- function HexRegExMinMax(minBytes?: number, maxBytes?: number): RegExp;
56
+ function HexRegExMinMax(minBytes?, maxBytes?): RegExp;
118
57
  ```
119
58
 
120
59
  Creates a RegExp matching lowercase hex strings with a byte length in the given range.
121
60
 
122
61
  ## Parameters
123
62
 
124
- | Parameter | Type | Default value | Description |
125
- | ------ | ------ | ------ | ------ |
126
- | `minBytes` | `number` | `0` | Minimum number of bytes (default 0) |
127
- | `maxBytes` | `number` | `...` | Maximum number of bytes |
63
+ ### minBytes?
64
+
65
+ `number` = `0`
66
+
67
+ Minimum number of bytes (default 0)
68
+
69
+ ### maxBytes?
70
+
71
+ `number` = `...`
72
+
73
+ Maximum number of bytes
128
74
 
129
75
  ## Returns
130
76
 
@@ -132,24 +78,31 @@ Creates a RegExp matching lowercase hex strings with a byte length in the given
132
78
 
133
79
  A RegExp for validating hex strings within the byte range
134
80
 
135
- ### <a id="HexRegExMinMaxMixedCaseWithPrefix"></a>HexRegExMinMaxMixedCaseWithPrefix
81
+ ### <a id="HexRegExMinMaxMixedCaseWithPrefix"></a>HexRegExMinMaxMixedCaseWithPrefix
136
82
 
137
83
  [**@xylabs/hex**](#../README)
138
84
 
139
85
  ***
140
86
 
141
87
  ```ts
142
- function HexRegExMinMaxMixedCaseWithPrefix(minBytes?: number, maxBytes?: number): RegExp;
88
+ function HexRegExMinMaxMixedCaseWithPrefix(minBytes?, maxBytes?): RegExp;
143
89
  ```
144
90
 
145
91
  Creates a RegExp matching mixed-case hex strings with a 0x prefix and a byte length in the given range.
146
92
 
147
93
  ## Parameters
148
94
 
149
- | Parameter | Type | Default value | Description |
150
- | ------ | ------ | ------ | ------ |
151
- | `minBytes` | `number` | `0` | Minimum number of bytes (default 0) |
152
- | `maxBytes` | `number` | `...` | Maximum number of bytes |
95
+ ### minBytes?
96
+
97
+ `number` = `0`
98
+
99
+ Minimum number of bytes (default 0)
100
+
101
+ ### maxBytes?
102
+
103
+ `number` = `...`
104
+
105
+ Maximum number of bytes
153
106
 
154
107
  ## Returns
155
108
 
@@ -157,7 +110,7 @@ Creates a RegExp matching mixed-case hex strings with a 0x prefix and a byte len
157
110
 
158
111
  A RegExp for validating prefixed hex strings within the byte range
159
112
 
160
- ### <a id="asAddress"></a>asAddress
113
+ ### <a id="asAddress"></a>asAddress
161
114
 
162
115
  [**@xylabs/hex**](#../README)
163
116
 
@@ -166,16 +119,18 @@ A RegExp for validating prefixed hex strings within the byte range
166
119
  ## Call Signature
167
120
 
168
121
  ```ts
169
- function asAddress(value: unknown): BrandedAddress | undefined;
122
+ function asAddress(value?): BrandedAddress | undefined;
170
123
  ```
171
124
 
172
125
  Attempts to coerce a value into an Address type, returning undefined or throwing based on the assert config.
173
126
 
174
127
  ### Parameters
175
128
 
176
- | Parameter | Type | Description |
177
- | ------ | ------ | ------ |
178
- | `value` | `unknown` | The value to coerce (must be a string) |
129
+ ### value?
130
+
131
+ `unknown`
132
+
133
+ The value to coerce (must be a string)
179
134
 
180
135
  ### Returns
181
136
 
@@ -186,17 +141,24 @@ The value as Address, or undefined if coercion fails and assert is not set
186
141
  ## Call Signature
187
142
 
188
143
  ```ts
189
- function asAddress(value: unknown, assert: AssertConfig): BrandedAddress;
144
+ function asAddress(value, assert): BrandedAddress;
190
145
  ```
191
146
 
192
147
  Attempts to coerce a value into an Address type, returning undefined or throwing based on the assert config.
193
148
 
194
149
  ### Parameters
195
150
 
196
- | Parameter | Type | Description |
197
- | ------ | ------ | ------ |
198
- | `value` | `unknown` | The value to coerce (must be a string) |
199
- | `assert` | `AssertConfig` | If provided, throws on failure instead of returning undefined |
151
+ ### value
152
+
153
+ `unknown`
154
+
155
+ The value to coerce (must be a string)
156
+
157
+ ### assert
158
+
159
+ `AssertConfig`
160
+
161
+ If provided, throws on failure instead of returning undefined
200
162
 
201
163
  ### Returns
202
164
 
@@ -204,30 +166,33 @@ Attempts to coerce a value into an Address type, returning undefined or throwing
204
166
 
205
167
  The value as Address, or undefined if coercion fails and assert is not set
206
168
 
207
- ### <a id="asAddressV2"></a>asAddressV2
169
+ ### <a id="asAddressV2"></a>asAddressV2
208
170
 
209
171
  [**@xylabs/hex**](#../README)
210
172
 
211
173
  ***
212
174
 
213
175
  ```ts
214
- function asAddressV2(value: unknown, assert?: boolean): BrandedAddress | undefined;
176
+ function asAddressV2(value?, assert?): BrandedAddress | undefined;
215
177
  ```
216
178
 
217
179
  **`Alpha`**
218
180
 
219
181
  ## Parameters
220
182
 
221
- | Parameter | Type | Default value |
222
- | ------ | ------ | ------ |
223
- | `value` | `unknown` | `undefined` |
224
- | `assert` | `boolean` | `false` |
183
+ ### value?
184
+
185
+ `unknown`
186
+
187
+ ### assert?
188
+
189
+ `boolean` = `false`
225
190
 
226
191
  ## Returns
227
192
 
228
193
  `BrandedAddress` \| `undefined`
229
194
 
230
- ### <a id="asEthAddress"></a>asEthAddress
195
+ ### <a id="asEthAddress"></a>asEthAddress
231
196
 
232
197
  [**@xylabs/hex**](#../README)
233
198
 
@@ -236,16 +201,18 @@ function asAddressV2(value: unknown, assert?: boolean): BrandedAddress | undefin
236
201
  ## Call Signature
237
202
 
238
203
  ```ts
239
- function asEthAddress(value: unknown): EthAddress | undefined;
204
+ function asEthAddress(value): EthAddress | undefined;
240
205
  ```
241
206
 
242
207
  Attempts to coerce a value into an EthAddress, returning undefined or throwing based on the assert config.
243
208
 
244
209
  ### Parameters
245
210
 
246
- | Parameter | Type | Description |
247
- | ------ | ------ | ------ |
248
- | `value` | `unknown` | The value to coerce (must be a string) |
211
+ ### value
212
+
213
+ `unknown`
214
+
215
+ The value to coerce (must be a string)
249
216
 
250
217
  ### Returns
251
218
 
@@ -256,17 +223,24 @@ The value as EthAddress, or undefined if coercion fails and assert is not set
256
223
  ## Call Signature
257
224
 
258
225
  ```ts
259
- function asEthAddress(value: unknown, assert: AssertConfig): EthAddress;
226
+ function asEthAddress(value, assert): EthAddress;
260
227
  ```
261
228
 
262
229
  Attempts to coerce a value into an EthAddress, returning undefined or throwing based on the assert config.
263
230
 
264
231
  ### Parameters
265
232
 
266
- | Parameter | Type | Description |
267
- | ------ | ------ | ------ |
268
- | `value` | `unknown` | The value to coerce (must be a string) |
269
- | `assert` | `AssertConfig` | If provided, throws on failure instead of returning undefined |
233
+ ### value
234
+
235
+ `unknown`
236
+
237
+ The value to coerce (must be a string)
238
+
239
+ ### assert
240
+
241
+ `AssertConfig`
242
+
243
+ If provided, throws on failure instead of returning undefined
270
244
 
271
245
  ### Returns
272
246
 
@@ -274,7 +248,7 @@ Attempts to coerce a value into an EthAddress, returning undefined or throwing b
274
248
 
275
249
  The value as EthAddress, or undefined if coercion fails and assert is not set
276
250
 
277
- ### <a id="asHash"></a>asHash
251
+ ### <a id="asHash"></a>asHash
278
252
 
279
253
  [**@xylabs/hex**](#../README)
280
254
 
@@ -283,16 +257,18 @@ The value as EthAddress, or undefined if coercion fails and assert is not set
283
257
  ## Call Signature
284
258
 
285
259
  ```ts
286
- function asHash(value: unknown): BrandedHash | undefined;
260
+ function asHash(value): BrandedHash | undefined;
287
261
  ```
288
262
 
289
263
  Attempts to coerce a value into a Hash type, returning undefined or throwing based on the assert config.
290
264
 
291
265
  ### Parameters
292
266
 
293
- | Parameter | Type | Description |
294
- | ------ | ------ | ------ |
295
- | `value` | `unknown` | The value to coerce (must be a string) |
267
+ ### value
268
+
269
+ `unknown`
270
+
271
+ The value to coerce (must be a string)
296
272
 
297
273
  ### Returns
298
274
 
@@ -303,17 +279,24 @@ The value as Hash, or undefined if coercion fails and assert is not set
303
279
  ## Call Signature
304
280
 
305
281
  ```ts
306
- function asHash(value: unknown, assert: AssertConfig): BrandedHash;
282
+ function asHash(value, assert): BrandedHash;
307
283
  ```
308
284
 
309
285
  Attempts to coerce a value into a Hash type, returning undefined or throwing based on the assert config.
310
286
 
311
287
  ### Parameters
312
288
 
313
- | Parameter | Type | Description |
314
- | ------ | ------ | ------ |
315
- | `value` | `unknown` | The value to coerce (must be a string) |
316
- | `assert` | `AssertConfig` | If provided, throws on failure instead of returning undefined |
289
+ ### value
290
+
291
+ `unknown`
292
+
293
+ The value to coerce (must be a string)
294
+
295
+ ### assert
296
+
297
+ `AssertConfig`
298
+
299
+ If provided, throws on failure instead of returning undefined
317
300
 
318
301
  ### Returns
319
302
 
@@ -321,7 +304,7 @@ Attempts to coerce a value into a Hash type, returning undefined or throwing bas
321
304
 
322
305
  The value as Hash, or undefined if coercion fails and assert is not set
323
306
 
324
- ### <a id="asHex"></a>asHex
307
+ ### <a id="asHex"></a>asHex
325
308
 
326
309
  [**@xylabs/hex**](#../README)
327
310
 
@@ -330,16 +313,18 @@ The value as Hash, or undefined if coercion fails and assert is not set
330
313
  ## Call Signature
331
314
 
332
315
  ```ts
333
- function asHex(value: unknown): BrandedHex | undefined;
316
+ function asHex(value): BrandedHex | undefined;
334
317
  ```
335
318
 
336
319
  Attempts to coerce a value into a Hex type, returning undefined or throwing based on the assert config.
337
320
 
338
321
  ### Parameters
339
322
 
340
- | Parameter | Type | Description |
341
- | ------ | ------ | ------ |
342
- | `value` | `unknown` | The value to coerce (must be a string) |
323
+ ### value
324
+
325
+ `unknown`
326
+
327
+ The value to coerce (must be a string)
343
328
 
344
329
  ### Returns
345
330
 
@@ -350,17 +335,24 @@ The value as Hex, or undefined if coercion fails and assert is not set
350
335
  ## Call Signature
351
336
 
352
337
  ```ts
353
- function asHex(value: unknown, assert: AssertConfig): BrandedHex;
338
+ function asHex(value, assert): BrandedHex;
354
339
  ```
355
340
 
356
341
  Attempts to coerce a value into a Hex type, returning undefined or throwing based on the assert config.
357
342
 
358
343
  ### Parameters
359
344
 
360
- | Parameter | Type | Description |
361
- | ------ | ------ | ------ |
362
- | `value` | `unknown` | The value to coerce (must be a string) |
363
- | `assert` | `AssertConfig` | If provided, throws on failure instead of returning undefined |
345
+ ### value
346
+
347
+ `unknown`
348
+
349
+ The value to coerce (must be a string)
350
+
351
+ ### assert
352
+
353
+ `AssertConfig`
354
+
355
+ If provided, throws on failure instead of returning undefined
364
356
 
365
357
  ### Returns
366
358
 
@@ -368,23 +360,25 @@ Attempts to coerce a value into a Hex type, returning undefined or throwing base
368
360
 
369
361
  The value as Hex, or undefined if coercion fails and assert is not set
370
362
 
371
- ### <a id="bitsToNibbles"></a>bitsToNibbles
363
+ ### <a id="bitsToNibbles"></a>bitsToNibbles
372
364
 
373
365
  [**@xylabs/hex**](#../README)
374
366
 
375
367
  ***
376
368
 
377
369
  ```ts
378
- function bitsToNibbles(value: number): number;
370
+ function bitsToNibbles(value): number;
379
371
  ```
380
372
 
381
373
  Converts a bit count to the equivalent number of hex nibbles (4 bits each).
382
374
 
383
375
  ## Parameters
384
376
 
385
- | Parameter | Type | Description |
386
- | ------ | ------ | ------ |
387
- | `value` | `number` | The number of bits (must be a multiple of 4) |
377
+ ### value
378
+
379
+ `number`
380
+
381
+ The number of bits (must be a multiple of 4)
388
382
 
389
383
  ## Returns
390
384
 
@@ -392,93 +386,121 @@ Converts a bit count to the equivalent number of hex nibbles (4 bits each).
392
386
 
393
387
  The number of nibbles
394
388
 
395
- ### <a id="hexFrom"></a>hexFrom
389
+ ### <a id="hexFrom"></a>hexFrom
396
390
 
397
391
  [**@xylabs/hex**](#../README)
398
392
 
399
393
  ***
400
394
 
401
395
  ```ts
402
- function hexFrom(value: string | number | bigint | ArrayBufferLike, config?: HexConfig): BrandedHex;
396
+ function hexFrom(value, config?): BrandedHex;
403
397
  ```
404
398
 
405
399
  Takes unknown value and tries our best to convert it to a hex string
406
400
 
407
401
  ## Parameters
408
402
 
409
- | Parameter | Type | Description |
410
- | ------ | ------ | ------ |
411
- | `value` | `string` \| `number` \| `bigint` \| `ArrayBufferLike` | Supported types are string, number, bigint, and ArrayBuffer |
412
- | `config?` | [`HexConfig`](#../interfaces/HexConfig) | Configuration of output format and validation |
403
+ ### value
404
+
405
+ `string` \| `number` \| `bigint` \| `ArrayBufferLike`
406
+
407
+ Supported types are string, number, bigint, and ArrayBuffer
408
+
409
+ ### config?
410
+
411
+ [`HexConfig`](#../interfaces/HexConfig)
412
+
413
+ Configuration of output format and validation
413
414
 
414
415
  ## Returns
415
416
 
416
417
  [`BrandedHex`](#../type-aliases/BrandedHex)
417
418
 
418
- ### <a id="hexFromArrayBuffer"></a>hexFromArrayBuffer
419
+ ### <a id="hexFromArrayBuffer"></a>hexFromArrayBuffer
419
420
 
420
421
  [**@xylabs/hex**](#../README)
421
422
 
422
423
  ***
423
424
 
424
425
  ```ts
425
- function hexFromArrayBuffer(buffer: ArrayBufferLike, config?: HexConfig): BrandedHex;
426
+ function hexFromArrayBuffer(buffer, config?): BrandedHex;
426
427
  ```
427
428
 
428
429
  Convert an ArrayBuffer to a hex string
429
430
 
430
431
  ## Parameters
431
432
 
432
- | Parameter | Type | Description |
433
- | ------ | ------ | ------ |
434
- | `buffer` | `ArrayBufferLike` | The buffer to be converted |
435
- | `config?` | [`HexConfig`](#../interfaces/HexConfig) | Configuration of output format and validation |
433
+ ### buffer
434
+
435
+ `ArrayBufferLike`
436
+
437
+ The buffer to be converted
438
+
439
+ ### config?
440
+
441
+ [`HexConfig`](#../interfaces/HexConfig)
442
+
443
+ Configuration of output format and validation
436
444
 
437
445
  ## Returns
438
446
 
439
447
  [`BrandedHex`](#../type-aliases/BrandedHex)
440
448
 
441
- ### <a id="hexFromBigInt"></a>hexFromBigInt
449
+ ### <a id="hexFromBigInt"></a>hexFromBigInt
442
450
 
443
451
  [**@xylabs/hex**](#../README)
444
452
 
445
453
  ***
446
454
 
447
455
  ```ts
448
- function hexFromBigInt(value: bigint, config?: HexConfig): BrandedHex;
456
+ function hexFromBigInt(value, config?): BrandedHex;
449
457
  ```
450
458
 
451
459
  Convert a bigint to a hex string
452
460
 
453
461
  ## Parameters
454
462
 
455
- | Parameter | Type | Description |
456
- | ------ | ------ | ------ |
457
- | `value` | `bigint` | The bigint to be converted |
458
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Configuration of output format and validation |
463
+ ### value
464
+
465
+ `bigint`
466
+
467
+ The bigint to be converted
468
+
469
+ ### config?
470
+
471
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
472
+
473
+ Configuration of output format and validation
459
474
 
460
475
  ## Returns
461
476
 
462
477
  [`BrandedHex`](#../type-aliases/BrandedHex)
463
478
 
464
- ### <a id="hexFromHexString"></a>hexFromHexString
479
+ ### <a id="hexFromHexString"></a>hexFromHexString
465
480
 
466
481
  [**@xylabs/hex**](#../README)
467
482
 
468
483
  ***
469
484
 
470
485
  ```ts
471
- function hexFromHexString(value: string, config?: HexConfig): BrandedHex;
486
+ function hexFromHexString(value, config?): BrandedHex;
472
487
  ```
473
488
 
474
489
  Normalizes a hex string by stripping an optional 0x prefix, lowercasing, and padding to byte/bit boundaries.
475
490
 
476
491
  ## Parameters
477
492
 
478
- | Parameter | Type | Description |
479
- | ------ | ------ | ------ |
480
- | `value` | `string` | The hex string to normalize (with or without 0x prefix) |
481
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Configuration for prefix, byteSize, and bitLength padding |
493
+ ### value
494
+
495
+ `string`
496
+
497
+ The hex string to normalize (with or without 0x prefix)
498
+
499
+ ### config?
500
+
501
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
502
+
503
+ Configuration for prefix, byteSize, and bitLength padding
482
504
 
483
505
  ## Returns
484
506
 
@@ -486,24 +508,31 @@ Normalizes a hex string by stripping an optional 0x prefix, lowercasing, and pad
486
508
 
487
509
  The normalized Hex string
488
510
 
489
- ### <a id="hexFromNumber"></a>hexFromNumber
511
+ ### <a id="hexFromNumber"></a>hexFromNumber
490
512
 
491
513
  [**@xylabs/hex**](#../README)
492
514
 
493
515
  ***
494
516
 
495
517
  ```ts
496
- function hexFromNumber(value: number, config?: HexConfig): BrandedHex;
518
+ function hexFromNumber(value, config?): BrandedHex;
497
519
  ```
498
520
 
499
521
  Converts a number to a hex string by converting to BigInt first.
500
522
 
501
523
  ## Parameters
502
524
 
503
- | Parameter | Type | Description |
504
- | ------ | ------ | ------ |
505
- | `value` | `number` | The number to convert |
506
- | `config?` | [`HexConfig`](#../interfaces/HexConfig) | Optional hex output configuration |
525
+ ### value
526
+
527
+ `number`
528
+
529
+ The number to convert
530
+
531
+ ### config?
532
+
533
+ [`HexConfig`](#../interfaces/HexConfig)
534
+
535
+ Optional hex output configuration
507
536
 
508
537
  ## Returns
509
538
 
@@ -511,23 +540,25 @@ Converts a number to a hex string by converting to BigInt first.
511
540
 
512
541
  The hex string representation
513
542
 
514
- ### <a id="hexToBigInt"></a>hexToBigInt
543
+ ### <a id="hexToBigInt"></a>hexToBigInt
515
544
 
516
545
  [**@xylabs/hex**](#../README)
517
546
 
518
547
  ***
519
548
 
520
549
  ```ts
521
- function hexToBigInt(hex: BrandedHex): bigint;
550
+ function hexToBigInt(hex): bigint;
522
551
  ```
523
552
 
524
553
  Converts a Hex string to a BigInt.
525
554
 
526
555
  ## Parameters
527
556
 
528
- | Parameter | Type | Description |
529
- | ------ | ------ | ------ |
530
- | `hex` | [`BrandedHex`](#../type-aliases/BrandedHex) | The hex string to convert |
557
+ ### hex
558
+
559
+ [`BrandedHex`](#../type-aliases/BrandedHex)
560
+
561
+ The hex string to convert
531
562
 
532
563
  ## Returns
533
564
 
@@ -535,24 +566,31 @@ Converts a Hex string to a BigInt.
535
566
 
536
567
  The BigInt representation of the hex value
537
568
 
538
- ### <a id="isAddress"></a>isAddress
569
+ ### <a id="isAddress"></a>isAddress
539
570
 
540
571
  [**@xylabs/hex**](#../README)
541
572
 
542
573
  ***
543
574
 
544
575
  ```ts
545
- function isAddress(value: unknown, config?: HexConfig): value is BrandedAddress;
576
+ function isAddress(value?, config?): value is BrandedAddress;
546
577
  ```
547
578
 
548
579
  Type guard that checks whether a value is a valid 160-bit address.
549
580
 
550
581
  ## Parameters
551
582
 
552
- | Parameter | Type | Description |
553
- | ------ | ------ | ------ |
554
- | `value` | `unknown` | The value to check |
555
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Optional hex config (defaults to 160-bit, no prefix) |
583
+ ### value?
584
+
585
+ `unknown`
586
+
587
+ The value to check
588
+
589
+ ### config?
590
+
591
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
592
+
593
+ Optional hex config (defaults to 160-bit, no prefix)
556
594
 
557
595
  ## Returns
558
596
 
@@ -560,46 +598,53 @@ Type guard that checks whether a value is a valid 160-bit address.
560
598
 
561
599
  True if the value is a valid Address
562
600
 
563
- ### <a id="isAddressV2"></a>isAddressV2
601
+ ### <a id="isAddressV2"></a>isAddressV2
564
602
 
565
603
  [**@xylabs/hex**](#../README)
566
604
 
567
605
  ***
568
606
 
569
607
  ```ts
570
- function isAddressV2(value: unknown): value is BrandedAddress;
608
+ function isAddressV2(value?): value is BrandedAddress;
571
609
  ```
572
610
 
573
611
  **`Alpha`**
574
612
 
575
613
  ## Parameters
576
614
 
577
- | Parameter | Type |
578
- | ------ | ------ |
579
- | `value` | `unknown` |
615
+ ### value?
616
+
617
+ `unknown`
580
618
 
581
619
  ## Returns
582
620
 
583
621
  `value is BrandedAddress`
584
622
 
585
- ### <a id="isEthAddress"></a>isEthAddress
623
+ ### <a id="isEthAddress"></a>isEthAddress
586
624
 
587
625
  [**@xylabs/hex**](#../README)
588
626
 
589
627
  ***
590
628
 
591
629
  ```ts
592
- function isEthAddress(value: unknown, config?: HexConfig): value is EthAddress;
630
+ function isEthAddress(value?, config?): value is EthAddress;
593
631
  ```
594
632
 
595
633
  Type guard that checks whether a value is a valid 0x-prefixed Ethereum address.
596
634
 
597
635
  ## Parameters
598
636
 
599
- | Parameter | Type | Description |
600
- | ------ | ------ | ------ |
601
- | `value` | `unknown` | The value to check |
602
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Optional hex config (defaults to 160-bit with prefix) |
637
+ ### value?
638
+
639
+ `unknown`
640
+
641
+ The value to check
642
+
643
+ ### config?
644
+
645
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
646
+
647
+ Optional hex config (defaults to 160-bit with prefix)
603
648
 
604
649
  ## Returns
605
650
 
@@ -607,24 +652,31 @@ Type guard that checks whether a value is a valid 0x-prefixed Ethereum address.
607
652
 
608
653
  True if the value is a valid EthAddress
609
654
 
610
- ### <a id="isHash"></a>isHash
655
+ ### <a id="isHash"></a>isHash
611
656
 
612
657
  [**@xylabs/hex**](#../README)
613
658
 
614
659
  ***
615
660
 
616
661
  ```ts
617
- function isHash(value: unknown, bitLength?: HashBitLength): value is BrandedHash;
662
+ function isHash(value, bitLength?): value is BrandedHash;
618
663
  ```
619
664
 
620
665
  Type guard that checks whether a value is a valid hash of the specified bit length.
621
666
 
622
667
  ## Parameters
623
668
 
624
- | Parameter | Type | Default value | Description |
625
- | ------ | ------ | ------ | ------ |
626
- | `value` | `unknown` | `undefined` | The value to check |
627
- | `bitLength` | [`HashBitLength`](#../type-aliases/HashBitLength) | `256` | The expected bit length of the hash (defaults to 256) |
669
+ ### value
670
+
671
+ `unknown`
672
+
673
+ The value to check
674
+
675
+ ### bitLength?
676
+
677
+ [`HashBitLength`](#../type-aliases/HashBitLength) = `256`
678
+
679
+ The expected bit length of the hash (defaults to 256)
628
680
 
629
681
  ## Returns
630
682
 
@@ -632,23 +684,25 @@ Type guard that checks whether a value is a valid hash of the specified bit leng
632
684
 
633
685
  True if the value is a valid Hash
634
686
 
635
- ### <a id="isHashBitLength"></a>isHashBitLength
687
+ ### <a id="isHashBitLength"></a>isHashBitLength
636
688
 
637
689
  [**@xylabs/hex**](#../README)
638
690
 
639
691
  ***
640
692
 
641
693
  ```ts
642
- function isHashBitLength(value: unknown): value is HashBitLength;
694
+ function isHashBitLength(value): value is HashBitLength;
643
695
  ```
644
696
 
645
697
  Type guard that checks whether a value is a valid hash bit length.
646
698
 
647
699
  ## Parameters
648
700
 
649
- | Parameter | Type | Description |
650
- | ------ | ------ | ------ |
651
- | `value` | `unknown` | The value to check |
701
+ ### value
702
+
703
+ `unknown`
704
+
705
+ The value to check
652
706
 
653
707
  ## Returns
654
708
 
@@ -656,24 +710,31 @@ Type guard that checks whether a value is a valid hash bit length.
656
710
 
657
711
  True if the value is one of the supported HashBitLength values
658
712
 
659
- ### <a id="isHex"></a>isHex
713
+ ### <a id="isHex"></a>isHex
660
714
 
661
715
  [**@xylabs/hex**](#../README)
662
716
 
663
717
  ***
664
718
 
665
719
  ```ts
666
- function isHex(value: unknown, config?: HexConfig): value is BrandedHex;
720
+ function isHex(value, config?): value is BrandedHex;
667
721
  ```
668
722
 
669
723
  Type guard that checks whether a value is a valid hex string.
670
724
 
671
725
  ## Parameters
672
726
 
673
- | Parameter | Type | Description |
674
- | ------ | ------ | ------ |
675
- | `value` | `unknown` | The value to check |
676
- | `config?` | [`HexConfig`](#../interfaces/HexConfig) | Optional configuration for prefix and bit length validation |
727
+ ### value
728
+
729
+ `unknown`
730
+
731
+ The value to check
732
+
733
+ ### config?
734
+
735
+ [`HexConfig`](#../interfaces/HexConfig)
736
+
737
+ Optional configuration for prefix and bit length validation
677
738
 
678
739
  ## Returns
679
740
 
@@ -681,23 +742,25 @@ Type guard that checks whether a value is a valid hex string.
681
742
 
682
743
  True if the value is a valid Hex string
683
744
 
684
- ### <a id="isHexZero"></a>isHexZero
745
+ ### <a id="isHexZero"></a>isHexZero
685
746
 
686
747
  [**@xylabs/hex**](#../README)
687
748
 
688
749
  ***
689
750
 
690
751
  ```ts
691
- function isHexZero(value?: string): boolean | undefined;
752
+ function isHexZero(value?): boolean | undefined;
692
753
  ```
693
754
 
694
755
  Checks whether a hex string represents a zero value.
695
756
 
696
757
  ## Parameters
697
758
 
698
- | Parameter | Type | Description |
699
- | ------ | ------ | ------ |
700
- | `value?` | `string` | The hex string to check |
759
+ ### value?
760
+
761
+ `string`
762
+
763
+ The hex string to check
701
764
 
702
765
  ## Returns
703
766
 
@@ -705,23 +768,25 @@ Checks whether a hex string represents a zero value.
705
768
 
706
769
  True if zero, false if non-zero, or undefined if the input is not a string
707
770
 
708
- ### <a id="nibblesToBits"></a>nibblesToBits
771
+ ### <a id="nibblesToBits"></a>nibblesToBits
709
772
 
710
773
  [**@xylabs/hex**](#../README)
711
774
 
712
775
  ***
713
776
 
714
777
  ```ts
715
- function nibblesToBits(value: number): number;
778
+ function nibblesToBits(value): number;
716
779
  ```
717
780
 
718
781
  Converts a nibble count to the equivalent number of bits.
719
782
 
720
783
  ## Parameters
721
784
 
722
- | Parameter | Type | Description |
723
- | ------ | ------ | ------ |
724
- | `value` | `number` | The number of nibbles |
785
+ ### value
786
+
787
+ `number`
788
+
789
+ The number of nibbles
725
790
 
726
791
  ## Returns
727
792
 
@@ -729,24 +794,31 @@ Converts a nibble count to the equivalent number of bits.
729
794
 
730
795
  The number of bits
731
796
 
732
- ### <a id="toAddress"></a>toAddress
797
+ ### <a id="toAddress"></a>toAddress
733
798
 
734
799
  [**@xylabs/hex**](#../README)
735
800
 
736
801
  ***
737
802
 
738
803
  ```ts
739
- function toAddress(value: string | number | bigint | ArrayBufferLike, config?: HexConfig): BrandedAddress;
804
+ function toAddress(value, config?): BrandedAddress;
740
805
  ```
741
806
 
742
807
  Converts a value to a 160-bit Address hex string.
743
808
 
744
809
  ## Parameters
745
810
 
746
- | Parameter | Type | Description |
747
- | ------ | ------ | ------ |
748
- | `value` | `string` \| `number` \| `bigint` \| `ArrayBufferLike` | The value to convert (string, number, bigint, or ArrayBuffer) |
749
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Optional hex config (defaults to 160-bit, no prefix) |
811
+ ### value
812
+
813
+ `string` \| `number` \| `bigint` \| `ArrayBufferLike`
814
+
815
+ The value to convert (string, number, bigint, or ArrayBuffer)
816
+
817
+ ### config?
818
+
819
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
820
+
821
+ Optional hex config (defaults to 160-bit, no prefix)
750
822
 
751
823
  ## Returns
752
824
 
@@ -754,47 +826,57 @@ Converts a value to a 160-bit Address hex string.
754
826
 
755
827
  The value as an Address
756
828
 
757
- ### <a id="toAddressV2"></a>toAddressV2
829
+ ### <a id="toAddressV2"></a>toAddressV2
758
830
 
759
831
  [**@xylabs/hex**](#../README)
760
832
 
761
833
  ***
762
834
 
763
835
  ```ts
764
- function toAddressV2(value: unknown, assert?: boolean): BrandedAddress | undefined;
836
+ function toAddressV2(value, assert?): BrandedAddress | undefined;
765
837
  ```
766
838
 
767
839
  **`Alpha`**
768
840
 
769
841
  ## Parameters
770
842
 
771
- | Parameter | Type | Default value |
772
- | ------ | ------ | ------ |
773
- | `value` | `unknown` | `undefined` |
774
- | `assert` | `boolean` | `false` |
843
+ ### value
844
+
845
+ `unknown`
846
+
847
+ ### assert?
848
+
849
+ `boolean` = `false`
775
850
 
776
851
  ## Returns
777
852
 
778
853
  `BrandedAddress` \| `undefined`
779
854
 
780
- ### <a id="toEthAddress"></a>toEthAddress
855
+ ### <a id="toEthAddress"></a>toEthAddress
781
856
 
782
857
  [**@xylabs/hex**](#../README)
783
858
 
784
859
  ***
785
860
 
786
861
  ```ts
787
- function toEthAddress(value: string | number | bigint | ArrayBufferLike, config?: HexConfig): EthAddress;
862
+ function toEthAddress(value, config?): EthAddress;
788
863
  ```
789
864
 
790
865
  Converts a value to a 0x-prefixed Ethereum address string.
791
866
 
792
867
  ## Parameters
793
868
 
794
- | Parameter | Type | Description |
795
- | ------ | ------ | ------ |
796
- | `value` | `string` \| `number` \| `bigint` \| `ArrayBufferLike` | The value to convert (string, number, bigint, or ArrayBuffer) |
797
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Optional hex config (defaults to 160-bit, no inner prefix) |
869
+ ### value
870
+
871
+ `string` \| `number` \| `bigint` \| `ArrayBufferLike`
872
+
873
+ The value to convert (string, number, bigint, or ArrayBuffer)
874
+
875
+ ### config?
876
+
877
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
878
+
879
+ Optional hex config (defaults to 160-bit, no inner prefix)
798
880
 
799
881
  ## Returns
800
882
 
@@ -802,46 +884,55 @@ Converts a value to a 0x-prefixed Ethereum address string.
802
884
 
803
885
  The value as an EthAddress
804
886
 
805
- ### <a id="toHex"></a>toHex
887
+ ### <a id="toHex"></a>toHex
806
888
 
807
889
  [**@xylabs/hex**](#../README)
808
890
 
809
891
  ***
810
892
 
811
893
  ```ts
812
- function toHex(value: string | number | bigint | ArrayBufferLike, config?: HexConfig): BrandedHex;
894
+ function toHex(value, config?): BrandedHex;
813
895
  ```
814
896
 
815
897
  takes any value and tries our best to convert it to a hex string
816
898
 
817
899
  ## Parameters
818
900
 
819
- | Parameter | Type | Description |
820
- | ------ | ------ | ------ |
821
- | `value` | `string` \| `number` \| `bigint` \| `ArrayBufferLike` | Supported types are string, number, bigint, and ArrayBuffer |
822
- | `config` | [`HexConfig`](#../interfaces/HexConfig) | Configuration of output format and validation |
901
+ ### value
902
+
903
+ `string` \| `number` \| `bigint` \| `ArrayBufferLike`
904
+
905
+ Supported types are string, number, bigint, and ArrayBuffer
906
+
907
+ ### config?
908
+
909
+ [`HexConfig`](#../interfaces/HexConfig) = `{}`
910
+
911
+ Configuration of output format and validation
823
912
 
824
913
  ## Returns
825
914
 
826
915
  [`BrandedHex`](#../type-aliases/BrandedHex)
827
916
 
828
- ### <a id="toHexLegacy"></a>toHexLegacy
917
+ ### <a id="toHexLegacy"></a>toHexLegacy
829
918
 
830
919
  [**@xylabs/hex**](#../README)
831
920
 
832
921
  ***
833
922
 
834
923
  ```ts
835
- function toHexLegacy(buffer: ArrayBuffer): string;
924
+ function toHexLegacy(buffer): string;
836
925
  ```
837
926
 
838
927
  Converts an ArrayBuffer to a hex string without padding or normalization.
839
928
 
840
929
  ## Parameters
841
930
 
842
- | Parameter | Type | Description |
843
- | ------ | ------ | ------ |
844
- | `buffer` | `ArrayBuffer` | The ArrayBuffer to convert |
931
+ ### buffer
932
+
933
+ `ArrayBuffer`
934
+
935
+ The ArrayBuffer to convert
845
936
 
846
937
  ## Returns
847
938
 
@@ -849,9 +940,9 @@ Converts an ArrayBuffer to a hex string without padding or normalization.
849
940
 
850
941
  A lowercase hex string representation of the buffer
851
942
 
852
- ### interfaces
943
+ ### interfaces
853
944
 
854
- ### <a id="HexConfig"></a>HexConfig
945
+ ### <a id="HexConfig"></a>HexConfig
855
946
 
856
947
  [**@xylabs/hex**](#../README)
857
948
 
@@ -861,15 +952,31 @@ Configuration of validation and output format
861
952
 
862
953
  ## Properties
863
954
 
864
- | Property | Type |
865
- | ------ | ------ |
866
- | <a id="bitlength"></a> `bitLength?` | `number` |
867
- | <a id="bytesize"></a> `byteSize?` | `number` |
868
- | <a id="prefix"></a> `prefix?` | `boolean` |
955
+ ### bitLength?
956
+
957
+ ```ts
958
+ optional bitLength?: number;
959
+ ```
960
+
961
+ ***
962
+
963
+ ### byteSize?
869
964
 
870
- ### type-aliases
965
+ ```ts
966
+ optional byteSize?: number;
967
+ ```
968
+
969
+ ***
871
970
 
872
- ### <a id="Address"></a>Address
971
+ ### prefix?
972
+
973
+ ```ts
974
+ optional prefix?: boolean;
975
+ ```
976
+
977
+ ### type-aliases
978
+
979
+ ### <a id="Address"></a>Address
873
980
 
874
981
  [**@xylabs/hex**](#../README)
875
982
 
@@ -881,7 +988,7 @@ type Address = z.infer<typeof AddressZod>;
881
988
 
882
989
  A validated 20-byte address string type, inferred from the AddressZod schema.
883
990
 
884
- ### <a id="AddressTransformZodType"></a>AddressTransformZodType
991
+ ### <a id="AddressTransformZodType"></a>AddressTransformZodType
885
992
 
886
993
  [**@xylabs/hex**](#../README)
887
994
 
@@ -893,7 +1000,7 @@ type AddressTransformZodType = z.infer<typeof AddressTransformZod>;
893
1000
 
894
1001
  The output type of AddressTransformZod after parsing and transformation.
895
1002
 
896
- ### <a id="AddressValidationZodType"></a>AddressValidationZodType
1003
+ ### <a id="AddressValidationZodType"></a>AddressValidationZodType
897
1004
 
898
1005
  [**@xylabs/hex**](#../README)
899
1006
 
@@ -905,7 +1012,7 @@ type AddressValidationZodType = z.infer<typeof AddressValidationZod>;
905
1012
 
906
1013
  The output type of AddressValidationZod after parsing.
907
1014
 
908
- ### <a id="BrandedHash"></a>BrandedHash
1015
+ ### <a id="BrandedHash"></a>BrandedHash
909
1016
 
910
1017
  [**@xylabs/hex**](#../README)
911
1018
 
@@ -919,7 +1026,7 @@ type BrandedHash = Brand<Hex, {
919
1026
 
920
1027
  Branded type representing a validated hash hex string.
921
1028
 
922
- ### <a id="BrandedHex"></a>BrandedHex
1029
+ ### <a id="BrandedHex"></a>BrandedHex
923
1030
 
924
1031
  [**@xylabs/hex**](#../README)
925
1032
 
@@ -933,7 +1040,7 @@ type BrandedHex = Brand<Lowercase<string>, {
933
1040
 
934
1041
  Branded type representing a validated lowercase hex string.
935
1042
 
936
- ### <a id="EthAddress"></a>EthAddress
1043
+ ### <a id="EthAddress"></a>EthAddress
937
1044
 
938
1045
  [**@xylabs/hex**](#../README)
939
1046
 
@@ -947,7 +1054,7 @@ type EthAddress = Brand<string, {
947
1054
 
948
1055
  Branded type representing a validated Ethereum address with 0x prefix.
949
1056
 
950
- ### <a id="Hash"></a>Hash
1057
+ ### <a id="Hash"></a>Hash
951
1058
 
952
1059
  [**@xylabs/hex**](#../README)
953
1060
 
@@ -959,7 +1066,7 @@ type Hash = z.infer<typeof HashZod>;
959
1066
 
960
1067
  A validated hash string type, inferred from the HashZod schema.
961
1068
 
962
- ### <a id="HashBitLength"></a>HashBitLength
1069
+ ### <a id="HashBitLength"></a>HashBitLength
963
1070
 
964
1071
  [**@xylabs/hex**](#../README)
965
1072
 
@@ -971,7 +1078,7 @@ type HashBitLength = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
971
1078
 
972
1079
  Valid bit lengths for hash values.
973
1080
 
974
- ### <a id="Hex"></a>Hex
1081
+ ### <a id="Hex"></a>Hex
975
1082
 
976
1083
  [**@xylabs/hex**](#../README)
977
1084
 
@@ -983,9 +1090,9 @@ type Hex = z.infer<typeof HexZod>;
983
1090
 
984
1091
  A validated hex string type, inferred from the HexZod schema.
985
1092
 
986
- ### variables
1093
+ ### variables
987
1094
 
988
- ### <a id="ADDRESS_LENGTH"></a>ADDRESS_LENGTH
1095
+ ### <a id="ADDRESS_LENGTH"></a>ADDRESS_LENGTH
989
1096
 
990
1097
  [**@xylabs/hex**](#../README)
991
1098
 
@@ -997,7 +1104,7 @@ const ADDRESS_LENGTH: 40;
997
1104
 
998
1105
  The character length of an address hex string (40 hex characters / 20 bytes).
999
1106
 
1000
- ### <a id="AddressRegEx"></a>AddressRegEx
1107
+ ### <a id="AddressRegEx"></a>AddressRegEx
1001
1108
 
1002
1109
  [**@xylabs/hex**](#../README)
1003
1110
 
@@ -1009,7 +1116,7 @@ const AddressRegEx: RegExp;
1009
1116
 
1010
1117
  Regular expression matching a 20-byte (40 hex character) address string.
1011
1118
 
1012
- ### <a id="AddressTransformZod"></a>AddressTransformZod
1119
+ ### <a id="AddressTransformZod"></a>AddressTransformZod
1013
1120
 
1014
1121
  [**@xylabs/hex**](#../README)
1015
1122
 
@@ -1021,7 +1128,7 @@ const AddressTransformZod: ZodPipe<ZodPipe<ZodUnion<readonly [ZodString, ZodBigI
1021
1128
 
1022
1129
  Zod schema that accepts a string, bigint, or number and transforms it into a validated Address.
1023
1130
 
1024
- ### <a id="AddressValidationZod"></a>AddressValidationZod
1131
+ ### <a id="AddressValidationZod"></a>AddressValidationZod
1025
1132
 
1026
1133
  [**@xylabs/hex**](#../README)
1027
1134
 
@@ -1033,7 +1140,7 @@ const AddressValidationZod: ZodPipe<ZodString, ZodTransform<BrandedAddress, stri
1033
1140
 
1034
1141
  Zod schema that validates a string is a properly formatted 40-character hex address.
1035
1142
 
1036
- ### <a id="AddressZod"></a>AddressZod
1143
+ ### <a id="AddressZod"></a>AddressZod
1037
1144
 
1038
1145
  [**@xylabs/hex**](#../README)
1039
1146
 
@@ -1045,7 +1152,7 @@ const AddressZod: ZodPipe<ZodString, ZodTransform<BrandedAddress, string>>;
1045
1152
 
1046
1153
  Zod schema that validates and transforms a string into a branded Address type.
1047
1154
 
1048
- ### <a id="BigIntToJsonZod"></a>BigIntToJsonZod
1155
+ ### <a id="BigIntToJsonZod"></a>BigIntToJsonZod
1049
1156
 
1050
1157
  [**@xylabs/hex**](#../README)
1051
1158
 
@@ -1057,7 +1164,7 @@ const BigIntToJsonZod: ZodPipe<ZodBigInt, ZodTransform<BrandedHex, bigint>>;
1057
1164
 
1058
1165
  Zod schema that transforms a non-negative BigInt into a hex string for JSON serialization.
1059
1166
 
1060
- ### <a id="ETH_ZERO_ADDRESS"></a>ETH_ZERO_ADDRESS
1167
+ ### <a id="ETH_ZERO_ADDRESS"></a>ETH_ZERO_ADDRESS
1061
1168
 
1062
1169
  [**@xylabs/hex**](#../README)
1063
1170
 
@@ -1069,7 +1176,7 @@ const ETH_ZERO_ADDRESS: EthAddress;
1069
1176
 
1070
1177
  The zero Ethereum address constant (0x followed by 40 zero characters).
1071
1178
 
1072
- ### <a id="EthAddressFromStringSchema"></a>EthAddressFromStringSchema
1179
+ ### <a id="EthAddressFromStringSchema"></a>EthAddressFromStringSchema
1073
1180
 
1074
1181
  [**@xylabs/hex**](#../README)
1075
1182
 
@@ -1083,7 +1190,7 @@ const EthAddressFromStringSchema: ZodPipe<ZodString, ZodTransform<EthAddress, st
1083
1190
 
1084
1191
  use EthAddressFromStringZod
1085
1192
 
1086
- ### <a id="EthAddressFromStringZod"></a>EthAddressFromStringZod
1193
+ ### <a id="EthAddressFromStringZod"></a>EthAddressFromStringZod
1087
1194
 
1088
1195
  [**@xylabs/hex**](#../README)
1089
1196
 
@@ -1095,7 +1202,7 @@ const EthAddressFromStringZod: ZodPipe<ZodString, ZodTransform<EthAddress, strin
1095
1202
 
1096
1203
  Zod schema that validates and transforms a string into an EthAddress type.
1097
1204
 
1098
- ### <a id="EthAddressRegEx"></a>EthAddressRegEx
1205
+ ### <a id="EthAddressRegEx"></a>EthAddressRegEx
1099
1206
 
1100
1207
  [**@xylabs/hex**](#../README)
1101
1208
 
@@ -1107,7 +1214,7 @@ const EthAddressRegEx: RegExp;
1107
1214
 
1108
1215
  Regular expression matching a 20-byte Ethereum address with 0x prefix (mixed case).
1109
1216
 
1110
- ### <a id="EthAddressToStringSchema"></a>EthAddressToStringSchema
1217
+ ### <a id="EthAddressToStringSchema"></a>EthAddressToStringSchema
1111
1218
 
1112
1219
  [**@xylabs/hex**](#../README)
1113
1220
 
@@ -1121,7 +1228,7 @@ const EthAddressToStringSchema: ZodString = EthAddressToStringZod;
1121
1228
 
1122
1229
  use EthAddressToStringZod
1123
1230
 
1124
- ### <a id="EthAddressToStringZod"></a>EthAddressToStringZod
1231
+ ### <a id="EthAddressToStringZod"></a>EthAddressToStringZod
1125
1232
 
1126
1233
  [**@xylabs/hex**](#../README)
1127
1234
 
@@ -1133,7 +1240,7 @@ const EthAddressToStringZod: ZodString;
1133
1240
 
1134
1241
  Zod schema that validates a string is a properly formatted Ethereum address.
1135
1242
 
1136
- ### <a id="EthAddressZod"></a>EthAddressZod
1243
+ ### <a id="EthAddressZod"></a>EthAddressZod
1137
1244
 
1138
1245
  [**@xylabs/hex**](#../README)
1139
1246
 
@@ -1145,7 +1252,7 @@ const EthAddressZod: ZodString & ZodType<EthAddress, string, $ZodTypeInternals<E
1145
1252
 
1146
1253
  Zod schema that validates a string as a properly formatted Ethereum address using regex and type guard.
1147
1254
 
1148
- ### <a id="HASH_LENGTH"></a>HASH_LENGTH
1255
+ ### <a id="HASH_LENGTH"></a>HASH_LENGTH
1149
1256
 
1150
1257
  [**@xylabs/hex**](#../README)
1151
1258
 
@@ -1157,7 +1264,7 @@ const HASH_LENGTH: 32;
1157
1264
 
1158
1265
  The byte length of a standard hash (32 bytes / 256 bits).
1159
1266
 
1160
- ### <a id="HashBitLength"></a>HashBitLength
1267
+ ### <a id="HashBitLength"></a>HashBitLength
1161
1268
 
1162
1269
  [**@xylabs/hex**](#../README)
1163
1270
 
@@ -1169,7 +1276,7 @@ HashBitLength: HashBitLength[];
1169
1276
 
1170
1277
  Array of all valid hash bit lengths for runtime validation.
1171
1278
 
1172
- ### <a id="HashRegEx"></a>HashRegEx
1279
+ ### <a id="HashRegEx"></a>HashRegEx
1173
1280
 
1174
1281
  [**@xylabs/hex**](#../README)
1175
1282
 
@@ -1181,7 +1288,7 @@ const HashRegEx: RegExp;
1181
1288
 
1182
1289
  Regular expression matching a 32-byte (64 hex character) hash string.
1183
1290
 
1184
- ### <a id="HashToJsonZod"></a>HashToJsonZod
1291
+ ### <a id="HashToJsonZod"></a>HashToJsonZod
1185
1292
 
1186
1293
  [**@xylabs/hex**](#../README)
1187
1294
 
@@ -1193,7 +1300,7 @@ const HashToJsonZod: ZodPipe<ZodPipe<ZodString, ZodTransform<BrandedHash, string
1193
1300
 
1194
1301
  Zod schema that transforms a Hash to a plain string for JSON serialization.
1195
1302
 
1196
- ### <a id="HashZod"></a>HashZod
1303
+ ### <a id="HashZod"></a>HashZod
1197
1304
 
1198
1305
  [**@xylabs/hex**](#../README)
1199
1306
 
@@ -1205,7 +1312,7 @@ const HashZod: ZodPipe<ZodString, ZodTransform<BrandedHash, string>>;
1205
1312
 
1206
1313
  Zod schema that validates and transforms a string into a branded Hash type.
1207
1314
 
1208
- ### <a id="HexRegEx"></a>HexRegEx
1315
+ ### <a id="HexRegEx"></a>HexRegEx
1209
1316
 
1210
1317
  [**@xylabs/hex**](#../README)
1211
1318
 
@@ -1217,7 +1324,7 @@ const HexRegEx: RegExp;
1217
1324
 
1218
1325
  Regular expression matching a lowercase hex string without prefix.
1219
1326
 
1220
- ### <a id="HexRegExWithPrefix"></a>HexRegExWithPrefix
1327
+ ### <a id="HexRegExWithPrefix"></a>HexRegExWithPrefix
1221
1328
 
1222
1329
  [**@xylabs/hex**](#../README)
1223
1330
 
@@ -1229,7 +1336,7 @@ const HexRegExWithPrefix: RegExp;
1229
1336
 
1230
1337
  Regular expression matching a lowercase hex string with a 0x prefix.
1231
1338
 
1232
- ### <a id="HexZod"></a>HexZod
1339
+ ### <a id="HexZod"></a>HexZod
1233
1340
 
1234
1341
  [**@xylabs/hex**](#../README)
1235
1342
 
@@ -1241,7 +1348,7 @@ const HexZod: ZodPipe<ZodString, ZodTransform<BrandedHex, string>>;
1241
1348
 
1242
1349
  Zod schema that validates and transforms a string into a branded Hex type.
1243
1350
 
1244
- ### <a id="JsonToBigIntZod"></a>JsonToBigIntZod
1351
+ ### <a id="JsonToBigIntZod"></a>JsonToBigIntZod
1245
1352
 
1246
1353
  [**@xylabs/hex**](#../README)
1247
1354
 
@@ -1253,7 +1360,7 @@ const JsonToBigIntZod: ZodPipe<ZodPipe<ZodString, ZodTransform<BrandedHex, strin
1253
1360
 
1254
1361
  Zod schema that parses a JSON hex string into a BigInt.
1255
1362
 
1256
- ### <a id="JsonToHashZod"></a>JsonToHashZod
1363
+ ### <a id="JsonToHashZod"></a>JsonToHashZod
1257
1364
 
1258
1365
  [**@xylabs/hex**](#../README)
1259
1366
 
@@ -1265,7 +1372,7 @@ const JsonToHashZod: ZodPipe<ZodString, ZodTransform<BrandedHash, string>>;
1265
1372
 
1266
1373
  Zod schema that parses a JSON string into a validated Hash, throwing on invalid input.
1267
1374
 
1268
- ### <a id="ZERO_ADDRESS"></a>ZERO_ADDRESS
1375
+ ### <a id="ZERO_ADDRESS"></a>ZERO_ADDRESS
1269
1376
 
1270
1377
  [**@xylabs/hex**](#../README)
1271
1378
 
@@ -1277,7 +1384,7 @@ const ZERO_ADDRESS: BrandedAddress;
1277
1384
 
1278
1385
  A 160-bit zero address constant.
1279
1386
 
1280
- ### <a id="ZERO_HASH"></a>ZERO_HASH
1387
+ ### <a id="ZERO_HASH"></a>ZERO_HASH
1281
1388
 
1282
1389
  [**@xylabs/hex**](#../README)
1283
1390
 
@@ -1290,41 +1397,7 @@ const ZERO_HASH: BrandedHash;
1290
1397
  A 256-bit zero hash constant.
1291
1398
 
1292
1399
 
1293
- Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
1294
-
1295
- ## Maintainers
1296
-
1297
- - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
1298
- - [Matt Jones](https://github.com/jonesmac)
1299
- - [Joel Carter](https://github.com/JoelBCarter)
1300
- - [Jordan Trouw](https://github.com/jordantrouw)
1301
-
1302
- ## License
1303
-
1304
- > See the [LICENSE](LICENSE) file for license details
1305
-
1306
- ## Credits
1307
-
1308
- [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
1309
-
1310
- [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
1311
-
1312
- [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
1313
- [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
1314
1400
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/hex.svg
1315
1401
  [npm-link]: https://www.npmjs.com/package/@xylabs/hex
1316
- [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
1317
- [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
1318
- [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
1319
- [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
1320
- [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
1321
- [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
1322
-
1323
- [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/hex
1324
- [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/hex
1325
-
1326
- [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/hex/badge
1327
- [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/hex
1328
-
1329
- [socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/hex
1330
- [socket-link]: https://socket.dev/npm/package/@xylabs/hex
1402
+ [license-badge]: https://img.shields.io/npm/l/@xylabs/hex.svg
1403
+ [license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE