@leofcoin/chain 1.7.68 → 1.7.70

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.
@@ -145,16 +145,16 @@ const ALPHABET$3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
145
145
  const ALPHABET_HEX$1 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
146
146
  const base32 = base(ALPHABET$3);
147
147
  const base32Hex = base(ALPHABET_HEX$1);
148
- const decode$5 = base32.decode;
148
+ const decode$3 = base32.decode;
149
149
  const decodeHex$1 = base32Hex.decode;
150
- const encode$5 = base32.encode;
150
+ const encode$3 = base32.encode;
151
151
  const encodeHex$1 = base32Hex.encode;
152
152
  const isBase32 = (string, hex = false) => {
153
153
  try {
154
154
  if (hex)
155
155
  decodeHex$1(string);
156
156
  else
157
- decode$5(string);
157
+ decode$3(string);
158
158
  return true;
159
159
  }
160
160
  catch (e) {
@@ -164,9 +164,9 @@ const isBase32 = (string, hex = false) => {
164
164
  const isBase32Hex = (string) => {
165
165
  return isBase32(string, true);
166
166
  };
167
- var index$7 = {
168
- encode: encode$5,
169
- decode: decode$5,
167
+ var index$5 = {
168
+ encode: encode$3,
169
+ decode: decode$3,
170
170
  encodeHex: encodeHex$1,
171
171
  decodeHex: decodeHex$1,
172
172
  isBase32,
@@ -177,13 +177,13 @@ const ALPHABET$2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
177
177
  const ALPHABET_HEX = "0123456789ABCDEFGHJKLMNPQRSTUVabcdefghijklmnopqrstuv";
178
178
  const base58 = base(ALPHABET$2);
179
179
  const base58Hex = base(ALPHABET_HEX);
180
- const encode$4 = base58.encode;
181
- const decode$4 = base58.decode;
180
+ const encode$2 = base58.encode;
181
+ const decode$2 = base58.decode;
182
182
  const encodeHex = base58Hex.encode;
183
183
  const decodeHex = base58Hex.decode;
184
184
  const isBase58 = (string) => {
185
185
  try {
186
- decode$4(string);
186
+ decode$2(string);
187
187
  return true;
188
188
  }
189
189
  catch (e) {
@@ -201,7 +201,7 @@ const isBase58Hex = (string) => {
201
201
  };
202
202
  const whatType = (string) => {
203
203
  try {
204
- decode$4(string);
204
+ decode$2(string);
205
205
  return "base58";
206
206
  }
207
207
  catch (e) {
@@ -215,8 +215,8 @@ const whatType = (string) => {
215
215
  }
216
216
  };
217
217
  var base58$1 = {
218
- encode: encode$4,
219
- decode: decode$4,
218
+ encode: encode$2,
219
+ decode: decode$2,
220
220
  isBase58,
221
221
  isBase58Hex,
222
222
  encodeHex,
@@ -231,12 +231,11 @@ var isHex = string => /^[A-F0-9]+$/i.test(
231
231
  );
232
232
 
233
233
  const MSB$1 = 0x80;
234
- const REST$1 = 0x7F;
235
- const MSBALL = ~REST$1;
234
+ const MSBALL = -128;
236
235
  const INT = Math.pow(2, 31);
237
- const encode$3 = (num, out, offset) => {
236
+ const encode$1 = (num, out, offset) => {
238
237
  if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
239
- encode$3.bytes = 0;
238
+ encode$1.bytes = 0;
240
239
  throw new RangeError('Could not encode varint');
241
240
  }
242
241
  out = out || [];
@@ -251,13 +250,13 @@ const encode$3 = (num, out, offset) => {
251
250
  num >>>= 7;
252
251
  }
253
252
  out[offset] = num | 0;
254
- encode$3.bytes = offset - oldOffset + 1;
253
+ encode$1.bytes = offset - oldOffset + 1;
255
254
  return out;
256
255
  };
257
256
 
258
257
  const MSB = 0x80;
259
258
  const REST = 0x7F;
260
- const decode$3 = (buf, offset) => {
259
+ const decode$1 = (buf, offset) => {
261
260
  offset = offset || 0;
262
261
  const l = buf.length;
263
262
  let counter = offset;
@@ -266,7 +265,7 @@ const decode$3 = (buf, offset) => {
266
265
  let b;
267
266
  do {
268
267
  if (counter >= l || shift > 49) {
269
- decode$3.bytes = 0;
268
+ decode$1.bytes = 0;
270
269
  throw new RangeError('Could not decode varint');
271
270
  }
272
271
  b = buf[counter++];
@@ -275,7 +274,7 @@ const decode$3 = (buf, offset) => {
275
274
  : (b & REST) * Math.pow(2, shift);
276
275
  shift += 7;
277
276
  } while (b >= MSB);
278
- decode$3.bytes = counter - offset;
277
+ decode$1.bytes = counter - offset;
279
278
  return result;
280
279
  };
281
280
 
@@ -299,16 +298,16 @@ var encodingLength = (value) => (value < N1 ? 1
299
298
  : value < N9 ? 9
300
299
  : 10);
301
300
 
302
- var index$6 = {
303
- encode: encode$3,
304
- decode: decode$3,
301
+ var index$4 = {
302
+ encode: encode$1,
303
+ decode: decode$1,
305
304
  encodingLength
306
305
  };
307
306
 
308
- var index$5 = (input, prefix) => {
307
+ var index$3 = (input, prefix) => {
309
308
  const encodedArray = [];
310
309
  const length = input.reduce((total, current) => {
311
- const encoded = index$6.encode(current.length);
310
+ const encoded = index$4.encode(current.length);
312
311
  encodedArray.push(encoded);
313
312
  total += current.length + encoded.length;
314
313
  return total;
@@ -326,12 +325,12 @@ var index$5 = (input, prefix) => {
326
325
  return typedArray;
327
326
  };
328
327
 
329
- var index$4 = (typedArray, prefix) => {
328
+ var index$2 = (typedArray, prefix) => {
330
329
  const set = [];
331
330
  const varintAndSub = (typedArray) => {
332
- const length = index$6.decode(typedArray);
331
+ const length = index$4.decode(typedArray);
333
332
  // remove length
334
- typedArray = typedArray.subarray(index$6.decode.bytes);
333
+ typedArray = typedArray.subarray(index$4.decode.bytes);
335
334
  // push value
336
335
  set.push(typedArray.subarray(0, length));
337
336
  // remove value
@@ -344,87 +343,17 @@ var index$4 = (typedArray, prefix) => {
344
343
  };
345
344
 
346
345
  const ALPHABET$1 = '0123456789ABCDEF';
347
- const base16 = base(ALPHABET$1);
348
- const decode$2 = base16.decode;
349
- const encode$2 = base16.encode;
350
- const isBase16 = (string) => {
351
- try {
352
- decode$2(string);
353
- return true;
354
- }
355
- catch (e) {
356
- return false;
357
- }
358
- };
359
- var index$3 = {
360
- encode: encode$2,
361
- decode: decode$2,
362
- isBase16
363
- };
346
+ base(ALPHABET$1);
364
347
 
365
348
  const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
366
- const base64 = base(ALPHABET);
367
- const decode$1 = base64.decode;
368
- const encode$1 = base64.encode;
369
- const isBase64 = (string) => {
370
- try {
371
- decode$1(string);
372
- return true;
373
- }
374
- catch (e) {
375
- return false;
376
- }
377
- };
378
- var index$2 = {
379
- encode: encode$1,
380
- decode: decode$1,
381
- isBase64
382
- };
349
+ base(ALPHABET);
383
350
 
384
- /**
385
- * Returns a hex string as Binary string
386
- * @param string string to encode to binary
387
- * @returns binaryString
388
- */
389
- const hexToBinary = (hex) => (parseInt(hex, 16).toString(2)).padStart(8, '0');
390
- const isTypedArrayCompatible = (possibleUint8Array) => {
391
- if (typeof possibleUint8Array === 'string') {
392
- possibleUint8Array = possibleUint8Array.split(',').map(number => Number(number));
393
- for (const number of possibleUint8Array) {
394
- if (isNaN(number))
395
- return false;
396
- }
397
- }
398
- for (const number of possibleUint8Array) {
399
- if (isNaN(number))
400
- return false;
401
- }
402
- return true;
403
- };
404
- /**
405
- * Returns a String as Uint8Array
406
- * @param string string to encode to Uint8Array
407
- * @returns Uint8Array
408
- */
409
- const fromString$1 = (string) => new TextEncoder().encode(string);
410
351
  /**
411
352
  * Returns a Uint8Array as String
412
353
  * @param uint8Array Uint8Array to encode to String
413
354
  * @returns String
414
355
  */
415
356
  const toString$3 = (uint8Array) => new TextDecoder().decode(uint8Array);
416
- /**
417
- * Returns a String as Uint8Array
418
- * @param string string to encode to Uint8Array
419
- * @returns Uint8Array
420
- */
421
- const fromUintArrayString = (string) => Uint8Array.from(string.split(',').map(string => Number(string)));
422
- /**
423
- * Returns a Uint8Array as String
424
- * @param uint8Array Uint8Array to encode to String
425
- * @returns String
426
- */
427
- const toUintArrayString = (uint8Array) => uint8Array.toString();
428
357
  /**
429
358
  * hexString -> uint8Array
430
359
  * @param string hex encoded string
@@ -437,151 +366,11 @@ const fromHex = (string) => Uint8Array.from(string.match(/.{1,2}/g).map((byte) =
437
366
  * @returns hexString
438
367
  */
439
368
  const toHex = (bytes) => bytes.reduce((string, byte) => string + byte.toString(16).padStart(2, '0'), '');
440
- /**
441
- * number[] -> Uint8Array
442
- * @param array number[]
443
- * @returns Uint8Array
444
- */
445
- const fromArrayLike = (array) => Uint8Array.from(array);
446
- /**
447
- * Uint8Array -> number[]
448
- * @param uint8Array Uint8Array
449
- * @returns Uint8Array
450
- */
451
- const toArrayLike = (uint8Array) => [...uint8Array.values()];
452
- /**
453
- * object -> Uint8Array
454
- * @param object any
455
- * @returns Uint8Array
456
- */
457
- const fromObject = (object) => new TextEncoder().encode(JSON.stringify(object));
458
- /**
459
- * Uint8Array -> Object
460
- * @param uint8Array Uint8Array
461
- * @returns Object
462
- */
463
- const toObject = (uint8Array) => JSON.parse(new TextDecoder().decode(uint8Array));
464
- const fromBinary = (string) => fromHex(parseInt(string, 2).toString(16).toUpperCase());
465
- const toBinary = (uint8Array) => hexToBinary(toHex(uint8Array));
466
- const toBase64 = (uint8Array) => index$2.encode(uint8Array);
467
- const fromBase64 = (string) => index$2.decode(string);
468
369
  const toBase58 = (uint8Array) => base58$1.encode(uint8Array);
469
370
  const fromBase58 = (string) => base58$1.decode(string);
470
- const toBase32 = (uint8Array) => index$7.encode(uint8Array);
471
- const fromBase32 = (string) => index$7.decode(string);
472
- const toBase16 = (uint8Array) => index$3.encode(uint8Array);
473
- const fromBase16 = (string) => index$3.decode(string);
474
- let FormatInterface$2 = class FormatInterface {
475
- encoded;
476
- decoded;
477
- constructor(input) {
478
- if (input) {
479
- if (index$3.isBase16(input))
480
- this.encoded = this.fromBase16(input);
481
- else if (index$7.isBase32(input))
482
- this.encoded = this.fromBase32(input);
483
- else if (base58$1.isBase58(input))
484
- this.encoded = this.fromBase58(input);
485
- else if (index$2.isBase64(input))
486
- this.encoded = this.fromBase64(input);
487
- else if (typeof input === 'string') {
488
- let isCompatible = isTypedArrayCompatible(input);
489
- if (isCompatible)
490
- this.encoded = fromUintArrayString(input);
491
- else
492
- this.encoded = this.fromString(input); // normal string
493
- }
494
- else if (typeof input === 'object')
495
- this.encoded = this.fromObject(input);
496
- else if (input instanceof Uint8Array)
497
- this.encoded = input;
498
- else if (Array.isArray(input) && isTypedArrayCompatible(input))
499
- this.encoded = this.fromArrayLike(input);
500
- }
501
- }
502
- /**
503
- * Returns a String as Uint8Array
504
- * @param string string to encode to Uint8Array
505
- * @returns Uint8Array
506
- */
507
- fromString = (string) => this.encoded = fromString$1(string);
508
- /**
509
- * Returns a Uint8Array as String
510
- * @param uint8Array Uint8Array to encode to String
511
- * @returns String
512
- */
513
- toString = (uint8Array) => this.decoded = toString$3(uint8Array);
514
- /**
515
- * Returns a String as Uint8Array
516
- * @param string string to encode to Uint8Array
517
- * @returns Uint8Array
518
- */
519
- fromUintArrayString = (string) => this.encoded = fromUintArrayString(string);
520
- /**
521
- * Returns a Uint8Array as String
522
- * @param uint8Array Uint8Array to encode to String
523
- * @returns String
524
- */
525
- toUintArrayString = (uint8Array) => this.decoded = uint8Array.toString();
526
- /**
527
- * hexString -> uint8Array
528
- * @param string hex encoded string
529
- * @returns UintArray
530
- */
531
- fromHex = (string) => this.encoded = fromHex(string);
532
- /**
533
- * uint8Array -> hexString
534
- * @param bytes ArrayLike
535
- * @returns hexString
536
- */
537
- toHex = (arrayLike) => this.decoded = toHex(arrayLike);
538
- /**
539
- * number[] -> Uint8Array
540
- * @param array number[]
541
- * @returns Uint8Array
542
- */
543
- fromArrayLike = (array) => this.encoded = Uint8Array.from(array);
544
- /**
545
- * Uint8Array -> number[]
546
- * @param uint8Array Uint8Array
547
- * @returns Uint8Array
548
- */
549
- toArrayLike = (uint8Array) => this.decoded = [...uint8Array.values()];
550
- fromObject = (object) => this.encoded = fromObject(object);
551
- toBinary = (uint8Array) => this.decoded = hexToBinary(toHex(uint8Array));
552
- fromBinary = (binary) => this.encoded = fromBinary(binary);
553
- toObject = (uint8Array) => this.decoded = toObject(uint8Array);
554
- toBase64 = (uint8Array) => this.decoded = index$2.encode(uint8Array);
555
- fromBase64 = (string) => this.encoded = index$2.decode(string);
556
- toBase58 = (uint8Array) => this.decoded = base58$1.encode(uint8Array);
557
- fromBase58 = (string) => this.encoded = base58$1.decode(string);
558
- toBase32 = (uint8Array) => this.decoded = index$7.encode(uint8Array);
559
- fromBase32 = (string) => this.encoded = index$7.decode(string);
560
- toBase16 = (uint8Array) => this.decoded = index$3.encode(uint8Array);
561
- fromBase16 = (string) => this.decoded = index$3.decode(string);
562
- };
371
+ const toBase32 = (uint8Array) => index$5.encode(uint8Array);
563
372
  var index$1 = {
564
- fromString: fromString$1,
565
- toString: toString$3,
566
- fromHex,
567
- toHex,
568
- fromArrayLike,
569
- toArrayLike,
570
- fromUintArrayString,
571
- toUintArrayString,
572
- toObject,
573
- toBinary,
574
- fromBinary,
575
- toBase64,
576
- fromBase64,
577
- toBase58,
578
- fromBase58,
579
- toBase32,
580
- fromBase32,
581
- toBase16,
582
- fromBase16,
583
- FormatInterface: FormatInterface$2
584
- };
373
+ toString: toString$3};
585
374
 
586
375
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
587
376
  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
@@ -4682,15 +4471,12 @@ var Deflate_1$1 = Deflate$1;
4682
4471
  var deflate_2 = deflate$1;
4683
4472
  var deflateRaw_1$1 = deflateRaw$1;
4684
4473
  var gzip_1$1 = gzip$1;
4685
- var constants$1 = constants$2;
4686
4474
 
4687
4475
  var deflate_1$1 = {
4688
4476
  Deflate: Deflate_1$1,
4689
4477
  deflate: deflate_2,
4690
4478
  deflateRaw: deflateRaw_1$1,
4691
- gzip: gzip_1$1,
4692
- constants: constants$1
4693
- };
4479
+ gzip: gzip_1$1};
4694
4480
 
4695
4481
  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
4696
4482
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
@@ -7420,15 +7206,12 @@ var Inflate_1$1 = Inflate$1;
7420
7206
  var inflate_2 = inflate$1;
7421
7207
  var inflateRaw_1$1 = inflateRaw$1;
7422
7208
  var ungzip$1 = inflate$1;
7423
- var constants = constants$2;
7424
7209
 
7425
7210
  var inflate_1$1 = {
7426
7211
  Inflate: Inflate_1$1,
7427
7212
  inflate: inflate_2,
7428
7213
  inflateRaw: inflateRaw_1$1,
7429
- ungzip: ungzip$1,
7430
- constants: constants
7431
- };
7214
+ ungzip: ungzip$1};
7432
7215
 
7433
7216
  const { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;
7434
7217
 
@@ -7461,8 +7244,7 @@ var pako = {
7461
7244
  const jsonStringifyBigInt$1 = (key, value) => (typeof value === 'bigint' ? { $bigint: value.toString() } : value);
7462
7245
  const jsonParseBigInt$1 = (key, value) => typeof value === 'object' && value.$bigint ? BigInt(value.$bigint) : value;
7463
7246
 
7464
- const { fromString, toString } = index$1;
7465
- const isJson = (type) => type === 'object' || 'array';
7247
+ const { toString } = index$1;
7466
7248
  const isString = (type) => type === 'string';
7467
7249
  const isNumber = (type) => type === 'number';
7468
7250
  const isBoolean = (type) => type === 'boolean';
@@ -7518,12 +7300,12 @@ const encode = (proto, input, compress) => {
7518
7300
  // when data is undefined push the default value of the proto
7519
7301
  set.push(toType(data || values[i]));
7520
7302
  }
7521
- return compress ? pako.deflate(index$5(set)) : index$5(set);
7303
+ return compress ? pako.deflate(index$3(set)) : index$3(set);
7522
7304
  };
7523
7305
  const decode = (proto, uint8Array, compressed) => {
7524
7306
  if (compressed)
7525
7307
  uint8Array = pako.inflate(uint8Array);
7526
- let deconcated = index$4(uint8Array);
7308
+ let deconcated = index$2(uint8Array);
7527
7309
  const output = {};
7528
7310
  const keys = Object.keys(proto);
7529
7311
  const values = Object.values(proto);
@@ -7541,8 +7323,7 @@ const decode = (proto, uint8Array, compressed) => {
7541
7323
  output[token.key] = Number(new TextDecoder().decode(deconcated[i]));
7542
7324
  else if (isBigInt(token.type))
7543
7325
  output[token.key] = BigInt(new TextDecoder().decode(deconcated[i]));
7544
- else if (isJson(token.type))
7545
- output[token.key] = JSON.parse(new TextDecoder().decode(deconcated[i]), jsonParseBigInt$1);
7326
+ else output[token.key] = JSON.parse(new TextDecoder().decode(deconcated[i]), jsonParseBigInt$1);
7546
7327
  if (token.optional) {
7547
7328
  if (!output[token.key] || output[token.key].length === 0)
7548
7329
  delete output[token.key];
@@ -7612,13 +7393,13 @@ class BasicInterface {
7612
7393
  return isHex(string);
7613
7394
  }
7614
7395
  isBase32(string) {
7615
- return index$7.isBase32(string);
7396
+ return index$5.isBase32(string);
7616
7397
  }
7617
7398
  isBase58(string) {
7618
7399
  return base58$1.isBase58(string);
7619
7400
  }
7620
7401
  fromBs32(encoded) {
7621
- return this.decode(index$7.decode(encoded));
7402
+ return this.decode(index$5.decode(encoded));
7622
7403
  }
7623
7404
  fromBs58(encoded) {
7624
7405
  return this.decode(fromBase58(encoded));
@@ -7888,7 +7669,7 @@ class Codec extends BasicInterface {
7888
7669
  super();
7889
7670
  if (buffer) {
7890
7671
  if (buffer instanceof Uint8Array) {
7891
- const codec = index$6.decode(buffer);
7672
+ const codec = index$4.decode(buffer);
7892
7673
  const name = this.getCodecName(codec);
7893
7674
  if (name) {
7894
7675
  this.name = name;
@@ -7900,7 +7681,7 @@ class Codec extends BasicInterface {
7900
7681
  }
7901
7682
  }
7902
7683
  else if (buffer instanceof ArrayBuffer) {
7903
- const codec = index$6.decode(buffer);
7684
+ const codec = index$4.decode(buffer);
7904
7685
  const name = this.getCodecName(codec);
7905
7686
  if (name) {
7906
7687
  this.name = name;
@@ -7928,7 +7709,7 @@ class Codec extends BasicInterface {
7928
7709
  }
7929
7710
  }
7930
7711
  fromEncoded(encoded) {
7931
- const codec = index$6.decode(encoded);
7712
+ const codec = index$4.decode(encoded);
7932
7713
  const name = this.getCodecName(codec);
7933
7714
  this.name = name;
7934
7715
  this.encoded = encoded;
@@ -7947,7 +7728,7 @@ class Codec extends BasicInterface {
7947
7728
  this.name = this.getCodecName(codec);
7948
7729
  this.hashAlg = this.getHashAlg(this.name);
7949
7730
  this.codec = this.getCodec(this.name);
7950
- this.codecBuffer = index$6.encode(this.codec);
7731
+ this.codecBuffer = index$4.encode(this.codec);
7951
7732
  this.decoded = {
7952
7733
  name: this.name,
7953
7734
  hashAlg: this.hashAlg,
@@ -7960,7 +7741,7 @@ class Codec extends BasicInterface {
7960
7741
  this.name = name;
7961
7742
  this.codec = codec;
7962
7743
  this.hashAlg = this.getHashAlg(name);
7963
- this.codecBuffer = index$6.encode(this.codec);
7744
+ this.codecBuffer = index$4.encode(this.codec);
7964
7745
  this.decoded = {
7965
7746
  name: this.name,
7966
7747
  hashAlg: this.hashAlg,
@@ -7970,13 +7751,13 @@ class Codec extends BasicInterface {
7970
7751
  }
7971
7752
  decode(encoded) {
7972
7753
  encoded = encoded || this.encoded;
7973
- const codec = index$6.decode(encoded);
7754
+ const codec = index$4.decode(encoded);
7974
7755
  this.fromCodec(codec);
7975
7756
  return this.decoded;
7976
7757
  }
7977
7758
  encode(codec) {
7978
7759
  codec = codec || this.codec;
7979
- this.encoded = index$6.encode(codec);
7760
+ this.encoded = index$4.encode(codec);
7980
7761
  return this.encoded;
7981
7762
  }
7982
7763
  }
@@ -8031,7 +7812,7 @@ class CodecHash extends BasicInterface {
8031
7812
  return uint8Array;
8032
7813
  }
8033
7814
  get length() {
8034
- return index$6.encode(this.size);
7815
+ return index$4.encode(this.size);
8035
7816
  }
8036
7817
  get buffer() {
8037
7818
  return this.encoded;
@@ -8078,7 +7859,7 @@ class CodecHash extends BasicInterface {
8078
7859
  }
8079
7860
  async validate(buffer) {
8080
7861
  if (Buffer.isBuffer(buffer)) {
8081
- const codec = index$6.decode(buffer);
7862
+ const codec = index$4.decode(buffer);
8082
7863
  if (this.codecs[codec]) {
8083
7864
  this.decode(buffer);
8084
7865
  }
@@ -8097,12 +7878,12 @@ class CodecHash extends BasicInterface {
8097
7878
  }
8098
7879
  decode(buffer) {
8099
7880
  this.encoded = buffer;
8100
- const codec = index$6.decode(buffer);
7881
+ const codec = index$4.decode(buffer);
8101
7882
  this.discoCodec = new Codec(codec, this.codecs);
8102
7883
  // TODO: validate codec
8103
- buffer = buffer.slice(index$6.decode.bytes);
8104
- this.size = index$6.decode(buffer);
8105
- this.digest = buffer.slice(index$6.decode.bytes);
7884
+ buffer = buffer.slice(index$4.decode.bytes);
7885
+ this.size = index$4.decode(buffer);
7886
+ this.digest = buffer.slice(index$4.decode.bytes);
8106
7887
  if (this.digest.length !== this.size) {
8107
7888
  throw new Error(`hash length inconsistent: 0x${this.encoded.toString('hex')}`);
8108
7889
  }
@@ -8314,14 +8095,14 @@ class BlockMessage extends FormatInterface {
8314
8095
  }
8315
8096
  return super.encode({
8316
8097
  ...decoded,
8317
- validators: index$5(validators)
8098
+ validators: index$3(validators)
8318
8099
  });
8319
8100
  }
8320
8101
  decode(encoded) {
8321
8102
  encoded = encoded || this.encoded;
8322
8103
  super.decode(encoded);
8323
8104
  // @ts-ignore
8324
- this.decoded.validators = index$4(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
8105
+ this.decoded.validators = index$2(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
8325
8106
  return this.decoded;
8326
8107
  }
8327
8108
  }
@@ -8375,7 +8156,6 @@ class ContractMessage extends FormatInterface {
8375
8156
  }
8376
8157
 
8377
8158
  ({
8378
- hash: String(),
8379
8159
  index: BigInt(0)
8380
8160
  });
8381
8161