@taquito/local-forging 22.0.0-beta.0 → 23.0.0-RC.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{codec-proto021.js → codec-proto022.js} +71 -23
- package/dist/lib/codec.js +87 -110
- package/dist/lib/{constants-proto021.js → constants-proto022.js} +1 -0
- package/dist/lib/constants.js +3 -0
- package/dist/lib/decoder-proto022.js +63 -0
- package/dist/lib/decoder.js +1 -0
- package/dist/lib/encoder-proto022.js +62 -0
- package/dist/lib/encoder.js +1 -0
- package/dist/lib/michelson/codec-proto022.js +283 -0
- package/dist/lib/protocols.js +2 -0
- package/dist/lib/schema/operation-proto022.js +238 -0
- package/dist/lib/schema/operation.js +11 -1
- package/dist/lib/taquito-local-forging.js +14 -8
- package/dist/lib/validator-proto022.js +56 -0
- package/dist/lib/validator.js +1 -0
- package/dist/lib/version.js +2 -2
- package/dist/taquito-local-forging.es6.js +606 -302
- package/dist/taquito-local-forging.es6.js.map +1 -1
- package/dist/taquito-local-forging.umd.js +604 -300
- package/dist/taquito-local-forging.umd.js.map +1 -1
- package/dist/types/{codec-proto021.d.ts → codec-proto022.d.ts} +3 -1
- package/dist/types/codec.d.ts +3 -3
- package/dist/types/{constants-proto021.d.ts → constants-proto022.d.ts} +1 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/{decoder-proto021.d.ts → decoder-proto022.d.ts} +1 -1
- package/dist/types/{encoder-proto021.d.ts → encoder-proto022.d.ts} +1 -1
- package/dist/types/michelson/codec-proto022.d.ts +49 -0
- package/dist/types/michelson/codec.d.ts +1 -1
- package/dist/types/protocols.d.ts +1 -0
- package/dist/types/schema/{operation-proto021.d.ts → operation-proto022.d.ts} +3 -2
- package/dist/types/schema/operation.d.ts +10 -0
- package/dist/types/taquito-local-forging.d.ts +3 -3
- package/dist/types/validator-proto022.d.ts +13 -0
- package/package.json +5 -5
- package/dist/lib/decoder-proto021.js +0 -62
- package/dist/lib/encoder-proto021.js +0 -61
- package/dist/lib/schema/operation-proto021.js +0 -237
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
CODEC["BURN_LIMIT"] = "burn_limit";
|
|
61
61
|
CODEC["OP_INCREASE_PAID_STORAGE"] = "increase_paid_storage";
|
|
62
62
|
CODEC["OP_UPDATE_CONSENSUS_KEY"] = "update_consensus_key";
|
|
63
|
+
CODEC["OP_UPDATE_COMPANION_KEY"] = "update_companion_key";
|
|
63
64
|
CODEC["SIGNATURE_PROOF"] = "signature_proof";
|
|
64
65
|
CODEC["OP_DRAIN_DELEGATE"] = "drain_delegate";
|
|
65
66
|
CODEC["DEPOSITS_LIMIT"] = "deposits_limit";
|
|
@@ -231,8 +232,9 @@
|
|
|
231
232
|
'9b': 'BYTES',
|
|
232
233
|
'9c': 'NAT',
|
|
233
234
|
'9d': 'Ticket',
|
|
235
|
+
'9e': 'IS_IMPLICIT_ACCOUNT',
|
|
234
236
|
};
|
|
235
|
-
const opMappingReverse = (() => {
|
|
237
|
+
const opMappingReverse$1 = (() => {
|
|
236
238
|
const result = {};
|
|
237
239
|
Object.keys(opMapping$1).forEach((key) => {
|
|
238
240
|
result[opMapping$1[key]] = key;
|
|
@@ -256,6 +258,7 @@
|
|
|
256
258
|
0x70: 'set_deposits_limit',
|
|
257
259
|
0x71: 'increase_paid_storage',
|
|
258
260
|
0x72: 'update_consensus_key',
|
|
261
|
+
0x73: 'update_companion_key',
|
|
259
262
|
0x09: 'drain_delegate',
|
|
260
263
|
0xc8: 'smart_rollup_originate',
|
|
261
264
|
0xc9: 'smart_rollup_add_messages',
|
|
@@ -485,73 +488,73 @@
|
|
|
485
488
|
}
|
|
486
489
|
}
|
|
487
490
|
|
|
488
|
-
const isPrim = (value) => {
|
|
491
|
+
const isPrim$1 = (value) => {
|
|
489
492
|
return 'prim' in value;
|
|
490
493
|
};
|
|
491
|
-
const isBytes = (value) => {
|
|
494
|
+
const isBytes$1 = (value) => {
|
|
492
495
|
return 'bytes' in value && typeof value.bytes === 'string';
|
|
493
496
|
};
|
|
494
|
-
const isString = (value) => {
|
|
497
|
+
const isString$1 = (value) => {
|
|
495
498
|
return 'string' in value && typeof value.string === 'string';
|
|
496
499
|
};
|
|
497
|
-
const isInt = (value) => {
|
|
500
|
+
const isInt$1 = (value) => {
|
|
498
501
|
return 'int' in value && typeof value.int === 'string';
|
|
499
502
|
};
|
|
500
|
-
const scriptEncoder = (script) => {
|
|
501
|
-
const code = valueEncoder(script.code);
|
|
502
|
-
const storage = valueEncoder(script.storage);
|
|
503
|
+
const scriptEncoder$1 = (script) => {
|
|
504
|
+
const code = valueEncoder$1(script.code);
|
|
505
|
+
const storage = valueEncoder$1(script.storage);
|
|
503
506
|
return `${pad(code.length / 2, 8)}${code}${pad(storage.length / 2, 8)}${storage}`;
|
|
504
507
|
};
|
|
505
|
-
const scriptDecoder = (value) => {
|
|
506
|
-
const code = extractRequiredLen(value);
|
|
507
|
-
const storage = extractRequiredLen(value);
|
|
508
|
+
const scriptDecoder$1 = (value) => {
|
|
509
|
+
const code = extractRequiredLen$1(value);
|
|
510
|
+
const storage = extractRequiredLen$1(value);
|
|
508
511
|
return {
|
|
509
|
-
code: valueDecoder(new Uint8ArrayConsumer(code)),
|
|
510
|
-
storage: valueDecoder(new Uint8ArrayConsumer(storage)),
|
|
512
|
+
code: valueDecoder$1(new Uint8ArrayConsumer(code)),
|
|
513
|
+
storage: valueDecoder$1(new Uint8ArrayConsumer(storage)),
|
|
511
514
|
};
|
|
512
515
|
};
|
|
513
|
-
const valueEncoder = (value) => {
|
|
516
|
+
const valueEncoder$1 = (value) => {
|
|
514
517
|
if (Array.isArray(value)) {
|
|
515
|
-
const encoded = value.map((x) => valueEncoder(x)).join('');
|
|
518
|
+
const encoded = value.map((x) => valueEncoder$1(x)).join('');
|
|
516
519
|
const len = encoded.length / 2;
|
|
517
520
|
return `02${pad(len)}${encoded}`;
|
|
518
521
|
}
|
|
519
|
-
else if (isPrim(value)) {
|
|
520
|
-
return primEncoder(value);
|
|
522
|
+
else if (isPrim$1(value)) {
|
|
523
|
+
return primEncoder$1(value);
|
|
521
524
|
}
|
|
522
|
-
else if (isBytes(value)) {
|
|
523
|
-
return bytesEncoder(value);
|
|
525
|
+
else if (isBytes$1(value)) {
|
|
526
|
+
return bytesEncoder$1(value);
|
|
524
527
|
}
|
|
525
|
-
else if (isString(value)) {
|
|
526
|
-
return stringEncoder(value);
|
|
528
|
+
else if (isString$1(value)) {
|
|
529
|
+
return stringEncoder$1(value);
|
|
527
530
|
}
|
|
528
|
-
else if (isInt(value)) {
|
|
529
|
-
return intEncoder(value);
|
|
531
|
+
else if (isInt$1(value)) {
|
|
532
|
+
return intEncoder$1(value);
|
|
530
533
|
}
|
|
531
534
|
throw new UnexpectedMichelsonValueError(JSON.stringify(value));
|
|
532
535
|
};
|
|
533
|
-
const valueDecoder = (value) => {
|
|
536
|
+
const valueDecoder$1 = (value) => {
|
|
534
537
|
const preamble = value.consume(1);
|
|
535
538
|
switch (preamble[0]) {
|
|
536
539
|
case 0x0a:
|
|
537
|
-
return bytesDecoder(value);
|
|
540
|
+
return bytesDecoder$1(value);
|
|
538
541
|
case 0x01:
|
|
539
|
-
return stringDecoder(value);
|
|
542
|
+
return stringDecoder$1(value);
|
|
540
543
|
case 0x00:
|
|
541
|
-
return intDecoder(value);
|
|
544
|
+
return intDecoder$1(value);
|
|
542
545
|
case 0x02: {
|
|
543
|
-
const val = new Uint8ArrayConsumer(extractRequiredLen(value));
|
|
546
|
+
const val = new Uint8ArrayConsumer(extractRequiredLen$1(value));
|
|
544
547
|
const results = [];
|
|
545
548
|
while (val.length() > 0) {
|
|
546
|
-
results.push(valueDecoder(val));
|
|
549
|
+
results.push(valueDecoder$1(val));
|
|
547
550
|
}
|
|
548
551
|
return results;
|
|
549
552
|
}
|
|
550
553
|
default:
|
|
551
|
-
return primDecoder(value, preamble);
|
|
554
|
+
return primDecoder$1(value, preamble);
|
|
552
555
|
}
|
|
553
556
|
};
|
|
554
|
-
const extractRequiredLen = (value, bytesLength = 4) => {
|
|
557
|
+
const extractRequiredLen$1 = (value, bytesLength = 4) => {
|
|
555
558
|
const len = value.consume(bytesLength);
|
|
556
559
|
const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
557
560
|
return value.consume(valueLen);
|
|
@@ -562,7 +565,7 @@
|
|
|
562
565
|
* @param bytesLength default 4 bytes for length of variable bytes
|
|
563
566
|
* @returns array of Uint8Array values for each array item
|
|
564
567
|
*/
|
|
565
|
-
const stripLengthPrefixFromBytes = (value, bytesLength = 4) => {
|
|
568
|
+
const stripLengthPrefixFromBytes$1 = (value, bytesLength = 4) => {
|
|
566
569
|
const ret = [];
|
|
567
570
|
let values = value;
|
|
568
571
|
while (values.length()) {
|
|
@@ -573,31 +576,31 @@
|
|
|
573
576
|
}
|
|
574
577
|
return ret;
|
|
575
578
|
};
|
|
576
|
-
const bytesEncoder = (value) => {
|
|
579
|
+
const bytesEncoder$1 = (value) => {
|
|
577
580
|
if (!/^([A-Fa-f0-9]{2})*$/.test(value.bytes)) {
|
|
578
581
|
throw new core.InvalidHexStringError(value.bytes);
|
|
579
582
|
}
|
|
580
583
|
const len = value.bytes.length / 2;
|
|
581
584
|
return `0a${pad(len)}${value.bytes}`;
|
|
582
585
|
};
|
|
583
|
-
const bytesDecoder = (value) => {
|
|
584
|
-
const bytes = extractRequiredLen(value);
|
|
586
|
+
const bytesDecoder$1 = (value) => {
|
|
587
|
+
const bytes = extractRequiredLen$1(value);
|
|
585
588
|
return {
|
|
586
589
|
bytes: Buffer.from(bytes).toString('hex'),
|
|
587
590
|
};
|
|
588
591
|
};
|
|
589
|
-
const stringEncoder = (value) => {
|
|
592
|
+
const stringEncoder$1 = (value) => {
|
|
590
593
|
const str = Buffer.from(value.string, 'utf8').toString('hex');
|
|
591
594
|
const hexLength = str.length / 2;
|
|
592
595
|
return `01${pad(hexLength)}${str}`;
|
|
593
596
|
};
|
|
594
|
-
const stringDecoder = (value) => {
|
|
595
|
-
const str = extractRequiredLen(value);
|
|
597
|
+
const stringDecoder$1 = (value) => {
|
|
598
|
+
const str = extractRequiredLen$1(value);
|
|
596
599
|
return {
|
|
597
600
|
string: Buffer.from(str).toString('utf8'),
|
|
598
601
|
};
|
|
599
602
|
};
|
|
600
|
-
const intEncoder = ({ int }) => {
|
|
603
|
+
const intEncoder$1 = ({ int }) => {
|
|
601
604
|
const num = new BigNumber.BigNumber(int, 10);
|
|
602
605
|
const positiveMark = num.toString(2)[0] === '-' ? '1' : '0';
|
|
603
606
|
const binary = num.toString(2).replace(/-/g, '');
|
|
@@ -617,7 +620,7 @@
|
|
|
617
620
|
.padStart(2, '0'));
|
|
618
621
|
return `00${numHex.join('')}`;
|
|
619
622
|
};
|
|
620
|
-
const intDecoder = (value) => {
|
|
623
|
+
const intDecoder$1 = (value) => {
|
|
621
624
|
let c = value.consume(1)[0];
|
|
622
625
|
const hexNumber = [];
|
|
623
626
|
const isNotLastChunkMask = 1 << 7;
|
|
@@ -642,14 +645,14 @@
|
|
|
642
645
|
int: num.toFixed(),
|
|
643
646
|
};
|
|
644
647
|
};
|
|
645
|
-
const primEncoder = (value) => {
|
|
648
|
+
const primEncoder$1 = (value) => {
|
|
646
649
|
const hasAnnot = +Array.isArray(value.annots);
|
|
647
650
|
const argsCount = Array.isArray(value.args) ? value.args.length : 0;
|
|
648
651
|
// Specify the number of args max is 3 without annotation
|
|
649
652
|
const preamble = pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2);
|
|
650
|
-
const op = opMappingReverse[value.prim];
|
|
651
|
-
let encodedArgs = (value.args || []).map((arg) => valueEncoder(arg)).join('');
|
|
652
|
-
const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';
|
|
653
|
+
const op = opMappingReverse$1[value.prim];
|
|
654
|
+
let encodedArgs = (value.args || []).map((arg) => valueEncoder$1(arg)).join('');
|
|
655
|
+
const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots$1(value.annots) : '';
|
|
653
656
|
if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) {
|
|
654
657
|
encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
|
|
655
658
|
}
|
|
@@ -664,7 +667,7 @@
|
|
|
664
667
|
}
|
|
665
668
|
return `${preamble}${op}${encodedArgs}${encodedAnnots}`;
|
|
666
669
|
};
|
|
667
|
-
const primDecoder = (value, preamble) => {
|
|
670
|
+
const primDecoder$1 = (value, preamble) => {
|
|
668
671
|
const hasAnnot = (preamble[0] - 0x03) % 2 === 1;
|
|
669
672
|
let argsCount = Math.floor((preamble[0] - 0x03) / 2);
|
|
670
673
|
const op = value.consume(1)[0].toString(16).padStart(2, '0');
|
|
@@ -676,7 +679,7 @@
|
|
|
676
679
|
}
|
|
677
680
|
if (opMapping$1[op] === 'view') {
|
|
678
681
|
if (argsCount != 0) {
|
|
679
|
-
return primViewDecoder(value, result);
|
|
682
|
+
return primViewDecoder$1(value, result);
|
|
680
683
|
}
|
|
681
684
|
else {
|
|
682
685
|
return result;
|
|
@@ -685,11 +688,11 @@
|
|
|
685
688
|
let combPairArgs;
|
|
686
689
|
let combPairAnnots;
|
|
687
690
|
if ((opMapping$1[op] === 'pair' || opMapping$1[op] === 'Pair') && argsCount > 2) {
|
|
688
|
-
combPairArgs = decodeCombPair(value);
|
|
691
|
+
combPairArgs = decodeCombPair$1(value);
|
|
689
692
|
argsCount = 0;
|
|
690
|
-
combPairAnnots = decodeAnnots(value);
|
|
693
|
+
combPairAnnots = decodeAnnots$1(value);
|
|
691
694
|
}
|
|
692
|
-
const args = new Array(argsCount).fill(0).map(() => valueDecoder(value));
|
|
695
|
+
const args = new Array(argsCount).fill(0).map(() => valueDecoder$1(value));
|
|
693
696
|
if (opMapping$1[op] === 'LAMBDA' || opMapping$1[op] === 'LAMBDA_REC') {
|
|
694
697
|
value.consume(4);
|
|
695
698
|
}
|
|
@@ -703,25 +706,25 @@
|
|
|
703
706
|
result['annots'] = combPairAnnots;
|
|
704
707
|
}
|
|
705
708
|
else if (hasAnnot) {
|
|
706
|
-
result['annots'] = decodeAnnots(value);
|
|
709
|
+
result['annots'] = decodeAnnots$1(value);
|
|
707
710
|
}
|
|
708
711
|
return result;
|
|
709
712
|
};
|
|
710
|
-
const primViewDecoder = (value, result) => {
|
|
713
|
+
const primViewDecoder$1 = (value, result) => {
|
|
711
714
|
value.consume(4);
|
|
712
|
-
result['args'] = new Array(4).fill(0).map(() => valueDecoder(value));
|
|
715
|
+
result['args'] = new Array(4).fill(0).map(() => valueDecoder$1(value));
|
|
713
716
|
value.consume(4);
|
|
714
717
|
return result;
|
|
715
718
|
};
|
|
716
|
-
const decodeCombPair = (val) => {
|
|
717
|
-
const array = new Uint8ArrayConsumer(extractRequiredLen(val));
|
|
719
|
+
const decodeCombPair$1 = (val) => {
|
|
720
|
+
const array = new Uint8ArrayConsumer(extractRequiredLen$1(val));
|
|
718
721
|
const args = [];
|
|
719
722
|
while (array.length() > 0) {
|
|
720
|
-
args.push(valueDecoder(array));
|
|
723
|
+
args.push(valueDecoder$1(array));
|
|
721
724
|
}
|
|
722
725
|
return args;
|
|
723
726
|
};
|
|
724
|
-
const encodeAnnots = (value) => {
|
|
727
|
+
const encodeAnnots$1 = (value) => {
|
|
725
728
|
const mergedAnnot = value
|
|
726
729
|
.map((x) => {
|
|
727
730
|
return Buffer.from(x, 'utf8').toString('hex');
|
|
@@ -730,7 +733,7 @@
|
|
|
730
733
|
const len = mergedAnnot.length / 2;
|
|
731
734
|
return `${pad(len)}${mergedAnnot}`;
|
|
732
735
|
};
|
|
733
|
-
const decodeAnnots = (val) => {
|
|
736
|
+
const decodeAnnots$1 = (val) => {
|
|
734
737
|
const len = val.consume(4);
|
|
735
738
|
const annotLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
736
739
|
const restOfAnnot = val.consume(annotLen);
|
|
@@ -740,27 +743,28 @@
|
|
|
740
743
|
|
|
741
744
|
// https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
|
|
742
745
|
const prefixEncoder$1 = (prefix) => (str) => {
|
|
743
|
-
|
|
746
|
+
const [pl] = utils.b58DecodeAndCheckPrefix(str, [prefix]);
|
|
747
|
+
return utils.buf2hex(pl);
|
|
744
748
|
};
|
|
745
749
|
const prefixDecoder$1 = (pre) => (str) => {
|
|
746
|
-
const val = str.consume(utils.
|
|
747
|
-
return utils.
|
|
750
|
+
const val = str.consume(utils.payloadLength[pre]);
|
|
751
|
+
return utils.b58Encode(val, pre);
|
|
748
752
|
};
|
|
749
|
-
const tz1Decoder$1 = prefixDecoder$1(utils.
|
|
750
|
-
const branchDecoder$1 = prefixDecoder$1(utils.
|
|
753
|
+
const tz1Decoder$1 = prefixDecoder$1(utils.PrefixV2.Ed25519PublicKeyHash);
|
|
754
|
+
const branchDecoder$1 = prefixDecoder$1(utils.PrefixV2.BlockHash);
|
|
751
755
|
const publicKeyHashDecoder$1 = (val) => {
|
|
752
756
|
const prefix = val.consume(1);
|
|
753
757
|
if (prefix[0] === 0x00) {
|
|
754
|
-
return prefixDecoder$1(utils.
|
|
758
|
+
return prefixDecoder$1(utils.PrefixV2.Ed25519PublicKeyHash)(val);
|
|
755
759
|
}
|
|
756
760
|
else if (prefix[0] === 0x01) {
|
|
757
|
-
return prefixDecoder$1(utils.
|
|
761
|
+
return prefixDecoder$1(utils.PrefixV2.Secp256k1PublicKeyHash)(val);
|
|
758
762
|
}
|
|
759
763
|
else if (prefix[0] === 0x02) {
|
|
760
|
-
return prefixDecoder$1(utils.
|
|
764
|
+
return prefixDecoder$1(utils.PrefixV2.P256PublicKeyHash)(val);
|
|
761
765
|
}
|
|
762
766
|
else if (prefix[0] === 0x03) {
|
|
763
|
-
return prefixDecoder$1(utils.
|
|
767
|
+
return prefixDecoder$1(utils.PrefixV2.BLS12_381PublicKeyHash)(val);
|
|
764
768
|
}
|
|
765
769
|
};
|
|
766
770
|
const publicKeyHashesDecoder$1 = (val) => {
|
|
@@ -774,14 +778,14 @@
|
|
|
774
778
|
}
|
|
775
779
|
return publicKeyHashes;
|
|
776
780
|
};
|
|
777
|
-
const branchEncoder$1 = prefixEncoder$1(utils.
|
|
778
|
-
const tz1Encoder$1 = prefixEncoder$1(utils.
|
|
781
|
+
const branchEncoder$1 = prefixEncoder$1(utils.PrefixV2.BlockHash);
|
|
782
|
+
const tz1Encoder$1 = prefixEncoder$1(utils.PrefixV2.Ed25519PublicKeyHash);
|
|
779
783
|
const boolEncoder$1 = (bool) => (bool ? 'ff' : '00');
|
|
780
784
|
const proposalEncoder$1 = (proposal) => {
|
|
781
|
-
return prefixEncoder$1(utils.
|
|
785
|
+
return prefixEncoder$1(utils.PrefixV2.ProtocolHash)(proposal);
|
|
782
786
|
};
|
|
783
787
|
const proposalDecoder$1 = (proposal) => {
|
|
784
|
-
return prefixDecoder$1(utils.
|
|
788
|
+
return prefixDecoder$1(utils.PrefixV2.ProtocolHash)(proposal);
|
|
785
789
|
};
|
|
786
790
|
const proposalsDecoder$1 = (proposal) => {
|
|
787
791
|
const proposals = [];
|
|
@@ -897,19 +901,11 @@
|
|
|
897
901
|
}
|
|
898
902
|
};
|
|
899
903
|
const publicKeyHashEncoder$1 = (val) => {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
return '01' + prefixEncoder$1(utils.Prefix.TZ2)(val);
|
|
906
|
-
case utils.Prefix.TZ3:
|
|
907
|
-
return '02' + prefixEncoder$1(utils.Prefix.TZ3)(val);
|
|
908
|
-
case utils.Prefix.TZ4:
|
|
909
|
-
return '03' + prefixEncoder$1(utils.Prefix.TZ4)(val);
|
|
910
|
-
default:
|
|
911
|
-
throw new utils.InvalidKeyHashError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
912
|
-
` expecting one for the following "${utils.Prefix.TZ1}", "${utils.Prefix.TZ2}", "${utils.Prefix.TZ3}" or "${utils.Prefix.TZ4}".`);
|
|
904
|
+
try {
|
|
905
|
+
return utils.b58DecodePublicKeyHash(val);
|
|
906
|
+
}
|
|
907
|
+
catch (err) {
|
|
908
|
+
throw new core.InvalidKeyHashError(val, err instanceof core.ParameterValidationError ? err.result : undefined);
|
|
913
909
|
}
|
|
914
910
|
};
|
|
915
911
|
const publicKeyHashesEncoder$1 = (val) => {
|
|
@@ -925,70 +921,57 @@
|
|
|
925
921
|
return boolEncoder$1(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes;
|
|
926
922
|
};
|
|
927
923
|
const publicKeyEncoder$1 = (val) => {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
return '01' + prefixEncoder$1(utils.Prefix.SPPK)(val);
|
|
934
|
-
case utils.Prefix.P2PK:
|
|
935
|
-
return '02' + prefixEncoder$1(utils.Prefix.P2PK)(val);
|
|
936
|
-
case utils.Prefix.BLPK:
|
|
937
|
-
return '03' + prefixEncoder$1(utils.Prefix.BLPK)(val);
|
|
938
|
-
default:
|
|
939
|
-
throw new utils.InvalidPublicKeyError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
940
|
-
` expecting one of the following '${utils.Prefix.EDPK}', '${utils.Prefix.SPPK}', '${utils.Prefix.P2PK}' or '${utils.Prefix.BLPK}'.`);
|
|
924
|
+
try {
|
|
925
|
+
return utils.b58DecodePublicKey(val);
|
|
926
|
+
}
|
|
927
|
+
catch (err) {
|
|
928
|
+
throw new utils.InvalidPublicKeyError(val, err instanceof core.ParameterValidationError ? err.result : undefined);
|
|
941
929
|
}
|
|
942
930
|
};
|
|
943
931
|
const addressEncoder$1 = (val) => {
|
|
944
|
-
|
|
945
|
-
switch (pubkeyPrefix) {
|
|
946
|
-
case utils.Prefix.TZ1:
|
|
947
|
-
case utils.Prefix.TZ2:
|
|
948
|
-
case utils.Prefix.TZ3:
|
|
949
|
-
case utils.Prefix.TZ4:
|
|
950
|
-
return '00' + publicKeyHashEncoder$1(val);
|
|
951
|
-
case utils.Prefix.KT1:
|
|
952
|
-
return '01' + prefixEncoder$1(utils.Prefix.KT1)(val) + '00';
|
|
953
|
-
default:
|
|
954
|
-
throw new core.InvalidAddressError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
955
|
-
` expecting one of the following prefix '${utils.Prefix.TZ1}', ${utils.Prefix.TZ2}', '${utils.Prefix.TZ3}', '${utils.Prefix.TZ4}' or '${utils.Prefix.KT1}'.`);
|
|
956
|
-
}
|
|
932
|
+
return utils.b58DecodeAddress(val);
|
|
957
933
|
};
|
|
958
934
|
const smartRollupAddressEncoder$1 = (val) => {
|
|
959
|
-
|
|
960
|
-
|
|
935
|
+
try {
|
|
936
|
+
return prefixEncoder$1(utils.PrefixV2.SmartRollupHash)(val);
|
|
961
937
|
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
938
|
+
catch (err) {
|
|
939
|
+
if (err instanceof core.ParameterValidationError) {
|
|
940
|
+
throw new InvalidSmartRollupAddressError(val);
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
throw err;
|
|
944
|
+
}
|
|
968
945
|
}
|
|
969
|
-
throw new core.InvalidContractAddressError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.KT1}'.`);
|
|
970
946
|
};
|
|
947
|
+
const smartContractAddressEncoder$1 = (val) => utils.b58DecodeAddress(val);
|
|
971
948
|
const publicKeyDecoder$1 = (val) => {
|
|
972
949
|
const preamble = val.consume(1);
|
|
973
950
|
switch (preamble[0]) {
|
|
974
951
|
case 0x00:
|
|
975
|
-
return prefixDecoder$1(utils.
|
|
952
|
+
return prefixDecoder$1(utils.PrefixV2.Ed25519PublicKey)(val);
|
|
976
953
|
case 0x01:
|
|
977
|
-
return prefixDecoder$1(utils.
|
|
954
|
+
return prefixDecoder$1(utils.PrefixV2.Secp256k1PublicKey)(val);
|
|
978
955
|
case 0x02:
|
|
979
|
-
return prefixDecoder$1(utils.
|
|
956
|
+
return prefixDecoder$1(utils.PrefixV2.P256PublicKey)(val);
|
|
980
957
|
case 0x03:
|
|
981
|
-
return prefixDecoder$1(utils.
|
|
958
|
+
return prefixDecoder$1(utils.PrefixV2.BLS12_381PublicKey)(val);
|
|
982
959
|
default:
|
|
983
|
-
throw new utils.InvalidPublicKeyError(
|
|
960
|
+
throw new utils.InvalidPublicKeyError(undefined, utils.ValidationResult.NO_PREFIX_MATCHED);
|
|
984
961
|
}
|
|
985
962
|
};
|
|
986
963
|
const smartRollupCommitmentHashEncoder$1 = (val) => {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
964
|
+
try {
|
|
965
|
+
return prefixEncoder$1(utils.PrefixV2.SmartRollupCommitmentHash)(val);
|
|
966
|
+
}
|
|
967
|
+
catch (err) {
|
|
968
|
+
if (err instanceof core.ParameterValidationError) {
|
|
969
|
+
throw new InvalidSmartRollupCommitmentHashError(val);
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
throw err;
|
|
973
|
+
}
|
|
990
974
|
}
|
|
991
|
-
throw new InvalidSmartRollupCommitmentHashError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SRC1}'`);
|
|
992
975
|
};
|
|
993
976
|
const addressDecoder$1 = (val) => {
|
|
994
977
|
const preamble = val.consume(1);
|
|
@@ -996,7 +979,7 @@
|
|
|
996
979
|
case 0x00:
|
|
997
980
|
return publicKeyHashDecoder$1(val);
|
|
998
981
|
case 0x01: {
|
|
999
|
-
const address = prefixDecoder$1(utils.
|
|
982
|
+
const address = prefixDecoder$1(utils.PrefixV2.ContractHash)(val);
|
|
1000
983
|
val.consume(1);
|
|
1001
984
|
return address;
|
|
1002
985
|
}
|
|
@@ -1005,27 +988,19 @@
|
|
|
1005
988
|
}
|
|
1006
989
|
};
|
|
1007
990
|
const smartRollupAddressDecoder$1 = (val) => {
|
|
1008
|
-
|
|
1009
|
-
if (address.substring(0, 3) !== utils.Prefix.SR1) {
|
|
1010
|
-
throw new InvalidSmartRollupAddressError(address, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SR1}'.`);
|
|
1011
|
-
}
|
|
1012
|
-
return address;
|
|
991
|
+
return prefixDecoder$1(utils.PrefixV2.SmartRollupHash)(val);
|
|
1013
992
|
};
|
|
1014
993
|
const smartContractAddressDecoder$1 = (val) => {
|
|
1015
994
|
const preamble = val.consume(1);
|
|
1016
995
|
if (preamble[0] === 0x01) {
|
|
1017
|
-
const scAddress = prefixDecoder$1(utils.
|
|
996
|
+
const scAddress = prefixDecoder$1(utils.PrefixV2.ContractHash)(val);
|
|
1018
997
|
val.consume(1);
|
|
1019
998
|
return scAddress;
|
|
1020
999
|
}
|
|
1021
|
-
throw new core.InvalidContractAddressError(val.toString(), utils.
|
|
1000
|
+
throw new core.InvalidContractAddressError(val.toString(), utils.ValidationResult.NO_PREFIX_MATCHED);
|
|
1022
1001
|
};
|
|
1023
1002
|
const smartRollupCommitmentHashDecoder$1 = (val) => {
|
|
1024
|
-
|
|
1025
|
-
if (address.substring(0, 4) !== utils.Prefix.SRC1) {
|
|
1026
|
-
throw new InvalidSmartRollupCommitmentHashError(address, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SRC1}'`);
|
|
1027
|
-
}
|
|
1028
|
-
return address;
|
|
1003
|
+
return prefixDecoder$1(utils.PrefixV2.SmartRollupCommitmentHash)(val);
|
|
1029
1004
|
};
|
|
1030
1005
|
const zarithEncoder$1 = (n) => {
|
|
1031
1006
|
const fn = [];
|
|
@@ -1071,7 +1046,7 @@
|
|
|
1071
1046
|
return entrypointMapping$1[preamble];
|
|
1072
1047
|
}
|
|
1073
1048
|
else {
|
|
1074
|
-
const entry = extractRequiredLen(value, 1);
|
|
1049
|
+
const entry = extractRequiredLen$1(value, 1);
|
|
1075
1050
|
const entrypoint = Buffer.from(entry).toString('utf8');
|
|
1076
1051
|
if (entrypoint.length > ENTRYPOINT_MAX_LENGTH$1) {
|
|
1077
1052
|
throw new OversizedEntryPointError(entrypoint);
|
|
@@ -1086,8 +1061,8 @@
|
|
|
1086
1061
|
}
|
|
1087
1062
|
else {
|
|
1088
1063
|
const encodedEntrypoint = entrypointDecoder$1(val);
|
|
1089
|
-
const params = extractRequiredLen(val);
|
|
1090
|
-
const parameters = valueDecoder(new Uint8ArrayConsumer(params));
|
|
1064
|
+
const params = extractRequiredLen$1(val);
|
|
1065
|
+
const parameters = valueDecoder$1(new Uint8ArrayConsumer(params));
|
|
1091
1066
|
return {
|
|
1092
1067
|
entrypoint: encodedEntrypoint,
|
|
1093
1068
|
value: parameters,
|
|
@@ -1103,7 +1078,7 @@
|
|
|
1103
1078
|
throw new OversizedEntryPointError(entrypoint);
|
|
1104
1079
|
}
|
|
1105
1080
|
const value = { string: entrypoint };
|
|
1106
|
-
return `ff${valueEncoder(value).slice(8)}`;
|
|
1081
|
+
return `ff${valueEncoder$1(value).slice(8)}`;
|
|
1107
1082
|
}
|
|
1108
1083
|
};
|
|
1109
1084
|
const parametersEncoder$1 = (val) => {
|
|
@@ -1111,26 +1086,26 @@
|
|
|
1111
1086
|
return '00';
|
|
1112
1087
|
}
|
|
1113
1088
|
const encodedEntrypoint = entrypointEncoder$1(val.entrypoint);
|
|
1114
|
-
const parameters = valueEncoder(val.value);
|
|
1089
|
+
const parameters = valueEncoder$1(val.value);
|
|
1115
1090
|
const length = pad(parameters.length / 2);
|
|
1116
1091
|
return `ff${encodedEntrypoint}${length}${parameters}`;
|
|
1117
1092
|
};
|
|
1118
1093
|
const valueParameterEncoder$1 = (value) => {
|
|
1119
|
-
const valueEncoded = valueEncoder(value);
|
|
1094
|
+
const valueEncoded = valueEncoder$1(value);
|
|
1120
1095
|
return `${pad(valueEncoded.length / 2)}${valueEncoded}`;
|
|
1121
1096
|
};
|
|
1122
1097
|
const valueParameterDecoder$1 = (val) => {
|
|
1123
|
-
const value = extractRequiredLen(val);
|
|
1124
|
-
return valueDecoder(new Uint8ArrayConsumer(value));
|
|
1098
|
+
const value = extractRequiredLen$1(val);
|
|
1099
|
+
return valueDecoder$1(new Uint8ArrayConsumer(value));
|
|
1125
1100
|
};
|
|
1126
|
-
const blockPayloadHashEncoder$1 = prefixEncoder$1(utils.
|
|
1127
|
-
const blockPayloadHashDecoder$1 = prefixDecoder$1(utils.
|
|
1101
|
+
const blockPayloadHashEncoder$1 = prefixEncoder$1(utils.PrefixV2.ValueHash);
|
|
1102
|
+
const blockPayloadHashDecoder$1 = prefixDecoder$1(utils.PrefixV2.ValueHash);
|
|
1128
1103
|
const entrypointNameEncoder$1 = (entrypoint) => {
|
|
1129
1104
|
const value = { string: entrypoint };
|
|
1130
|
-
return `${valueEncoder(value).slice(2)}`;
|
|
1105
|
+
return `${valueEncoder$1(value).slice(2)}`;
|
|
1131
1106
|
};
|
|
1132
1107
|
const entrypointNameDecoder$1 = (val) => {
|
|
1133
|
-
const entry = extractRequiredLen(val);
|
|
1108
|
+
const entry = extractRequiredLen$1(val);
|
|
1134
1109
|
return Buffer.from(entry).toString('utf8');
|
|
1135
1110
|
};
|
|
1136
1111
|
const burnLimitEncoder$1 = (val) => {
|
|
@@ -1151,50 +1126,53 @@
|
|
|
1151
1126
|
return zarithDecoder$1(value);
|
|
1152
1127
|
}
|
|
1153
1128
|
};
|
|
1154
|
-
const signatureV1Encoder = (val) => {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
return paddedBytesEncoder$1(
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
throw new core.InvalidSignatureError(val,
|
|
1167
|
-
|
|
1129
|
+
const signatureV1Encoder$1 = (val) => {
|
|
1130
|
+
try {
|
|
1131
|
+
const [data, pre] = utils.b58DecodeAndCheckPrefix(val, utils.signaturePrefixes);
|
|
1132
|
+
if (pre === utils.PrefixV2.BLS12_381Signature) {
|
|
1133
|
+
return paddedBytesEncoder$1(utils.buf2hex(data));
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
throw new core.ProhibitedActionError('we only support encoding of BLSIG signatures from protocol Seoul');
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
catch (err) {
|
|
1140
|
+
if (err instanceof core.ParameterValidationError) {
|
|
1141
|
+
throw new core.InvalidSignatureError(val, err.result);
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
throw err;
|
|
1145
|
+
}
|
|
1168
1146
|
}
|
|
1169
1147
|
};
|
|
1170
|
-
const signatureV1Decoder = (val) => {
|
|
1148
|
+
const signatureV1Decoder$1 = (val) => {
|
|
1171
1149
|
val.consume(4);
|
|
1172
1150
|
if (val.length().toString() === '96') {
|
|
1173
|
-
return prefixDecoder$1(utils.
|
|
1151
|
+
return prefixDecoder$1(utils.PrefixV2.BLS12_381Signature)(val);
|
|
1174
1152
|
}
|
|
1175
1153
|
else {
|
|
1176
|
-
throw new core.ProhibitedActionError('
|
|
1154
|
+
throw new core.ProhibitedActionError('we only support decoding of BLSIG signatures');
|
|
1177
1155
|
}
|
|
1178
1156
|
};
|
|
1179
|
-
const signatureProofEncoder = (val) => {
|
|
1157
|
+
const signatureProofEncoder$1 = (val) => {
|
|
1180
1158
|
if (val) {
|
|
1181
|
-
return boolEncoder$1(true) + signatureV1Encoder(val);
|
|
1159
|
+
return boolEncoder$1(true) + signatureV1Encoder$1(val);
|
|
1182
1160
|
}
|
|
1183
1161
|
else {
|
|
1184
1162
|
return boolEncoder$1(false);
|
|
1185
1163
|
}
|
|
1186
1164
|
};
|
|
1187
|
-
const signatureProofDecoder = (value) => {
|
|
1165
|
+
const signatureProofDecoder$1 = (value) => {
|
|
1188
1166
|
const hasProof = boolDecoder$1(value);
|
|
1189
1167
|
if (hasProof) {
|
|
1190
|
-
return signatureV1Decoder(value);
|
|
1168
|
+
return signatureV1Decoder$1(value);
|
|
1191
1169
|
}
|
|
1192
1170
|
};
|
|
1193
1171
|
const paddedBytesEncoder$1 = (val, paddingLength = 8) => {
|
|
1194
1172
|
return `${pad(val.length / 2, paddingLength)}${val}`;
|
|
1195
1173
|
};
|
|
1196
1174
|
const paddedBytesDecoder$1 = (val) => {
|
|
1197
|
-
const value = extractRequiredLen(val);
|
|
1175
|
+
const value = extractRequiredLen$1(val);
|
|
1198
1176
|
return Buffer.from(value).toString('hex');
|
|
1199
1177
|
};
|
|
1200
1178
|
const smartRollupMessageEncoder$1 = (val) => {
|
|
@@ -1204,23 +1182,25 @@
|
|
|
1204
1182
|
return `${pad(message.length / 2)}${message}`;
|
|
1205
1183
|
};
|
|
1206
1184
|
const smartRollupMessageDecoder$1 = (val) => {
|
|
1207
|
-
const valueArray = extractRequiredLen(val);
|
|
1208
|
-
const ret = stripLengthPrefixFromBytes(new Uint8ArrayConsumer(valueArray));
|
|
1185
|
+
const valueArray = extractRequiredLen$1(val);
|
|
1186
|
+
const ret = stripLengthPrefixFromBytes$1(new Uint8ArrayConsumer(valueArray));
|
|
1209
1187
|
return ret.map((value) => Buffer.from(value).toString('hex'));
|
|
1210
1188
|
};
|
|
1211
1189
|
const dalCommitmentEncoder$1 = (val) => {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1190
|
+
try {
|
|
1191
|
+
return prefixEncoder$1(utils.PrefixV2.SlotHeader)(val);
|
|
1192
|
+
}
|
|
1193
|
+
catch (err) {
|
|
1194
|
+
if (err instanceof core.ParameterValidationError) {
|
|
1195
|
+
throw new InvalidDalCommitmentError(val);
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
throw err;
|
|
1199
|
+
}
|
|
1215
1200
|
}
|
|
1216
|
-
throw new InvalidDalCommitmentError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SH}'`);
|
|
1217
1201
|
};
|
|
1218
1202
|
const dalCommitmentDecoder$1 = (val) => {
|
|
1219
|
-
|
|
1220
|
-
if (commitment.substring(0, 2) !== utils.Prefix.SH) {
|
|
1221
|
-
throw new InvalidDalCommitmentError(commitment, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SH}'`);
|
|
1222
|
-
}
|
|
1223
|
-
return commitment;
|
|
1203
|
+
return prefixDecoder$1(utils.PrefixV2.SlotHeader)(val);
|
|
1224
1204
|
};
|
|
1225
1205
|
const slotHeaderEncoder$1 = (val) => {
|
|
1226
1206
|
return pad(val.slot_index, 2) + dalCommitmentEncoder$1(val.commitment) + val.commitment_proof;
|
|
@@ -1249,6 +1229,7 @@
|
|
|
1249
1229
|
gas_limit: exports.CODEC.ZARITH,
|
|
1250
1230
|
storage_limit: exports.CODEC.ZARITH,
|
|
1251
1231
|
public_key: exports.CODEC.PUBLIC_KEY,
|
|
1232
|
+
proof: exports.CODEC.SIGNATURE_PROOF,
|
|
1252
1233
|
};
|
|
1253
1234
|
const DelegationSchema$1 = {
|
|
1254
1235
|
source: exports.CODEC.PKH,
|
|
@@ -1345,6 +1326,15 @@
|
|
|
1345
1326
|
pk: exports.CODEC.PUBLIC_KEY,
|
|
1346
1327
|
proof: exports.CODEC.SIGNATURE_PROOF,
|
|
1347
1328
|
};
|
|
1329
|
+
const UpdateCompanionKeySchema = {
|
|
1330
|
+
source: exports.CODEC.PKH,
|
|
1331
|
+
fee: exports.CODEC.ZARITH,
|
|
1332
|
+
counter: exports.CODEC.ZARITH,
|
|
1333
|
+
gas_limit: exports.CODEC.ZARITH,
|
|
1334
|
+
storage_limit: exports.CODEC.ZARITH,
|
|
1335
|
+
pk: exports.CODEC.PUBLIC_KEY,
|
|
1336
|
+
proof: exports.CODEC.SIGNATURE_PROOF,
|
|
1337
|
+
};
|
|
1348
1338
|
const DrainDelegateSchema$1 = {
|
|
1349
1339
|
consensus_key: exports.CODEC.PKH,
|
|
1350
1340
|
delegate: exports.CODEC.PKH,
|
|
@@ -1463,7 +1453,7 @@
|
|
|
1463
1453
|
}, {});
|
|
1464
1454
|
};
|
|
1465
1455
|
|
|
1466
|
-
const decoders = {
|
|
1456
|
+
const decoders$1 = {
|
|
1467
1457
|
[exports.CODEC.SECRET]: (val) => toHexString(val.consume(20)),
|
|
1468
1458
|
[exports.CODEC.RAW]: (val) => toHexString(val.consume(32)),
|
|
1469
1459
|
[exports.CODEC.TZ1]: tz1Decoder$1,
|
|
@@ -1474,7 +1464,7 @@
|
|
|
1474
1464
|
[exports.CODEC.PKH_ARR]: publicKeyHashesDecoder$1,
|
|
1475
1465
|
[exports.CODEC.DELEGATE]: delegateDecoder$1,
|
|
1476
1466
|
[exports.CODEC.INT32]: int32Decoder$1,
|
|
1477
|
-
[exports.CODEC.SCRIPT]: scriptDecoder,
|
|
1467
|
+
[exports.CODEC.SCRIPT]: scriptDecoder$1,
|
|
1478
1468
|
[exports.CODEC.BALLOT_STATEMENT]: ballotDecoder$1,
|
|
1479
1469
|
[exports.CODEC.PROPOSAL]: proposalDecoder$1,
|
|
1480
1470
|
[exports.CODEC.PROPOSAL_ARR]: proposalsDecoder$1,
|
|
@@ -1489,35 +1479,36 @@
|
|
|
1489
1479
|
[exports.CODEC.ENTRYPOINT]: entrypointNameDecoder$1,
|
|
1490
1480
|
[exports.CODEC.BURN_LIMIT]: burnLimitDecoder$1,
|
|
1491
1481
|
[exports.CODEC.DEPOSITS_LIMIT]: depositsLimitDecoder$1,
|
|
1492
|
-
[exports.CODEC.SIGNATURE_PROOF]: signatureProofDecoder,
|
|
1482
|
+
[exports.CODEC.SIGNATURE_PROOF]: signatureProofDecoder$1,
|
|
1493
1483
|
[exports.CODEC.PVM_KIND]: pvmKindDecoder$1,
|
|
1494
1484
|
[exports.CODEC.PADDED_BYTES]: paddedBytesDecoder$1,
|
|
1495
1485
|
[exports.CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder$1,
|
|
1496
1486
|
[exports.CODEC.SLOT_HEADER]: slotHeaderDecoder$1,
|
|
1497
1487
|
};
|
|
1498
|
-
decoders[exports.CODEC.OPERATION] = operationDecoder$1(decoders);
|
|
1499
|
-
decoders[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder$1(decoders)(ActivationSchema$1)(val);
|
|
1500
|
-
decoders[exports.CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder$1(decoders)(FailingNoopSchema$1)(val);
|
|
1501
|
-
decoders[exports.CODEC.OP_DELEGATION] = (val) => schemaDecoder$1(decoders)(DelegationSchema$1)(val);
|
|
1502
|
-
decoders[exports.CODEC.OP_TRANSACTION] = (val) => schemaDecoder$1(decoders)(TransactionSchema$1)(val);
|
|
1503
|
-
decoders[exports.CODEC.OP_ORIGINATION] = (val) => schemaDecoder$1(decoders)(OriginationSchema$1)(val);
|
|
1504
|
-
decoders[exports.CODEC.OP_BALLOT] = (val) => schemaDecoder$1(decoders)(BallotSchema$1)(val);
|
|
1505
|
-
decoders[exports.CODEC.OP_ATTESTATION] = (val) => schemaDecoder$1(decoders)(AttestationSchema$1)(val);
|
|
1506
|
-
decoders[exports.CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder$1(decoders)(AttestationWithDalSchema$1)(val);
|
|
1507
|
-
decoders[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder$1(decoders)(SeedNonceRevelationSchema$1)(val);
|
|
1508
|
-
decoders[exports.CODEC.OP_PROPOSALS] = (val) => schemaDecoder$1(decoders)(ProposalsSchema$1)(val);
|
|
1509
|
-
decoders[exports.CODEC.OP_REVEAL] = (val) => schemaDecoder$1(decoders)(RevealSchema$1)(val);
|
|
1510
|
-
decoders[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder$1(decoders)(RegisterGlobalConstantSchema$1)(val);
|
|
1511
|
-
decoders[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder$1(decoders)(TransferTicketSchema$1)(val);
|
|
1512
|
-
decoders[exports.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder$1(decoders)(IncreasePaidStorageSchema$1)(val);
|
|
1513
|
-
decoders[exports.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder$1(decoders)(UpdateConsensusKeySchema$1)(val);
|
|
1514
|
-
decoders[exports.CODEC.
|
|
1515
|
-
decoders[exports.CODEC.
|
|
1516
|
-
decoders[exports.CODEC.
|
|
1517
|
-
decoders[exports.CODEC.
|
|
1518
|
-
decoders[exports.CODEC.
|
|
1519
|
-
decoders[exports.CODEC.
|
|
1520
|
-
decoders[exports.CODEC.
|
|
1488
|
+
decoders$1[exports.CODEC.OPERATION] = operationDecoder$1(decoders$1);
|
|
1489
|
+
decoders$1[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder$1(decoders$1)(ActivationSchema$1)(val);
|
|
1490
|
+
decoders$1[exports.CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder$1(decoders$1)(FailingNoopSchema$1)(val);
|
|
1491
|
+
decoders$1[exports.CODEC.OP_DELEGATION] = (val) => schemaDecoder$1(decoders$1)(DelegationSchema$1)(val);
|
|
1492
|
+
decoders$1[exports.CODEC.OP_TRANSACTION] = (val) => schemaDecoder$1(decoders$1)(TransactionSchema$1)(val);
|
|
1493
|
+
decoders$1[exports.CODEC.OP_ORIGINATION] = (val) => schemaDecoder$1(decoders$1)(OriginationSchema$1)(val);
|
|
1494
|
+
decoders$1[exports.CODEC.OP_BALLOT] = (val) => schemaDecoder$1(decoders$1)(BallotSchema$1)(val);
|
|
1495
|
+
decoders$1[exports.CODEC.OP_ATTESTATION] = (val) => schemaDecoder$1(decoders$1)(AttestationSchema$1)(val);
|
|
1496
|
+
decoders$1[exports.CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder$1(decoders$1)(AttestationWithDalSchema$1)(val);
|
|
1497
|
+
decoders$1[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder$1(decoders$1)(SeedNonceRevelationSchema$1)(val);
|
|
1498
|
+
decoders$1[exports.CODEC.OP_PROPOSALS] = (val) => schemaDecoder$1(decoders$1)(ProposalsSchema$1)(val);
|
|
1499
|
+
decoders$1[exports.CODEC.OP_REVEAL] = (val) => schemaDecoder$1(decoders$1)(RevealSchema$1)(val);
|
|
1500
|
+
decoders$1[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder$1(decoders$1)(RegisterGlobalConstantSchema$1)(val);
|
|
1501
|
+
decoders$1[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder$1(decoders$1)(TransferTicketSchema$1)(val);
|
|
1502
|
+
decoders$1[exports.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder$1(decoders$1)(IncreasePaidStorageSchema$1)(val);
|
|
1503
|
+
decoders$1[exports.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder$1(decoders$1)(UpdateConsensusKeySchema$1)(val);
|
|
1504
|
+
decoders$1[exports.CODEC.OP_UPDATE_COMPANION_KEY] = (val) => schemaDecoder$1(decoders$1)(UpdateCompanionKeySchema)(val);
|
|
1505
|
+
decoders$1[exports.CODEC.OP_DRAIN_DELEGATE] = (val) => schemaDecoder$1(decoders$1)(DrainDelegateSchema$1)(val);
|
|
1506
|
+
decoders$1[exports.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder$1(decoders$1)(SmartRollupOriginateSchema$1)(val);
|
|
1507
|
+
decoders$1[exports.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder$1(decoders$1)(SmartRollupAddMessagesSchema$1)(val);
|
|
1508
|
+
decoders$1[exports.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder$1(decoders$1)(SmartRollupExecuteOutboxMessageSchema$1)(val);
|
|
1509
|
+
decoders$1[exports.CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder$1(decoders$1)(DalPublishCommitmentSchema$1)(val);
|
|
1510
|
+
decoders$1[exports.CODEC.MANAGER] = schemaDecoder$1(decoders$1)(ManagerOperationSchema$1);
|
|
1511
|
+
decoders$1[exports.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder$1(decoders$1)(SetDepositsLimitSchema$1)(val);
|
|
1521
1512
|
|
|
1522
1513
|
/*
|
|
1523
1514
|
* Some code in this file is originally from sotez
|
|
@@ -1570,6 +1561,7 @@
|
|
|
1570
1561
|
CODEC["BURN_LIMIT"] = "burn_limit";
|
|
1571
1562
|
CODEC["OP_INCREASE_PAID_STORAGE"] = "increase_paid_storage";
|
|
1572
1563
|
CODEC["OP_UPDATE_CONSENSUS_KEY"] = "update_consensus_key";
|
|
1564
|
+
CODEC["SIGNATURE_PROOF"] = "signature_proof";
|
|
1573
1565
|
CODEC["OP_DRAIN_DELEGATE"] = "drain_delegate";
|
|
1574
1566
|
CODEC["DEPOSITS_LIMIT"] = "deposits_limit";
|
|
1575
1567
|
CODEC["OP_SET_DEPOSITS_LIMIT"] = "set_deposits_limit";
|
|
@@ -1741,7 +1733,7 @@
|
|
|
1741
1733
|
'9c': 'NAT',
|
|
1742
1734
|
'9d': 'Ticket',
|
|
1743
1735
|
};
|
|
1744
|
-
(() => {
|
|
1736
|
+
const opMappingReverse = (() => {
|
|
1745
1737
|
const result = {};
|
|
1746
1738
|
Object.keys(opMapping).forEach((key) => {
|
|
1747
1739
|
result[opMapping[key]] = key;
|
|
@@ -1801,6 +1793,259 @@
|
|
|
1801
1793
|
return result;
|
|
1802
1794
|
})();
|
|
1803
1795
|
|
|
1796
|
+
const isPrim = (value) => {
|
|
1797
|
+
return 'prim' in value;
|
|
1798
|
+
};
|
|
1799
|
+
const isBytes = (value) => {
|
|
1800
|
+
return 'bytes' in value && typeof value.bytes === 'string';
|
|
1801
|
+
};
|
|
1802
|
+
const isString = (value) => {
|
|
1803
|
+
return 'string' in value && typeof value.string === 'string';
|
|
1804
|
+
};
|
|
1805
|
+
const isInt = (value) => {
|
|
1806
|
+
return 'int' in value && typeof value.int === 'string';
|
|
1807
|
+
};
|
|
1808
|
+
const scriptEncoder = (script) => {
|
|
1809
|
+
const code = valueEncoder(script.code);
|
|
1810
|
+
const storage = valueEncoder(script.storage);
|
|
1811
|
+
return `${pad(code.length / 2, 8)}${code}${pad(storage.length / 2, 8)}${storage}`;
|
|
1812
|
+
};
|
|
1813
|
+
const scriptDecoder = (value) => {
|
|
1814
|
+
const code = extractRequiredLen(value);
|
|
1815
|
+
const storage = extractRequiredLen(value);
|
|
1816
|
+
return {
|
|
1817
|
+
code: valueDecoder(new Uint8ArrayConsumer(code)),
|
|
1818
|
+
storage: valueDecoder(new Uint8ArrayConsumer(storage)),
|
|
1819
|
+
};
|
|
1820
|
+
};
|
|
1821
|
+
const valueEncoder = (value) => {
|
|
1822
|
+
if (Array.isArray(value)) {
|
|
1823
|
+
const encoded = value.map((x) => valueEncoder(x)).join('');
|
|
1824
|
+
const len = encoded.length / 2;
|
|
1825
|
+
return `02${pad(len)}${encoded}`;
|
|
1826
|
+
}
|
|
1827
|
+
else if (isPrim(value)) {
|
|
1828
|
+
return primEncoder(value);
|
|
1829
|
+
}
|
|
1830
|
+
else if (isBytes(value)) {
|
|
1831
|
+
return bytesEncoder(value);
|
|
1832
|
+
}
|
|
1833
|
+
else if (isString(value)) {
|
|
1834
|
+
return stringEncoder(value);
|
|
1835
|
+
}
|
|
1836
|
+
else if (isInt(value)) {
|
|
1837
|
+
return intEncoder(value);
|
|
1838
|
+
}
|
|
1839
|
+
throw new UnexpectedMichelsonValueError(JSON.stringify(value));
|
|
1840
|
+
};
|
|
1841
|
+
const valueDecoder = (value) => {
|
|
1842
|
+
const preamble = value.consume(1);
|
|
1843
|
+
switch (preamble[0]) {
|
|
1844
|
+
case 0x0a:
|
|
1845
|
+
return bytesDecoder(value);
|
|
1846
|
+
case 0x01:
|
|
1847
|
+
return stringDecoder(value);
|
|
1848
|
+
case 0x00:
|
|
1849
|
+
return intDecoder(value);
|
|
1850
|
+
case 0x02: {
|
|
1851
|
+
const val = new Uint8ArrayConsumer(extractRequiredLen(value));
|
|
1852
|
+
const results = [];
|
|
1853
|
+
while (val.length() > 0) {
|
|
1854
|
+
results.push(valueDecoder(val));
|
|
1855
|
+
}
|
|
1856
|
+
return results;
|
|
1857
|
+
}
|
|
1858
|
+
default:
|
|
1859
|
+
return primDecoder(value, preamble);
|
|
1860
|
+
}
|
|
1861
|
+
};
|
|
1862
|
+
const extractRequiredLen = (value, bytesLength = 4) => {
|
|
1863
|
+
const len = value.consume(bytesLength);
|
|
1864
|
+
const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
1865
|
+
return value.consume(valueLen);
|
|
1866
|
+
};
|
|
1867
|
+
/**
|
|
1868
|
+
* @description parse bytes into multiple items of an array
|
|
1869
|
+
* @param value Uint8ArrayConsumer class of forged segment to parse
|
|
1870
|
+
* @param bytesLength default 4 bytes for length of variable bytes
|
|
1871
|
+
* @returns array of Uint8Array values for each array item
|
|
1872
|
+
*/
|
|
1873
|
+
const stripLengthPrefixFromBytes = (value, bytesLength = 4) => {
|
|
1874
|
+
const ret = [];
|
|
1875
|
+
let values = value;
|
|
1876
|
+
while (values.length()) {
|
|
1877
|
+
const len = values.consume(bytesLength);
|
|
1878
|
+
const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
1879
|
+
ret.push(values.consume(valueLen));
|
|
1880
|
+
values = values.slice(valueLen + bytesLength);
|
|
1881
|
+
}
|
|
1882
|
+
return ret;
|
|
1883
|
+
};
|
|
1884
|
+
const bytesEncoder = (value) => {
|
|
1885
|
+
if (!/^([A-Fa-f0-9]{2})*$/.test(value.bytes)) {
|
|
1886
|
+
throw new core.InvalidHexStringError(value.bytes);
|
|
1887
|
+
}
|
|
1888
|
+
const len = value.bytes.length / 2;
|
|
1889
|
+
return `0a${pad(len)}${value.bytes}`;
|
|
1890
|
+
};
|
|
1891
|
+
const bytesDecoder = (value) => {
|
|
1892
|
+
const bytes = extractRequiredLen(value);
|
|
1893
|
+
return {
|
|
1894
|
+
bytes: Buffer.from(bytes).toString('hex'),
|
|
1895
|
+
};
|
|
1896
|
+
};
|
|
1897
|
+
const stringEncoder = (value) => {
|
|
1898
|
+
const str = Buffer.from(value.string, 'utf8').toString('hex');
|
|
1899
|
+
const hexLength = str.length / 2;
|
|
1900
|
+
return `01${pad(hexLength)}${str}`;
|
|
1901
|
+
};
|
|
1902
|
+
const stringDecoder = (value) => {
|
|
1903
|
+
const str = extractRequiredLen(value);
|
|
1904
|
+
return {
|
|
1905
|
+
string: Buffer.from(str).toString('utf8'),
|
|
1906
|
+
};
|
|
1907
|
+
};
|
|
1908
|
+
const intEncoder = ({ int }) => {
|
|
1909
|
+
const num = new BigNumber.BigNumber(int, 10);
|
|
1910
|
+
const positiveMark = num.toString(2)[0] === '-' ? '1' : '0';
|
|
1911
|
+
const binary = num.toString(2).replace(/-/g, '');
|
|
1912
|
+
const pad = binary.length <= 6
|
|
1913
|
+
? 6
|
|
1914
|
+
: (binary.length - 6) % 7
|
|
1915
|
+
? binary.length + 7 - ((binary.length - 6) % 7)
|
|
1916
|
+
: binary.length;
|
|
1917
|
+
const splitted = binary.padStart(pad, '0').match(/\d{6,7}/g);
|
|
1918
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1919
|
+
const reversed = splitted.reverse();
|
|
1920
|
+
reversed[0] = positiveMark + reversed[0];
|
|
1921
|
+
const numHex = reversed.map((x, i) =>
|
|
1922
|
+
// Add one to the last chunk
|
|
1923
|
+
parseInt((i === reversed.length - 1 ? '0' : '1') + x, 2)
|
|
1924
|
+
.toString(16)
|
|
1925
|
+
.padStart(2, '0'));
|
|
1926
|
+
return `00${numHex.join('')}`;
|
|
1927
|
+
};
|
|
1928
|
+
const intDecoder = (value) => {
|
|
1929
|
+
let c = value.consume(1)[0];
|
|
1930
|
+
const hexNumber = [];
|
|
1931
|
+
const isNotLastChunkMask = 1 << 7;
|
|
1932
|
+
while (c & isNotLastChunkMask) {
|
|
1933
|
+
hexNumber.push(c);
|
|
1934
|
+
c = value.consume(1)[0];
|
|
1935
|
+
}
|
|
1936
|
+
hexNumber.push(c);
|
|
1937
|
+
const isNegative = !!((1 << 6) & hexNumber[0]);
|
|
1938
|
+
hexNumber[0] = hexNumber[0] & 0b1111111;
|
|
1939
|
+
const numBin = hexNumber
|
|
1940
|
+
.map((x, i) => x
|
|
1941
|
+
.toString(2)
|
|
1942
|
+
.slice(i === 0 ? -6 : -7)
|
|
1943
|
+
.padStart(i === 0 ? 6 : 7, '0'))
|
|
1944
|
+
.reverse();
|
|
1945
|
+
let num = new BigNumber.BigNumber(numBin.join(''), 2);
|
|
1946
|
+
if (isNegative) {
|
|
1947
|
+
num = num.times(-1);
|
|
1948
|
+
}
|
|
1949
|
+
return {
|
|
1950
|
+
int: num.toFixed(),
|
|
1951
|
+
};
|
|
1952
|
+
};
|
|
1953
|
+
const primEncoder = (value) => {
|
|
1954
|
+
const hasAnnot = +Array.isArray(value.annots);
|
|
1955
|
+
const argsCount = Array.isArray(value.args) ? value.args.length : 0;
|
|
1956
|
+
// Specify the number of args max is 3 without annotation
|
|
1957
|
+
const preamble = pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2);
|
|
1958
|
+
const op = opMappingReverse[value.prim];
|
|
1959
|
+
let encodedArgs = (value.args || []).map((arg) => valueEncoder(arg)).join('');
|
|
1960
|
+
const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';
|
|
1961
|
+
if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) {
|
|
1962
|
+
encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
|
|
1963
|
+
}
|
|
1964
|
+
if ((value.prim === 'pair' || value.prim === 'Pair') && argsCount > 2) {
|
|
1965
|
+
encodedArgs =
|
|
1966
|
+
encodedAnnots === ''
|
|
1967
|
+
? pad(encodedArgs.length / 2) + encodedArgs + pad(0)
|
|
1968
|
+
: pad(encodedArgs.length / 2) + encodedArgs;
|
|
1969
|
+
}
|
|
1970
|
+
if (value.prim === 'view' && value.args) {
|
|
1971
|
+
encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
|
|
1972
|
+
}
|
|
1973
|
+
return `${preamble}${op}${encodedArgs}${encodedAnnots}`;
|
|
1974
|
+
};
|
|
1975
|
+
const primDecoder = (value, preamble) => {
|
|
1976
|
+
const hasAnnot = (preamble[0] - 0x03) % 2 === 1;
|
|
1977
|
+
let argsCount = Math.floor((preamble[0] - 0x03) / 2);
|
|
1978
|
+
const op = value.consume(1)[0].toString(16).padStart(2, '0');
|
|
1979
|
+
const result = {
|
|
1980
|
+
prim: opMapping[op],
|
|
1981
|
+
};
|
|
1982
|
+
if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
|
|
1983
|
+
value.consume(4);
|
|
1984
|
+
}
|
|
1985
|
+
if (opMapping[op] === 'view') {
|
|
1986
|
+
if (argsCount != 0) {
|
|
1987
|
+
return primViewDecoder(value, result);
|
|
1988
|
+
}
|
|
1989
|
+
else {
|
|
1990
|
+
return result;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
let combPairArgs;
|
|
1994
|
+
let combPairAnnots;
|
|
1995
|
+
if ((opMapping[op] === 'pair' || opMapping[op] === 'Pair') && argsCount > 2) {
|
|
1996
|
+
combPairArgs = decodeCombPair(value);
|
|
1997
|
+
argsCount = 0;
|
|
1998
|
+
combPairAnnots = decodeAnnots(value);
|
|
1999
|
+
}
|
|
2000
|
+
const args = new Array(argsCount).fill(0).map(() => valueDecoder(value));
|
|
2001
|
+
if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
|
|
2002
|
+
value.consume(4);
|
|
2003
|
+
}
|
|
2004
|
+
if (combPairArgs) {
|
|
2005
|
+
result['args'] = combPairArgs;
|
|
2006
|
+
}
|
|
2007
|
+
else if (args.length) {
|
|
2008
|
+
result['args'] = args;
|
|
2009
|
+
}
|
|
2010
|
+
if (combPairAnnots && combPairAnnots[0] !== '') {
|
|
2011
|
+
result['annots'] = combPairAnnots;
|
|
2012
|
+
}
|
|
2013
|
+
else if (hasAnnot) {
|
|
2014
|
+
result['annots'] = decodeAnnots(value);
|
|
2015
|
+
}
|
|
2016
|
+
return result;
|
|
2017
|
+
};
|
|
2018
|
+
const primViewDecoder = (value, result) => {
|
|
2019
|
+
value.consume(4);
|
|
2020
|
+
result['args'] = new Array(4).fill(0).map(() => valueDecoder(value));
|
|
2021
|
+
value.consume(4);
|
|
2022
|
+
return result;
|
|
2023
|
+
};
|
|
2024
|
+
const decodeCombPair = (val) => {
|
|
2025
|
+
const array = new Uint8ArrayConsumer(extractRequiredLen(val));
|
|
2026
|
+
const args = [];
|
|
2027
|
+
while (array.length() > 0) {
|
|
2028
|
+
args.push(valueDecoder(array));
|
|
2029
|
+
}
|
|
2030
|
+
return args;
|
|
2031
|
+
};
|
|
2032
|
+
const encodeAnnots = (value) => {
|
|
2033
|
+
const mergedAnnot = value
|
|
2034
|
+
.map((x) => {
|
|
2035
|
+
return Buffer.from(x, 'utf8').toString('hex');
|
|
2036
|
+
})
|
|
2037
|
+
.join('20');
|
|
2038
|
+
const len = mergedAnnot.length / 2;
|
|
2039
|
+
return `${pad(len)}${mergedAnnot}`;
|
|
2040
|
+
};
|
|
2041
|
+
const decodeAnnots = (val) => {
|
|
2042
|
+
const len = val.consume(4);
|
|
2043
|
+
const annotLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
2044
|
+
const restOfAnnot = val.consume(annotLen);
|
|
2045
|
+
const restOfAnnotHex = Buffer.from(restOfAnnot).toString('hex');
|
|
2046
|
+
return restOfAnnotHex.split('20').map((x) => Buffer.from(x, 'hex').toString('utf8'));
|
|
2047
|
+
};
|
|
2048
|
+
|
|
1804
2049
|
// https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
|
|
1805
2050
|
const prefixEncoder = (prefix) => (str) => {
|
|
1806
2051
|
return utils.buf2hex(Buffer.from(utils.b58cdecode(str, utils.prefix[prefix])));
|
|
@@ -1822,10 +2067,13 @@
|
|
|
1822
2067
|
else if (prefix[0] === 0x02) {
|
|
1823
2068
|
return prefixDecoder(utils.Prefix.TZ3)(val);
|
|
1824
2069
|
}
|
|
2070
|
+
else if (prefix[0] === 0x03) {
|
|
2071
|
+
return prefixDecoder(utils.Prefix.TZ4)(val);
|
|
2072
|
+
}
|
|
1825
2073
|
};
|
|
1826
2074
|
const publicKeyHashesDecoder = (val) => {
|
|
1827
2075
|
if (!boolDecoder(val)) {
|
|
1828
|
-
return
|
|
2076
|
+
return;
|
|
1829
2077
|
}
|
|
1830
2078
|
const publicKeyHashes = [];
|
|
1831
2079
|
val.consume(4);
|
|
@@ -1993,6 +2241,8 @@
|
|
|
1993
2241
|
return '01' + prefixEncoder(utils.Prefix.SPPK)(val);
|
|
1994
2242
|
case utils.Prefix.P2PK:
|
|
1995
2243
|
return '02' + prefixEncoder(utils.Prefix.P2PK)(val);
|
|
2244
|
+
case utils.Prefix.BLPK:
|
|
2245
|
+
return '03' + prefixEncoder(utils.Prefix.BLPK)(val);
|
|
1996
2246
|
default:
|
|
1997
2247
|
throw new utils.InvalidPublicKeyError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
1998
2248
|
` expecting one of the following '${utils.Prefix.EDPK}', '${utils.Prefix.SPPK}', '${utils.Prefix.P2PK}' or '${utils.Prefix.BLPK}'.`);
|
|
@@ -2035,6 +2285,8 @@
|
|
|
2035
2285
|
return prefixDecoder(utils.Prefix.SPPK)(val);
|
|
2036
2286
|
case 0x02:
|
|
2037
2287
|
return prefixDecoder(utils.Prefix.P2PK)(val);
|
|
2288
|
+
case 0x03:
|
|
2289
|
+
return prefixDecoder(utils.Prefix.BLPK)(val);
|
|
2038
2290
|
default:
|
|
2039
2291
|
throw new utils.InvalidPublicKeyError(val.toString(), utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED));
|
|
2040
2292
|
}
|
|
@@ -2207,6 +2459,45 @@
|
|
|
2207
2459
|
return zarithDecoder(value);
|
|
2208
2460
|
}
|
|
2209
2461
|
};
|
|
2462
|
+
const signatureV1Encoder = (val) => {
|
|
2463
|
+
const signaturePrefix = val.substring(0, 5);
|
|
2464
|
+
switch (signaturePrefix) {
|
|
2465
|
+
case utils.Prefix.EDSIG:
|
|
2466
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.EDSIG)(val));
|
|
2467
|
+
case utils.Prefix.SPSIG:
|
|
2468
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.SPSIG)(val));
|
|
2469
|
+
case utils.Prefix.P2SIG:
|
|
2470
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.P2SIG)(val));
|
|
2471
|
+
case utils.Prefix.BLSIG:
|
|
2472
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.BLSIG)(val));
|
|
2473
|
+
default:
|
|
2474
|
+
throw new core.InvalidSignatureError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
2475
|
+
` expecting one of the following '${utils.Prefix.EDSIG}', '${utils.Prefix.SPSIG}', '${utils.Prefix.P2SIG}' or '${utils.Prefix.BLSIG}'.`);
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
const signatureV1Decoder = (val) => {
|
|
2479
|
+
val.consume(4);
|
|
2480
|
+
if (val.length().toString() === '96') {
|
|
2481
|
+
return prefixDecoder(utils.Prefix.BLSIG)(val);
|
|
2482
|
+
}
|
|
2483
|
+
else {
|
|
2484
|
+
throw new core.ProhibitedActionError('currently we only support decoding of BLSIG signatures');
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
const signatureProofEncoder = (val) => {
|
|
2488
|
+
if (val) {
|
|
2489
|
+
return boolEncoder(true) + signatureV1Encoder(val);
|
|
2490
|
+
}
|
|
2491
|
+
else {
|
|
2492
|
+
return boolEncoder(false);
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
const signatureProofDecoder = (value) => {
|
|
2496
|
+
const hasProof = boolDecoder(value);
|
|
2497
|
+
if (hasProof) {
|
|
2498
|
+
return signatureV1Decoder(value);
|
|
2499
|
+
}
|
|
2500
|
+
};
|
|
2210
2501
|
const paddedBytesEncoder = (val, paddingLength = 8) => {
|
|
2211
2502
|
return `${pad(val.length / 2, paddingLength)}${val}`;
|
|
2212
2503
|
};
|
|
@@ -2360,6 +2651,7 @@
|
|
|
2360
2651
|
gas_limit: CODEC.ZARITH,
|
|
2361
2652
|
storage_limit: CODEC.ZARITH,
|
|
2362
2653
|
pk: CODEC.PUBLIC_KEY,
|
|
2654
|
+
proof: CODEC.SIGNATURE_PROOF,
|
|
2363
2655
|
};
|
|
2364
2656
|
const DrainDelegateSchema = {
|
|
2365
2657
|
consensus_key: CODEC.PKH,
|
|
@@ -2479,7 +2771,7 @@
|
|
|
2479
2771
|
}, {});
|
|
2480
2772
|
};
|
|
2481
2773
|
|
|
2482
|
-
const
|
|
2774
|
+
const decoders = {
|
|
2483
2775
|
[CODEC.SECRET]: (val) => toHexString(val.consume(20)),
|
|
2484
2776
|
[CODEC.RAW]: (val) => toHexString(val.consume(32)),
|
|
2485
2777
|
[CODEC.TZ1]: tz1Decoder,
|
|
@@ -2505,36 +2797,37 @@
|
|
|
2505
2797
|
[CODEC.ENTRYPOINT]: entrypointNameDecoder,
|
|
2506
2798
|
[CODEC.BURN_LIMIT]: burnLimitDecoder,
|
|
2507
2799
|
[CODEC.DEPOSITS_LIMIT]: depositsLimitDecoder,
|
|
2800
|
+
[CODEC.SIGNATURE_PROOF]: signatureProofDecoder,
|
|
2508
2801
|
[CODEC.PVM_KIND]: pvmKindDecoder,
|
|
2509
2802
|
[CODEC.PADDED_BYTES]: paddedBytesDecoder,
|
|
2510
2803
|
[CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder,
|
|
2511
2804
|
[CODEC.SLOT_HEADER]: slotHeaderDecoder,
|
|
2512
2805
|
};
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2806
|
+
decoders[CODEC.OPERATION] = operationDecoder(decoders);
|
|
2807
|
+
decoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decoders)(ActivationSchema)(val);
|
|
2808
|
+
decoders[CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder(decoders)(FailingNoopSchema)(val);
|
|
2809
|
+
decoders[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decoders)(DelegationSchema)(val);
|
|
2810
|
+
decoders[CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decoders)(TransactionSchema)(val);
|
|
2811
|
+
decoders[CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decoders)(OriginationSchema)(val);
|
|
2812
|
+
decoders[CODEC.OP_BALLOT] = (val) => schemaDecoder(decoders)(BallotSchema)(val);
|
|
2813
|
+
decoders[CODEC.OP_ATTESTATION] = (val) => schemaDecoder(decoders)(AttestationSchema)(val);
|
|
2814
|
+
decoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder(decoders)(AttestationWithDalSchema)(val);
|
|
2815
|
+
decoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decoders)(SeedNonceRevelationSchema)(val);
|
|
2816
|
+
decoders[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decoders)(ProposalsSchema)(val);
|
|
2817
|
+
decoders[CODEC.OP_REVEAL] = (val) => schemaDecoder(decoders)(RevealSchema)(val);
|
|
2818
|
+
decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decoders)(RegisterGlobalConstantSchema)(val);
|
|
2819
|
+
decoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decoders)(TransferTicketSchema)(val);
|
|
2820
|
+
decoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder(decoders)(IncreasePaidStorageSchema)(val);
|
|
2821
|
+
decoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder(decoders)(UpdateConsensusKeySchema)(val);
|
|
2822
|
+
decoders[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaDecoder(decoders)(DrainDelegateSchema)(val);
|
|
2823
|
+
decoders[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder(decoders)(SmartRollupOriginateSchema)(val);
|
|
2824
|
+
decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(val);
|
|
2825
|
+
decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(val);
|
|
2826
|
+
decoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder(decoders)(DalPublishCommitmentSchema)(val);
|
|
2827
|
+
decoders[CODEC.MANAGER] = schemaDecoder(decoders)(ManagerOperationSchema);
|
|
2828
|
+
decoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder(decoders)(SetDepositsLimitSchema)(val);
|
|
2536
2829
|
|
|
2537
|
-
const encoders = {
|
|
2830
|
+
const encoders$1 = {
|
|
2538
2831
|
[exports.CODEC.SECRET]: (val) => val,
|
|
2539
2832
|
[exports.CODEC.RAW]: (val) => val,
|
|
2540
2833
|
[exports.CODEC.TZ1]: tz1Encoder$1,
|
|
@@ -2544,7 +2837,7 @@
|
|
|
2544
2837
|
[exports.CODEC.PKH]: publicKeyHashEncoder$1,
|
|
2545
2838
|
[exports.CODEC.PKH_ARR]: publicKeyHashesEncoder$1,
|
|
2546
2839
|
[exports.CODEC.DELEGATE]: delegateEncoder$1,
|
|
2547
|
-
[exports.CODEC.SCRIPT]: scriptEncoder,
|
|
2840
|
+
[exports.CODEC.SCRIPT]: scriptEncoder$1,
|
|
2548
2841
|
[exports.CODEC.BALLOT_STATEMENT]: ballotEncoder$1,
|
|
2549
2842
|
[exports.CODEC.PROPOSAL]: proposalEncoder$1,
|
|
2550
2843
|
[exports.CODEC.PROPOSAL_ARR]: proposalsEncoder$1,
|
|
@@ -2560,37 +2853,38 @@
|
|
|
2560
2853
|
[exports.CODEC.ENTRYPOINT]: entrypointNameEncoder$1,
|
|
2561
2854
|
[exports.CODEC.BURN_LIMIT]: burnLimitEncoder$1,
|
|
2562
2855
|
[exports.CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder$1,
|
|
2563
|
-
[exports.CODEC.SIGNATURE_PROOF]: signatureProofEncoder,
|
|
2856
|
+
[exports.CODEC.SIGNATURE_PROOF]: signatureProofEncoder$1,
|
|
2564
2857
|
[exports.CODEC.PVM_KIND]: pvmKindEncoder$1,
|
|
2565
2858
|
[exports.CODEC.PADDED_BYTES]: paddedBytesEncoder$1,
|
|
2566
2859
|
[exports.CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder$1,
|
|
2567
2860
|
[exports.CODEC.SLOT_HEADER]: slotHeaderEncoder$1,
|
|
2568
2861
|
};
|
|
2569
|
-
encoders[exports.CODEC.OPERATION] = operationEncoder$1(encoders);
|
|
2570
|
-
encoders[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder$1(encoders)(ActivationSchema$1)(val);
|
|
2571
|
-
encoders[exports.CODEC.OP_DELEGATION] = (val) => schemaEncoder$1(encoders)(DelegationSchema$1)(val);
|
|
2572
|
-
encoders[exports.CODEC.OP_TRANSACTION] = (val) => schemaEncoder$1(encoders)(TransactionSchema$1)(val);
|
|
2573
|
-
encoders[exports.CODEC.OP_ORIGINATION] = (val) => schemaEncoder$1(encoders)(OriginationSchema$1)(val);
|
|
2574
|
-
encoders[exports.CODEC.OP_BALLOT] = (val) => schemaEncoder$1(encoders)(BallotSchema$1)(val);
|
|
2575
|
-
encoders[exports.CODEC.OP_ATTESTATION] = (val) => schemaEncoder$1(encoders)(AttestationSchema$1)(val);
|
|
2576
|
-
encoders[exports.CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder$1(encoders)(AttestationWithDalSchema$1)(val);
|
|
2577
|
-
encoders[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder$1(encoders)(SeedNonceRevelationSchema$1)(val);
|
|
2578
|
-
encoders[exports.CODEC.OP_PROPOSALS] = (val) => schemaEncoder$1(encoders)(ProposalsSchema$1)(val);
|
|
2579
|
-
encoders[exports.CODEC.OP_REVEAL] = (val) => schemaEncoder$1(encoders)(RevealSchema$1)(val);
|
|
2580
|
-
encoders[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder$1(encoders)(RegisterGlobalConstantSchema$1)(val);
|
|
2581
|
-
encoders[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder$1(encoders)(TransferTicketSchema$1)(val);
|
|
2582
|
-
encoders[exports.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder$1(encoders)(IncreasePaidStorageSchema$1)(val);
|
|
2583
|
-
encoders[exports.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder$1(encoders)(UpdateConsensusKeySchema$1)(val);
|
|
2584
|
-
encoders[exports.CODEC.
|
|
2585
|
-
encoders[exports.CODEC.
|
|
2586
|
-
encoders[exports.CODEC.
|
|
2587
|
-
encoders[exports.CODEC.
|
|
2588
|
-
encoders[exports.CODEC.
|
|
2589
|
-
encoders[exports.CODEC.
|
|
2590
|
-
encoders[exports.CODEC.
|
|
2591
|
-
encoders[exports.CODEC.
|
|
2862
|
+
encoders$1[exports.CODEC.OPERATION] = operationEncoder$1(encoders$1);
|
|
2863
|
+
encoders$1[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder$1(encoders$1)(ActivationSchema$1)(val);
|
|
2864
|
+
encoders$1[exports.CODEC.OP_DELEGATION] = (val) => schemaEncoder$1(encoders$1)(DelegationSchema$1)(val);
|
|
2865
|
+
encoders$1[exports.CODEC.OP_TRANSACTION] = (val) => schemaEncoder$1(encoders$1)(TransactionSchema$1)(val);
|
|
2866
|
+
encoders$1[exports.CODEC.OP_ORIGINATION] = (val) => schemaEncoder$1(encoders$1)(OriginationSchema$1)(val);
|
|
2867
|
+
encoders$1[exports.CODEC.OP_BALLOT] = (val) => schemaEncoder$1(encoders$1)(BallotSchema$1)(val);
|
|
2868
|
+
encoders$1[exports.CODEC.OP_ATTESTATION] = (val) => schemaEncoder$1(encoders$1)(AttestationSchema$1)(val);
|
|
2869
|
+
encoders$1[exports.CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder$1(encoders$1)(AttestationWithDalSchema$1)(val);
|
|
2870
|
+
encoders$1[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder$1(encoders$1)(SeedNonceRevelationSchema$1)(val);
|
|
2871
|
+
encoders$1[exports.CODEC.OP_PROPOSALS] = (val) => schemaEncoder$1(encoders$1)(ProposalsSchema$1)(val);
|
|
2872
|
+
encoders$1[exports.CODEC.OP_REVEAL] = (val) => schemaEncoder$1(encoders$1)(RevealSchema$1)(val);
|
|
2873
|
+
encoders$1[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder$1(encoders$1)(RegisterGlobalConstantSchema$1)(val);
|
|
2874
|
+
encoders$1[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder$1(encoders$1)(TransferTicketSchema$1)(val);
|
|
2875
|
+
encoders$1[exports.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder$1(encoders$1)(IncreasePaidStorageSchema$1)(val);
|
|
2876
|
+
encoders$1[exports.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder$1(encoders$1)(UpdateConsensusKeySchema$1)(val);
|
|
2877
|
+
encoders$1[exports.CODEC.OP_UPDATE_COMPANION_KEY] = (val) => schemaEncoder$1(encoders$1)(UpdateCompanionKeySchema)(val);
|
|
2878
|
+
encoders$1[exports.CODEC.OP_DRAIN_DELEGATE] = (val) => schemaEncoder$1(encoders$1)(DrainDelegateSchema$1)(val);
|
|
2879
|
+
encoders$1[exports.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder$1(encoders$1)(SmartRollupOriginateSchema$1)(val);
|
|
2880
|
+
encoders$1[exports.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder$1(encoders$1)(SmartRollupAddMessagesSchema$1)(val);
|
|
2881
|
+
encoders$1[exports.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder$1(encoders$1)(SmartRollupExecuteOutboxMessageSchema$1)(val);
|
|
2882
|
+
encoders$1[exports.CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder$1(encoders$1)(DalPublishCommitmentSchema$1)(val);
|
|
2883
|
+
encoders$1[exports.CODEC.MANAGER] = schemaEncoder$1(encoders$1)(ManagerOperationSchema$1);
|
|
2884
|
+
encoders$1[exports.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder$1(encoders$1)(SetDepositsLimitSchema$1)(val);
|
|
2885
|
+
encoders$1[exports.CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder$1(encoders$1)(FailingNoopSchema$1)(val);
|
|
2592
2886
|
|
|
2593
|
-
const
|
|
2887
|
+
const encoders = {
|
|
2594
2888
|
[CODEC.SECRET]: (val) => val,
|
|
2595
2889
|
[CODEC.RAW]: (val) => val,
|
|
2596
2890
|
[CODEC.TZ1]: tz1Encoder,
|
|
@@ -2616,34 +2910,35 @@
|
|
|
2616
2910
|
[CODEC.ENTRYPOINT]: entrypointNameEncoder,
|
|
2617
2911
|
[CODEC.BURN_LIMIT]: burnLimitEncoder,
|
|
2618
2912
|
[CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder,
|
|
2913
|
+
[CODEC.SIGNATURE_PROOF]: signatureProofEncoder,
|
|
2619
2914
|
[CODEC.PVM_KIND]: pvmKindEncoder,
|
|
2620
2915
|
[CODEC.PADDED_BYTES]: paddedBytesEncoder,
|
|
2621
2916
|
[CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder,
|
|
2622
2917
|
[CODEC.SLOT_HEADER]: slotHeaderEncoder,
|
|
2623
2918
|
};
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2919
|
+
encoders[CODEC.OPERATION] = operationEncoder(encoders);
|
|
2920
|
+
encoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encoders)(ActivationSchema)(val);
|
|
2921
|
+
encoders[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encoders)(DelegationSchema)(val);
|
|
2922
|
+
encoders[CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encoders)(TransactionSchema)(val);
|
|
2923
|
+
encoders[CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encoders)(OriginationSchema)(val);
|
|
2924
|
+
encoders[CODEC.OP_BALLOT] = (val) => schemaEncoder(encoders)(BallotSchema)(val);
|
|
2925
|
+
encoders[CODEC.OP_ATTESTATION] = (val) => schemaEncoder(encoders)(AttestationSchema)(val);
|
|
2926
|
+
encoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder(encoders)(AttestationWithDalSchema)(val);
|
|
2927
|
+
encoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encoders)(SeedNonceRevelationSchema)(val);
|
|
2928
|
+
encoders[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encoders)(ProposalsSchema)(val);
|
|
2929
|
+
encoders[CODEC.OP_REVEAL] = (val) => schemaEncoder(encoders)(RevealSchema)(val);
|
|
2930
|
+
encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encoders)(RegisterGlobalConstantSchema)(val);
|
|
2931
|
+
encoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encoders)(TransferTicketSchema)(val);
|
|
2932
|
+
encoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder(encoders)(IncreasePaidStorageSchema)(val);
|
|
2933
|
+
encoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder(encoders)(UpdateConsensusKeySchema)(val);
|
|
2934
|
+
encoders[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaEncoder(encoders)(DrainDelegateSchema)(val);
|
|
2935
|
+
encoders[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder(encoders)(SmartRollupOriginateSchema)(val);
|
|
2936
|
+
encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(val);
|
|
2937
|
+
encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(val);
|
|
2938
|
+
encoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder(encoders)(DalPublishCommitmentSchema)(val);
|
|
2939
|
+
encoders[CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema);
|
|
2940
|
+
encoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encoders)(SetDepositsLimitSchema)(val);
|
|
2941
|
+
encoders[CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder(encoders)(FailingNoopSchema)(val);
|
|
2647
2942
|
|
|
2648
2943
|
const OperationKindMapping = {
|
|
2649
2944
|
activate_account: ActivationSchema$1,
|
|
@@ -2660,6 +2955,7 @@
|
|
|
2660
2955
|
transfer_ticket: TransferTicketSchema$1,
|
|
2661
2956
|
increase_paid_storage: IncreasePaidStorageSchema$1,
|
|
2662
2957
|
update_consensus_key: UpdateConsensusKeySchema$1,
|
|
2958
|
+
update_companion_key: UpdateCompanionKeySchema,
|
|
2663
2959
|
drain_delegate: DrainDelegateSchema$1,
|
|
2664
2960
|
set_deposits_limit: SetDepositsLimitSchema$1,
|
|
2665
2961
|
smart_rollup_originate: SmartRollupOriginateSchema$1,
|
|
@@ -2719,6 +3015,7 @@
|
|
|
2719
3015
|
ProtocolsHash["PsParisCZ"] = "PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi";
|
|
2720
3016
|
ProtocolsHash["PsQuebecn"] = "PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg";
|
|
2721
3017
|
ProtocolsHash["PsRiotuma"] = "PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7";
|
|
3018
|
+
ProtocolsHash["PtSeouLou"] = "PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh";
|
|
2722
3019
|
ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";
|
|
2723
3020
|
})(exports.ProtocolsHash || (exports.ProtocolsHash = {}));
|
|
2724
3021
|
const protoLevel = {
|
|
@@ -2743,6 +3040,7 @@
|
|
|
2743
3040
|
PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi: 20,
|
|
2744
3041
|
PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg: 21,
|
|
2745
3042
|
PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7: 22,
|
|
3043
|
+
PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh: 23,
|
|
2746
3044
|
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 23,
|
|
2747
3045
|
};
|
|
2748
3046
|
function ProtoInferiorTo(a, b) {
|
|
@@ -2751,32 +3049,32 @@
|
|
|
2751
3049
|
|
|
2752
3050
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
2753
3051
|
const VERSION = {
|
|
2754
|
-
"commitHash": "
|
|
2755
|
-
"version": "
|
|
3052
|
+
"commitHash": "13639ef56845fbb7e93bcbd37d3f6d0457b0872b",
|
|
3053
|
+
"version": "23.0.0-RC.0"
|
|
2756
3054
|
};
|
|
2757
3055
|
|
|
2758
3056
|
/**
|
|
2759
3057
|
* @packageDocumentation
|
|
2760
3058
|
* @module @taquito/local-forging
|
|
2761
3059
|
*/
|
|
2762
|
-
const PROTOCOL_CURRENT = exports.ProtocolsHash.
|
|
3060
|
+
const PROTOCOL_CURRENT = exports.ProtocolsHash.PtSeouLou;
|
|
2763
3061
|
function getCodec(codec, _proto) {
|
|
2764
|
-
// use
|
|
2765
|
-
if (_proto === exports.ProtocolsHash.
|
|
3062
|
+
// use encodersProto022 & decodersProto022 if it's rio or prior
|
|
3063
|
+
if (_proto === exports.ProtocolsHash.PsRiotuma || ProtoInferiorTo(_proto, exports.ProtocolsHash.PsRiotuma)) {
|
|
2766
3064
|
return {
|
|
2767
|
-
encoder:
|
|
3065
|
+
encoder: encoders[codec],
|
|
2768
3066
|
decoder: (hex) => {
|
|
2769
3067
|
const consumer = Uint8ArrayConsumer.fromHexString(hex);
|
|
2770
|
-
return
|
|
3068
|
+
return decoders[codec](consumer);
|
|
2771
3069
|
},
|
|
2772
3070
|
};
|
|
2773
3071
|
}
|
|
2774
3072
|
else {
|
|
2775
3073
|
return {
|
|
2776
|
-
encoder: encoders[codec],
|
|
3074
|
+
encoder: encoders$1[codec],
|
|
2777
3075
|
decoder: (hex) => {
|
|
2778
3076
|
const consumer = Uint8ArrayConsumer.fromHexString(hex);
|
|
2779
|
-
return decoders[codec](consumer);
|
|
3077
|
+
return decoders$1[codec](consumer);
|
|
2780
3078
|
},
|
|
2781
3079
|
};
|
|
2782
3080
|
}
|
|
@@ -2797,7 +3095,7 @@
|
|
|
2797
3095
|
forge(params) {
|
|
2798
3096
|
const branchValidation = utils.validateBlock(params.branch);
|
|
2799
3097
|
if (branchValidation !== utils.ValidationResult.VALID) {
|
|
2800
|
-
throw new core.InvalidBlockHashError(params.branch,
|
|
3098
|
+
throw new core.InvalidBlockHashError(params.branch, branchValidation);
|
|
2801
3099
|
}
|
|
2802
3100
|
for (const content of params.contents) {
|
|
2803
3101
|
if (!validateOperationKind(content.kind)) {
|
|
@@ -2823,6 +3121,12 @@
|
|
|
2823
3121
|
else if (content.kind === 'update_consensus_key' && diff[0] === 'proof') {
|
|
2824
3122
|
continue;
|
|
2825
3123
|
}
|
|
3124
|
+
else if (content.kind === 'update_companion_key' && diff[0] === 'proof') {
|
|
3125
|
+
continue;
|
|
3126
|
+
}
|
|
3127
|
+
else if (content.kind === 'reveal' && diff[0] === 'proof') {
|
|
3128
|
+
continue;
|
|
3129
|
+
}
|
|
2826
3130
|
else {
|
|
2827
3131
|
throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
2828
3132
|
}
|
|
@@ -2843,12 +3147,12 @@
|
|
|
2843
3147
|
exports.LocalForger = LocalForger;
|
|
2844
3148
|
exports.Uint8ArrayConsumer = Uint8ArrayConsumer;
|
|
2845
3149
|
exports.VERSION = VERSION;
|
|
2846
|
-
exports.decoders = decoders;
|
|
2847
|
-
exports.encoders = encoders;
|
|
3150
|
+
exports.decoders = decoders$1;
|
|
3151
|
+
exports.encoders = encoders$1;
|
|
2848
3152
|
exports.getCodec = getCodec;
|
|
2849
3153
|
exports.localForger = localForger;
|
|
2850
3154
|
exports.opMapping = opMapping$1;
|
|
2851
|
-
exports.opMappingReverse = opMappingReverse;
|
|
3155
|
+
exports.opMappingReverse = opMappingReverse$1;
|
|
2852
3156
|
|
|
2853
3157
|
}));
|
|
2854
3158
|
//# sourceMappingURL=taquito-local-forging.umd.js.map
|