@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.
- package/dist/lib/{codec-proto021.js → codec-proto022.js} +71 -23
- package/dist/lib/codec.js +5 -12
- 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 +13 -7
- 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 +521 -201
- package/dist/taquito-local-forging.es6.js.map +1 -1
- package/dist/taquito-local-forging.umd.js +522 -202
- 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/{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);
|
|
@@ -1071,7 +1074,7 @@
|
|
|
1071
1074
|
return entrypointMapping$1[preamble];
|
|
1072
1075
|
}
|
|
1073
1076
|
else {
|
|
1074
|
-
const entry = extractRequiredLen(value, 1);
|
|
1077
|
+
const entry = extractRequiredLen$1(value, 1);
|
|
1075
1078
|
const entrypoint = Buffer.from(entry).toString('utf8');
|
|
1076
1079
|
if (entrypoint.length > ENTRYPOINT_MAX_LENGTH$1) {
|
|
1077
1080
|
throw new OversizedEntryPointError(entrypoint);
|
|
@@ -1086,8 +1089,8 @@
|
|
|
1086
1089
|
}
|
|
1087
1090
|
else {
|
|
1088
1091
|
const encodedEntrypoint = entrypointDecoder$1(val);
|
|
1089
|
-
const params = extractRequiredLen(val);
|
|
1090
|
-
const parameters = valueDecoder(new Uint8ArrayConsumer(params));
|
|
1092
|
+
const params = extractRequiredLen$1(val);
|
|
1093
|
+
const parameters = valueDecoder$1(new Uint8ArrayConsumer(params));
|
|
1091
1094
|
return {
|
|
1092
1095
|
entrypoint: encodedEntrypoint,
|
|
1093
1096
|
value: parameters,
|
|
@@ -1103,7 +1106,7 @@
|
|
|
1103
1106
|
throw new OversizedEntryPointError(entrypoint);
|
|
1104
1107
|
}
|
|
1105
1108
|
const value = { string: entrypoint };
|
|
1106
|
-
return `ff${valueEncoder(value).slice(8)}`;
|
|
1109
|
+
return `ff${valueEncoder$1(value).slice(8)}`;
|
|
1107
1110
|
}
|
|
1108
1111
|
};
|
|
1109
1112
|
const parametersEncoder$1 = (val) => {
|
|
@@ -1111,26 +1114,26 @@
|
|
|
1111
1114
|
return '00';
|
|
1112
1115
|
}
|
|
1113
1116
|
const encodedEntrypoint = entrypointEncoder$1(val.entrypoint);
|
|
1114
|
-
const parameters = valueEncoder(val.value);
|
|
1117
|
+
const parameters = valueEncoder$1(val.value);
|
|
1115
1118
|
const length = pad(parameters.length / 2);
|
|
1116
1119
|
return `ff${encodedEntrypoint}${length}${parameters}`;
|
|
1117
1120
|
};
|
|
1118
1121
|
const valueParameterEncoder$1 = (value) => {
|
|
1119
|
-
const valueEncoded = valueEncoder(value);
|
|
1122
|
+
const valueEncoded = valueEncoder$1(value);
|
|
1120
1123
|
return `${pad(valueEncoded.length / 2)}${valueEncoded}`;
|
|
1121
1124
|
};
|
|
1122
1125
|
const valueParameterDecoder$1 = (val) => {
|
|
1123
|
-
const value = extractRequiredLen(val);
|
|
1124
|
-
return valueDecoder(new Uint8ArrayConsumer(value));
|
|
1126
|
+
const value = extractRequiredLen$1(val);
|
|
1127
|
+
return valueDecoder$1(new Uint8ArrayConsumer(value));
|
|
1125
1128
|
};
|
|
1126
1129
|
const blockPayloadHashEncoder$1 = prefixEncoder$1(utils.Prefix.VH);
|
|
1127
1130
|
const blockPayloadHashDecoder$1 = prefixDecoder$1(utils.Prefix.VH);
|
|
1128
1131
|
const entrypointNameEncoder$1 = (entrypoint) => {
|
|
1129
1132
|
const value = { string: entrypoint };
|
|
1130
|
-
return `${valueEncoder(value).slice(2)}`;
|
|
1133
|
+
return `${valueEncoder$1(value).slice(2)}`;
|
|
1131
1134
|
};
|
|
1132
1135
|
const entrypointNameDecoder$1 = (val) => {
|
|
1133
|
-
const entry = extractRequiredLen(val);
|
|
1136
|
+
const entry = extractRequiredLen$1(val);
|
|
1134
1137
|
return Buffer.from(entry).toString('utf8');
|
|
1135
1138
|
};
|
|
1136
1139
|
const burnLimitEncoder$1 = (val) => {
|
|
@@ -1151,23 +1154,16 @@
|
|
|
1151
1154
|
return zarithDecoder$1(value);
|
|
1152
1155
|
}
|
|
1153
1156
|
};
|
|
1154
|
-
const signatureV1Encoder = (val) => {
|
|
1157
|
+
const signatureV1Encoder$1 = (val) => {
|
|
1155
1158
|
const signaturePrefix = val.substring(0, 5);
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
case utils.Prefix.P2SIG:
|
|
1162
|
-
return paddedBytesEncoder$1(prefixEncoder$1(utils.Prefix.P2SIG)(val));
|
|
1163
|
-
case utils.Prefix.BLSIG:
|
|
1164
|
-
return paddedBytesEncoder$1(prefixEncoder$1(utils.Prefix.BLSIG)(val));
|
|
1165
|
-
default:
|
|
1166
|
-
throw new core.InvalidSignatureError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
1167
|
-
` expecting one of the following '${utils.Prefix.EDSIG}', '${utils.Prefix.SPSIG}', '${utils.Prefix.P2SIG}' or '${utils.Prefix.BLSIG}'.`);
|
|
1159
|
+
if (signaturePrefix === utils.Prefix.BLSIG) {
|
|
1160
|
+
return paddedBytesEncoder$1(prefixEncoder$1(utils.Prefix.BLSIG)(val));
|
|
1161
|
+
}
|
|
1162
|
+
else {
|
|
1163
|
+
throw new core.ProhibitedActionError('currently we only support encoding of BLSIG signatures');
|
|
1168
1164
|
}
|
|
1169
1165
|
};
|
|
1170
|
-
const signatureV1Decoder = (val) => {
|
|
1166
|
+
const signatureV1Decoder$1 = (val) => {
|
|
1171
1167
|
val.consume(4);
|
|
1172
1168
|
if (val.length().toString() === '96') {
|
|
1173
1169
|
return prefixDecoder$1(utils.Prefix.BLSIG)(val);
|
|
@@ -1176,25 +1172,25 @@
|
|
|
1176
1172
|
throw new core.ProhibitedActionError('currently we only support decoding of BLSIG signatures');
|
|
1177
1173
|
}
|
|
1178
1174
|
};
|
|
1179
|
-
const signatureProofEncoder = (val) => {
|
|
1175
|
+
const signatureProofEncoder$1 = (val) => {
|
|
1180
1176
|
if (val) {
|
|
1181
|
-
return boolEncoder$1(true) + signatureV1Encoder(val);
|
|
1177
|
+
return boolEncoder$1(true) + signatureV1Encoder$1(val);
|
|
1182
1178
|
}
|
|
1183
1179
|
else {
|
|
1184
1180
|
return boolEncoder$1(false);
|
|
1185
1181
|
}
|
|
1186
1182
|
};
|
|
1187
|
-
const signatureProofDecoder = (value) => {
|
|
1183
|
+
const signatureProofDecoder$1 = (value) => {
|
|
1188
1184
|
const hasProof = boolDecoder$1(value);
|
|
1189
1185
|
if (hasProof) {
|
|
1190
|
-
return signatureV1Decoder(value);
|
|
1186
|
+
return signatureV1Decoder$1(value);
|
|
1191
1187
|
}
|
|
1192
1188
|
};
|
|
1193
1189
|
const paddedBytesEncoder$1 = (val, paddingLength = 8) => {
|
|
1194
1190
|
return `${pad(val.length / 2, paddingLength)}${val}`;
|
|
1195
1191
|
};
|
|
1196
1192
|
const paddedBytesDecoder$1 = (val) => {
|
|
1197
|
-
const value = extractRequiredLen(val);
|
|
1193
|
+
const value = extractRequiredLen$1(val);
|
|
1198
1194
|
return Buffer.from(value).toString('hex');
|
|
1199
1195
|
};
|
|
1200
1196
|
const smartRollupMessageEncoder$1 = (val) => {
|
|
@@ -1204,8 +1200,8 @@
|
|
|
1204
1200
|
return `${pad(message.length / 2)}${message}`;
|
|
1205
1201
|
};
|
|
1206
1202
|
const smartRollupMessageDecoder$1 = (val) => {
|
|
1207
|
-
const valueArray = extractRequiredLen(val);
|
|
1208
|
-
const ret = stripLengthPrefixFromBytes(new Uint8ArrayConsumer(valueArray));
|
|
1203
|
+
const valueArray = extractRequiredLen$1(val);
|
|
1204
|
+
const ret = stripLengthPrefixFromBytes$1(new Uint8ArrayConsumer(valueArray));
|
|
1209
1205
|
return ret.map((value) => Buffer.from(value).toString('hex'));
|
|
1210
1206
|
};
|
|
1211
1207
|
const dalCommitmentEncoder$1 = (val) => {
|
|
@@ -1249,6 +1245,7 @@
|
|
|
1249
1245
|
gas_limit: exports.CODEC.ZARITH,
|
|
1250
1246
|
storage_limit: exports.CODEC.ZARITH,
|
|
1251
1247
|
public_key: exports.CODEC.PUBLIC_KEY,
|
|
1248
|
+
proof: exports.CODEC.SIGNATURE_PROOF,
|
|
1252
1249
|
};
|
|
1253
1250
|
const DelegationSchema$1 = {
|
|
1254
1251
|
source: exports.CODEC.PKH,
|
|
@@ -1345,6 +1342,15 @@
|
|
|
1345
1342
|
pk: exports.CODEC.PUBLIC_KEY,
|
|
1346
1343
|
proof: exports.CODEC.SIGNATURE_PROOF,
|
|
1347
1344
|
};
|
|
1345
|
+
const UpdateCompanionKeySchema = {
|
|
1346
|
+
source: exports.CODEC.PKH,
|
|
1347
|
+
fee: exports.CODEC.ZARITH,
|
|
1348
|
+
counter: exports.CODEC.ZARITH,
|
|
1349
|
+
gas_limit: exports.CODEC.ZARITH,
|
|
1350
|
+
storage_limit: exports.CODEC.ZARITH,
|
|
1351
|
+
pk: exports.CODEC.PUBLIC_KEY,
|
|
1352
|
+
proof: exports.CODEC.SIGNATURE_PROOF,
|
|
1353
|
+
};
|
|
1348
1354
|
const DrainDelegateSchema$1 = {
|
|
1349
1355
|
consensus_key: exports.CODEC.PKH,
|
|
1350
1356
|
delegate: exports.CODEC.PKH,
|
|
@@ -1463,7 +1469,7 @@
|
|
|
1463
1469
|
}, {});
|
|
1464
1470
|
};
|
|
1465
1471
|
|
|
1466
|
-
const decoders = {
|
|
1472
|
+
const decoders$1 = {
|
|
1467
1473
|
[exports.CODEC.SECRET]: (val) => toHexString(val.consume(20)),
|
|
1468
1474
|
[exports.CODEC.RAW]: (val) => toHexString(val.consume(32)),
|
|
1469
1475
|
[exports.CODEC.TZ1]: tz1Decoder$1,
|
|
@@ -1474,7 +1480,7 @@
|
|
|
1474
1480
|
[exports.CODEC.PKH_ARR]: publicKeyHashesDecoder$1,
|
|
1475
1481
|
[exports.CODEC.DELEGATE]: delegateDecoder$1,
|
|
1476
1482
|
[exports.CODEC.INT32]: int32Decoder$1,
|
|
1477
|
-
[exports.CODEC.SCRIPT]: scriptDecoder,
|
|
1483
|
+
[exports.CODEC.SCRIPT]: scriptDecoder$1,
|
|
1478
1484
|
[exports.CODEC.BALLOT_STATEMENT]: ballotDecoder$1,
|
|
1479
1485
|
[exports.CODEC.PROPOSAL]: proposalDecoder$1,
|
|
1480
1486
|
[exports.CODEC.PROPOSAL_ARR]: proposalsDecoder$1,
|
|
@@ -1489,35 +1495,36 @@
|
|
|
1489
1495
|
[exports.CODEC.ENTRYPOINT]: entrypointNameDecoder$1,
|
|
1490
1496
|
[exports.CODEC.BURN_LIMIT]: burnLimitDecoder$1,
|
|
1491
1497
|
[exports.CODEC.DEPOSITS_LIMIT]: depositsLimitDecoder$1,
|
|
1492
|
-
[exports.CODEC.SIGNATURE_PROOF]: signatureProofDecoder,
|
|
1498
|
+
[exports.CODEC.SIGNATURE_PROOF]: signatureProofDecoder$1,
|
|
1493
1499
|
[exports.CODEC.PVM_KIND]: pvmKindDecoder$1,
|
|
1494
1500
|
[exports.CODEC.PADDED_BYTES]: paddedBytesDecoder$1,
|
|
1495
1501
|
[exports.CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder$1,
|
|
1496
1502
|
[exports.CODEC.SLOT_HEADER]: slotHeaderDecoder$1,
|
|
1497
1503
|
};
|
|
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.
|
|
1504
|
+
decoders$1[exports.CODEC.OPERATION] = operationDecoder$1(decoders$1);
|
|
1505
|
+
decoders$1[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder$1(decoders$1)(ActivationSchema$1)(val);
|
|
1506
|
+
decoders$1[exports.CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder$1(decoders$1)(FailingNoopSchema$1)(val);
|
|
1507
|
+
decoders$1[exports.CODEC.OP_DELEGATION] = (val) => schemaDecoder$1(decoders$1)(DelegationSchema$1)(val);
|
|
1508
|
+
decoders$1[exports.CODEC.OP_TRANSACTION] = (val) => schemaDecoder$1(decoders$1)(TransactionSchema$1)(val);
|
|
1509
|
+
decoders$1[exports.CODEC.OP_ORIGINATION] = (val) => schemaDecoder$1(decoders$1)(OriginationSchema$1)(val);
|
|
1510
|
+
decoders$1[exports.CODEC.OP_BALLOT] = (val) => schemaDecoder$1(decoders$1)(BallotSchema$1)(val);
|
|
1511
|
+
decoders$1[exports.CODEC.OP_ATTESTATION] = (val) => schemaDecoder$1(decoders$1)(AttestationSchema$1)(val);
|
|
1512
|
+
decoders$1[exports.CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder$1(decoders$1)(AttestationWithDalSchema$1)(val);
|
|
1513
|
+
decoders$1[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder$1(decoders$1)(SeedNonceRevelationSchema$1)(val);
|
|
1514
|
+
decoders$1[exports.CODEC.OP_PROPOSALS] = (val) => schemaDecoder$1(decoders$1)(ProposalsSchema$1)(val);
|
|
1515
|
+
decoders$1[exports.CODEC.OP_REVEAL] = (val) => schemaDecoder$1(decoders$1)(RevealSchema$1)(val);
|
|
1516
|
+
decoders$1[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder$1(decoders$1)(RegisterGlobalConstantSchema$1)(val);
|
|
1517
|
+
decoders$1[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder$1(decoders$1)(TransferTicketSchema$1)(val);
|
|
1518
|
+
decoders$1[exports.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder$1(decoders$1)(IncreasePaidStorageSchema$1)(val);
|
|
1519
|
+
decoders$1[exports.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder$1(decoders$1)(UpdateConsensusKeySchema$1)(val);
|
|
1520
|
+
decoders$1[exports.CODEC.OP_UPDATE_COMPANION_KEY] = (val) => schemaDecoder$1(decoders$1)(UpdateCompanionKeySchema)(val);
|
|
1521
|
+
decoders$1[exports.CODEC.OP_DRAIN_DELEGATE] = (val) => schemaDecoder$1(decoders$1)(DrainDelegateSchema$1)(val);
|
|
1522
|
+
decoders$1[exports.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder$1(decoders$1)(SmartRollupOriginateSchema$1)(val);
|
|
1523
|
+
decoders$1[exports.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder$1(decoders$1)(SmartRollupAddMessagesSchema$1)(val);
|
|
1524
|
+
decoders$1[exports.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder$1(decoders$1)(SmartRollupExecuteOutboxMessageSchema$1)(val);
|
|
1525
|
+
decoders$1[exports.CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder$1(decoders$1)(DalPublishCommitmentSchema$1)(val);
|
|
1526
|
+
decoders$1[exports.CODEC.MANAGER] = schemaDecoder$1(decoders$1)(ManagerOperationSchema$1);
|
|
1527
|
+
decoders$1[exports.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder$1(decoders$1)(SetDepositsLimitSchema$1)(val);
|
|
1521
1528
|
|
|
1522
1529
|
/*
|
|
1523
1530
|
* Some code in this file is originally from sotez
|
|
@@ -1570,6 +1577,7 @@
|
|
|
1570
1577
|
CODEC["BURN_LIMIT"] = "burn_limit";
|
|
1571
1578
|
CODEC["OP_INCREASE_PAID_STORAGE"] = "increase_paid_storage";
|
|
1572
1579
|
CODEC["OP_UPDATE_CONSENSUS_KEY"] = "update_consensus_key";
|
|
1580
|
+
CODEC["SIGNATURE_PROOF"] = "signature_proof";
|
|
1573
1581
|
CODEC["OP_DRAIN_DELEGATE"] = "drain_delegate";
|
|
1574
1582
|
CODEC["DEPOSITS_LIMIT"] = "deposits_limit";
|
|
1575
1583
|
CODEC["OP_SET_DEPOSITS_LIMIT"] = "set_deposits_limit";
|
|
@@ -1741,7 +1749,7 @@
|
|
|
1741
1749
|
'9c': 'NAT',
|
|
1742
1750
|
'9d': 'Ticket',
|
|
1743
1751
|
};
|
|
1744
|
-
(() => {
|
|
1752
|
+
const opMappingReverse = (() => {
|
|
1745
1753
|
const result = {};
|
|
1746
1754
|
Object.keys(opMapping).forEach((key) => {
|
|
1747
1755
|
result[opMapping[key]] = key;
|
|
@@ -1801,6 +1809,259 @@
|
|
|
1801
1809
|
return result;
|
|
1802
1810
|
})();
|
|
1803
1811
|
|
|
1812
|
+
const isPrim = (value) => {
|
|
1813
|
+
return 'prim' in value;
|
|
1814
|
+
};
|
|
1815
|
+
const isBytes = (value) => {
|
|
1816
|
+
return 'bytes' in value && typeof value.bytes === 'string';
|
|
1817
|
+
};
|
|
1818
|
+
const isString = (value) => {
|
|
1819
|
+
return 'string' in value && typeof value.string === 'string';
|
|
1820
|
+
};
|
|
1821
|
+
const isInt = (value) => {
|
|
1822
|
+
return 'int' in value && typeof value.int === 'string';
|
|
1823
|
+
};
|
|
1824
|
+
const scriptEncoder = (script) => {
|
|
1825
|
+
const code = valueEncoder(script.code);
|
|
1826
|
+
const storage = valueEncoder(script.storage);
|
|
1827
|
+
return `${pad(code.length / 2, 8)}${code}${pad(storage.length / 2, 8)}${storage}`;
|
|
1828
|
+
};
|
|
1829
|
+
const scriptDecoder = (value) => {
|
|
1830
|
+
const code = extractRequiredLen(value);
|
|
1831
|
+
const storage = extractRequiredLen(value);
|
|
1832
|
+
return {
|
|
1833
|
+
code: valueDecoder(new Uint8ArrayConsumer(code)),
|
|
1834
|
+
storage: valueDecoder(new Uint8ArrayConsumer(storage)),
|
|
1835
|
+
};
|
|
1836
|
+
};
|
|
1837
|
+
const valueEncoder = (value) => {
|
|
1838
|
+
if (Array.isArray(value)) {
|
|
1839
|
+
const encoded = value.map((x) => valueEncoder(x)).join('');
|
|
1840
|
+
const len = encoded.length / 2;
|
|
1841
|
+
return `02${pad(len)}${encoded}`;
|
|
1842
|
+
}
|
|
1843
|
+
else if (isPrim(value)) {
|
|
1844
|
+
return primEncoder(value);
|
|
1845
|
+
}
|
|
1846
|
+
else if (isBytes(value)) {
|
|
1847
|
+
return bytesEncoder(value);
|
|
1848
|
+
}
|
|
1849
|
+
else if (isString(value)) {
|
|
1850
|
+
return stringEncoder(value);
|
|
1851
|
+
}
|
|
1852
|
+
else if (isInt(value)) {
|
|
1853
|
+
return intEncoder(value);
|
|
1854
|
+
}
|
|
1855
|
+
throw new UnexpectedMichelsonValueError(JSON.stringify(value));
|
|
1856
|
+
};
|
|
1857
|
+
const valueDecoder = (value) => {
|
|
1858
|
+
const preamble = value.consume(1);
|
|
1859
|
+
switch (preamble[0]) {
|
|
1860
|
+
case 0x0a:
|
|
1861
|
+
return bytesDecoder(value);
|
|
1862
|
+
case 0x01:
|
|
1863
|
+
return stringDecoder(value);
|
|
1864
|
+
case 0x00:
|
|
1865
|
+
return intDecoder(value);
|
|
1866
|
+
case 0x02: {
|
|
1867
|
+
const val = new Uint8ArrayConsumer(extractRequiredLen(value));
|
|
1868
|
+
const results = [];
|
|
1869
|
+
while (val.length() > 0) {
|
|
1870
|
+
results.push(valueDecoder(val));
|
|
1871
|
+
}
|
|
1872
|
+
return results;
|
|
1873
|
+
}
|
|
1874
|
+
default:
|
|
1875
|
+
return primDecoder(value, preamble);
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
const extractRequiredLen = (value, bytesLength = 4) => {
|
|
1879
|
+
const len = value.consume(bytesLength);
|
|
1880
|
+
const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
1881
|
+
return value.consume(valueLen);
|
|
1882
|
+
};
|
|
1883
|
+
/**
|
|
1884
|
+
* @description parse bytes into multiple items of an array
|
|
1885
|
+
* @param value Uint8ArrayConsumer class of forged segment to parse
|
|
1886
|
+
* @param bytesLength default 4 bytes for length of variable bytes
|
|
1887
|
+
* @returns array of Uint8Array values for each array item
|
|
1888
|
+
*/
|
|
1889
|
+
const stripLengthPrefixFromBytes = (value, bytesLength = 4) => {
|
|
1890
|
+
const ret = [];
|
|
1891
|
+
let values = value;
|
|
1892
|
+
while (values.length()) {
|
|
1893
|
+
const len = values.consume(bytesLength);
|
|
1894
|
+
const valueLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
1895
|
+
ret.push(values.consume(valueLen));
|
|
1896
|
+
values = values.slice(valueLen + bytesLength);
|
|
1897
|
+
}
|
|
1898
|
+
return ret;
|
|
1899
|
+
};
|
|
1900
|
+
const bytesEncoder = (value) => {
|
|
1901
|
+
if (!/^([A-Fa-f0-9]{2})*$/.test(value.bytes)) {
|
|
1902
|
+
throw new core.InvalidHexStringError(value.bytes);
|
|
1903
|
+
}
|
|
1904
|
+
const len = value.bytes.length / 2;
|
|
1905
|
+
return `0a${pad(len)}${value.bytes}`;
|
|
1906
|
+
};
|
|
1907
|
+
const bytesDecoder = (value) => {
|
|
1908
|
+
const bytes = extractRequiredLen(value);
|
|
1909
|
+
return {
|
|
1910
|
+
bytes: Buffer.from(bytes).toString('hex'),
|
|
1911
|
+
};
|
|
1912
|
+
};
|
|
1913
|
+
const stringEncoder = (value) => {
|
|
1914
|
+
const str = Buffer.from(value.string, 'utf8').toString('hex');
|
|
1915
|
+
const hexLength = str.length / 2;
|
|
1916
|
+
return `01${pad(hexLength)}${str}`;
|
|
1917
|
+
};
|
|
1918
|
+
const stringDecoder = (value) => {
|
|
1919
|
+
const str = extractRequiredLen(value);
|
|
1920
|
+
return {
|
|
1921
|
+
string: Buffer.from(str).toString('utf8'),
|
|
1922
|
+
};
|
|
1923
|
+
};
|
|
1924
|
+
const intEncoder = ({ int }) => {
|
|
1925
|
+
const num = new BigNumber.BigNumber(int, 10);
|
|
1926
|
+
const positiveMark = num.toString(2)[0] === '-' ? '1' : '0';
|
|
1927
|
+
const binary = num.toString(2).replace(/-/g, '');
|
|
1928
|
+
const pad = binary.length <= 6
|
|
1929
|
+
? 6
|
|
1930
|
+
: (binary.length - 6) % 7
|
|
1931
|
+
? binary.length + 7 - ((binary.length - 6) % 7)
|
|
1932
|
+
: binary.length;
|
|
1933
|
+
const splitted = binary.padStart(pad, '0').match(/\d{6,7}/g);
|
|
1934
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1935
|
+
const reversed = splitted.reverse();
|
|
1936
|
+
reversed[0] = positiveMark + reversed[0];
|
|
1937
|
+
const numHex = reversed.map((x, i) =>
|
|
1938
|
+
// Add one to the last chunk
|
|
1939
|
+
parseInt((i === reversed.length - 1 ? '0' : '1') + x, 2)
|
|
1940
|
+
.toString(16)
|
|
1941
|
+
.padStart(2, '0'));
|
|
1942
|
+
return `00${numHex.join('')}`;
|
|
1943
|
+
};
|
|
1944
|
+
const intDecoder = (value) => {
|
|
1945
|
+
let c = value.consume(1)[0];
|
|
1946
|
+
const hexNumber = [];
|
|
1947
|
+
const isNotLastChunkMask = 1 << 7;
|
|
1948
|
+
while (c & isNotLastChunkMask) {
|
|
1949
|
+
hexNumber.push(c);
|
|
1950
|
+
c = value.consume(1)[0];
|
|
1951
|
+
}
|
|
1952
|
+
hexNumber.push(c);
|
|
1953
|
+
const isNegative = !!((1 << 6) & hexNumber[0]);
|
|
1954
|
+
hexNumber[0] = hexNumber[0] & 0b1111111;
|
|
1955
|
+
const numBin = hexNumber
|
|
1956
|
+
.map((x, i) => x
|
|
1957
|
+
.toString(2)
|
|
1958
|
+
.slice(i === 0 ? -6 : -7)
|
|
1959
|
+
.padStart(i === 0 ? 6 : 7, '0'))
|
|
1960
|
+
.reverse();
|
|
1961
|
+
let num = new BigNumber.BigNumber(numBin.join(''), 2);
|
|
1962
|
+
if (isNegative) {
|
|
1963
|
+
num = num.times(-1);
|
|
1964
|
+
}
|
|
1965
|
+
return {
|
|
1966
|
+
int: num.toFixed(),
|
|
1967
|
+
};
|
|
1968
|
+
};
|
|
1969
|
+
const primEncoder = (value) => {
|
|
1970
|
+
const hasAnnot = +Array.isArray(value.annots);
|
|
1971
|
+
const argsCount = Array.isArray(value.args) ? value.args.length : 0;
|
|
1972
|
+
// Specify the number of args max is 3 without annotation
|
|
1973
|
+
const preamble = pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2);
|
|
1974
|
+
const op = opMappingReverse[value.prim];
|
|
1975
|
+
let encodedArgs = (value.args || []).map((arg) => valueEncoder(arg)).join('');
|
|
1976
|
+
const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';
|
|
1977
|
+
if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) {
|
|
1978
|
+
encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
|
|
1979
|
+
}
|
|
1980
|
+
if ((value.prim === 'pair' || value.prim === 'Pair') && argsCount > 2) {
|
|
1981
|
+
encodedArgs =
|
|
1982
|
+
encodedAnnots === ''
|
|
1983
|
+
? pad(encodedArgs.length / 2) + encodedArgs + pad(0)
|
|
1984
|
+
: pad(encodedArgs.length / 2) + encodedArgs;
|
|
1985
|
+
}
|
|
1986
|
+
if (value.prim === 'view' && value.args) {
|
|
1987
|
+
encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
|
|
1988
|
+
}
|
|
1989
|
+
return `${preamble}${op}${encodedArgs}${encodedAnnots}`;
|
|
1990
|
+
};
|
|
1991
|
+
const primDecoder = (value, preamble) => {
|
|
1992
|
+
const hasAnnot = (preamble[0] - 0x03) % 2 === 1;
|
|
1993
|
+
let argsCount = Math.floor((preamble[0] - 0x03) / 2);
|
|
1994
|
+
const op = value.consume(1)[0].toString(16).padStart(2, '0');
|
|
1995
|
+
const result = {
|
|
1996
|
+
prim: opMapping[op],
|
|
1997
|
+
};
|
|
1998
|
+
if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
|
|
1999
|
+
value.consume(4);
|
|
2000
|
+
}
|
|
2001
|
+
if (opMapping[op] === 'view') {
|
|
2002
|
+
if (argsCount != 0) {
|
|
2003
|
+
return primViewDecoder(value, result);
|
|
2004
|
+
}
|
|
2005
|
+
else {
|
|
2006
|
+
return result;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
let combPairArgs;
|
|
2010
|
+
let combPairAnnots;
|
|
2011
|
+
if ((opMapping[op] === 'pair' || opMapping[op] === 'Pair') && argsCount > 2) {
|
|
2012
|
+
combPairArgs = decodeCombPair(value);
|
|
2013
|
+
argsCount = 0;
|
|
2014
|
+
combPairAnnots = decodeAnnots(value);
|
|
2015
|
+
}
|
|
2016
|
+
const args = new Array(argsCount).fill(0).map(() => valueDecoder(value));
|
|
2017
|
+
if (opMapping[op] === 'LAMBDA' || opMapping[op] === 'LAMBDA_REC') {
|
|
2018
|
+
value.consume(4);
|
|
2019
|
+
}
|
|
2020
|
+
if (combPairArgs) {
|
|
2021
|
+
result['args'] = combPairArgs;
|
|
2022
|
+
}
|
|
2023
|
+
else if (args.length) {
|
|
2024
|
+
result['args'] = args;
|
|
2025
|
+
}
|
|
2026
|
+
if (combPairAnnots && combPairAnnots[0] !== '') {
|
|
2027
|
+
result['annots'] = combPairAnnots;
|
|
2028
|
+
}
|
|
2029
|
+
else if (hasAnnot) {
|
|
2030
|
+
result['annots'] = decodeAnnots(value);
|
|
2031
|
+
}
|
|
2032
|
+
return result;
|
|
2033
|
+
};
|
|
2034
|
+
const primViewDecoder = (value, result) => {
|
|
2035
|
+
value.consume(4);
|
|
2036
|
+
result['args'] = new Array(4).fill(0).map(() => valueDecoder(value));
|
|
2037
|
+
value.consume(4);
|
|
2038
|
+
return result;
|
|
2039
|
+
};
|
|
2040
|
+
const decodeCombPair = (val) => {
|
|
2041
|
+
const array = new Uint8ArrayConsumer(extractRequiredLen(val));
|
|
2042
|
+
const args = [];
|
|
2043
|
+
while (array.length() > 0) {
|
|
2044
|
+
args.push(valueDecoder(array));
|
|
2045
|
+
}
|
|
2046
|
+
return args;
|
|
2047
|
+
};
|
|
2048
|
+
const encodeAnnots = (value) => {
|
|
2049
|
+
const mergedAnnot = value
|
|
2050
|
+
.map((x) => {
|
|
2051
|
+
return Buffer.from(x, 'utf8').toString('hex');
|
|
2052
|
+
})
|
|
2053
|
+
.join('20');
|
|
2054
|
+
const len = mergedAnnot.length / 2;
|
|
2055
|
+
return `${pad(len)}${mergedAnnot}`;
|
|
2056
|
+
};
|
|
2057
|
+
const decodeAnnots = (val) => {
|
|
2058
|
+
const len = val.consume(4);
|
|
2059
|
+
const annotLen = parseInt(Buffer.from(len).toString('hex'), 16);
|
|
2060
|
+
const restOfAnnot = val.consume(annotLen);
|
|
2061
|
+
const restOfAnnotHex = Buffer.from(restOfAnnot).toString('hex');
|
|
2062
|
+
return restOfAnnotHex.split('20').map((x) => Buffer.from(x, 'hex').toString('utf8'));
|
|
2063
|
+
};
|
|
2064
|
+
|
|
1804
2065
|
// https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
|
|
1805
2066
|
const prefixEncoder = (prefix) => (str) => {
|
|
1806
2067
|
return utils.buf2hex(Buffer.from(utils.b58cdecode(str, utils.prefix[prefix])));
|
|
@@ -1822,10 +2083,13 @@
|
|
|
1822
2083
|
else if (prefix[0] === 0x02) {
|
|
1823
2084
|
return prefixDecoder(utils.Prefix.TZ3)(val);
|
|
1824
2085
|
}
|
|
2086
|
+
else if (prefix[0] === 0x03) {
|
|
2087
|
+
return prefixDecoder(utils.Prefix.TZ4)(val);
|
|
2088
|
+
}
|
|
1825
2089
|
};
|
|
1826
2090
|
const publicKeyHashesDecoder = (val) => {
|
|
1827
2091
|
if (!boolDecoder(val)) {
|
|
1828
|
-
return
|
|
2092
|
+
return;
|
|
1829
2093
|
}
|
|
1830
2094
|
const publicKeyHashes = [];
|
|
1831
2095
|
val.consume(4);
|
|
@@ -1993,6 +2257,8 @@
|
|
|
1993
2257
|
return '01' + prefixEncoder(utils.Prefix.SPPK)(val);
|
|
1994
2258
|
case utils.Prefix.P2PK:
|
|
1995
2259
|
return '02' + prefixEncoder(utils.Prefix.P2PK)(val);
|
|
2260
|
+
case utils.Prefix.BLPK:
|
|
2261
|
+
return '03' + prefixEncoder(utils.Prefix.BLPK)(val);
|
|
1996
2262
|
default:
|
|
1997
2263
|
throw new utils.InvalidPublicKeyError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
1998
2264
|
` expecting one of the following '${utils.Prefix.EDPK}', '${utils.Prefix.SPPK}', '${utils.Prefix.P2PK}' or '${utils.Prefix.BLPK}'.`);
|
|
@@ -2035,6 +2301,8 @@
|
|
|
2035
2301
|
return prefixDecoder(utils.Prefix.SPPK)(val);
|
|
2036
2302
|
case 0x02:
|
|
2037
2303
|
return prefixDecoder(utils.Prefix.P2PK)(val);
|
|
2304
|
+
case 0x03:
|
|
2305
|
+
return prefixDecoder(utils.Prefix.BLPK)(val);
|
|
2038
2306
|
default:
|
|
2039
2307
|
throw new utils.InvalidPublicKeyError(val.toString(), utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED));
|
|
2040
2308
|
}
|
|
@@ -2207,6 +2475,45 @@
|
|
|
2207
2475
|
return zarithDecoder(value);
|
|
2208
2476
|
}
|
|
2209
2477
|
};
|
|
2478
|
+
const signatureV1Encoder = (val) => {
|
|
2479
|
+
const signaturePrefix = val.substring(0, 5);
|
|
2480
|
+
switch (signaturePrefix) {
|
|
2481
|
+
case utils.Prefix.EDSIG:
|
|
2482
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.EDSIG)(val));
|
|
2483
|
+
case utils.Prefix.SPSIG:
|
|
2484
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.SPSIG)(val));
|
|
2485
|
+
case utils.Prefix.P2SIG:
|
|
2486
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.P2SIG)(val));
|
|
2487
|
+
case utils.Prefix.BLSIG:
|
|
2488
|
+
return paddedBytesEncoder(prefixEncoder(utils.Prefix.BLSIG)(val));
|
|
2489
|
+
default:
|
|
2490
|
+
throw new core.InvalidSignatureError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
|
|
2491
|
+
` expecting one of the following '${utils.Prefix.EDSIG}', '${utils.Prefix.SPSIG}', '${utils.Prefix.P2SIG}' or '${utils.Prefix.BLSIG}'.`);
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
const signatureV1Decoder = (val) => {
|
|
2495
|
+
val.consume(4);
|
|
2496
|
+
if (val.length().toString() === '96') {
|
|
2497
|
+
return prefixDecoder(utils.Prefix.BLSIG)(val);
|
|
2498
|
+
}
|
|
2499
|
+
else {
|
|
2500
|
+
throw new core.ProhibitedActionError('currently we only support decoding of BLSIG signatures');
|
|
2501
|
+
}
|
|
2502
|
+
};
|
|
2503
|
+
const signatureProofEncoder = (val) => {
|
|
2504
|
+
if (val) {
|
|
2505
|
+
return boolEncoder(true) + signatureV1Encoder(val);
|
|
2506
|
+
}
|
|
2507
|
+
else {
|
|
2508
|
+
return boolEncoder(false);
|
|
2509
|
+
}
|
|
2510
|
+
};
|
|
2511
|
+
const signatureProofDecoder = (value) => {
|
|
2512
|
+
const hasProof = boolDecoder(value);
|
|
2513
|
+
if (hasProof) {
|
|
2514
|
+
return signatureV1Decoder(value);
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2210
2517
|
const paddedBytesEncoder = (val, paddingLength = 8) => {
|
|
2211
2518
|
return `${pad(val.length / 2, paddingLength)}${val}`;
|
|
2212
2519
|
};
|
|
@@ -2360,6 +2667,7 @@
|
|
|
2360
2667
|
gas_limit: CODEC.ZARITH,
|
|
2361
2668
|
storage_limit: CODEC.ZARITH,
|
|
2362
2669
|
pk: CODEC.PUBLIC_KEY,
|
|
2670
|
+
proof: CODEC.SIGNATURE_PROOF,
|
|
2363
2671
|
};
|
|
2364
2672
|
const DrainDelegateSchema = {
|
|
2365
2673
|
consensus_key: CODEC.PKH,
|
|
@@ -2479,7 +2787,7 @@
|
|
|
2479
2787
|
}, {});
|
|
2480
2788
|
};
|
|
2481
2789
|
|
|
2482
|
-
const
|
|
2790
|
+
const decoders = {
|
|
2483
2791
|
[CODEC.SECRET]: (val) => toHexString(val.consume(20)),
|
|
2484
2792
|
[CODEC.RAW]: (val) => toHexString(val.consume(32)),
|
|
2485
2793
|
[CODEC.TZ1]: tz1Decoder,
|
|
@@ -2505,36 +2813,37 @@
|
|
|
2505
2813
|
[CODEC.ENTRYPOINT]: entrypointNameDecoder,
|
|
2506
2814
|
[CODEC.BURN_LIMIT]: burnLimitDecoder,
|
|
2507
2815
|
[CODEC.DEPOSITS_LIMIT]: depositsLimitDecoder,
|
|
2816
|
+
[CODEC.SIGNATURE_PROOF]: signatureProofDecoder,
|
|
2508
2817
|
[CODEC.PVM_KIND]: pvmKindDecoder,
|
|
2509
2818
|
[CODEC.PADDED_BYTES]: paddedBytesDecoder,
|
|
2510
2819
|
[CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageDecoder,
|
|
2511
2820
|
[CODEC.SLOT_HEADER]: slotHeaderDecoder,
|
|
2512
2821
|
};
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2822
|
+
decoders[CODEC.OPERATION] = operationDecoder(decoders);
|
|
2823
|
+
decoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decoders)(ActivationSchema)(val);
|
|
2824
|
+
decoders[CODEC.OP_FAILING_NOOP] = (val) => schemaDecoder(decoders)(FailingNoopSchema)(val);
|
|
2825
|
+
decoders[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decoders)(DelegationSchema)(val);
|
|
2826
|
+
decoders[CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decoders)(TransactionSchema)(val);
|
|
2827
|
+
decoders[CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decoders)(OriginationSchema)(val);
|
|
2828
|
+
decoders[CODEC.OP_BALLOT] = (val) => schemaDecoder(decoders)(BallotSchema)(val);
|
|
2829
|
+
decoders[CODEC.OP_ATTESTATION] = (val) => schemaDecoder(decoders)(AttestationSchema)(val);
|
|
2830
|
+
decoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaDecoder(decoders)(AttestationWithDalSchema)(val);
|
|
2831
|
+
decoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decoders)(SeedNonceRevelationSchema)(val);
|
|
2832
|
+
decoders[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decoders)(ProposalsSchema)(val);
|
|
2833
|
+
decoders[CODEC.OP_REVEAL] = (val) => schemaDecoder(decoders)(RevealSchema)(val);
|
|
2834
|
+
decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decoders)(RegisterGlobalConstantSchema)(val);
|
|
2835
|
+
decoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decoders)(TransferTicketSchema)(val);
|
|
2836
|
+
decoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder(decoders)(IncreasePaidStorageSchema)(val);
|
|
2837
|
+
decoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaDecoder(decoders)(UpdateConsensusKeySchema)(val);
|
|
2838
|
+
decoders[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaDecoder(decoders)(DrainDelegateSchema)(val);
|
|
2839
|
+
decoders[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaDecoder(decoders)(SmartRollupOriginateSchema)(val);
|
|
2840
|
+
decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(val);
|
|
2841
|
+
decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(val);
|
|
2842
|
+
decoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaDecoder(decoders)(DalPublishCommitmentSchema)(val);
|
|
2843
|
+
decoders[CODEC.MANAGER] = schemaDecoder(decoders)(ManagerOperationSchema);
|
|
2844
|
+
decoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaDecoder(decoders)(SetDepositsLimitSchema)(val);
|
|
2536
2845
|
|
|
2537
|
-
const encoders = {
|
|
2846
|
+
const encoders$1 = {
|
|
2538
2847
|
[exports.CODEC.SECRET]: (val) => val,
|
|
2539
2848
|
[exports.CODEC.RAW]: (val) => val,
|
|
2540
2849
|
[exports.CODEC.TZ1]: tz1Encoder$1,
|
|
@@ -2544,7 +2853,7 @@
|
|
|
2544
2853
|
[exports.CODEC.PKH]: publicKeyHashEncoder$1,
|
|
2545
2854
|
[exports.CODEC.PKH_ARR]: publicKeyHashesEncoder$1,
|
|
2546
2855
|
[exports.CODEC.DELEGATE]: delegateEncoder$1,
|
|
2547
|
-
[exports.CODEC.SCRIPT]: scriptEncoder,
|
|
2856
|
+
[exports.CODEC.SCRIPT]: scriptEncoder$1,
|
|
2548
2857
|
[exports.CODEC.BALLOT_STATEMENT]: ballotEncoder$1,
|
|
2549
2858
|
[exports.CODEC.PROPOSAL]: proposalEncoder$1,
|
|
2550
2859
|
[exports.CODEC.PROPOSAL_ARR]: proposalsEncoder$1,
|
|
@@ -2560,37 +2869,38 @@
|
|
|
2560
2869
|
[exports.CODEC.ENTRYPOINT]: entrypointNameEncoder$1,
|
|
2561
2870
|
[exports.CODEC.BURN_LIMIT]: burnLimitEncoder$1,
|
|
2562
2871
|
[exports.CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder$1,
|
|
2563
|
-
[exports.CODEC.SIGNATURE_PROOF]: signatureProofEncoder,
|
|
2872
|
+
[exports.CODEC.SIGNATURE_PROOF]: signatureProofEncoder$1,
|
|
2564
2873
|
[exports.CODEC.PVM_KIND]: pvmKindEncoder$1,
|
|
2565
2874
|
[exports.CODEC.PADDED_BYTES]: paddedBytesEncoder$1,
|
|
2566
2875
|
[exports.CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder$1,
|
|
2567
2876
|
[exports.CODEC.SLOT_HEADER]: slotHeaderEncoder$1,
|
|
2568
2877
|
};
|
|
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.
|
|
2878
|
+
encoders$1[exports.CODEC.OPERATION] = operationEncoder$1(encoders$1);
|
|
2879
|
+
encoders$1[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder$1(encoders$1)(ActivationSchema$1)(val);
|
|
2880
|
+
encoders$1[exports.CODEC.OP_DELEGATION] = (val) => schemaEncoder$1(encoders$1)(DelegationSchema$1)(val);
|
|
2881
|
+
encoders$1[exports.CODEC.OP_TRANSACTION] = (val) => schemaEncoder$1(encoders$1)(TransactionSchema$1)(val);
|
|
2882
|
+
encoders$1[exports.CODEC.OP_ORIGINATION] = (val) => schemaEncoder$1(encoders$1)(OriginationSchema$1)(val);
|
|
2883
|
+
encoders$1[exports.CODEC.OP_BALLOT] = (val) => schemaEncoder$1(encoders$1)(BallotSchema$1)(val);
|
|
2884
|
+
encoders$1[exports.CODEC.OP_ATTESTATION] = (val) => schemaEncoder$1(encoders$1)(AttestationSchema$1)(val);
|
|
2885
|
+
encoders$1[exports.CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder$1(encoders$1)(AttestationWithDalSchema$1)(val);
|
|
2886
|
+
encoders$1[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder$1(encoders$1)(SeedNonceRevelationSchema$1)(val);
|
|
2887
|
+
encoders$1[exports.CODEC.OP_PROPOSALS] = (val) => schemaEncoder$1(encoders$1)(ProposalsSchema$1)(val);
|
|
2888
|
+
encoders$1[exports.CODEC.OP_REVEAL] = (val) => schemaEncoder$1(encoders$1)(RevealSchema$1)(val);
|
|
2889
|
+
encoders$1[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder$1(encoders$1)(RegisterGlobalConstantSchema$1)(val);
|
|
2890
|
+
encoders$1[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder$1(encoders$1)(TransferTicketSchema$1)(val);
|
|
2891
|
+
encoders$1[exports.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder$1(encoders$1)(IncreasePaidStorageSchema$1)(val);
|
|
2892
|
+
encoders$1[exports.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder$1(encoders$1)(UpdateConsensusKeySchema$1)(val);
|
|
2893
|
+
encoders$1[exports.CODEC.OP_UPDATE_COMPANION_KEY] = (val) => schemaEncoder$1(encoders$1)(UpdateCompanionKeySchema)(val);
|
|
2894
|
+
encoders$1[exports.CODEC.OP_DRAIN_DELEGATE] = (val) => schemaEncoder$1(encoders$1)(DrainDelegateSchema$1)(val);
|
|
2895
|
+
encoders$1[exports.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder$1(encoders$1)(SmartRollupOriginateSchema$1)(val);
|
|
2896
|
+
encoders$1[exports.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder$1(encoders$1)(SmartRollupAddMessagesSchema$1)(val);
|
|
2897
|
+
encoders$1[exports.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder$1(encoders$1)(SmartRollupExecuteOutboxMessageSchema$1)(val);
|
|
2898
|
+
encoders$1[exports.CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder$1(encoders$1)(DalPublishCommitmentSchema$1)(val);
|
|
2899
|
+
encoders$1[exports.CODEC.MANAGER] = schemaEncoder$1(encoders$1)(ManagerOperationSchema$1);
|
|
2900
|
+
encoders$1[exports.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder$1(encoders$1)(SetDepositsLimitSchema$1)(val);
|
|
2901
|
+
encoders$1[exports.CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder$1(encoders$1)(FailingNoopSchema$1)(val);
|
|
2592
2902
|
|
|
2593
|
-
const
|
|
2903
|
+
const encoders = {
|
|
2594
2904
|
[CODEC.SECRET]: (val) => val,
|
|
2595
2905
|
[CODEC.RAW]: (val) => val,
|
|
2596
2906
|
[CODEC.TZ1]: tz1Encoder,
|
|
@@ -2616,34 +2926,35 @@
|
|
|
2616
2926
|
[CODEC.ENTRYPOINT]: entrypointNameEncoder,
|
|
2617
2927
|
[CODEC.BURN_LIMIT]: burnLimitEncoder,
|
|
2618
2928
|
[CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder,
|
|
2929
|
+
[CODEC.SIGNATURE_PROOF]: signatureProofEncoder,
|
|
2619
2930
|
[CODEC.PVM_KIND]: pvmKindEncoder,
|
|
2620
2931
|
[CODEC.PADDED_BYTES]: paddedBytesEncoder,
|
|
2621
2932
|
[CODEC.SMART_ROLLUP_MESSAGE]: smartRollupMessageEncoder,
|
|
2622
2933
|
[CODEC.SLOT_HEADER]: slotHeaderEncoder,
|
|
2623
2934
|
};
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2935
|
+
encoders[CODEC.OPERATION] = operationEncoder(encoders);
|
|
2936
|
+
encoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encoders)(ActivationSchema)(val);
|
|
2937
|
+
encoders[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encoders)(DelegationSchema)(val);
|
|
2938
|
+
encoders[CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encoders)(TransactionSchema)(val);
|
|
2939
|
+
encoders[CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encoders)(OriginationSchema)(val);
|
|
2940
|
+
encoders[CODEC.OP_BALLOT] = (val) => schemaEncoder(encoders)(BallotSchema)(val);
|
|
2941
|
+
encoders[CODEC.OP_ATTESTATION] = (val) => schemaEncoder(encoders)(AttestationSchema)(val);
|
|
2942
|
+
encoders[CODEC.OP_ATTESTATION_WITH_DAL] = (val) => schemaEncoder(encoders)(AttestationWithDalSchema)(val);
|
|
2943
|
+
encoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encoders)(SeedNonceRevelationSchema)(val);
|
|
2944
|
+
encoders[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encoders)(ProposalsSchema)(val);
|
|
2945
|
+
encoders[CODEC.OP_REVEAL] = (val) => schemaEncoder(encoders)(RevealSchema)(val);
|
|
2946
|
+
encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encoders)(RegisterGlobalConstantSchema)(val);
|
|
2947
|
+
encoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encoders)(TransferTicketSchema)(val);
|
|
2948
|
+
encoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder(encoders)(IncreasePaidStorageSchema)(val);
|
|
2949
|
+
encoders[CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => schemaEncoder(encoders)(UpdateConsensusKeySchema)(val);
|
|
2950
|
+
encoders[CODEC.OP_DRAIN_DELEGATE] = (val) => schemaEncoder(encoders)(DrainDelegateSchema)(val);
|
|
2951
|
+
encoders[CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => schemaEncoder(encoders)(SmartRollupOriginateSchema)(val);
|
|
2952
|
+
encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(val);
|
|
2953
|
+
encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(val);
|
|
2954
|
+
encoders[CODEC.OP_DAL_PUBLISH_COMMITMENT] = (val) => schemaEncoder(encoders)(DalPublishCommitmentSchema)(val);
|
|
2955
|
+
encoders[CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema);
|
|
2956
|
+
encoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encoders)(SetDepositsLimitSchema)(val);
|
|
2957
|
+
encoders[CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder(encoders)(FailingNoopSchema)(val);
|
|
2647
2958
|
|
|
2648
2959
|
const OperationKindMapping = {
|
|
2649
2960
|
activate_account: ActivationSchema$1,
|
|
@@ -2660,6 +2971,7 @@
|
|
|
2660
2971
|
transfer_ticket: TransferTicketSchema$1,
|
|
2661
2972
|
increase_paid_storage: IncreasePaidStorageSchema$1,
|
|
2662
2973
|
update_consensus_key: UpdateConsensusKeySchema$1,
|
|
2974
|
+
update_companion_key: UpdateCompanionKeySchema,
|
|
2663
2975
|
drain_delegate: DrainDelegateSchema$1,
|
|
2664
2976
|
set_deposits_limit: SetDepositsLimitSchema$1,
|
|
2665
2977
|
smart_rollup_originate: SmartRollupOriginateSchema$1,
|
|
@@ -2719,6 +3031,7 @@
|
|
|
2719
3031
|
ProtocolsHash["PsParisCZ"] = "PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi";
|
|
2720
3032
|
ProtocolsHash["PsQuebecn"] = "PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg";
|
|
2721
3033
|
ProtocolsHash["PsRiotuma"] = "PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7";
|
|
3034
|
+
ProtocolsHash["PtSeouLou"] = "PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh";
|
|
2722
3035
|
ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";
|
|
2723
3036
|
})(exports.ProtocolsHash || (exports.ProtocolsHash = {}));
|
|
2724
3037
|
const protoLevel = {
|
|
@@ -2743,6 +3056,7 @@
|
|
|
2743
3056
|
PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi: 20,
|
|
2744
3057
|
PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg: 21,
|
|
2745
3058
|
PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7: 22,
|
|
3059
|
+
PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh: 23,
|
|
2746
3060
|
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 23,
|
|
2747
3061
|
};
|
|
2748
3062
|
function ProtoInferiorTo(a, b) {
|
|
@@ -2751,32 +3065,32 @@
|
|
|
2751
3065
|
|
|
2752
3066
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
2753
3067
|
const VERSION = {
|
|
2754
|
-
"commitHash": "
|
|
2755
|
-
"version": "
|
|
3068
|
+
"commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
|
|
3069
|
+
"version": "23.0.0-beta.0"
|
|
2756
3070
|
};
|
|
2757
3071
|
|
|
2758
3072
|
/**
|
|
2759
3073
|
* @packageDocumentation
|
|
2760
3074
|
* @module @taquito/local-forging
|
|
2761
3075
|
*/
|
|
2762
|
-
const PROTOCOL_CURRENT = exports.ProtocolsHash.
|
|
3076
|
+
const PROTOCOL_CURRENT = exports.ProtocolsHash.PtSeouLou;
|
|
2763
3077
|
function getCodec(codec, _proto) {
|
|
2764
|
-
// use
|
|
2765
|
-
if (_proto === exports.ProtocolsHash.
|
|
3078
|
+
// use encodersProto022 & decodersProto022 if it's rio or prior
|
|
3079
|
+
if (_proto === exports.ProtocolsHash.PsRiotuma || ProtoInferiorTo(_proto, exports.ProtocolsHash.PsRiotuma)) {
|
|
2766
3080
|
return {
|
|
2767
|
-
encoder:
|
|
3081
|
+
encoder: encoders[codec],
|
|
2768
3082
|
decoder: (hex) => {
|
|
2769
3083
|
const consumer = Uint8ArrayConsumer.fromHexString(hex);
|
|
2770
|
-
return
|
|
3084
|
+
return decoders[codec](consumer);
|
|
2771
3085
|
},
|
|
2772
3086
|
};
|
|
2773
3087
|
}
|
|
2774
3088
|
else {
|
|
2775
3089
|
return {
|
|
2776
|
-
encoder: encoders[codec],
|
|
3090
|
+
encoder: encoders$1[codec],
|
|
2777
3091
|
decoder: (hex) => {
|
|
2778
3092
|
const consumer = Uint8ArrayConsumer.fromHexString(hex);
|
|
2779
|
-
return decoders[codec](consumer);
|
|
3093
|
+
return decoders$1[codec](consumer);
|
|
2780
3094
|
},
|
|
2781
3095
|
};
|
|
2782
3096
|
}
|
|
@@ -2823,6 +3137,12 @@
|
|
|
2823
3137
|
else if (content.kind === 'update_consensus_key' && diff[0] === 'proof') {
|
|
2824
3138
|
continue;
|
|
2825
3139
|
}
|
|
3140
|
+
else if (content.kind === 'update_companion_key' && diff[0] === 'proof') {
|
|
3141
|
+
continue;
|
|
3142
|
+
}
|
|
3143
|
+
else if (content.kind === 'reveal' && diff[0] === 'proof') {
|
|
3144
|
+
continue;
|
|
3145
|
+
}
|
|
2826
3146
|
else {
|
|
2827
3147
|
throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
2828
3148
|
}
|
|
@@ -2843,12 +3163,12 @@
|
|
|
2843
3163
|
exports.LocalForger = LocalForger;
|
|
2844
3164
|
exports.Uint8ArrayConsumer = Uint8ArrayConsumer;
|
|
2845
3165
|
exports.VERSION = VERSION;
|
|
2846
|
-
exports.decoders = decoders;
|
|
2847
|
-
exports.encoders = encoders;
|
|
3166
|
+
exports.decoders = decoders$1;
|
|
3167
|
+
exports.encoders = encoders$1;
|
|
2848
3168
|
exports.getCodec = getCodec;
|
|
2849
3169
|
exports.localForger = localForger;
|
|
2850
3170
|
exports.opMapping = opMapping$1;
|
|
2851
|
-
exports.opMappingReverse = opMappingReverse;
|
|
3171
|
+
exports.opMappingReverse = opMappingReverse$1;
|
|
2852
3172
|
|
|
2853
3173
|
}));
|
|
2854
3174
|
//# sourceMappingURL=taquito-local-forging.umd.js.map
|