@taquito/local-forging 22.0.0-beta.0 → 23.0.0-beta.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.
Files changed (36) hide show
  1. package/dist/lib/{codec-proto021.js → codec-proto022.js} +71 -23
  2. package/dist/lib/codec.js +5 -12
  3. package/dist/lib/{constants-proto021.js → constants-proto022.js} +1 -0
  4. package/dist/lib/constants.js +3 -0
  5. package/dist/lib/decoder-proto022.js +63 -0
  6. package/dist/lib/decoder.js +1 -0
  7. package/dist/lib/encoder-proto022.js +62 -0
  8. package/dist/lib/encoder.js +1 -0
  9. package/dist/lib/michelson/codec-proto022.js +283 -0
  10. package/dist/lib/protocols.js +2 -0
  11. package/dist/lib/schema/operation-proto022.js +238 -0
  12. package/dist/lib/schema/operation.js +11 -1
  13. package/dist/lib/taquito-local-forging.js +13 -7
  14. package/dist/lib/validator-proto022.js +56 -0
  15. package/dist/lib/validator.js +1 -0
  16. package/dist/lib/version.js +2 -2
  17. package/dist/taquito-local-forging.es6.js +521 -201
  18. package/dist/taquito-local-forging.es6.js.map +1 -1
  19. package/dist/taquito-local-forging.umd.js +522 -202
  20. package/dist/taquito-local-forging.umd.js.map +1 -1
  21. package/dist/types/{codec-proto021.d.ts → codec-proto022.d.ts} +3 -1
  22. package/dist/types/{constants-proto021.d.ts → constants-proto022.d.ts} +1 -0
  23. package/dist/types/constants.d.ts +1 -0
  24. package/dist/types/{decoder-proto021.d.ts → decoder-proto022.d.ts} +1 -1
  25. package/dist/types/{encoder-proto021.d.ts → encoder-proto022.d.ts} +1 -1
  26. package/dist/types/michelson/codec-proto022.d.ts +49 -0
  27. package/dist/types/michelson/codec.d.ts +1 -1
  28. package/dist/types/protocols.d.ts +1 -0
  29. package/dist/types/schema/{operation-proto021.d.ts → operation-proto022.d.ts} +3 -2
  30. package/dist/types/schema/operation.d.ts +10 -0
  31. package/dist/types/taquito-local-forging.d.ts +3 -3
  32. package/dist/types/validator-proto022.d.ts +13 -0
  33. package/package.json +5 -5
  34. package/dist/lib/decoder-proto021.js +0 -62
  35. package/dist/lib/encoder-proto021.js +0 -61
  36. package/dist/lib/schema/operation-proto021.js +0 -237
@@ -1,5 +1,5 @@
1
1
  import { Prefix, buf2hex, b58cdecode, prefix, prefixLength, b58cencode, InvalidKeyHashError, invalidDetail, ValidationResult, InvalidPublicKeyError, validateBlock } from '@taquito/utils';
2
- import { ParameterValidationError, InvalidHexStringError, InvalidAddressError, InvalidContractAddressError, InvalidSignatureError, ProhibitedActionError, InvalidOperationKindError, InvalidBlockHashError } from '@taquito/core';
2
+ import { ParameterValidationError, InvalidHexStringError, InvalidAddressError, InvalidContractAddressError, ProhibitedActionError, InvalidOperationKindError, InvalidSignatureError, InvalidBlockHashError } from '@taquito/core';
3
3
  import BigNumber$1, { BigNumber } from 'bignumber.js';
4
4
 
5
5
  const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
@@ -58,6 +58,7 @@ var CODEC$1;
58
58
  CODEC["BURN_LIMIT"] = "burn_limit";
59
59
  CODEC["OP_INCREASE_PAID_STORAGE"] = "increase_paid_storage";
60
60
  CODEC["OP_UPDATE_CONSENSUS_KEY"] = "update_consensus_key";
61
+ CODEC["OP_UPDATE_COMPANION_KEY"] = "update_companion_key";
61
62
  CODEC["SIGNATURE_PROOF"] = "signature_proof";
62
63
  CODEC["OP_DRAIN_DELEGATE"] = "drain_delegate";
63
64
  CODEC["DEPOSITS_LIMIT"] = "deposits_limit";
@@ -229,8 +230,9 @@ const opMapping$1 = {
229
230
  '9b': 'BYTES',
230
231
  '9c': 'NAT',
231
232
  '9d': 'Ticket',
233
+ '9e': 'IS_IMPLICIT_ACCOUNT',
232
234
  };
