@xylabs/eth-address 5.0.84 → 5.0.86

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.
Files changed (2) hide show
  1. package/README.md +58 -70
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  Base functionality used throughout XY Labs TypeScript/JavaScript libraries
17
17
 
18
+
19
+
18
20
  ## Reference
19
21
 
20
22
  **@xylabs/eth-address**
@@ -23,13 +25,17 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
23
25
 
24
26
  ## Classes
25
27
 
26
- - [EthAddressWrapper](#classes/EthAddressWrapper)
28
+ | Class | Description |
29
+ | ------ | ------ |
30
+ | [EthAddressWrapper](#classes/EthAddressWrapper) | Wrapper around an Ethereum address providing parsing, formatting, validation, and checksum support. |
27
31
 
28
32
  ## Functions
29
33
 
30
- - [isEthAddressWrapper](#functions/isEthAddressWrapper)
31
- - [ellipsize](#functions/ellipsize)
32
- - [padHex](#functions/padHex)
34
+ | Function | Description |
35
+ | ------ | ------ |
36
+ | [isEthAddressWrapper](#functions/isEthAddressWrapper) | Type guard that checks if the given object is an instance of EthAddressWrapper. |
37
+ | [ellipsize](#functions/ellipsize) | Truncates a string to show the first and last `length` characters separated by an ellipsis. |
38
+ | [padHex](#functions/padHex) | - |
33
39
 
34
40
  ### classes
35
41
 
@@ -46,14 +52,14 @@ Wrapper around an Ethereum address providing parsing, formatting, validation, an
46
52
  ### Constructor
47
53
 
48
54
  ```ts
49
- protected new EthAddressWrapper(address): EthAddressWrapper;
55
+ protected new EthAddressWrapper(address: bigint): EthAddressWrapper;
50
56
  ```
51
57
 
52
58
  ### Parameters
53
59
 
54
- #### address
55
-
56
- `bigint`
60
+ | Parameter | Type |
61
+ | ------ | ------ |
62
+ | `address` | `bigint` |
57
63
 
58
64
  ### Returns
59
65
 
@@ -64,18 +70,15 @@ protected new EthAddressWrapper(address): EthAddressWrapper;
64
70
  ### fromString()
65
71
 
66
72
  ```ts
67
- static fromString(value?, base?): EthAddressWrapper | undefined;
73
+ static fromString(value?: string, base?: number): EthAddressWrapper | undefined;
68
74
  ```
69
75
 
70
76
  ### Parameters
71
77
 
72
- #### value?
73
-
74
- `string`
75
-
76
- #### base?
77
-
78
- `number` = `16`
78
+ | Parameter | Type | Default value |
79
+ | ------ | ------ | ------ |
80
+ | `value?` | `string` | `undefined` |
81
+ | `base?` | `number` | `16` |
79
82
 
80
83
  ### Returns
81
84
 
@@ -86,18 +89,15 @@ static fromString(value?, base?): EthAddressWrapper | undefined;
86
89
  ### parse()
87
90
 
88
91
  ```ts
89
- static parse(value, base?): EthAddressWrapper | undefined;
92
+ static parse(value: unknown, base?: number): EthAddressWrapper | undefined;
90
93
  ```
91
94
 
92
95
  ### Parameters
93
96
 
94
- #### value
95
-
96
- `unknown`
97
-
98
- #### base?
99
-
100
- `number`
97
+ | Parameter | Type |
98
+ | ------ | ------ |
99
+ | `value` | `unknown` |
100
+ | `base?` | `number` |
101
101
 
102
102
  ### Returns
103
103
 
@@ -108,14 +108,14 @@ static parse(value, base?): EthAddressWrapper | undefined;
108
108
  ### validate()
109
109
 
110
110
  ```ts
111
- static validate(address): boolean;
111
+ static validate(address: string): boolean;
112
112
  ```
113
113
 
114
114
  ### Parameters
115
115
 
116
- #### address
117
-
118
- `string`
116
+ | Parameter | Type |
117
+ | ------ | ------ |
118
+ | `address` | `string` |
119
119
 
120
120
  ### Returns
121
121
 
@@ -126,14 +126,14 @@ static validate(address): boolean;
126
126
  ### equals()
127
127
 
128
128
  ```ts
129
- equals(address?): boolean;
129
+ equals(address?: string | EthAddressWrapper | null): boolean;
130
130
  ```
131
131
 
132
132
  ### Parameters
133
133
 
134
- #### address?
135
-
136
- `string` | `EthAddressWrapper` | `null`
134
+ | Parameter | Type |
135
+ | ------ | ------ |
136
+ | `address?` | `string` \| `EthAddressWrapper` \| `null` |
137
137
 
138
138
  ### Returns
139
139
 
@@ -192,14 +192,14 @@ toLowerCaseString(): string;
192
192
  ### toShortString()
193
193
 
194
194
  ```ts
195
- toShortString(length?): string;
195
+ toShortString(length?: number): string;
196
196
  ```
197
197
 
198
198
  ### Parameters
199
199
 
200
- #### length?
201
-
202
- `number` = `2`
200
+ | Parameter | Type | Default value |
201
+ | ------ | ------ | ------ |
202
+ | `length` | `number` | `2` |
203
203
 
204
204
  ### Returns
205
205
 
@@ -210,18 +210,15 @@ toShortString(length?): string;
210
210
  ### toString()
211
211
 
212
212
  ```ts
213
- toString(checksum?, chainId?): string;
213
+ toString(checksum?: boolean, chainId?: string): string;
214
214
  ```
215
215
 
216
216
  ### Parameters
217
217
 
218
- #### checksum?
219
-
220
- `boolean`
221
-
222
- #### chainId?
223
-
224
- `string`
218
+ | Parameter | Type |
219
+ | ------ | ------ |
220
+ | `checksum?` | `boolean` |
221
+ | `chainId?` | `string` |
225
222
 
226
223
  ### Returns
227
224
 
@@ -248,24 +245,17 @@ validate(): boolean;
248
245
  ***
249
246
 
250
247
  ```ts
251
- function ellipsize(value, length?): string;
248
+ function ellipsize(value: string, length?: number): string;
252
249
  ```
253
250
 
254
251
  Truncates a string to show the first and last `length` characters separated by an ellipsis.
255
252
 
256
253
  ## Parameters
257
254
 
258
- ### value
259
-
260
- `string`
261
-
262
- The string to ellipsize
263
-
264
- ### length?
265
-
266
- `number` = `2`
267
-
268
- Number of characters to keep at each end (default 2)
255
+ | Parameter | Type | Default value | Description |
256
+ | ------ | ------ | ------ | ------ |
257
+ | `value` | `string` | `undefined` | The string to ellipsize |
258
+ | `length` | `number` | `2` | Number of characters to keep at each end (default 2) |
269
259
 
270
260
  ## Returns
271
261
 
@@ -280,18 +270,19 @@ The ellipsized string
280
270
  ***
281
271
 
282
272
  ```ts
283
- function isEthAddressWrapper(obj): obj is { type: string } & EthAddressWrapper;
273
+ function isEthAddressWrapper(obj: {
274
+ type: string;
275
+ }): obj is { type: string } & EthAddressWrapper;
284
276
  ```
285
277
 
286
278
  Type guard that checks if the given object is an instance of EthAddressWrapper.
287
279
 
288
280
  ## Parameters
289
281
 
290
- ### obj
291
-
292
- ### type
293
-
294
- `string`
282
+ | Parameter | Type |
283
+ | ------ | ------ |
284
+ | `obj` | \{ `type`: `string`; \} |
285
+ | `obj.type` | `string` |
295
286
 
296
287
  ## Returns
297
288
 
@@ -304,18 +295,15 @@ Type guard that checks if the given object is an instance of EthAddressWrapper.
304
295
  ***
305
296
 
306
297
  ```ts
307
- function padHex(hex, byteCount?): string;
298
+ function padHex(hex: string, byteCount?: number): string;
308
299
  ```
309
300
 
310
301
  ## Parameters
311
302
 
312
- ### hex
313
-
314
- `string`
315
-
316
- ### byteCount?
317
-
318
- `number` = `0`
303
+ | Parameter | Type | Default value |
304
+ | ------ | ------ | ------ |
305
+ | `hex` | `string` | `undefined` |
306
+ | `byteCount` | `number` | `0` |
319
307
 
320
308
  ## Returns
321
309
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/eth-address",
3
- "version": "5.0.84",
3
+ "version": "5.0.86",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "eth",
@@ -44,12 +44,12 @@
44
44
  "!**/*.test.*"
45
45
  ],
46
46
  "dependencies": {
47
- "@xylabs/assert": "~5.0.84",
47
+ "@xylabs/assert": "~5.0.86",
48
48
  "ethers": "^6.16.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@xylabs/ts-scripts-yarn3": "~7.4.13",
52
- "@xylabs/tsconfig": "~7.4.13",
51
+ "@xylabs/ts-scripts-yarn3": "~7.4.16",
52
+ "@xylabs/tsconfig": "~7.4.16",
53
53
  "typescript": "~5.9.3",
54
54
  "vitest": "~4.0.18"
55
55
  },