@haneullabs/bcs 0.1.0
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/CHANGELOG.md +388 -0
- package/README.md +358 -0
- package/dist/cjs/bcs-type.d.ts +127 -0
- package/dist/cjs/bcs-type.js +386 -0
- package/dist/cjs/bcs-type.js.map +7 -0
- package/dist/cjs/bcs.d.ts +175 -0
- package/dist/cjs/bcs.js +406 -0
- package/dist/cjs/bcs.js.map +7 -0
- package/dist/cjs/index.d.ts +22 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/reader.d.ts +92 -0
- package/dist/cjs/reader.js +136 -0
- package/dist/cjs/reader.js.map +7 -0
- package/dist/cjs/types.d.ts +28 -0
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/cjs/uleb.d.ts +5 -0
- package/dist/cjs/uleb.js +66 -0
- package/dist/cjs/uleb.js.map +7 -0
- package/dist/cjs/utils.d.ts +18 -0
- package/dist/cjs/utils.js +74 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/cjs/writer.d.ts +117 -0
- package/dist/cjs/writer.js +196 -0
- package/dist/cjs/writer.js.map +7 -0
- package/dist/esm/bcs-type.d.ts +127 -0
- package/dist/esm/bcs-type.js +366 -0
- package/dist/esm/bcs-type.js.map +7 -0
- package/dist/esm/bcs.d.ts +175 -0
- package/dist/esm/bcs.js +397 -0
- package/dist/esm/bcs.js.map +7 -0
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +46 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +5 -0
- package/dist/esm/reader.d.ts +92 -0
- package/dist/esm/reader.js +116 -0
- package/dist/esm/reader.js.map +7 -0
- package/dist/esm/types.d.ts +28 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +7 -0
- package/dist/esm/uleb.d.ts +5 -0
- package/dist/esm/uleb.js +46 -0
- package/dist/esm/uleb.js.map +7 -0
- package/dist/esm/utils.d.ts +18 -0
- package/dist/esm/utils.js +54 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/esm/writer.d.ts +117 -0
- package/dist/esm/writer.js +176 -0
- package/dist/esm/writer.js.map +7 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +73 -0
- package/src/bcs-type.ts +531 -0
- package/src/bcs.ts +543 -0
- package/src/index.ts +82 -0
- package/src/reader.ts +156 -0
- package/src/types.ts +52 -0
- package/src/uleb.ts +61 -0
- package/src/utils.ts +75 -0
- package/src/writer.ts +222 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## 1.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 89fa2dc: Work around bug in turbopack thatbreaks uleb128 encoding in next@16
|
|
8
|
+
|
|
9
|
+
## 1.9.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a37829f: Fix encoding/decoding large uleb128 values
|
|
14
|
+
|
|
15
|
+
## 1.9.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- f3b19a7: Use bcs.byteVector and bcs.bytes instead of bcs.vector(bcs.u8()) and bcs.fixedArrray(n,
|
|
20
|
+
bcs.u8()) to improve performance
|
|
21
|
+
- f3b19a7: improve perf of bcs.byteVector
|
|
22
|
+
|
|
23
|
+
## 1.8.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- a17c337: Fix name in bcs error message
|
|
28
|
+
|
|
29
|
+
## 1.8.0
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- ea1ac70: Update dependencies and improve support for typescript 5.9
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [ea1ac70]
|
|
38
|
+
- @haneullabs/utils@0.2.0
|
|
39
|
+
|
|
40
|
+
## 1.7.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- 33230ed: Add generic inference for bcs type names
|
|
45
|
+
- 33230ed: Update generics for vector, option, fixedArray, and map to prefer bcs types over input
|
|
46
|
+
and output values
|
|
47
|
+
- 33230ed: Export new BcsStruct, BcsEnum and BcsTuple classes
|
|
48
|
+
|
|
49
|
+
## 1.6.4
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 1c4a82d: update links in package.json
|
|
54
|
+
- Updated dependencies [1c4a82d]
|
|
55
|
+
- @haneullabs/utils@0.1.1
|
|
56
|
+
|
|
57
|
+
## 1.6.3
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [a00522b]
|
|
62
|
+
- @haneullabs/utils@0.1.0
|
|
63
|
+
|
|
64
|
+
## 1.6.2
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- bb7c03a: Update dependencies
|
|
69
|
+
- Updated dependencies [bb7c03a]
|
|
70
|
+
- @haneullabs/utils@0.0.1
|
|
71
|
+
|
|
72
|
+
## 1.6.1
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- 7e1c525: Correctly handle byteOffset in Uint8Arrays when reading bcs bytes
|
|
77
|
+
|
|
78
|
+
## 1.6.0
|
|
79
|
+
|
|
80
|
+
### Minor Changes
|
|
81
|
+
|
|
82
|
+
- c3a788c: Expose `Owner` struct and update it to support `ConsensusV2` owner types
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- 7ba32a4: update dependencies
|
|
87
|
+
|
|
88
|
+
## 1.5.0
|
|
89
|
+
|
|
90
|
+
### Minor Changes
|
|
91
|
+
|
|
92
|
+
- 03975f4: replace bs58 and bech32 packages with @scure/base
|
|
93
|
+
|
|
94
|
+
## 1.4.0
|
|
95
|
+
|
|
96
|
+
### Minor Changes
|
|
97
|
+
|
|
98
|
+
- 95b1ea5: Add bcs.byteVector for parsing a vector<u8> into a Uint8Array
|
|
99
|
+
|
|
100
|
+
## 1.3.0
|
|
101
|
+
|
|
102
|
+
### Minor Changes
|
|
103
|
+
|
|
104
|
+
- 10e2724: Allow BcsType.transform to omit input or output transform
|
|
105
|
+
|
|
106
|
+
## 1.2.1
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- 7abd243: Update repo links
|
|
111
|
+
|
|
112
|
+
## 1.2.0
|
|
113
|
+
|
|
114
|
+
### Minor Changes
|
|
115
|
+
|
|
116
|
+
- ad24b95: Verify hex string is valid hex in `fromHex`
|
|
117
|
+
|
|
118
|
+
## 1.1.1
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- 1dd7713: Accept arrays of numbers when serializing bcs.bytes()
|
|
123
|
+
|
|
124
|
+
## 1.1.0
|
|
125
|
+
|
|
126
|
+
### Minor Changes
|
|
127
|
+
|
|
128
|
+
- 489f421: Updated hex, base64, and base58 utility names for better consistency
|
|
129
|
+
|
|
130
|
+
All existing methods will continue to work, but the following methods have been deprecated and
|
|
131
|
+
replaced with methods with improved names:
|
|
132
|
+
- `toHEX` -> `toHEX`
|
|
133
|
+
- `fromHEX` -> `fromHex`
|
|
134
|
+
- `toB64` -> `toBase64`
|
|
135
|
+
- `fromB64` -> `fromBase64`
|
|
136
|
+
- `toB58` -> `toBase58`
|
|
137
|
+
- `fromB58` -> `fromBase58`
|
|
138
|
+
|
|
139
|
+
## 1.0.4
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- f37b3c2: Improve error message when bcs enum contains unknown value
|
|
144
|
+
|
|
145
|
+
## 1.0.3
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- 7fc464a: Remove unique symbols from types to improve compatability between version
|
|
150
|
+
- 0f27a97: Update dependencies
|
|
151
|
+
|
|
152
|
+
## 1.0.2
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- 369b924343: Improve error messages when attempting to serialze non-array values that should be
|
|
157
|
+
arrays
|
|
158
|
+
|
|
159
|
+
## 1.0.1
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- f1e828f557: Remove undefined from bcs.option output types
|
|
164
|
+
|
|
165
|
+
## 1.0.0
|
|
166
|
+
|
|
167
|
+
### Major Changes
|
|
168
|
+
|
|
169
|
+
- a92b03de42: The Typescript SDK has been renamed to `@haneullabs/haneul` and includes many new features
|
|
170
|
+
and breaking changes. See the
|
|
171
|
+
[full migration guide](https://sdk.haneullabs.com/typescript/migrations/haneul-1.0) for details on
|
|
172
|
+
how to upgrade.
|
|
173
|
+
|
|
174
|
+
## 0.11.1
|
|
175
|
+
|
|
176
|
+
### Patch Changes
|
|
177
|
+
|
|
178
|
+
- 4830361fa4: Updated typescript version
|
|
179
|
+
|
|
180
|
+
## 0.11.0
|
|
181
|
+
|
|
182
|
+
### Minor Changes
|
|
183
|
+
|
|
184
|
+
- bae8802fe3: Update base64 encoding to use global `atob` and `btoa` functions.
|
|
185
|
+
|
|
186
|
+
## 0.10.1
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- 9ac0a4ec01: Add extensions to all sdk import paths
|
|
191
|
+
|
|
192
|
+
## 0.10.0
|
|
193
|
+
|
|
194
|
+
### Minor Changes
|
|
195
|
+
|
|
196
|
+
- e5f9e3ba21: Replace tsup based build to fix issues with esm/cjs dual publishing
|
|
197
|
+
|
|
198
|
+
## 0.9.1
|
|
199
|
+
|
|
200
|
+
### Patch Changes
|
|
201
|
+
|
|
202
|
+
- dd362ec1d6: Update docs url to sdk.haneullabs.com
|
|
203
|
+
|
|
204
|
+
## 0.9.0
|
|
205
|
+
|
|
206
|
+
### Minor Changes
|
|
207
|
+
|
|
208
|
+
- fce0a08d0f: Deprecate the bcs.generic helper. This helper causes typescript performance issues,
|
|
209
|
+
and the generated generics can't be exported
|
|
210
|
+
|
|
211
|
+
## 0.8.1
|
|
212
|
+
|
|
213
|
+
### Patch Changes
|
|
214
|
+
|
|
215
|
+
- b48289346: Mark packages as being side-effect free.
|
|
216
|
+
|
|
217
|
+
## 0.8.0
|
|
218
|
+
|
|
219
|
+
### Minor Changes
|
|
220
|
+
|
|
221
|
+
- 1bc430161: Add new type-safe schema builder. See https://sdk.haneullabs.com/bcs for updated
|
|
222
|
+
documentation
|
|
223
|
+
- e4484852b: Add isSerializedBcs helper
|
|
224
|
+
|
|
225
|
+
## 0.7.4
|
|
226
|
+
|
|
227
|
+
### Patch Changes
|
|
228
|
+
|
|
229
|
+
- 290c8e640: Fix parsing of hex strings where leading 0s have been trimmed
|
|
230
|
+
|
|
231
|
+
## 0.7.3
|
|
232
|
+
|
|
233
|
+
### Patch Changes
|
|
234
|
+
|
|
235
|
+
- 36f2edff3: Fix an issue with parsing struct types with nested type parameters
|
|
236
|
+
|
|
237
|
+
## 0.7.2
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- ca5c72815d: Fix a bcs decoding bug for u128 and u256 values
|
|
242
|
+
- fdb569464e: Fixes an issue with a top level generic in a nested vector
|
|
243
|
+
|
|
244
|
+
## 0.7.1
|
|
245
|
+
|
|
246
|
+
### Patch Changes
|
|
247
|
+
|
|
248
|
+
- b4f0bfc76: Fix type definitions for package exports.
|
|
249
|
+
|
|
250
|
+
## 0.7.0
|
|
251
|
+
|
|
252
|
+
### Minor Changes
|
|
253
|
+
|
|
254
|
+
- 19b567f21: Unified self- and delegated staking flows. Removed fields from `Validator`
|
|
255
|
+
(`stake_amount`, `pending_stake`, and `pending_withdraw`) and renamed `delegation_staking_pool` to
|
|
256
|
+
`staking_pool`. Additionally removed the `validator_stake` and `delegated_stake` fields in the
|
|
257
|
+
`ValidatorSet` type and replaced them with a `total_stake` field.
|
|
258
|
+
- 5c3b00cde: Add object id to staking pool and pool id to staked sui.
|
|
259
|
+
- 3d9a04648: Adds `deactivation_epoch` to staking pool object, and adds `inactive_pools` to the
|
|
260
|
+
validator set object.
|
|
261
|
+
- a8049d159: Fixes the issue with deep nested generics by introducing array type names
|
|
262
|
+
- all of the methods (except for aliasing) now allow passing in arrays instead of strings to allow
|
|
263
|
+
for easier composition of generics and avoid using template strings
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
// new syntax
|
|
267
|
+
bcs.registerStructType(['VecMap', 'K', 'V'], {
|
|
268
|
+
keys: ['vector', 'K'],
|
|
269
|
+
values: ['vector', 'V'],
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// is identical to an old string definition
|
|
273
|
+
bcs.registerStructType('VecMap<K, V>', {
|
|
274
|
+
keys: 'vector<K>',
|
|
275
|
+
values: 'vector<V>',
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Similar approach applies to `bcs.ser()` and `bcs.de()` as well as to other register\* methods
|
|
280
|
+
|
|
281
|
+
- a0955c479: Switch from 20 to 32-byte address. Match Secp256k1.deriveKeypair with Ed25519.
|
|
282
|
+
- 0a7b42a6d: This changes almost all occurences of "delegate", "delegation" (and various
|
|
283
|
+
capitalizations/forms) to their equivalent "stake"-based name. Function names, function argument
|
|
284
|
+
names, RPC endpoints, Move functions, and object fields have been updated with this new naming
|
|
285
|
+
convention.
|
|
286
|
+
- 77bdf907f: When parsing u64, u128, and u256 values with bcs, they are now string encoded.
|
|
287
|
+
|
|
288
|
+
## 0.6.1
|
|
289
|
+
|
|
290
|
+
### Patch Changes
|
|
291
|
+
|
|
292
|
+
- 0e202a543: Remove pending delegation switches.
|
|
293
|
+
|
|
294
|
+
## 0.6.0
|
|
295
|
+
|
|
296
|
+
```js
|
|
297
|
+
// new syntax
|
|
298
|
+
bcs.registerStructType(['VecMap', 'K', 'V'], {
|
|
299
|
+
keys: ['vector', 'K'],
|
|
300
|
+
values: ['vector', 'V'],
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// is identical to an old string definition
|
|
304
|
+
bcs.registerStructType('VecMap<K, V>', {
|
|
305
|
+
keys: 'vector<K>',
|
|
306
|
+
values: 'vector<V>',
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Minor Changes
|
|
311
|
+
|
|
312
|
+
- 598f106ef: Adds base58 encoding support to bcs
|
|
313
|
+
|
|
314
|
+
- two functions added: `fromB58` and `toB58` similar to existing encodings
|
|
315
|
+
- `Reader.toString` and `de/encodeStr` methods support new `base58` value
|
|
316
|
+
- adds a 3 built-in types "hex-string", "base58-string" and "base64-string"
|
|
317
|
+
- adds constants for the built-ins: `BCS.BASE64`, `BCS.BASE58` and `BCS.HEX`
|
|
318
|
+
|
|
319
|
+
```js
|
|
320
|
+
bcs.registerStructType('TestStruct', {
|
|
321
|
+
hex: BCS.HEX,
|
|
322
|
+
base58: BCS.BASE58,
|
|
323
|
+
base64: BCS.BASE64,
|
|
324
|
+
});
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Adds type aliasing and inline definitions
|
|
328
|
+
|
|
329
|
+
- adds new `registerAlias` function which allows type aliases and tracks basic recursion
|
|
330
|
+
- adds support for inline definitions in the `.de()` and `.ser()` methods
|
|
331
|
+
|
|
332
|
+
### Examples
|
|
333
|
+
|
|
334
|
+
```js
|
|
335
|
+
// inline definition example
|
|
336
|
+
let struct = { name: 'Alice', age: 25 };
|
|
337
|
+
let bytes = bcs.ser({ name: 'string', age: 'u8' }, struct).toBytes();
|
|
338
|
+
let restored = bcs.de({ name: 'string', age: 'u8' }, bytes);
|
|
339
|
+
|
|
340
|
+
// `restored` deeply equals `struct`
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
```js
|
|
344
|
+
// aliases for types
|
|
345
|
+
bcs.registerAlias('Name', 'string');
|
|
346
|
+
bcs.ser('Name', 'Palpatine');
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## 0.5.0
|
|
350
|
+
|
|
351
|
+
### Minor Changes
|
|
352
|
+
|
|
353
|
+
- 1a0968636: Remove usage of bn.js, and use native bigints instead.
|
|
354
|
+
|
|
355
|
+
## 0.4.0
|
|
356
|
+
|
|
357
|
+
### Minor Changes
|
|
358
|
+
|
|
359
|
+
- 1591726e8: Support multiple instances of BCS
|
|
360
|
+
|
|
361
|
+
### Patch Changes
|
|
362
|
+
|
|
363
|
+
- 1591726e8: Add support for generic types
|
|
364
|
+
|
|
365
|
+
## 0.3.0
|
|
366
|
+
|
|
367
|
+
### Minor Changes
|
|
368
|
+
|
|
369
|
+
- d343b67e: Re-release packages
|
|
370
|
+
|
|
371
|
+
## 0.2.1
|
|
372
|
+
|
|
373
|
+
### Patch Changes
|
|
374
|
+
|
|
375
|
+
- c5e4851b: Updated build process from TSDX to tsup.
|
|
376
|
+
- e2aa08e9: Fix missing built files for packages.
|
|
377
|
+
|
|
378
|
+
Version history from v0.1.0 to this day.
|
|
379
|
+
|
|
380
|
+
## v0.2.0 - Usability Boost
|
|
381
|
+
|
|
382
|
+
- `bcs.de(...)` now supports strings if encoding is passed as the last argument
|
|
383
|
+
- `BCS` (upper) -> `bcs` (lower) renaming
|
|
384
|
+
- Improved documentation, checked documentation examples for failures
|
|
385
|
+
|
|
386
|
+
## v0.1.0
|
|
387
|
+
|
|
388
|
+
First version of libary published.
|