233
- const opMappingReverse = (() => {
235
+ const opMappingReverse$1 = (() => {
234
236
  const result = {};
235
237
  Object.keys(opMapping$1).forEach((key) => {
236
238
  result[opMapping$1[key]] = key;
@@ -254,6 +256,7 @@ const kindMapping$1 = {
254
256
  0x70: 'set_deposits_limit',
255
257
  0x71: 'increase_paid_storage',
256
258
  0x72: 'update_consensus_key',
259
+ 0x73: 'update_companion_key',
257
260
  0x09: 'drain_delegate',
258
261
  0xc8: 'smart_rollup_originate',
259
262
  0xc9: 'smart_rollup_add_messages',
@@ -483,73 +486,73 @@ class Uint8ArrayConsumer {
483
486
  }
484
487
  }
485
488
 
486
- const isPrim = (value) => {
489
+ const isPrim$1 = (value) => {
487
490
  return 'prim' in value;
488
491
  };
489
- const isBytes = (value) => {
492
+ const isBytes$1 = (value) => {
490
493
  return 'bytes' in value && typeof value.bytes === 'string';
491
494
  };
492
- const isString = (value) => {
495
+ const isString$1 = (value) => {
493
496
  return 'string' in value && typeof value.string === 'string';
494
497
  };
495
- const isInt = (value) => {
498
+ const isInt$1 = (value) => {
496
499
  return 'int' in value && typeof value.int === 'string';
497
500
  };
498
- const scriptEncoder = (script) => {
499
- const code = valueEncoder(script.code);
500
- const storage = valueEncoder(script.storage);
501
+ const scriptEncoder$1 = (script) => {
502
+ const code = valueEncoder$1(script.code);
503
+ const storage = valueEncoder$1(script.storage);
501
504
  return `${pad(code.length / 2, 8)}${code}${pad(storage.length / 2, 8)}${storage}`;
502
505
  };
503
- const scriptDecoder = (value) => {
504
- const code = extractRequiredLen(value);
505
- const storage = extractRequiredLen(value);
506
+ const scriptDecoder$1 = (value) => {
507
+ const code = extractRequiredLen$1(value);
508
+ const storage = extractRequiredLen$1(value);
506
509
  return {
507
- code: valueDecoder(new Uint8ArrayConsumer(code)),
508
- storage: valueDecoder(new Uint8ArrayConsumer(storage)),
510
+ code: valueDecoder$1(new Uint8ArrayConsumer(code)),
511
+ storage: valueDecoder$1(new Uint8ArrayConsumer(storage)),
509
512
  };
510
513
  };
511
- const valueEncoder = (value) => {
514
+ const valueEncoder$1 = (value) => {
512
515
  if (Array.isArray(value)) {
513
- const encoded = value.map((x) => valueEncoder(x)).join('');
516
+ const encoded = value.map((x) => valueEncoder$1(x)).join('');
514
517
  const len = encoded.length / 2;
515
518
  return `02${pad(len)}${encoded}`;
516
519
  }
517
- else if (isPrim(value)) {
518
- return primEncoder(value);
520
+ else if (isPrim$1(value)) {
521
+ return primEncoder$1(value);
519
522
  }
520
- else if (isBytes(value)) {
521
- return bytesEncoder(value);
523
+ else if (isBytes$1(value)) {
524
+ return bytesEncoder$1(value);
522
525
  }
523
- else if (isString(value)) {
524
- return stringEncoder(value);
526
+ else if (isString$1(value)) {
527
+ return stringEncoder$1(value);
525
528
  }
526
- else if (isInt(value)) {
527
- return intEncoder(value);
529
+ else if (isInt$1(value)) {
530
+ return intEncoder$1(value);
528
531
  }
529
532
  throw new UnexpectedMichelsonValueError(JSON.stringify(value));
530
533
  };
531
- const valueDecoder = (value) => {
534
+ const valueDecoder$1 = (value) => {
532
535
  const preamble = value.consume(1);
533
536
  switch (preamble[0]) {
534
537
  case 0x0a:
535
- return bytesDecoder(value);
538
+ return bytesDecoder$1(value);
536
539
  case 0x01:
537
- return stringDecoder(value);
540
+ return stringDecoder$1(value);
538
541
  case 0x00:
539
- return intDecoder(value);
542
+ return intDecoder$1(value);
540
543
  case 0x02: {
541
- const val = new Uint8ArrayConsumer(extractRequiredLen(value));
544
+ const val = new Uint8ArrayConsumer(extractRequiredLen$1(value));
542
545
  const results = [];
543
546
  while (val.length() > 0) {
544
- results.push(valueDecoder(val));
547
+ results.push(valueDecoder$1(val));
545
548
  }
546
549
  return results;
547
550
  }
548
551
  default:
549
- return primDecoder(value, preamble);
552
+ return primDecoder$1(value, preamble);
550
553
  }
551
554
  };
552
- const extractRequiredLen = (value, bytesLength = 4) => {
555
+ const extractRequiredLen$1 = (value, bytesLength = 4) => {
553
556
  const len = value.consume(bytesLength);
554
557
  const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
555
558
  return value.consume(valueLen);
@@ -560,7 +563,7 @@ const extractRequiredLen = (value, bytesLength = 4) => {
560
563
  * @param bytesLength default 4 bytes for length of variable bytes
561
564
  * @returns array of Uint8Array values for each array item
562
565
  */
563
- const stripLengthPrefixFromBytes = (value, bytesLength = 4) => {
566
+ const stripLengthPrefixFromBytes$1 = (value, bytesLength = 4) => {
564
567
  const ret = [];
565
568
  let values = value;
566
569
  while (values.length()) {
@@ -571,31 +574,31 @@ const stripLengthPrefixFromBytes = (value, bytesLength = 4) => {
571
574
  }
572
575
  return ret;
573
576
  };
574
- const bytesEncoder = (value) => {
577
+ const bytesEncoder$1 = (value) => {
575
578
  if (!/^([A-Fa-f0-9]{2})*$/.test(value.bytes)) {
576
579
  throw new InvalidHexStringError(value.bytes);
577
580
  }
578
581
  const len = value.bytes.length / 2;
579
582
  return `0a${pad(len)}${value.bytes}`;
580
583
  };
581
- const bytesDecoder = (value) => {
582
- const bytes = extractRequiredLen(value);
584
+ const bytesDecoder$1 = (value) => {
585
+ const bytes = extractRequiredLen$1(value);
583
586
  return {
584
587
  bytes: Buffer.from(bytes).toString('hex'),
585
588
  };
586
589
  };
587
- const stringEncoder = (value) => {
590
+ const stringEncoder$1 = (value) => {
588
591
  const str = Buffer.from(value.string, 'utf8').toString('hex');
589
592
  const hexLength = str.length / 2;
590
593
  return `01${pad(hexLength)}${str}`;
591
594
  };
592
- const stringDecoder = (value) => {
593
- const str = extractRequiredLen(value);
595
+ const stringDecoder$1 = (value) => {
596
+ const str = extractRequiredLen$1(value);
594
597
  return {
595
598
  string: Buffer.from(str).toString('utf8'),
596
599
  };
597
600
  };
598
- const intEncoder = ({ int }) => {
601
+ const intEncoder$1 = ({ int }) => {
599
602
  const num = new BigNumber(int, 10);
600
603
  const positiveMark = num.toString(2)[0] === '-' ? '1' : '0';
601
604
  const binary = num.toString(2).replace(/-/g, '');
@@ -615,7 +618,7 @@ const intEncoder = ({ int }) => {
615
618
  .padStart(2, '0'));
616
619
  return `00${numHex.join('')}`;
617
620
  };
618
- const intDecoder = (value) => {
621
+ const intDecoder$1 = (value) => {
619
622
  let c = value.consume(1)[0];
620
623
  const hexNumber = [];
621
624
  const isNotLastChunkMask = 1 << 7;
@@ -640,14 +643,14 @@ const intDecoder = (value) => {
640
643
  int: num.toFixed(),
641
644
  };
642
645
  };
643
- const primEncoder = (value) => {
646
+ const primEncoder$1 = (value) => {
644
647
  const hasAnnot = +Array.isArray(value.annots);
645
648
  const argsCount = Array.isArray(value.args) ? value.args.length : 0;
646
649
  // Specify the number of args max is 3 without annotation
647
650
  const preamble = pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2);
648
- const op = opMappingReverse[value.prim];
649
- let encodedArgs = (value.args || []).map((arg) => valueEncoder(arg)).join('');
650
- const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';
651
+ const op = opMappingReverse$1[value.prim];
652
+ let encodedArgs = (value.args || []).map((arg) => valueEncoder$1(arg)).join('');
653
+ const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots$1(value.annots) : '';
651
654
  if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) {
652
655
  encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
653
656
  }
@@ -662,7 +665,7 @@ const primEncoder = (value) => {
662
665
  }
663
666
  return `${preamble}${op}${encodedArgs}${encodedAnnots}`;
664
667
  };
665
- const primDecoder = (value, preamble) => {
668
+ const primDecoder$1 = (value, preamble) => {
666
669
  const hasAnnot = (preamble[0] - 0x03) % 2 === 1;
667
670
  let argsCount = Math.floor((preamble[0] - 0x03) / 2);
668
671
  const op = value.consume(1)[0].toString(16).padStart(2, '0');
@@ -674,7 +677,7 @@ const primDecoder = (value, preamble) => {
674
677
  }
675
678
  if (opMapping$1[op] === 'view') {
676
679
  if (argsCount != 0) {
677
- return primViewDecoder(value, result);
680
+ return primViewDecoder$1(value, result);
678
681
  }
679
682
  else {
680
683
  return result;
@@ -683,11 +686,11 @@ const primDecoder = (value, preamble) => {
683
686
  let combPairArgs;
684
687
  let combPairAnnots;
685
688
  if ((opMapping$1[op] === 'pair' || opMapping$1[op] === 'Pair') && argsCount > 2) {
686
- combPairArgs = decodeCombPair(value);
689
+ combPairArgs = decodeCombPair$1(value);
687
690
  argsCount = 0;
688
- combPairAnnots = decodeAnnots(value);
691
+ combPairAnnots = decodeAnnots$1(value);
689
692
  }
690
- const args = new Array(argsCount).fill(0).map(() => valueDecoder(value));
693
+ const args = new Array(argsCount).fill(0).map(() => valueDecoder$1(value));
691
694
  if (opMapping$1[op] === 'LAMBDA' || opMapping$1[op] === 'LAMBDA_REC') {
692
695
  value.consume(4);
693
696
  }
@@ -701,25 +704,25 @@ const primDecoder = (value, preamble) => {
701
704
  result['annots'] = combPairAnnots;
702
705
  }
703
706
  else if (hasAnnot) {
704
- result['annots'] = decodeAnnots(value);
707
+ result['annots'] = decodeAnnots$1(value);
705
708
  }
706
709
  return result;
707
710
  };
708
- const primViewDecoder = (value, result) => {
711
+ const primViewDecoder$1 = (value, result) => {
709
712
  value.consume(4);
710
- result['args'] = new Array(4).fill(0).map(() => valueDecoder(value));
713
+ result['args'] = new Array(4).fill(0).map(() => valueDecoder$1(value));
711
714
  value.consume(4);
712
715
  return result;
713
716
  };
714
- const decodeCombPair = (val) => {
715
- const array = new Uint8ArrayConsumer(extractRequiredLen(val));
717
+ const decodeCombPair$1 = (val) => {
718
+ const array = new Uint8ArrayConsumer(extractRequiredLen$1(val));
716
719
  const args = [];
717
720
  while (array.length() > 0) {
718
- args.push(valueDecoder(array));
721
+ args.push(valueDecoder$1(array));
719
722
  }
720
723
  return args;
721
724
  };
722
- const encodeAnnots = (value) => {
725
+ const encodeAnnots$1 = (value) => {
723
726
  const mergedAnnot = value
724
727
  .map((x) => {
725
728
  return Buffer.from(x, 'utf8').toString('hex');
@@ -728,7 +731,7 @@ const encodeAnnots = (value) => {
728
731
  const len = mergedAnnot.length / 2;
729
732
  return `${pad(len)}${mergedAnnot}`;
730
733
  };
731
- const decodeAnnots = (val) => {
734
+ const decodeAnnots$1 = (val) => {
732
735
  const len = val.consume(4);
733
736
  const annotLen = parseInt(Buffer.from(len).toString('hex'), 16);
734
737
  const restOfAnnot = val.consume(annotLen);
@@ -1069,7 +1072,7 @@ const entrypointDecoder$1 = (value) => {
1069
1072
  return entrypointMapping$1[preamble];
1070
1073
  }
1071
1074
  else {
1072
- const entry = extractRequiredLen(value, 1);
1075
+ const entry = extractRequiredLen$1(value, 1);
1073
1076
  const entrypoint = Buffer.from(entry).toString('utf8');
1074
1077
  if (entrypoint.length > ENTRYPOINT_MAX_LENGTH$1) {
1075
1078
  throw new OversizedEntryPointError(entrypoint);
@@ -1084,8 +1087,8 @@ const parametersDecoder$1 = (val) => {
1084
1087
  }
1085
1088
  else {
1086
1089
  const encodedEntrypoint = entrypointDecoder$1(val);
1087
- const params = extractRequiredLen(val);
1088
- const parameters = valueDecoder(new Uint8ArrayConsumer(params));
1090
+ const params = extractRequiredLen$1(val);
1091
+ const parameters = valueDecoder$1(new Uint8ArrayConsumer(params));
1089
1092
  return {
1090
1093
  entrypoint: encodedEntrypoint,
1091
1094
  value: parameters,
@@ -1101,7 +1104,7 @@ const entrypointEncoder$1 = (entrypoint) => {
1101
1104
  throw new OversizedEntryPointError(entrypoint);
1102
1105
  }
1103
1106
  const value = { string: entrypoint };
1104
- return `ff${valueEncoder(value).slice(8)}`;
1107
+ return `ff${valueEncoder$1(value).slice(8)}`;
1105
1108
  }
1106
1109
  };
1107
1110
  const parametersEncoder$1 = (val) => {
@@ -1109,26 +1112,26 @@ const parametersEncoder$1 = (val) => {
1109
1112
  return '00';
1110
1113
  }
1111
1114
  const encodedEntrypoint = entrypointEncoder$1(val.entrypoint);
1112
- const parameters = valueEncoder(val.value);
1115
+ const parameters = valueEncoder$1(val.value);
1113
1116
  const length = pad(parameters.length / 2);
1114
1117
  return `ff${encodedEntrypoint}${length}${parameters}`;
1115
1118
  };
1116
1119
  const valueParameterEncoder$1 = (value) => {
1117
- const valueEncoded = valueEncoder(value);
1120
+ const valueEncoded = valueEncoder$1(value);
1118
1121
  return `${pad(valueEncoded.length / 2)}${valueEncoded}`;
1119
1122
  };
1120
1123
  const valueParameterDecoder$1 = (val) => {
1121
- const value = extractRequiredLen(val);
1122
- return valueDecoder(new Uint8ArrayConsumer(value));
1124
+ const value = extractRequiredLen$1(val);
1125
+ return valueDecoder$1(new Uint8ArrayConsumer(value));
1123
1126
  };
1124
1127
  const blockPayloadHashEncoder$1 = prefixEncoder$1(Prefix.VH);
1125
1128
  const blockPayloadHashDecoder$1 = prefixDecoder$1(Prefix.VH);
1126
1129
  const entrypointNameEncoder$1 = (entrypoint) => {
1127
1130
  const value = { string: entrypoint };
1128
- return `${valueEncoder(value).slice(2)}`;
1131
+ return `${valueEncoder$1(value).slice(2)}`;
1129
1132
  };
1130
1133
  const entrypointNameDecoder$1 = (val) => {
1131
- const entry = extractRequiredLen(val);
1134
+ const entry = extractRequiredLen$1(val);
1132
1135
  return Buffer.from(entry).toString('utf8');
1133
1136
  };
1134
1137
  const burnLimitEncoder$1 = (val) => {
@@ -1149,23 +1152,16 @@ const depositsLimitDecoder$1 = (value) => {
1149
1152
  return zarithDecoder$1(value);
1150
1153
  }
1151
1154
  };
1152
- const signatureV1Encoder = (val) => {
1155
+ const signatureV1Encoder$1 = (val) => {
1153
1156
  const signaturePrefix = val.substring(0, 5);
1154
- switch (signaturePrefix) {
1155
- case Prefix.EDSIG:
1156
- return paddedBytesEncoder$1(prefixEncoder$1(Prefix.EDSIG)(val));
1157
- case Prefix.SPSIG:
1158
- return paddedBytesEncoder$1(prefixEncoder$1(Prefix.SPSIG)(val));
1159
- case Prefix.P2SIG:
1160
- return paddedBytesEncoder$1(prefixEncoder$1(Prefix.P2SIG)(val));
1161
- case Prefix.BLSIG:
1162
- return paddedBytesEncoder$1(prefixEncoder$1(Prefix.BLSIG)(val));
1163
- default:
1164
- throw new InvalidSignatureError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
1165
- ` expecting one of the following '${Prefix.EDSIG}', '${Prefix.SPSIG}', '${Prefix.P2SIG}' or '${Prefix.BLSIG}'.`);
1157
+ if (signaturePrefix === Prefix.BLSIG) {
1158
+ return paddedBytesEncoder$1(prefixEncoder$1(Prefix.BLSIG)(val));
1159
+ }
1160
+ else {
1161
+ throw new ProhibitedActionError('currently we only support encoding of BLSIG signatures');
1166
1162
  }
1167
1163
  };
1168
- const signatureV1Decoder = (val) => {
1164
+ const signatureV1Decoder$1 = (val) => {
1169
1165
  val.consume(4);
1170
1166
  if (val.length().toString() === '96') {
1171
1167
  return prefixDecoder$1(Prefix.BLSIG)(val);
@@ -1174,25 +1170,25 @@ const signatureV1Decoder = (val) => {
1174
1170
  throw new ProhibitedActionError('currently we only support decoding of BLSIG signatures');
1175
1171
  }
1176
1172
  };
1177
- const signatureProofEncoder = (val) => {
1173
+ const signatureProofEncoder$1 = (val) => {
1178
1174
  if (val) {
1179
- return boolEncoder$1(true) + signatureV1Encoder(val);
1175
+ return boolEncoder$1(true) + signatureV1Encoder$1(val);
1180
1176
  }
1181
1177
  else {
1182
1178
  return boolEncoder$1(false);
1183
1179
  }
1184
1180
  };
1185
- const signatureProofDecoder = (value) => {
1181
+ const signatureProofDecoder$1 = (value) => {
1186
1182
  const hasProof = boolDecoder$1(value);
1187
1183
  if (hasProof) {
1188
- return signatureV1Decoder(value);
1184
+ return signatureV1Decoder$1(value);
1189
1185
  }
1190
1186
  };
1191
1187
  const paddedBytesEncoder$1 = (val, paddingLength = 8) => {
1192
1188
  return `${pad(val.length / 2, paddingLength)}${val}`;
1193
1189
  };
1194
1190
  const paddedBytesDecoder$1 = (val) => {
1195
- const value = extractRequiredLen(val);
1191
+ const value = extractRequiredLen$1(val);
1196
1192
  return Buffer.from(value).toString('hex');
1197
1193
  };
1198
1194
  const smartRollupMessageEncoder$1 = (val) => {
@@ -1202,8 +1198,8 @@ const smartRollupMessageEncoder$1 = (val) => {
1202
1198
  return `${pad(message.length / 2)}${message}`;
1203
1199
  };
1204
1200
  const smartRollupMessageDecoder$1 = (val) => {
1205
- const valueArray = extractRequiredLen(val);
1206
- const ret = stripLengthPrefixFromBytes(new Uint8ArrayConsumer(valueArray));
1201
+ const valueArray = extractRequiredLen$1(val);
1202
+ const ret = stripLengthPrefixFromBytes$1(new Uint8ArrayConsumer(valueArray));
1207
1203
  return ret.map((value) => Buffer.from(value).toString('hex'));
1208
1204
  };
1209
1205
  const dalCommitmentEncoder$1 = (val) => {
@@ -1247,6 +1243,7 @@ const RevealSchema$1 = {
1247
1243
  gas_limit: CODEC$1.ZARITH,
1248
1244
  storage_limit: CODEC$1.ZARITH,
1249
1245
  public_key: CODEC$1.PUBLIC_KEY,
1246
+ proof: CODEC$1.SIGNATURE_PROOF,
1250
1247
  };
1251
1248
  const DelegationSchema$1 = {
1252
1249
  source: CODEC$1.PKH,
@@ -1343,6 +1340,15 @@ const UpdateConsensusKeySchema$1 = {
1343
1340
  pk: CODEC$1.PUBLIC_KEY,
1344
1341
  proof: CODEC$1.SIGNATURE_PROOF,
1345
1342
  };
1343
+ const UpdateCompanionKeySchema = {
1344
+ source: CODEC$1.PKH,
1345
+ fee: CODEC$1.ZARITH,
1346
+ counter: CODEC$1.ZARITH,
1347
+ gas_limit: CODEC$1.ZARITH,
1348
+ storage_limit: CODEC$1.ZARITH,
1349
+ pk: CODEC$1.PUBLIC_KEY,
1350
+ proof: CODEC$1.SIGNATURE_PROOF,
1351
+ };
1346
1352
  const DrainDelegateSchema$1 = {
1347
1353
  consensus_key: CODEC$1.PKH,
1348
1354
  delegate: CODEC$1.PKH,
@@ -1461,7 +1467,7 @@ const schemaDecoder$1 = (decoders) => (schema) => (value) => {
1461
1467
  }, {});
1462
1468
  };
1463
1469
 
1464
- const decoders = {
1470
+ const decoders$1 = {
1465
1471
  [CODEC$1.SECRET]: (val) => toHexString(val.consume(20)),
1466
1472
  [CODEC$1.RAW]: (val) => toHexString(val.consume(32)),
1467
1473
  [CODEC$1.TZ1]: tz1Decoder$1,
@@ -1472,7 +1478,7 @@ const decoders = {
1472
1478
  [CODEC$1.PKH_ARR]: publicKeyHashesDecoder$1,
1473
1479
  [CODEC$1.DELEGATE]: delegateDecoder$1,
1474
1480
  [CODEC$1.INT32]: int32Decoder$1,
1475
- [CODEC$1.SCRIPT]: scriptDecoder,
1481
+ [CODEC$1.SCRIPT]: scriptDecoder$1,
1476
1482
  [CODEC$1.BALLOT_STATEMENT]: ballotDecoder$1,
1477
1483
  [CODEC$1.PROPOSAL]: proposalDecoder$1,
1478
1484
  [CODEC$1.PROPOSAL_ARR]: proposalsDecoder$1,
@@ -1487,35 +1493,36 @@ const decoders = {
1487
1493
  [CODEC$1.ENTRYPOINT]: entrypointNameDecoder$1,
1488
1494
  [CODEC$1.BURN_LIMIT]: burnLimitDecoder$1,
1489
1495
  [CODEC$1.DEPOSITS_LIMIT]: depositsLimitDecoder$1,
1490
- [CODEC$1.SIGNATURE_PROOF]: signatureProofDecoder,
1496
+ [CODEC$1.SIGNATURE_PROOF]: signatureProofDecoder$1,
1491
1497
  [CODEC$1.PVM_KIND]: pvmKindDecoder$1,
1492
1498
  [CODEC$1.PADDED_BYTES]: paddedBytesDecoder$1,
1493
1499
  [CODEC$1.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder$1,
1494
1500
  [CODEC$1.SLOT_HEADER]: slotHeaderDecoder$1,
1495
1501
  };
1496
- decoders[CODEC$1.OPERATION] = operationDecoder$1(decoders);
1497
- decoders[CODEC$1.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder$1(decoders)(ActivationSchema$1)(val);
1498
- decoders[CODEC$1.OP_FAILING_NOOP] = (val) => schemaDecoder$1(decoders)(FailingNoopSchema$1)(val);
1499
- decoders[CODEC$1.OP_DELEGATION] = (val) => schemaDecoder$1(decoders)(DelegationSchema$1)(val);
1500
- decoders[CODEC$1.OP_TRANSACTION] = (val) => schemaDecoder$1(decoders)(TransactionSchema$1)(val);
1501
- decoders[CODEC$1.OP_ORIGINATION] = (val) => schemaDecoder$1(decoders)(OriginationSchema$1)(val);
1502
- decoders[CODEC$1.OP_BALLOT] = (val) => schemaDecoder$1(decoders)(BallotSchema$1)(val);
1503
- decoders[CODEC$1.OP_ATTESTATION] = (val) => schemaDecoder$1(decoders)(AttestationSchema$1)(val);
1504
- decoders[CODEC$1.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder$1(decoders)(AttestationWithDalSchema$1)(val);
1505
- decoders[CODEC$1.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder$1(decoders)(SeedNonceRevelationSchema$1)(val);
1506
- decoders[CODEC$1.OP_PROPOSALS] = (val) => schemaDecoder$1(decoders)(ProposalsSchema$1)(val);
1507
- decoders[CODEC$1.OP_REVEAL] = (val) => schemaDecoder$1(decoders)(RevealSchema$1)(val);
1508
- decoders[CODEC$1.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder$1(decoders)(RegisterGlobalConstantSchema$1)(val);
1509
- decoders[CODEC$1.OP_TRANSFER_TICKET] = (val) => schemaDecoder$1(decoders)(TransferTicketSchema$1)(val);
1510
- decoders[CODEC$1.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder$1(decoders)(IncreasePaidStorageSchema$1)(val);
1511
- decoders[CODEC$1.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder$1(decoders)(UpdateConsensusKeySchema$1)(val);
1512
- decoders[CODEC$1.OP_DRAIN_DELEGATE] = (val) => schemaDecoder$1(decoders)(DrainDelegateSchema$1)(val);
1513
- decoders[CODEC$1.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder$1(decoders)(SmartRollupOriginateSchema$1)(val);
1514
- decoders[CODEC$1.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder$1(decoders)(SmartRollupAddMessagesSchema$1)(val);
1515
- decoders[CODEC$1.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder$1(decoders)(SmartRollupExecuteOutboxMessageSchema$1)(val);
1516
- decoders[CODEC$1.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder$1(decoders)(DalPublishCommitmentSchema$1)(val);
1517
- decoders[CODEC$1.MANAGER] = schemaDecoder$1(decoders)(ManagerOperationSchema$1);
1518
- decoders[CODEC$1.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder$1(decoders)(SetDepositsLimitSchema$1)(val);
1502
+ decoders$1[CODEC$1.OPERATION] = operationDecoder$1(decoders$1);
1503
+ decoders$1[CODEC$1.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder$1(decoders$1)(ActivationSchema$1)(val);
1504
+ decoders$1[CODEC$1.OP_FAILING_NOOP] = (val) => schemaDecoder$1(decoders$1)(FailingNoopSchema$1)(val);
1505
+ decoders$1[CODEC$1.OP_DELEGATION] = (val) => schemaDecoder$1(decoders$1)(DelegationSchema$1)(val);
1506
+ decoders$1[CODEC$1.OP_TRANSACTION] = (val) => schemaDecoder$1(decoders$1)(TransactionSchema$1)(val);
1507
+ decoders$1[CODEC$1.OP_ORIGINATION] = (val) => schemaDecoder$1(decoders$1)(OriginationSchema$1)(val);
1508
+ decoders$1[CODEC$1.OP_BALLOT] = (val) => schemaDecoder$1(decoders$1)(BallotSchema$1)(val);
1509
+ decoders$1[CODEC$1.OP_ATTESTATION] = (val) => schemaDecoder$1(decoders$1)(AttestationSchema$1)(val);
1510
+ decoders$1[CODEC$1.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder$1(decoders$1)(AttestationWithDalSchema$1)(val);
1511
+ decoders$1[CODEC$1.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder$1(decoders$1)(SeedNonceRevelationSchema$1)(val);
1512
+ decoders$1[CODEC$1.OP_PROPOSALS] = (val) => schemaDecoder$1(decoders$1)(ProposalsSchema$1)(val);
1513
+ decoders$1[CODEC$1.OP_REVEAL] = (val) => schemaDecoder$1(decoders$1)(RevealSchema$1)(val);
1514
+ decoders$1[CODEC$1.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder$1(decoders$1)(RegisterGlobalConstantSchema$1)(val);
1515
+ decoders$1[CODEC$1.OP_TRANSFER_TICKET] = (val) => schemaDecoder$1(decoders$1)(TransferTicketSchema$1)(val);
1516
+ decoders$1[CODEC$1.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder$1(decoders$1)(IncreasePaidStorageSchema$1)(val);
1517
+ decoders$1[CODEC$1.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder$1(decoders$1)(UpdateConsensusKeySchema$1)(val);
1518
+ decoders$1[CODEC$1.OP_UPDATE_COMPANION_KEY] = (val) => schemaDecoder$1(decoders$1)(UpdateCompanionKeySchema)(val);
1519
+ decoders$1[CODEC$1.OP_DRAIN_DELEGATE] = (val) => schemaDecoder$1(decoders$1)(DrainDelegateSchema$1)(val);
1520
+ decoders$1[CODEC$1.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder$1(decoders$1)(SmartRollupOriginateSchema$1)(val);
1521
+ decoders$1[CODEC$1.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder$1(decoders$1)(SmartRollupAddMessagesSchema$1)(val);
1522
+ decoders$1[CODEC$1.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder$1(decoders$1)(SmartRollupExecuteOutboxMessageSchema$1)(val);
1523
+ decoders$1[CODEC$1.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder$1(decoders$1)(DalPublishCommitmentSchema$1)(val);
1524
+ decoders$1[CODEC$1.MANAGER] = schemaDecoder$1(decoders$1)(ManagerOperationSchema$1);
1525
+ decoders$1[CODEC$1.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder$1(decoders$1)(SetDepositsLimitSchema$1)(val);
1519
1526
 
1520
1527
  /*
1521
1528
  * Some code in this file is originally from sotez
@@ -1568,6 +1575,7 @@ var CODEC;
1568
1575
  CODEC["BURN_LIMIT"] = "burn_limit";
1569
1576
  CODEC["OP_INCREASE_PAID_STORAGE"] = "increase_paid_storage";
1570
1577
  CODEC["OP_UPDATE_CONSENSUS_KEY"] = "update_consensus_key";
1578
+ CODEC["SIGNATURE_PROOF"] = "signature_proof";
1571
1579
  CODEC["OP_DRAIN_DELEGATE"] = "drain_delegate";
1572
1580
  CODEC["DEPOSITS_LIMIT"] = "deposits_limit";
1573
1581
  CODEC["OP_SET_DEPOSITS_LIMIT"] = "set_deposits_limit";
@@ -1739,7 +1747,7 @@ const opMapping = {
1739
1747
  '9c': 'NAT',
1740
1748
  '9d': 'Ticket',
1741
1749
  };
1742
- (() => {
1750
+ const opMappingReverse = (() => {
1743
1751
  const result = {};
1744
1752
  Object.keys(opMapping).forEach((key) => {
1745
1753
  result[opMapping[key]] = key;
@@ -1799,6 +1807,259 @@ const entrypointMappingReverse = (() => {
1799
1807
  return result;
1800
1808
  })();
1801
1809
 
1810
+ const isPrim = (value) => {
1811
+ return 'prim' in value;
1812
+ };
1813
+ const isBytes = (value) => {
1814
+ return 'bytes' in value && typeof value.bytes === 'string';
1815
+ };
1816
+ const isString = (value) => {
1817
+ return 'string' in value && typeof value.string === 'string';
1818
+ };
1819
+ const isInt = (value) => {
1820
+ return 'int' in value && typeof value.int === 'string';
1821
+ };
1822
+ const scriptEncoder = (script) => {
1823
+ const code = valueEncoder(script.code);
1824
+ const storage = valueEncoder(script.storage);
1825
+ return `${pad(code.length / 2, 8)}${code}${pad(storage.length / 2, 8)}${storage}`;
1826
+ };
1827
+ const scriptDecoder = (value) => {
1828
+ const code = extractRequiredLen(value);
1829
+ const storage = extractRequiredLen(value);
1830
+ return {
1831
+ code: valueDecoder(new Uint8ArrayConsumer(code)),
1832
+ storage: valueDecoder(new Uint8ArrayConsumer(storage)),
1833
+ };
1834
+ };
1835
+ const valueEncoder = (value) => {
1836
+ if (Array.isArray(value)) {
1837
+ const encoded = value.map((x) => valueEncoder(x)).join('');
1838
+ const len = encoded.length / 2;
1839
+ return `02${pad(len)}${encoded}`;
1840
+ }
1841
+ else if (isPrim(value)) {
1842
+ return primEncoder(value);
1843
+ }
1844
+ else if (isBytes(value)) {
1845
+ return bytesEncoder(value);
1846
+ }
1847
+ else if (isString(value)) {
1848
+ return stringEncoder(value);
1849
+ }
1850
+ else if (isInt(value)) {
1851
+ return intEncoder(value);
1852
+ }
1853
+ throw new UnexpectedMichelsonValueError(JSON.stringify(value));
1854
+ };
1855
+ const valueDecoder = (value) => {
1856
+ const preamble = value.consume(1);
1857
+ switch (preamble[0]) {
1858
+ case 0x0a:
1859
+ return bytesDecoder(value);
1860
+ case 0x01:
1861
+ return stringDecoder(value);
1862
+ case 0x00:
1863
+ return intDecoder(value);
1864
+ case 0x02: {
1865
+ const val = new Uint8ArrayConsumer(extractRequiredLen(value));
1866
+ const results = [];
1867
+ while (val.length() > 0) {
1868
+ results.push(valueDecoder(val));
1869
+ }
1870
+ return results;
1871
+ }
1872
+ default:
1873
+ return primDecoder(value, preamble);
1874
+ }
1875
+ };
1876
+ const extractRequiredLen = (value, bytesLength = 4) => {
1877
+ const len = value.consume(bytesLength);
1878
+ const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
1879
+ return value.consume(valueLen);
1880
+ };
1881
+ /**
1882
+ * @description parse bytes into multiple items of an array
1883
+ * @param value Uint8ArrayConsumer class of forged segment to parse
1884
+ * @param bytesLength default 4 bytes for length of variable bytes
1885
+ * @returns array of Uint8Array values for each array item
1886
+ */
1887
+ const stripLengthPrefixFromBytes = (value, bytesLength = 4) => {
1888
+ const ret = [];
1889
+ let values = value;
1890
+ while (values.length()) {
1891
+ const len = values.consume(bytesLength);
1892
+ const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
1893
+ ret.push(values.consume(valueLen));
1894
+ values = values.slice(valueLen + bytesLength);
1895
+ }
1896
+ return ret;
1897
+ };
1898
+ const bytesEncoder = (value) => {
1899
+ if (!/^([A-Fa-f0-9]{2})*$/.test(value.bytes)) {
1900
+ throw new InvalidHexStringError(value.bytes);
1901
+ }
1902
+ const len = value.bytes.length / 2;
1903
+ return `0a${pad(len)}${value.bytes}`;
1904
+ };
1905
+ const bytesDecoder = (value) => {
1906
+ const bytes = extractRequiredLen(value);
1907
+ return {
1908
+ bytes: Buffer.from(bytes).toString('hex'),
1909
+ };
1910
+ };
1911
+ const stringEncoder = (value) => {
1912
+ const str = Buffer.from(value.string, 'utf8').toString('hex');
1913
+ const hexLength = str.length / 2;
1914
+ return `01${pad(hexLength)}${str}`;
1915
+ };
1916
+ const stringDecoder = (value) => {
1917
+ const str = extractRequiredLen(value);
1918
+ return {
1919
+ string: Buffer.from(str).toString('utf8'),
1920
+ };
1921
+ };
1922
+ const intEncoder = ({ int }) => {
1923
+ const num = new BigNumber(int, 10);
1924
+ const positiveMark = num.toString(2)[0] === '-' ? '1' : '0';
1925
+ const binary = num.toString(2).replace(/-/g, '');
1926
+ const pad = binary.length <= 6
1927
+ ? 6
1928
+ : (binary.length - 6) % 7
1929
+ ? binary.length + 7 - ((binary.length - 6) % 7)
1930
+ : binary.length;
1931
+ const splitted = binary.padStart(pad, '0').match(/\d{6,7}/g);
1932
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1933
+ const reversed = splitted.reverse();
1934
+ reversed[0] = positiveMark + reversed[0];
1935
+ const numHex = reversed.map((x, i) =>
1936
+ // Add one to the last chunk
1937
+ parseInt((i === reversed.length - 1 ? '0' : '1') + x, 2)
1938
+ .toString(16)
1939
+ .padStart(2, '0'));
1940
+ return `00${numHex.join('')}`;
1941
+ };
1942
+ const intDecoder = (value) => {
1943
+ let c = value.consume(1)[0];
1944
+ const hexNumber = [];
1945
+ const isNotLastChunkMask = 1 << 7;
1946
+ while (c & isNotLastChunkMask) {
1947
+ hexNumber.push(c);
1948
+ c = value.consume(1)[0];
1949
+ }
1950
+ hexNumber.push(c);
1951
+ const isNegative = !!((1 << 6) & hexNumber[0]);
1952
+ hexNumber[0] = hexNumber[0] & 0b1111111;
1953
+ const numBin = hexNumber
1954
+ .map((x, i) => x
1955
+ .toString(2)
1956
+ .slice(i === 0 ? -6 : -7)
1957
+ .padStart(i === 0 ? 6 : 7, '0'))
1958
+ .reverse();
1959
+ let num = new BigNumber(numBin.join(''), 2);
1960
+ if (isNegative) {
1961
+ num = num.times(-1);
1962
+ }
1963
+ return {
1964
+ int: num.toFixed(),
1965
+ };
1966
+ };
1967
+ const primEncoder = (value) => {
1968
+ const hasAnnot = +Array.isArray(value.annots);
1969
+ const argsCount = Array.isArray(value.args) ? value.args.length : 0;
1970
+ // Specify the number of args max is 3 without annotation
1971
+ const preamble = pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2);
1972
+ const op = opMappingReverse[value.prim];
1973
+ let encodedArgs = (value.args || []).map((arg) => valueEncoder(arg)).join('');
1974
+ const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';
1975
+ if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) {
1976
+ encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
1977
+ }
1978
+ if ((value.prim === 'pair' || value.prim === 'Pair') && argsCount > 2) {
1979
+ encodedArgs =
1980
+ encodedAnnots === ''
1981
+ ? pad(encodedArgs.length / 2) + encodedArgs + pad(0)
1982
+ : pad(encodedArgs.length / 2) + encodedArgs;
1983
+ }
1984
+ if (value.prim === 'view' && value.args) {
1985
+ encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
1986
+ }
1987
+ return `${preamble}${op}${encodedArgs}${encodedAnnots}`;
1988
+ };
1989
+ const primDecoder = (value, preamble) => {
1990
+ const hasAnnot = (preamble[0] - 0x03) % 2 === 1;
1991
+ let argsCount = Math.floor((preamble[0] - 0x03) / 2);
1992
+ const op = value.consume(1)[0].toString(16).padStart(2, '0');
1993
+ const result = {
1994
+ prim: opMapping[op],
1995
+ };
1996
+ if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
1997
+ value.consume(4);
1998
+ }
1999
+ if (opMapping[op] === 'view') {
2000
+ if (argsCount != 0) {
2001
+ return primViewDecoder(value, result);
2002
+ }
2003
+ else {
2004
+ return result;
2005
+ }
2006
+ }
2007
+ let combPairArgs;
2008
+ let combPairAnnots;
2009
+ if ((opMapping[op] === 'pair' || opMapping[op] === 'Pair') && argsCount > 2) {
2010
+ combPairArgs = decodeCombPair(value);
2011
+ argsCount = 0;
2012
+ combPairAnnots = decodeAnnots(value);
2013
+ }
2014
+ const args = new Array(argsCount).fill(0).map(() => valueDecoder(value));
2015
+ if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
2016
+ value.consume(4);
2017
+ }
2018
+ if (combPairArgs) {
2019
+ result['args'] = combPairArgs;
2020
+ }
2021
+ else if (args.length) {
2022
+ result['args'] = args;
2023
+ }
2024
+ if (combPairAnnots && combPairAnnots[0] !== '') {
2025
+ result['annots'] = combPairAnnots;
2026
+ }
2027
+ else if (hasAnnot) {
2028
+ result['annots'] = decodeAnnots(value);
2029
+ }
2030
+ return result;
2031
+ };
2032
+ const primViewDecoder = (value, result) => {
2033
+ value.consume(4);
2034
+ result['args'] = new Array(4).fill(0).map(() => valueDecoder(value));
2035
+ value.consume(4);
2036
+ return result;
2037
+ };
2038
+ const decodeCombPair = (val) => {
2039
+ const array = new Uint8ArrayConsumer(extractRequiredLen(val));
2040
+ const args = [];
2041
+ while (array.length() > 0) {
2042
+ args.push(valueDecoder(array));
2043
+ }
2044
+ return args;
2045
+ };
2046
+ const encodeAnnots = (value) => {
2047
+ const mergedAnnot = value
2048
+ .map((x) => {
2049
+ return Buffer.from(x, 'utf8').toString('hex');
2050
+ })
2051
+ .join('20');
2052
+ const len = mergedAnnot.length / 2;
2053
+ return `${pad(len)}${mergedAnnot}`;
2054
+ };
2055
+ const decodeAnnots = (val) => {
2056
+ const len = val.consume(4);
2057
+ const annotLen = parseInt(Buffer.from(len).toString('hex'), 16);
2058
+ const restOfAnnot = val.consume(annotLen);
2059
+ const restOfAnnotHex = Buffer.from(restOfAnnot).toString('hex');
2060
+ return restOfAnnotHex.split('20').map((x) => Buffer.from(x, 'hex').toString('utf8'));
2061
+ };
2062
+
1802
2063
  // https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
1803
2064
  const prefixEncoder = (prefix$1) => (str) => {
1804
2065
  return buf2hex(Buffer.from(b58cdecode(str, prefix[prefix$1])));
@@ -1820,10 +2081,13 @@ const publicKeyHashDecoder = (val) => {
1820
2081
  else if (prefix[0] === 0x02) {
1821
2082
  return prefixDecoder(Prefix.TZ3)(val);
1822
2083
  }
2084
+ else if (prefix[0] === 0x03) {
2085
+ return prefixDecoder(Prefix.TZ4)(val);
2086
+ }
1823
2087
  };
1824
2088
  const publicKeyHashesDecoder = (val) => {
1825
2089
  if (!boolDecoder(val)) {
1826
- return undefined;
2090
+ return;
1827
2091
  }
1828
2092
  const publicKeyHashes = [];
1829
2093
  val.consume(4);
@@ -1991,6 +2255,8 @@ const publicKeyEncoder = (val) => {
1991
2255
  return '01' + prefixEncoder(Prefix.SPPK)(val);
1992
2256
  case Prefix.P2PK:
1993
2257
  return '02' + prefixEncoder(Prefix.P2PK)(val);
2258
+ case Prefix.BLPK:
2259
+ return '03' + prefixEncoder(Prefix.BLPK)(val);
1994
2260
  default:
1995
2261
  throw new InvalidPublicKeyError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
1996
2262
  ` expecting one of the following '${Prefix.EDPK}', '${Prefix.SPPK}', '${Prefix.P2PK}' or '${Prefix.BLPK}'.`);
@@ -2033,6 +2299,8 @@ const publicKeyDecoder = (val) => {
2033
2299
  return prefixDecoder(Prefix.SPPK)(val);
2034
2300
  case 0x02:
2035
2301
  return prefixDecoder(Prefix.P2PK)(val);
2302
+ case 0x03:
2303
+ return prefixDecoder(Prefix.BLPK)(val);
2036
2304
  default:
2037
2305
  throw new InvalidPublicKeyError(val.toString(), invalidDetail(ValidationResult.NO_PREFIX_MATCHED));
2038
2306
  }
@@ -2205,6 +2473,45 @@ const depositsLimitDecoder = (value) => {
2205
2473
  return zarithDecoder(value);
2206
2474
  }
2207
2475
  };
2476
+ const signatureV1Encoder = (val) => {
2477
+ const signaturePrefix = val.substring(0, 5);
2478
+ switch (signaturePrefix) {
2479
+ case Prefix.EDSIG:
2480
+ return paddedBytesEncoder(prefixEncoder(Prefix.EDSIG)(val));
2481
+ case Prefix.SPSIG:
2482
+ return paddedBytesEncoder(prefixEncoder(Prefix.SPSIG)(val));
2483
+ case Prefix.P2SIG:
2484
+ return paddedBytesEncoder(prefixEncoder(Prefix.P2SIG)(val));
2485
+ case Prefix.BLSIG:
2486
+ return paddedBytesEncoder(prefixEncoder(Prefix.BLSIG)(val));
2487
+ default:
2488
+ throw new InvalidSignatureError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
2489
+ ` expecting one of the following '${Prefix.EDSIG}', '${Prefix.SPSIG}', '${Prefix.P2SIG}' or '${Prefix.BLSIG}'.`);
2490
+ }
2491
+ };
2492
+ const signatureV1Decoder = (val) => {
2493
+ val.consume(4);
2494
+ if (val.length().toString() === '96') {
2495
+ return prefixDecoder(Prefix.BLSIG)(val);
2496
+ }
2497
+ else {
2498
+ throw new ProhibitedActionError('currently we only support decoding of BLSIG signatures');
2499
+ }
2500
+ };
2501
+ const signatureProofEncoder = (val) => {
2502
+ if (val) {
2503
+ return boolEncoder(true) + signatureV1Encoder(val);
2504
+ }
2505
+ else {
2506
+ return boolEncoder(false);
2507
+ }
2508
+ };
2509
+ const signatureProofDecoder = (value) => {
2510
+ const hasProof = boolDecoder(value);
2511
+ if (hasProof) {
2512
+ return signatureV1Decoder(value);
2513
+ }
2514
+ };
2208
2515
  const paddedBytesEncoder = (val, paddingLength = 8) => {
2209
2516
  return `${pad(val.length / 2, paddingLength)}${val}`;
2210
2517
  };
@@ -2358,6 +2665,7 @@ const UpdateConsensusKeySchema = {
2358
2665
  gas_limit: CODEC.ZARITH,
2359
2666
  storage_limit: CODEC.ZARITH,
2360
2667
  pk: CODEC.PUBLIC_KEY,
2668
+ proof: CODEC.SIGNATURE_PROOF,
2361
2669
  };
2362
2670
  const DrainDelegateSchema = {
2363
2671
  consensus_key: CODEC.PKH,
@@ -2477,7 +2785,7 @@ const schemaDecoder = (decoders) => (schema) => (value) => {
2477
2785
  }, {});
2478
2786
  };
2479
2787
 
2480
- const decodersProto021 = {
2788
+ const decoders = {
2481
2789
  [CODEC.SECRET]: (val) => toHexString(val.consume(20)),
2482
2790
  [CODEC.RAW]: (val) => toHexString(val.consume(32)),
2483
2791
  [CODEC.TZ1]: tz1Decoder,
@@ -2503,36 +2811,37 @@ const decodersProto021 = {
2503
2811
  [CODEC.ENTRYPOINT]: entrypointNameDecoder,
2504
2812
  [CODEC.BURN_LIMIT]: burnLimitDecoder,
2505
2813
  [CODEC.DEPOSITS_LIMIT]: depositsLimitDecoder,
2814
+ [CODEC.SIGNATURE_PROOF]: signatureProofDecoder,
2506
2815
  [CODEC.PVM_KIND]: pvmKindDecoder,
2507
2816
  [CODEC.PADDED_BYTES]: paddedBytesDecoder,
2508
2817
  [CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder,
2509
2818
  [CODEC.SLOT_HEADER]: slotHeaderDecoder,
2510
2819
  };
2511
- decodersProto021[CODEC.OPERATION] = operationDecoder(decodersProto021);
2512
- decodersProto021[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decodersProto021)(ActivationSchema)(val);
2513
- decodersProto021[CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder(decodersProto021)(FailingNoopSchema)(val);
2514
- decodersProto021[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decodersProto021)(DelegationSchema)(val);
2515
- decodersProto021[CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decodersProto021)(TransactionSchema)(val);
2516
- decodersProto021[CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decodersProto021)(OriginationSchema)(val);
2517
- decodersProto021[CODEC.OP_BALLOT] = (val) => schemaDecoder(decodersProto021)(BallotSchema)(val);
2518
- decodersProto021[CODEC.OP_ATTESTATION] = (val) => schemaDecoder(decodersProto021)(AttestationSchema)(val);
2519
- decodersProto021[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder(decodersProto021)(AttestationWithDalSchema)(val);
2520
- decodersProto021[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decodersProto021)(SeedNonceRevelationSchema)(val);
2521
- decodersProto021[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decodersProto021)(ProposalsSchema)(val);
2522
- decodersProto021[CODEC.OP_REVEAL] = (val) => schemaDecoder(decodersProto021)(RevealSchema)(val);
2523
- decodersProto021[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decodersProto021)(RegisterGlobalConstantSchema)(val);
2524
- decodersProto021[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decodersProto021)(TransferTicketSchema)(val);
2525
- decodersProto021[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder(decodersProto021)(IncreasePaidStorageSchema)(val);
2526
- decodersProto021[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder(decodersProto021)(UpdateConsensusKeySchema)(val);
2527
- decodersProto021[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaDecoder(decodersProto021)(DrainDelegateSchema)(val);
2528
- decodersProto021[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder(decodersProto021)(SmartRollupOriginateSchema)(val);
2529
- decodersProto021[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder(decodersProto021)(SmartRollupAddMessagesSchema)(val);
2530
- decodersProto021[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder(decodersProto021)(SmartRollupExecuteOutboxMessageSchema)(val);
2531
- decodersProto021[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder(decodersProto021)(DalPublishCommitmentSchema)(val);
2532
- decodersProto021[CODEC.MANAGER] = schemaDecoder(decodersProto021)(ManagerOperationSchema);
2533
- decodersProto021[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder(decodersProto021)(SetDepositsLimitSchema)(val);
2820
+ decoders[CODEC.OPERATION] = operationDecoder(decoders);
2821
+ decoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decoders)(ActivationSchema)(val);
2822
+ decoders[CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder(decoders)(FailingNoopSchema)(val);
2823
+ decoders[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decoders)(DelegationSchema)(val);
2824
+ decoders[CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decoders)(TransactionSchema)(val);
2825
+ decoders[CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decoders)(OriginationSchema)(val);
2826
+ decoders[CODEC.OP_BALLOT] = (val) => schemaDecoder(decoders)(BallotSchema)(val);
2827
+ decoders[CODEC.OP_ATTESTATION] = (val) => schemaDecoder(decoders)(AttestationSchema)(val);
2828
+ decoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder(decoders)(AttestationWithDalSchema)(val);
2829
+ decoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decoders)(SeedNonceRevelationSchema)(val);
2830
+ decoders[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decoders)(ProposalsSchema)(val);
2831
+ decoders[CODEC.OP_REVEAL] = (val) => schemaDecoder(decoders)(RevealSchema)(val);
2832
+ decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decoders)(RegisterGlobalConstantSchema)(val);
2833
+ decoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decoders)(TransferTicketSchema)(val);
2834
+ decoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder(decoders)(IncreasePaidStorageSchema)(val);
2835
+ decoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder(decoders)(UpdateConsensusKeySchema)(val);
2836
+ decoders[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaDecoder(decoders)(DrainDelegateSchema)(val);
2837
+ decoders[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder(decoders)(SmartRollupOriginateSchema)(val);
2838
+ decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(val);
2839
+ decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(val);
2840
+ decoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder(decoders)(DalPublishCommitmentSchema)(val);
2841
+ decoders[CODEC.MANAGER] = schemaDecoder(decoders)(ManagerOperationSchema);
2842
+ decoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder(decoders)(SetDepositsLimitSchema)(val);
2534
2843
 
2535
- const encoders = {
2844
+ const encoders$1 = {
2536
2845
  [CODEC$1.SECRET]: (val) => val,
2537
2846
  [CODEC$1.RAW]: (val) => val,
2538
2847
  [CODEC$1.TZ1]: tz1Encoder$1,
@@ -2542,7 +2851,7 @@ const encoders = {
2542
2851
  [CODEC$1.PKH]: publicKeyHashEncoder$1,
2543
2852
  [CODEC$1.PKH_ARR]: publicKeyHashesEncoder$1,
2544
2853
  [CODEC$1.DELEGATE]: delegateEncoder$1,
2545
- [CODEC$1.SCRIPT]: scriptEncoder,
2854
+ [CODEC$1.SCRIPT]: scriptEncoder$1,
2546
2855
  [CODEC$1.BALLOT_STATEMENT]: ballotEncoder$1,
2547
2856
  [CODEC$1.PROPOSAL]: proposalEncoder$1,
2548
2857
  [CODEC$1.PROPOSAL_ARR]: proposalsEncoder$1,
@@ -2558,37 +2867,38 @@ const encoders = {
2558
2867
  [CODEC$1.ENTRYPOINT]: entrypointNameEncoder$1,
2559
2868
  [CODEC$1.BURN_LIMIT]: burnLimitEncoder$1,
2560
2869
  [CODEC$1.DEPOSITS_LIMIT]: depositsLimitEncoder$1,
2561
- [CODEC$1.SIGNATURE_PROOF]: signatureProofEncoder,
2870
+ [CODEC$1.SIGNATURE_PROOF]: signatureProofEncoder$1,
2562
2871
  [CODEC$1.PVM_KIND]: pvmKindEncoder$1,
2563
2872
  [CODEC$1.PADDED_BYTES]: paddedBytesEncoder$1,
2564
2873
  [CODEC$1.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder$1,
2565
2874
  [CODEC$1.SLOT_HEADER]: slotHeaderEncoder$1,
2566
2875
  };
2567
- encoders[CODEC$1.OPERATION] = operationEncoder$1(encoders);
2568
- encoders[CODEC$1.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder$1(encoders)(ActivationSchema$1)(val);
2569
- encoders[CODEC$1.OP_DELEGATION] = (val) => schemaEncoder$1(encoders)(DelegationSchema$1)(val);
2570
- encoders[CODEC$1.OP_TRANSACTION] = (val) => schemaEncoder$1(encoders)(TransactionSchema$1)(val);
2571
- encoders[CODEC$1.OP_ORIGINATION] = (val) => schemaEncoder$1(encoders)(OriginationSchema$1)(val);
2572
- encoders[CODEC$1.OP_BALLOT] = (val) => schemaEncoder$1(encoders)(BallotSchema$1)(val);
2573
- encoders[CODEC$1.OP_ATTESTATION] = (val) => schemaEncoder$1(encoders)(AttestationSchema$1)(val);
2574
- encoders[CODEC$1.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder$1(encoders)(AttestationWithDalSchema$1)(val);
2575
- encoders[CODEC$1.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder$1(encoders)(SeedNonceRevelationSchema$1)(val);
2576
- encoders[CODEC$1.OP_PROPOSALS] = (val) => schemaEncoder$1(encoders)(ProposalsSchema$1)(val);
2577
- encoders[CODEC$1.OP_REVEAL] = (val) => schemaEncoder$1(encoders)(RevealSchema$1)(val);
2578
- encoders[CODEC$1.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder$1(encoders)(RegisterGlobalConstantSchema$1)(val);
2579
- encoders[CODEC$1.OP_TRANSFER_TICKET] = (val) => schemaEncoder$1(encoders)(TransferTicketSchema$1)(val);
2580
- encoders[CODEC$1.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder$1(encoders)(IncreasePaidStorageSchema$1)(val);
2581
- encoders[CODEC$1.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder$1(encoders)(UpdateConsensusKeySchema$1)(val);
2582
- encoders[CODEC$1.OP_DRAIN_DELEGATE] = (val) => schemaEncoder$1(encoders)(DrainDelegateSchema$1)(val);
2583
- encoders[CODEC$1.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder$1(encoders)(SmartRollupOriginateSchema$1)(val);
2584
- encoders[CODEC$1.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder$1(encoders)(SmartRollupAddMessagesSchema$1)(val);
2585
- encoders[CODEC$1.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder$1(encoders)(SmartRollupExecuteOutboxMessageSchema$1)(val);
2586
- encoders[CODEC$1.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder$1(encoders)(DalPublishCommitmentSchema$1)(val);
2587
- encoders[CODEC$1.MANAGER] = schemaEncoder$1(encoders)(ManagerOperationSchema$1);
2588
- encoders[CODEC$1.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder$1(encoders)(SetDepositsLimitSchema$1)(val);
2589
- encoders[CODEC$1.OP_FAILING_NOOP] = (val) => schemaEncoder$1(encoders)(FailingNoopSchema$1)(val);
2876
+ encoders$1[CODEC$1.OPERATION] = operationEncoder$1(encoders$1);
2877
+ encoders$1[CODEC$1.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder$1(encoders$1)(ActivationSchema$1)(val);
2878
+ encoders$1[CODEC$1.OP_DELEGATION] = (val) => schemaEncoder$1(encoders$1)(DelegationSchema$1)(val);
2879
+ encoders$1[CODEC$1.OP_TRANSACTION] = (val) => schemaEncoder$1(encoders$1)(TransactionSchema$1)(val);
2880
+ encoders$1[CODEC$1.OP_ORIGINATION] = (val) => schemaEncoder$1(encoders$1)(OriginationSchema$1)(val);
2881
+ encoders$1[CODEC$1.OP_BALLOT] = (val) => schemaEncoder$1(encoders$1)(BallotSchema$1)(val);
2882
+ encoders$1[CODEC$1.OP_ATTESTATION] = (val) => schemaEncoder$1(encoders$1)(AttestationSchema$1)(val);
2883
+ encoders$1[CODEC$1.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder$1(encoders$1)(AttestationWithDalSchema$1)(val);
2884
+ encoders$1[CODEC$1.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder$1(encoders$1)(SeedNonceRevelationSchema$1)(val);
2885
+ encoders$1[CODEC$1.OP_PROPOSALS] = (val) => schemaEncoder$1(encoders$1)(ProposalsSchema$1)(val);
2886
+ encoders$1[CODEC$1.OP_REVEAL] = (val) => schemaEncoder$1(encoders$1)(RevealSchema$1)(val);
2887
+ encoders$1[CODEC$1.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder$1(encoders$1)(RegisterGlobalConstantSchema$1)(val);
2888
+ encoders$1[CODEC$1.OP_TRANSFER_TICKET] = (val) => schemaEncoder$1(encoders$1)(TransferTicketSchema$1)(val);
2889
+ encoders$1[CODEC$1.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder$1(encoders$1)(IncreasePaidStorageSchema$1)(val);
2890
+ encoders$1[CODEC$1.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder$1(encoders$1)(UpdateConsensusKeySchema$1)(val);
2891
+ encoders$1[CODEC$1.OP_UPDATE_COMPANION_KEY] = (val) => schemaEncoder$1(encoders$1)(UpdateCompanionKeySchema)(val);
2892
+ encoders$1[CODEC$1.OP_DRAIN_DELEGATE] = (val) => schemaEncoder$1(encoders$1)(DrainDelegateSchema$1)(val);
2893
+ encoders$1[CODEC$1.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder$1(encoders$1)(SmartRollupOriginateSchema$1)(val);
2894
+ encoders$1[CODEC$1.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder$1(encoders$1)(SmartRollupAddMessagesSchema$1)(val);
2895
+ encoders$1[CODEC$1.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder$1(encoders$1)(SmartRollupExecuteOutboxMessageSchema$1)(val);
2896
+ encoders$1[CODEC$1.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder$1(encoders$1)(DalPublishCommitmentSchema$1)(val);
2897
+ encoders$1[CODEC$1.MANAGER] = schemaEncoder$1(encoders$1)(ManagerOperationSchema$1);
2898
+ encoders$1[CODEC$1.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder$1(encoders$1)(SetDepositsLimitSchema$1)(val);
2899
+ encoders$1[CODEC$1.OP_FAILING_NOOP] = (val) => schemaEncoder$1(encoders$1)(FailingNoopSchema$1)(val);
2590
2900
 
2591
- const encodersProto021 = {
2901
+ const encoders = {
2592
2902
  [CODEC.SECRET]: (val) => val,
2593
2903
  [CODEC.RAW]: (val) => val,
2594
2904
  [CODEC.TZ1]: tz1Encoder,
@@ -2614,34 +2924,35 @@ const encodersProto021 = {
2614
2924
  [CODEC.ENTRYPOINT]: entrypointNameEncoder,
2615
2925
  [CODEC.BURN_LIMIT]: burnLimitEncoder,
2616
2926
  [CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder,
2927
+ [CODEC.SIGNATURE_PROOF]: signatureProofEncoder,
2617
2928
  [CODEC.PVM_KIND]: pvmKindEncoder,
2618
2929
  [CODEC.PADDED_BYTES]: paddedBytesEncoder,
2619
2930
  [CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder,
2620
2931
  [CODEC.SLOT_HEADER]: slotHeaderEncoder,
2621
2932
  };
2622
- encodersProto021[CODEC.OPERATION] = operationEncoder(encodersProto021);
2623
- encodersProto021[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encodersProto021)(ActivationSchema)(val);
2624
- encodersProto021[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encodersProto021)(DelegationSchema)(val);
2625
- encodersProto021[CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encodersProto021)(TransactionSchema)(val);
2626
- encodersProto021[CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encodersProto021)(OriginationSchema)(val);
2627
- encodersProto021[CODEC.OP_BALLOT] = (val) => schemaEncoder(encodersProto021)(BallotSchema)(val);
2628
- encodersProto021[CODEC.OP_ATTESTATION] = (val) => schemaEncoder(encodersProto021)(AttestationSchema)(val);
2629
- encodersProto021[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder(encodersProto021)(AttestationWithDalSchema)(val);
2630
- encodersProto021[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encodersProto021)(SeedNonceRevelationSchema)(val);
2631
- encodersProto021[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encodersProto021)(ProposalsSchema)(val);
2632
- encodersProto021[CODEC.OP_REVEAL] = (val) => schemaEncoder(encodersProto021)(RevealSchema)(val);
2633
- encodersProto021[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encodersProto021)(RegisterGlobalConstantSchema)(val);
2634
- encodersProto021[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encodersProto021)(TransferTicketSchema)(val);
2635
- encodersProto021[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder(encodersProto021)(IncreasePaidStorageSchema)(val);
2636
- encodersProto021[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder(encodersProto021)(UpdateConsensusKeySchema)(val);
2637
- encodersProto021[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaEncoder(encodersProto021)(DrainDelegateSchema)(val);
2638
- encodersProto021[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder(encodersProto021)(SmartRollupOriginateSchema)(val);
2639
- encodersProto021[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder(encodersProto021)(SmartRollupAddMessagesSchema)(val);
2640
- encodersProto021[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder(encodersProto021)(SmartRollupExecuteOutboxMessageSchema)(val);
2641
- encodersProto021[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder(encodersProto021)(DalPublishCommitmentSchema)(val);
2642
- encodersProto021[CODEC.MANAGER] = schemaEncoder(encodersProto021)(ManagerOperationSchema);
2643
- encodersProto021[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encodersProto021)(SetDepositsLimitSchema)(val);
2644
- encodersProto021[CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder(encodersProto021)(FailingNoopSchema)(val);
2933
+ encoders[CODEC.OPERATION] = operationEncoder(encoders);
2934
+ encoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encoders)(ActivationSchema)(val);
2935
+ encoders[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encoders)(DelegationSchema)(val);
2936
+ encoders[CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encoders)(TransactionSchema)(val);
2937
+ encoders[CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encoders)(OriginationSchema)(val);
2938
+ encoders[CODEC.OP_BALLOT] = (val) => schemaEncoder(encoders)(BallotSchema)(val);
2939
+ encoders[CODEC.OP_ATTESTATION] = (val) => schemaEncoder(encoders)(AttestationSchema)(val);
2940
+ encoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder(encoders)(AttestationWithDalSchema)(val);
2941
+ encoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encoders)(SeedNonceRevelationSchema)(val);
2942
+ encoders[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encoders)(ProposalsSchema)(val);
2943
+ encoders[CODEC.OP_REVEAL] = (val) => schemaEncoder(encoders)(RevealSchema)(val);
2944
+ encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encoders)(RegisterGlobalConstantSchema)(val);
2945
+ encoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encoders)(TransferTicketSchema)(val);
2946
+ encoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder(encoders)(IncreasePaidStorageSchema)(val);
2947
+ encoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder(encoders)(UpdateConsensusKeySchema)(val);
2948
+ encoders[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaEncoder(encoders)(DrainDelegateSchema)(val);
2949
+ encoders[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder(encoders)(SmartRollupOriginateSchema)(val);
2950
+ encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(val);
2951
+ encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(val);
2952
+ encoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder(encoders)(DalPublishCommitmentSchema)(val);
2953
+ encoders[CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema);
2954
+ encoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encoders)(SetDepositsLimitSchema)(val);
2955
+ encoders[CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder(encoders)(FailingNoopSchema)(val);
2645
2956
 
2646
2957
  const OperationKindMapping = {
2647
2958
  activate_account: ActivationSchema$1,
@@ -2658,6 +2969,7 @@ const OperationKindMapping = {
2658
2969
  transfer_ticket: TransferTicketSchema$1,
2659
2970
  increase_paid_storage: IncreasePaidStorageSchema$1,
2660
2971
  update_consensus_key: UpdateConsensusKeySchema$1,
2972
+ update_companion_key: UpdateCompanionKeySchema,
2661
2973
  drain_delegate: DrainDelegateSchema$1,
2662
2974
  set_deposits_limit: SetDepositsLimitSchema$1,
2663
2975
  smart_rollup_originate: SmartRollupOriginateSchema$1,
@@ -2717,6 +3029,7 @@ var ProtocolsHash;
2717
3029
  ProtocolsHash["PsParisCZ"] = "PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi";
2718
3030
  ProtocolsHash["PsQuebecn"] = "PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg";
2719
3031
  ProtocolsHash["PsRiotuma"] = "PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7";
3032
+ ProtocolsHash["PtSeouLou"] = "PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh";
2720
3033
  ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";
2721
3034
  })(ProtocolsHash || (ProtocolsHash = {}));
2722
3035
  const protoLevel = {
@@ -2741,6 +3054,7 @@ const protoLevel = {
2741
3054
  PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi: 20,
2742
3055
  PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg: 21,
2743
3056
  PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7: 22,
3057
+ PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh: 23,
2744
3058
  ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 23,
2745
3059
  };
2746
3060
  function ProtoInferiorTo(a, b) {
@@ -2749,32 +3063,32 @@ function ProtoInferiorTo(a, b) {
2749
3063
 
2750
3064
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
2751
3065
  const VERSION = {
2752
- "commitHash": "f0eb755ed1e0de4d1cd86623df4496f76efd0caf",
2753
- "version": "22.0.0-beta.0"
3066
+ "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
3067
+ "version": "23.0.0-beta.0"
2754
3068
  };
2755
3069
 
2756
3070
  /**
2757
3071
  * @packageDocumentation
2758
3072
  * @module @taquito/local-forging
2759
3073
  */
2760
- const PROTOCOL_CURRENT = ProtocolsHash.PsRiotuma;
3074
+ const PROTOCOL_CURRENT = ProtocolsHash.PtSeouLou;
2761
3075
  function getCodec(codec, _proto) {
2762
- // use encodersProto021 & decodersProto021 if it's quebec or prior
2763
- if (_proto === ProtocolsHash.PsQuebecn || ProtoInferiorTo(_proto, ProtocolsHash.PsQuebecn)) {
3076
+ // use encodersProto022 & decodersProto022 if it's rio or prior
3077
+ if (_proto === ProtocolsHash.PsRiotuma || ProtoInferiorTo(_proto, ProtocolsHash.PsRiotuma)) {
2764
3078
  return {
2765
- encoder: encodersProto021[codec],
3079
+ encoder: encoders[codec],
2766
3080
  decoder: (hex) => {
2767
3081
  const consumer = Uint8ArrayConsumer.fromHexString(hex);
2768
- return decodersProto021[codec](consumer);
3082
+ return decoders[codec](consumer);
2769
3083
  },
2770
3084
  };
2771
3085
  }
2772
3086
  else {
2773
3087
  return {
2774
- encoder: encoders[codec],
3088
+ encoder: encoders$1[codec],
2775
3089
  decoder: (hex) => {
2776
3090
  const consumer = Uint8ArrayConsumer.fromHexString(hex);
2777
- return decoders[codec](consumer);
3091
+ return decoders$1[codec](consumer);
2778
3092
  },
2779
3093
  };
2780
3094
  }
@@ -2821,6 +3135,12 @@ class LocalForger {
2821
3135
  else if (content.kind === 'update_consensus_key' && diff[0] === 'proof') {
2822
3136
  continue;
2823
3137
  }
3138
+ else if (content.kind === 'update_companion_key' && diff[0] === 'proof') {
3139
+ continue;
3140
+ }
3141
+ else if (content.kind === 'reveal' && diff[0] === 'proof') {
3142
+ continue;
3143
+ }
2824
3144
  else {
2825
3145
  throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
2826
3146
  }
@@ -2838,5 +3158,5 @@ class LocalForger {
2838
3158
  }
2839
3159
  const localForger = new LocalForger();
2840
3160
 
2841
- export { CODEC$1 as CODEC, LocalForger, ProtocolsHash, Uint8ArrayConsumer, VERSION, decoders, encoders, getCodec, localForger, opMapping$1 as opMapping, opMappingReverse };
3161
+ export { CODEC$1 as CODEC, LocalForger, ProtocolsHash, Uint8ArrayConsumer, VERSION, decoders$1 as decoders, encoders$1 as encoders, getCodec, localForger, opMapping$1 as opMapping, opMappingReverse$1 as opMappingReverse };
2842
3162
  //# sourceMappingURL=taquito-local-forging.es6.js.map