@leofcoin/chain 1.10.9 → 1.10.11

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 (44) hide show
  1. package/exports/beacon-envelope.js +68 -0
  2. package/exports/beacon-epoch.js +117 -0
  3. package/exports/beacon-lifecycle.js +155 -0
  4. package/exports/beacon-round.js +77 -0
  5. package/exports/beacon-wire.js +98 -0
  6. package/exports/beacon.js +141 -0
  7. package/exports/browser/beacon-envelope.js +163 -0
  8. package/exports/browser/beacon-epoch.js +116 -0
  9. package/exports/browser/beacon-lifecycle.js +154 -0
  10. package/exports/browser/beacon-round.js +76 -0
  11. package/exports/browser/beacon-wire.js +99 -0
  12. package/exports/browser/beacon.js +1706 -0
  13. package/exports/browser/{browser-D-r0O9Qn-BZDYY6cg.js → browser-CWeoyGUw-BabtHowB.js} +4 -2
  14. package/exports/browser/{browser-_hiyXwPp-DYI1tyUr.js → browser-DvU1xNFS-sdlKNCJc.js} +4 -2
  15. package/exports/browser/chain.js +174 -5008
  16. package/exports/browser/{client-BVhUamQG-D-D1e_x8.js → client-B-jyclOB-CsNYfj4Z.js} +6 -4
  17. package/exports/browser/constants-Cv0p224A.js +130 -0
  18. package/exports/browser/hkdf-DhdhLAAv.js +147 -0
  19. package/exports/browser/{index-BD0Anx7_-Dg4_tCeN.js → index-Bxr5Iztg-C6xBk0rK.js} +4 -2
  20. package/exports/browser/index-CvKt4UDE.js +464 -0
  21. package/exports/browser/index-D7FUx7Dd.js +4996 -0
  22. package/exports/browser/{messages-UKnuelZ7-DJT-98q-.js → messages-FMRAS8QX-CvlZBzy5.js} +4 -2
  23. package/exports/browser/{node-browser-DlzZ5CP_.js → node-browser-xlqSBOaN.js} +12 -5
  24. package/exports/browser/node-browser.js +4 -2
  25. package/exports/browser/{constants-gMYZLHKp.js → proposal.proto-BcUgd885.js} +61 -620
  26. package/exports/browser/quorum-S_qdgiAY.js +8 -0
  27. package/exports/browser/weierstrass-C-jX_jly.js +2156 -0
  28. package/exports/browser/workers/block-worker.js +1 -1
  29. package/exports/browser/workers/machine-worker.js +7142 -72
  30. package/exports/browser/workers/{worker-CZqErLI7-BxofVJAn.js → worker-DMCj1e6z-CTYVa2yX.js} +30 -1
  31. package/exports/chain.js +158 -75
  32. package/exports/{constants-D6gWzJZg.js → constants-CMYKv-Rt.js} +1 -1
  33. package/exports/node.js +1 -1
  34. package/exports/quorum-S_qdgiAY.js +8 -0
  35. package/exports/workers/block-worker.js +1 -1
  36. package/exports/workers/machine-worker.js +7142 -72
  37. package/exports/workers/{worker-CZqErLI7-BxofVJAn.js → worker-DMCj1e6z-CTYVa2yX.js} +30 -1
  38. package/package.json +29 -2
  39. package/types/beacon-envelope.d.ts +27 -0
  40. package/types/beacon-epoch.d.ts +28 -0
  41. package/types/beacon-lifecycle.d.ts +40 -0
  42. package/types/beacon-round.d.ts +18 -0
  43. package/types/beacon-wire.d.ts +31 -0
  44. package/types/beacon.d.ts +24 -0
@@ -1,425 +1,4 @@
1
- // base-x encoding / decoding
2
- // Copyright (c) 2018 base-x contributors
3
- // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
4
- // Copyright (c) 2026 Vandeuren Glenn
5
- // Distributed under the MIT software license, see the accompanying
6
- // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
7
- const base = (ALPHABET, options = {}) => {
8
- if (ALPHABET.length >= 255) {
9
- throw new TypeError("Alphabet too long");
10
- }
11
- const BASE_MAP = new Uint8Array(256);
12
- for (let j = 0; j < BASE_MAP.length; j++) {
13
- BASE_MAP[j] = 255;
14
- }
15
- for (let i = 0; i < ALPHABET.length; i++) {
16
- const x = ALPHABET.charAt(i);
17
- const xc = x.charCodeAt(0);
18
- if (BASE_MAP[xc] !== 255) {
19
- throw new TypeError(x + " is ambiguous");
20
- }
21
- BASE_MAP[xc] = i;
22
- }
23
- const BASE = ALPHABET.length;
24
- const LEADER = ALPHABET.charAt(0);
25
- const LEADER_CODE = ALPHABET.charCodeAt(0);
26
- const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
27
- const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
28
- // Optimization: If BASE is a power of 2, we can use bitwise operations
29
- // This is much faster than the generic algorithm (approx 10x-20x)
30
- const isPowerOfTwo = (BASE & (BASE - 1)) === 0;
31
- if (isPowerOfTwo) {
32
- const k = Math.log2(BASE);
33
- const mask = (1 << k) - 1;
34
- if (options.rfc4648) {
35
- // RFC 4648 Mode
36
- const encode = (source) => {
37
- if (source instanceof Uint8Array) ;
38
- else if (ArrayBuffer.isView(source)) {
39
- source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
40
- }
41
- else if (Array.isArray(source)) {
42
- source = Uint8Array.from(source);
43
- }
44
- if (!(source instanceof Uint8Array)) {
45
- throw new TypeError("Expected Uint8Array");
46
- }
47
- if (source.length === 0) {
48
- return "";
49
- }
50
- let str = "";
51
- let currentValue = 0;
52
- let currentBits = 0;
53
- for (let i = 0; i < source.length; i++) {
54
- currentValue = (currentValue << 8) | source[i];
55
- currentBits += 8;
56
- while (currentBits >= k) {
57
- currentBits -= k;
58
- str += ALPHABET.charAt((currentValue >>> currentBits) & mask);
59
- }
60
- }
61
- // Leftover bits (padding logic for the last character)
62
- if (currentBits > 0) {
63
- str += ALPHABET.charAt((currentValue << (k - currentBits)) & mask);
64
- }
65
- // Add padding chars '=' if required
66
- while ((str.length * k) % 8 !== 0) {
67
- str += "=";
68
- }
69
- return str;
70
- };
71
- const decodeUnsafe = (source) => {
72
- if (typeof source !== "string") {
73
- throw new TypeError("Expected String");
74
- }
75
- if (source.length === 0) {
76
- return new Uint8Array();
77
- }
78
- // Strip padding
79
- let end = source.length;
80
- while (end > 0 && source[end - 1] === "=") {
81
- end--;
82
- }
83
- source = source.substring(0, end);
84
- let currentValue = 0;
85
- let currentBits = 0;
86
- // Estimate size: source.length * k / 8
87
- const buffer = new Uint8Array((source.length * k) >>> 3);
88
- let ptr = 0;
89
- for (let i = 0; i < source.length; i++) {
90
- const char = source.charCodeAt(i);
91
- const val = BASE_MAP[char];
92
- if (val === 255)
93
- return undefined;
94
- currentValue = (currentValue << k) | val;
95
- currentBits += k;
96
- if (currentBits >= 8) {
97
- currentBits -= 8;
98
- buffer[ptr++] = (currentValue >>> currentBits) & 0xff;
99
- }
100
- }
101
- return buffer;
102
- };
103
- const decode = (string) => {
104
- const buffer = decodeUnsafe(string);
105
- if (buffer)
106
- return buffer;
107
- throw new Error("Non-base" + BASE + " character");
108
- };
109
- return { encode, decodeUnsafe, decode };
110
- }
111
- // Standard Mode (Bitwise)
112
- const encode = (source) => {
113
- if (source instanceof Uint8Array) ;
114
- else if (ArrayBuffer.isView(source)) {
115
- source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
116
- }
117
- else if (Array.isArray(source)) {
118
- source = Uint8Array.from(source);
119
- }
120
- if (!(source instanceof Uint8Array)) {
121
- throw new TypeError("Expected Uint8Array");
122
- }
123
- if (source.length === 0) {
124
- return "";
125
- }
126
- let zeroes = 0;
127
- let pbegin = 0;
128
- const pend = source.length;
129
- while (pbegin !== pend && source[pbegin] === 0) {
130
- pbegin++;
131
- zeroes++;
132
- }
133
- let str = LEADER.repeat(zeroes);
134
- if (pbegin === pend)
135
- return str;
136
- // Bitwise conversion
137
- let currentValue = 0;
138
- let currentBits = 0;
139
- const totalBits = (pend - pbegin) * 8;
140
- let remainder = totalBits % k;
141
- // Handling the initial alignment to the most significant bits
142
- // If total bits isn't divisible by k, the first digit uses 'remainder' bits
143
- if (remainder === 0)
144
- remainder = k; // effectively divisible, treating first k bits normally
145
- let seenNonZero = false;
146
- let firstChunk = true;
147
- for (let i = pbegin; i < pend; i++) {
148
- currentValue = (currentValue << 8) | source[i];
149
- currentBits += 8;
150
- while (currentBits >= k || (firstChunk && currentBits >= remainder)) {
151
- let bitsToExtract = k;
152
- if (firstChunk) {
153
- if (totalBits % k !== 0) {
154
- bitsToExtract = totalBits % k;
155
- }
156
- firstChunk = false;
157
- }
158
- const shift = currentBits - bitsToExtract;
159
- const digit = (currentValue >>> shift) & ((1 << bitsToExtract) - 1);
160
- currentBits -= bitsToExtract;
161
- if (seenNonZero || digit !== 0) {
162
- str += ALPHABET.charAt(digit);
163
- seenNonZero = true;
164
- }
165
- }
166
- }
167
- return str;
168
- };
169
- const decodeUnsafe = (source) => {
170
- if (typeof source !== "string") {
171
- throw new TypeError("Expected String");
172
- }
173
- if (source.length === 0) {
174
- return new Uint8Array();
175
- }
176
- let psz = 0;
177
- let zeroes = 0;
178
- while (source.charCodeAt(psz) === LEADER_CODE) {
179
- zeroes++;
180
- psz++;
181
- }
182
- // Accumulate bits
183
- // We must handle alignment.
184
- const length = source.length - psz;
185
- const totalBits = length * k;
186
- let currentBits = (8 - (totalBits % 8)) % 8; // align to byte boundary
187
- const result = new Uint8Array((totalBits + 7) >>> 3); // (totalBits + 7) / 8
188
- let rIdx = 0;
189
- let currentValue = 0;
190
- for (let i = psz; i < source.length; i++) {
191
- const char = source.charCodeAt(i);
192
- const val = BASE_MAP[char];
193
- if (val === 255)
194
- return;
195
- currentValue = (currentValue << k) | val;
196
- currentBits += k;
197
- if (currentBits >= 8) {
198
- const shift = currentBits - 8;
199
- result[rIdx++] = (currentValue >>> shift) & 0xff;
200
- currentBits -= 8;
201
- // Keep only the remaining bits to avoid overflow
202
- currentValue &= (1 << currentBits) - 1;
203
- }
204
- }
205
- // Skip leading zeroes in result buffer
206
- let skip = 0;
207
- while (skip < rIdx && result[skip] === 0) {
208
- skip++;
209
- }
210
- // Combine with zeroes
211
- const final = new Uint8Array(zeroes + (rIdx - skip));
212
- // zeroes are 0, so just copy result
213
- final.set(result.subarray(skip, rIdx), zeroes);
214
- return final;
215
- };
216
- const decode = (string) => {
217
- const buffer = decodeUnsafe(string);
218
- if (buffer)
219
- return buffer;
220
- throw new Error("Non-base" + BASE + " character");
221
- };
222
- return { encode, decodeUnsafe, decode };
223
- }
224
- const encode = (source) => {
225
- if (source instanceof Uint8Array) ;
226
- else if (ArrayBuffer.isView(source)) {
227
- source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
228
- }
229
- else if (Array.isArray(source)) {
230
- source = Uint8Array.from(source);
231
- }
232
- if (!(source instanceof Uint8Array)) {
233
- throw new TypeError("Expected Uint8Array");
234
- }
235
- if (source.length === 0) {
236
- return "";
237
- }
238
- // Skip & count leading zeroes.
239
- let zeroes = 0;
240
- let length = 0;
241
- let pbegin = 0;
242
- const pend = source.length;
243
- while (pbegin !== pend && source[pbegin] === 0) {
244
- pbegin++;
245
- zeroes++;
246
- }
247
- // Allocate enough space in big-endian base58 representation.
248
- const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
249
- const b58 = new Uint8Array(size);
250
- // Process the bytes.
251
- while (pbegin !== pend) {
252
- let carry = source[pbegin];
253
- // Apply "b58 = b58 * 256 + ch".
254
- let i = 0;
255
- for (let it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {
256
- carry += (b58[it1] << 8) >>> 0;
257
- b58[it1] = (carry % BASE) >>> 0;
258
- carry = (carry / BASE) >>> 0;
259
- }
260
- if (carry !== 0) {
261
- throw new Error("Non-zero carry");
262
- }
263
- length = i;
264
- pbegin++;
265
- }
266
- // Skip leading zeroes in base58 result.
267
- let it2 = size - length;
268
- while (it2 !== size && b58[it2] === 0) {
269
- it2++;
270
- }
271
- // Translate the result into a string.
272
- let str = LEADER.repeat(zeroes);
273
- for (; it2 < size; ++it2) {
274
- str += ALPHABET.charAt(b58[it2]);
275
- }
276
- return str;
277
- };
278
- const decodeUnsafe = (source) => {
279
- if (typeof source !== "string") {
280
- throw new TypeError("Expected String");
281
- }
282
- if (source.length === 0) {
283
- return new Uint8Array();
284
- }
285
- let psz = 0;
286
- // Skip and count leading '1's.
287
- let zeroes = 0;
288
- let length = 0;
289
- while (source.charCodeAt(psz) === LEADER_CODE) {
290
- zeroes++;
291
- psz++;
292
- }
293
- // Allocate enough space in big-endian base256 representation.
294
- const size = ((source.length - psz) * FACTOR + 1) >>> 0; // log(58) / log(256), rounded up.
295
- let b256 = new Uint8Array(size);
296
- // Process the characters.
297
- for (; psz < source.length; psz++) {
298
- // Decode character
299
- let carry = BASE_MAP[source.charCodeAt(psz)];
300
- // Invalid character
301
- if (carry === 255) {
302
- return;
303
- }
304
- let i = 0;
305
- for (let it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) {
306
- carry += (BASE * b256[it3]) >>> 0;
307
- b256[it3] = (carry & 0xff) >>> 0;
308
- carry = (carry >> 8) >>> 0;
309
- }
310
- if (carry !== 0) {
311
- throw new Error("Non-zero carry");
312
- }
313
- length = i;
314
- }
315
- // Skip leading zeroes in b256.
316
- let it4 = size - length;
317
- while (it4 !== size && b256[it4] === 0) {
318
- it4++;
319
- }
320
- let vch = new Uint8Array(zeroes + (size - it4));
321
- let j = zeroes;
322
- while (it4 !== size) {
323
- vch[j++] = b256[it4++];
324
- }
325
- return vch;
326
- };
327
- const decode = (string) => {
328
- const buffer = decodeUnsafe(string);
329
- if (buffer) {
330
- return buffer;
331
- }
332
- throw new Error("Non-base" + BASE + " character");
333
- };
334
- return {
335
- encode,
336
- decodeUnsafe,
337
- decode,
338
- };
339
- };
340
-
341
- const ALPHABET$3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
342
- const ALPHABET_HEX$1 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
343
- const base32 = base(ALPHABET$3);
344
- const base32Hex = base(ALPHABET_HEX$1);
345
- const decode$3 = base32.decode;
346
- const decodeHex$1 = base32Hex.decode;
347
- const encode$3 = base32.encode;
348
- const encodeHex$1 = base32Hex.encode;
349
- const isBase32 = (string, hex = false) => {
350
- try {
351
- if (hex)
352
- decodeHex$1(string);
353
- else
354
- decode$3(string);
355
- return true;
356
- }
357
- catch (e) {
358
- return false;
359
- }
360
- };
361
- const isBase32Hex = (string) => {
362
- return isBase32(string, true);
363
- };
364
- var index$5 = {
365
- encode: encode$3,
366
- decode: decode$3,
367
- encodeHex: encodeHex$1,
368
- decodeHex: decodeHex$1,
369
- isBase32,
370
- isBase32Hex,
371
- };
372
-
373
- const ALPHABET$2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
374
- const ALPHABET_HEX = "0123456789ABCDEFGHJKLMNPQRSTUVabcdefghijklmnopqrstuv";
375
- const base58 = base(ALPHABET$2);
376
- const base58Hex = base(ALPHABET_HEX);
377
- const encode$2 = base58.encode;
378
- const decode$2 = base58.decode;
379
- const encodeHex = base58Hex.encode;
380
- const decodeHex = base58Hex.decode;
381
- const isBase58 = (string) => {
382
- try {
383
- decode$2(string);
384
- return true;
385
- }
386
- catch (e) {
387
- return false;
388
- }
389
- };
390
- const isBase58Hex = (string) => {
391
- try {
392
- decodeHex(string);
393
- return true;
394
- }
395
- catch (e) {
396
- return false;
397
- }
398
- };
399
- const whatType = (string) => {
400
- try {
401
- decode$2(string);
402
- return "base58";
403
- }
404
- catch (e) {
405
- try {
406
- decodeHex(string);
407
- return "base58Hex";
408
- }
409
- catch {
410
- return;
411
- }
412
- }
413
- };
414
- var base58$1 = {
415
- encode: encode$2,
416
- decode: decode$2,
417
- isBase58,
418
- isBase58Hex,
419
- encodeHex,
420
- decodeHex,
421
- whatType,
422
- };
1
+ import { a as index$4, b as base58$1, i as index$5, f as fromBase58, c as fromHex, d as fromArrayLike, e as toBase32, t as toBase58, g as toHex } from './index-CvKt4UDE.js';
423
2
 
424
3
  var isHex = string => /^[A-F0-9]+$/i.test(
425
4
  string.startsWith('0x') ?
@@ -495,16 +74,16 @@ var encodingLength = (value) => (value < N1 ? 1
495
74
  : value < N9 ? 9
496
75
  : 10);
497
76
 
498
- var index$4 = {
77
+ var index$3 = {
499
78
  encode: encode$1,
500
79
  decode: decode$1,
501
80
  encodingLength
502
81
  };
503
82
 
504
- var index$3 = (input, prefix) => {
83
+ var index$2 = (input, prefix) => {
505
84
  const encodedArray = [];
506
85
  const length = input.reduce((total, current) => {
507
- const encoded = index$4.encode(current.length);
86
+ const encoded = index$3.encode(current.length);
508
87
  encodedArray.push(encoded);
509
88
  total += current.length + encoded.length;
510
89
  return total;
@@ -4272,7 +3851,7 @@ function ZStream() {
4272
3851
 
4273
3852
  var zstream = ZStream;
4274
3853
 
4275
- const toString$1$1 = Object.prototype.toString;
3854
+ const toString$1 = Object.prototype.toString;
4276
3855
 
4277
3856
  /* Public constants ==========================================================*/
4278
3857
  /* ===========================================================================*/
@@ -4431,7 +4010,7 @@ function Deflate$1(options) {
4431
4010
  if (typeof opt.dictionary === 'string') {
4432
4011
  // If we need to compress text, change encoding to utf8.
4433
4012
  dict = strings.string2buf(opt.dictionary);
4434
- } else if (toString$1$1.call(opt.dictionary) === '[object ArrayBuffer]') {
4013
+ } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {
4435
4014
  dict = new Uint8Array(opt.dictionary);
4436
4015
  } else {
4437
4016
  dict = opt.dictionary;
@@ -4483,7 +4062,7 @@ Deflate$1.prototype.push = function (data, flush_mode) {
4483
4062
  if (typeof data === 'string') {
4484
4063
  // If we need to compress text, change encoding to utf8.
4485
4064
  strm.input = strings.string2buf(data);
4486
- } else if (toString$1$1.call(data) === '[object ArrayBuffer]') {
4065
+ } else if (toString$1.call(data) === '[object ArrayBuffer]') {
4487
4066
  strm.input = new Uint8Array(data);
4488
4067
  } else {
4489
4068
  strm.input = data;
@@ -7515,15 +7094,15 @@ const encode = (proto, input, compress) => {
7515
7094
  throw new Error(`minimumLength for ${token.key} is set to ${token.minimumLength} but got ${data.length}`);
7516
7095
  set.push(toType(data !== undefined ? data : token.defaultValue));
7517
7096
  }
7518
- return compress ? pako.deflate(index$3(set)) : index$3(set);
7097
+ return compress ? pako.deflate(index$2(set)) : index$2(set);
7519
7098
  };
7520
7099
 
7521
- var index$2 = (typedArray, prefix) => {
7100
+ var index$1 = (typedArray, prefix) => {
7522
7101
  const set = [];
7523
7102
  const varintAndSub = (typedArray) => {
7524
- const length = index$4.decode(typedArray);
7103
+ const length = index$3.decode(typedArray);
7525
7104
  // remove length
7526
- typedArray = typedArray.subarray(index$4.decode.bytes);
7105
+ typedArray = typedArray.subarray(index$3.decode.bytes);
7527
7106
  // push value
7528
7107
  set.push(typedArray.subarray(0, length));
7529
7108
  // remove value
@@ -7535,52 +7114,12 @@ var index$2 = (typedArray, prefix) => {
7535
7114
  return varintAndSub(typedArray);
7536
7115
  };
7537
7116
 
7538
- const ALPHABET$1 = '0123456789ABCDEF';
7539
- const base16 = base(ALPHABET$1);
7540
- base16.decode;
7541
- base16.encode;
7542
-
7543
- const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
7544
- const base64 = base(ALPHABET);
7545
- base64.decode;
7546
- base64.encode;
7547
-
7548
- /**
7549
- * Returns a Uint8Array as String
7550
- * @param uint8Array Uint8Array to encode to String
7551
- * @returns String
7552
- */
7553
- const toString$1 = (uint8Array) => new TextDecoder().decode(uint8Array);
7554
- /**
7555
- * hexString -> uint8Array
7556
- * @param string hex encoded string
7557
- * @returns UintArray
7558
- */
7559
- const fromHex = (string) => Uint8Array.from(string.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
7560
- /**
7561
- * uint8Array -> hexString
7562
- * @param bytes number[]
7563
- * @returns hexString
7564
- */
7565
- const toHex = (bytes) => bytes.reduce((string, byte) => string + byte.toString(16).padStart(2, '0'), '');
7566
- /**
7567
- * number[] -> Uint8Array
7568
- * @param array number[]
7569
- * @returns Uint8Array
7570
- */
7571
- const fromArrayLike = (array) => Uint8Array.from(array);
7572
- const toBase58 = (uint8Array) => base58$1.encode(uint8Array);
7573
- const fromBase58 = (string) => base58$1.decode(string);
7574
- const toBase32 = (uint8Array) => index$5.encode(uint8Array);
7575
- var index$1 = {
7576
- toString: toString$1};
7577
-
7578
- const { toString } = index$1;
7117
+ const { toString } = index$4;
7579
7118
  const decoder = new TextDecoder();
7580
7119
  const decode = (proto, uint8Array, compressed) => {
7581
7120
  if (compressed)
7582
7121
  uint8Array = pako.inflate(uint8Array);
7583
- let deconcated = index$2(uint8Array);
7122
+ let deconcated = index$1(uint8Array);
7584
7123
  const output = {};
7585
7124
  const tokens = getTokens(proto);
7586
7125
  if (tokens.length !== deconcated.length)
@@ -7916,6 +7455,21 @@ const blockchainCodecs = [
7916
7455
  }
7917
7456
  ];
7918
7457
  const consensusCodecs = [
7458
+ {
7459
+ name: "beacon-activation-message",
7460
+ codec: "0x62616d",
7461
+ hashAlg: "keccak-256"
7462
+ },
7463
+ {
7464
+ name: "beacon-commitment-message",
7465
+ codec: "0x62636d",
7466
+ hashAlg: "keccak-256"
7467
+ },
7468
+ {
7469
+ name: "beacon-share-message",
7470
+ codec: "0x62736d",
7471
+ hashAlg: "keccak-256"
7472
+ },
7919
7473
  {
7920
7474
  name: "proposal-message",
7921
7475
  codec: "0x70726d",
@@ -8079,7 +7633,7 @@ let Codec$1 = class Codec extends BasicInterface {
8079
7633
  super();
8080
7634
  if (buffer) {
8081
7635
  if (buffer instanceof Uint8Array) {
8082
- const codec = index$4.decode(buffer);
7636
+ const codec = index$3.decode(buffer);
8083
7637
  const name = this.getCodecName(codec);
8084
7638
  if (name) {
8085
7639
  this.name = name;
@@ -8091,7 +7645,7 @@ let Codec$1 = class Codec extends BasicInterface {
8091
7645
  }
8092
7646
  }
8093
7647
  else if (buffer instanceof ArrayBuffer) {
8094
- const codec = index$4.decode(buffer);
7648
+ const codec = index$3.decode(buffer);
8095
7649
  const name = this.getCodecName(codec);
8096
7650
  if (name) {
8097
7651
  this.name = name;
@@ -8120,7 +7674,7 @@ let Codec$1 = class Codec extends BasicInterface {
8120
7674
  }
8121
7675
  }
8122
7676
  fromEncoded(encoded) {
8123
- const codec = index$4.decode(encoded);
7677
+ const codec = index$3.decode(encoded);
8124
7678
  const name = this.getCodecName(codec);
8125
7679
  this.name = name;
8126
7680
  this.encoded = encoded;
@@ -8139,7 +7693,7 @@ let Codec$1 = class Codec extends BasicInterface {
8139
7693
  this.name = this.getCodecName(codec);
8140
7694
  this.hashAlg = this.getHashAlg(this.name);
8141
7695
  this.codec = this.getCodec(this.name);
8142
- this.codecBuffer = index$4.encode(this.codec);
7696
+ this.codecBuffer = index$3.encode(this.codec);
8143
7697
  this.decoded = {
8144
7698
  name: this.name,
8145
7699
  hashAlg: this.hashAlg,
@@ -8152,7 +7706,7 @@ let Codec$1 = class Codec extends BasicInterface {
8152
7706
  this.name = name;
8153
7707
  this.codec = codec;
8154
7708
  this.hashAlg = this.getHashAlg(name);
8155
- this.codecBuffer = index$4.encode(this.codec);
7709
+ this.codecBuffer = index$3.encode(this.codec);
8156
7710
  this.decoded = {
8157
7711
  name: this.name,
8158
7712
  hashAlg: this.hashAlg,
@@ -8162,13 +7716,13 @@ let Codec$1 = class Codec extends BasicInterface {
8162
7716
  }
8163
7717
  decode(encoded) {
8164
7718
  encoded = encoded || this.encoded;
8165
- const codec = index$4.decode(encoded);
7719
+ const codec = index$3.decode(encoded);
8166
7720
  this.fromCodec(codec);
8167
7721
  return this.decoded;
8168
7722
  }
8169
7723
  encode(codec) {
8170
7724
  codec = codec || this.codec;
8171
- this.encoded = index$4.encode(codec);
7725
+ this.encoded = index$3.encode(codec);
8172
7726
  return this.encoded;
8173
7727
  }
8174
7728
  };
@@ -8956,7 +8510,7 @@ class CodecHash extends BasicInterface {
8956
8510
  return uint8Array;
8957
8511
  }
8958
8512
  get length() {
8959
- return index$4.encode(this.size);
8513
+ return index$3.encode(this.size);
8960
8514
  }
8961
8515
  get buffer() {
8962
8516
  return this.encoded;
@@ -8990,7 +8544,7 @@ class CodecHash extends BasicInterface {
8990
8544
  if (!(buffer instanceof Uint8Array)) {
8991
8545
  throw new Error('CodecHash only supports Uint8Array input');
8992
8546
  }
8993
- const codec = index$4.decode(buffer);
8547
+ const codec = index$3.decode(buffer);
8994
8548
  if (this.codecs[codec]) {
8995
8549
  this.decode(buffer);
8996
8550
  }
@@ -9000,12 +8554,12 @@ class CodecHash extends BasicInterface {
9000
8554
  }
9001
8555
  decode(buffer) {
9002
8556
  this.encoded = buffer;
9003
- const codec = index$4.decode(buffer);
8557
+ const codec = index$3.decode(buffer);
9004
8558
  this.discoCodec = new Codec$1(codec, this.codecs);
9005
8559
  // TODO: validate codec
9006
- buffer = buffer.slice(index$4.decode.bytes);
9007
- this.size = index$4.decode(buffer);
9008
- this.digest = buffer.slice(index$4.decode.bytes);
8560
+ buffer = buffer.slice(index$3.decode.bytes);
8561
+ this.size = index$3.decode(buffer);
8562
+ this.digest = buffer.slice(index$3.decode.bytes);
9009
8563
  if (this.digest.length !== this.size) {
9010
8564
  throw new Error(`hash length inconsistent: 0x${this.encoded.toString()}`);
9011
8565
  }
@@ -9189,7 +8743,7 @@ const FormatInterface = FormatInterface$1;
9189
8743
  */
9190
8744
  const Codec = Codec$1;
9191
8745
 
9192
- var proto$a = {
8746
+ var proto$8 = {
9193
8747
  index: BigInt(0),
9194
8748
  previousHash: String(),
9195
8749
  timestamp: Number(),
@@ -9202,73 +8756,26 @@ var proto$a = {
9202
8756
  protocolVersion: String()
9203
8757
  };
9204
8758
 
9205
- var proto$9 = {
8759
+ var proto$7 = {
9206
8760
  address: String(),
9207
8761
  reward: BigInt(0)
9208
8762
  };
9209
8763
 
9210
- class ValidatorMessage extends FormatInterface {
9211
- get messageName() {
9212
- return "ValidatorMessage";
9213
- }
9214
- constructor(buffer) {
9215
- if (buffer instanceof ValidatorMessage)
9216
- return buffer;
9217
- const name = "validator-message";
9218
- super(buffer, proto$9, { name });
9219
- }
9220
- }
8764
+ ({
8765
+ epoch: BigInt(0)});
9221
8766
 
9222
- class BlockMessage extends FormatInterface {
9223
- get messageName() {
9224
- return "BlockMessage";
9225
- }
9226
- constructor(buffer) {
9227
- if (buffer instanceof BlockMessage)
9228
- return buffer;
9229
- const name = "block-message";
9230
- super(buffer, proto$a, { name });
9231
- }
9232
- encode(decoded) {
9233
- decoded = decoded || this.decoded;
9234
- const validators = [];
9235
- for (const validator of decoded.validators) {
9236
- if (validator instanceof ValidatorMessage)
9237
- validators.push(validator.encode());
9238
- else
9239
- validators.push(new ValidatorMessage(validator).encode());
9240
- }
9241
- return super.encode({
9242
- ...decoded,
9243
- validators: index$3(validators)
9244
- });
9245
- }
9246
- decode(encoded) {
9247
- encoded = encoded || this.encoded;
9248
- super.decode(encoded);
9249
- this.decoded.validators = index$2(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
9250
- return this.decoded;
9251
- }
9252
- }
9253
-
9254
- var proto$8 = {
9255
- up: Number(),
9256
- down: Number()
9257
- };
8767
+ ({
8768
+ epoch: BigInt(0),
8769
+ threshold: BigInt(0),
8770
+ participant: BigInt(0),
8771
+ commitments: Array()});
9258
8772
 
9259
- class BWMessage extends FormatInterface {
9260
- get messageName() {
9261
- return "BWMessage";
9262
- }
9263
- constructor(buffer) {
9264
- if (buffer instanceof BWMessage)
9265
- return buffer;
9266
- const name = "bw-message";
9267
- super(buffer, proto$8, { name });
9268
- }
9269
- }
8773
+ ({
8774
+ epoch: BigInt(0),
8775
+ round: BigInt(0),
8776
+ participant: BigInt(0)});
9270
8777
 
9271
- var proto$7 = {
8778
+ var proto$6 = {
9272
8779
  creator: String(),
9273
8780
  contract: new Uint8Array(),
9274
8781
  constructorParameters: Array()
@@ -9281,28 +8788,16 @@ class ContractMessage extends FormatInterface {
9281
8788
  constructor(buffer) {
9282
8789
  if (buffer instanceof ContractMessage)
9283
8790
  return buffer;
9284
- super(buffer, proto$7, { name: "contract-message" });
8791
+ super(buffer, proto$6, { name: "contract-message" });
9285
8792
  }
9286
8793
  }
9287
8794
 
9288
- var proto$6 = {
8795
+ var proto$5 = {
9289
8796
  hash: String(),
9290
8797
  index: BigInt(0)
9291
8798
  };
9292
8799
 
9293
- class LastBlockMessage extends FormatInterface {
9294
- get messageName() {
9295
- return "LastBlockMessage";
9296
- }
9297
- constructor(buffer) {
9298
- if (buffer instanceof LastBlockMessage)
9299
- return buffer;
9300
- const name = "last-block-message";
9301
- super(buffer, proto$6, { name });
9302
- }
9303
- }
9304
-
9305
- var proto$5 = {
8800
+ var proto$4 = {
9306
8801
  timestamp: Number(),
9307
8802
  from: String(),
9308
8803
  to: String(),
@@ -9322,7 +8817,7 @@ class TransactionMessage extends FormatInterface {
9322
8817
  if (buffer instanceof TransactionMessage)
9323
8818
  return buffer;
9324
8819
  const name = "transaction-message";
9325
- super(buffer, proto$5, { name });
8820
+ super(buffer, proto$4, { name });
9326
8821
  }
9327
8822
  beforeHashing(decoded) {
9328
8823
  decoded = super.beforeHashing(decoded);
@@ -9333,7 +8828,7 @@ class TransactionMessage extends FormatInterface {
9333
8828
  }
9334
8829
  }
9335
8830
 
9336
- var proto$4 = {
8831
+ var proto$3 = {
9337
8832
  timestamp: Number(),
9338
8833
  from: String(),
9339
8834
  to: String(),
@@ -9342,23 +8837,6 @@ var proto$4 = {
9342
8837
  "nonce?": Number()
9343
8838
  };
9344
8839
 
9345
- var proto$3 = {
9346
- lastblock: Object(),
9347
- values: Object()
9348
- };
9349
-
9350
- class StateMessage extends FormatInterface {
9351
- get messageName() {
9352
- return "StateMessage";
9353
- }
9354
- constructor(buffer) {
9355
- if (buffer instanceof StateMessage)
9356
- return buffer;
9357
- const name = "state-message";
9358
- super(buffer, proto$3, { name });
9359
- }
9360
- }
9361
-
9362
8840
  var proto$2 = {
9363
8841
  blockHash: String(),
9364
8842
  index: BigInt(0),
@@ -9383,41 +8861,4 @@ var proto = {
9383
8861
  signature: String()
9384
8862
  };
9385
8863
 
9386
- var networks = {
9387
- leofcoin: {
9388
- mainnet: {
9389
- // ports don't really matter since it is favorable to have it begind a ngninx proxy but if we change something to the proto it's easier maybe?
9390
- port: 44444,
9391
- // todo a versionhash would be nice to have as a double check?
9392
- versionHash: "0",
9393
- // a short description identifying the version
9394
- description: "Main net current version",
9395
- stars: ["wss://star.leofcoin.org"]
9396
- // todo webrtc and bittorent stars
9397
- },
9398
- peach: {
9399
- port: 44444,
9400
- description: "Main testnet: latest step before merging into main",
9401
- versionHash: "1",
9402
- stars: ["wss://star.leofcoin.org"]
9403
- // todo webrtc and bittorent stars
9404
- }
9405
- }
9406
- };
9407
-
9408
- var networks$1 = /*#__PURE__*/Object.freeze({
9409
- __proto__: null,
9410
- default: networks
9411
- });
9412
-
9413
- const PROTOCOL_VERSION = "0.2.0";
9414
- const REACHED_ONE_ZERO_ZERO = false;
9415
- const DEFAULT_NODE_OPTIONS = {
9416
- autoStart: false,
9417
- network: "leofcoin:peach",
9418
- networkVersion: "peach",
9419
- version: PROTOCOL_VERSION,
9420
- stars: networks.leofcoin.peach.stars
9421
- };
9422
-
9423
- export { BlockMessage as B, ContractMessage as C, DEFAULT_NODE_OPTIONS as D, FormatInterface as F, LastBlockMessage as L, PROTOCOL_VERSION as P, REACHED_ONE_ZERO_ZERO as R, StateMessage as S, TransactionMessage as T, ValidatorMessage as V, proto$2 as a, proto$1 as b, proto as c, base58$1 as d, index$2 as e, createRIPEMD160 as f, createHMAC as g, createSHA512 as h, index$3 as i, createKeccak as j, index$4 as k, index$5 as l, fromBase58 as m, jsonStringifyBigInt$1 as n, jsonParseBigInt$1 as o, proto$4 as p, Codec as q, BWMessage as r, networks$1 as s, toBase58 as t };
8864
+ export { ContractMessage as C, FormatInterface as F, TransactionMessage as T, proto$1 as a, proto as b, jsonParseBigInt$1 as c, Codec as d, proto$3 as e, index$1 as f, createRIPEMD160 as g, createHMAC as h, index$2 as i, jsonStringifyBigInt$1 as j, createSHA512 as k, createKeccak as l, index$3 as m, proto$7 as n, proto$8 as o, proto$2 as p, proto$5 as q };