@taquito/michel-codec 24.2.0-beta.1 → 24.3.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/base58.js +1 -1
- package/dist/lib/binary.js +2 -3
- package/dist/lib/errors.js +7 -7
- package/dist/lib/formatters.js +2 -4
- package/dist/lib/macros.js +9 -6
- package/dist/lib/micheline-emitter.js +4 -8
- package/dist/lib/micheline-parser.js +13 -14
- package/dist/lib/michelson-contract.js +3 -3
- package/dist/lib/michelson-typecheck.js +61 -57
- package/dist/lib/michelson-validator.js +7 -9
- package/dist/lib/scan.js +1 -1
- package/dist/lib/utils.js +12 -10
- package/dist/lib/version.js +2 -2
- package/dist/taquito-michel-codec.es6.js +124 -148
- package/dist/taquito-michel-codec.es6.js.map +1 -1
- package/dist/taquito-michel-codec.umd.js +124 -148
- package/dist/taquito-michel-codec.umd.js.map +1 -1
- package/dist/types/base58.d.ts +1 -1
- package/dist/types/errors.d.ts +7 -7
- package/dist/types/macros.d.ts +1 -1
- package/dist/types/micheline-parser.d.ts +2 -2
- package/dist/types/scan.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -2
- package/package.json +22 -8
- package/LICENSE +0 -202
|
@@ -5,7 +5,7 @@ const sourceReference = Symbol('source_reference');
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @category Error
|
|
8
|
-
*
|
|
8
|
+
* Error that indicates a failure when performing the scan step when parsing Michelson
|
|
9
9
|
*/
|
|
10
10
|
class ScanError extends TaquitoError {
|
|
11
11
|
constructor(src, idx, message) {
|
|
@@ -207,7 +207,7 @@ function ProtoInferiorTo(a, b) {
|
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
* @category Error
|
|
210
|
-
*
|
|
210
|
+
* Error that indicates macros failed to be expanded
|
|
211
211
|
*/
|
|
212
212
|
class MacroError extends TaquitoError {
|
|
213
213
|
constructor(prim, message) {
|
|
@@ -218,11 +218,10 @@ class MacroError extends TaquitoError {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
function assertArgs$1(ex, n) {
|
|
221
|
-
|
|
222
|
-
if ((n === 0 && ex.args === undefined) || ((_a = ex.args) === null || _a === void 0 ? void 0 : _a.length) === n) {
|
|
221
|
+
if ((n === 0 && ex.args === undefined) || ex.args?.length === n) {
|
|
223
222
|
return true;
|
|
224
223
|
}
|
|
225
|
-
throw new MacroError(ex, `macro ${ex.prim} expects ${n} arguments, was given ${
|
|
224
|
+
throw new MacroError(ex, `macro ${ex.prim} expects ${n} arguments, was given ${ex.args?.length}`);
|
|
226
225
|
}
|
|
227
226
|
function assertNoAnnots(ex) {
|
|
228
227
|
if (ex.annots === undefined) {
|
|
@@ -340,7 +339,11 @@ function filterAnnotations(a) {
|
|
|
340
339
|
return { fields, rest };
|
|
341
340
|
}
|
|
342
341
|
function mkPrim({ prim, annots, args }) {
|
|
343
|
-
return
|
|
342
|
+
return {
|
|
343
|
+
prim,
|
|
344
|
+
...(annots && { annots }),
|
|
345
|
+
...(args && { args }),
|
|
346
|
+
};
|
|
344
347
|
}
|
|
345
348
|
const pairRe = /^P[PAI]{3,}R$/;
|
|
346
349
|
const unpairRe = /^UNP[PAI]{2,}R$/;
|
|
@@ -350,7 +353,7 @@ const mapCadrRe = /^MAP_C[AD]+R$/;
|
|
|
350
353
|
const diipRe = /^DI{2,}P$/;
|
|
351
354
|
const duupRe = /^DU+P$/;
|
|
352
355
|
function expandMacros(ex, opt) {
|
|
353
|
-
const proto =
|
|
356
|
+
const proto = opt?.protocol || DefaultProtocol;
|
|
354
357
|
function mayRename(annots) {
|
|
355
358
|
return annots !== undefined ? [{ prim: 'RENAME', annots }] : [];
|
|
356
359
|
}
|
|
@@ -759,7 +762,7 @@ function expandGlobalConstants(ex, hashAndValue) {
|
|
|
759
762
|
|
|
760
763
|
/**
|
|
761
764
|
* @category Error
|
|
762
|
-
*
|
|
765
|
+
* Error that indicates a failure when parsing Micheline expressions
|
|
763
766
|
*/
|
|
764
767
|
class MichelineParseError extends TaquitoError {
|
|
765
768
|
/**
|
|
@@ -775,7 +778,7 @@ class MichelineParseError extends TaquitoError {
|
|
|
775
778
|
}
|
|
776
779
|
/**
|
|
777
780
|
* @category Error
|
|
778
|
-
*
|
|
781
|
+
* Error indicates a failure when parsing Micheline JSON
|
|
779
782
|
*/
|
|
780
783
|
class JSONParseError extends TaquitoError {
|
|
781
784
|
/**
|
|
@@ -832,18 +835,20 @@ class Parser {
|
|
|
832
835
|
this.opt = opt;
|
|
833
836
|
}
|
|
834
837
|
expand(ex) {
|
|
835
|
-
|
|
836
|
-
if (((_a = this.opt) === null || _a === void 0 ? void 0 : _a.expandGlobalConstant) !== undefined && ex.prim === 'constant') {
|
|
838
|
+
if (this.opt?.expandGlobalConstant !== undefined && ex.prim === 'constant') {
|
|
837
839
|
const ret = expandGlobalConstants(ex, this.opt.expandGlobalConstant);
|
|
838
840
|
if (ret !== ex) {
|
|
839
|
-
ret[sourceReference] =
|
|
841
|
+
ret[sourceReference] = {
|
|
842
|
+
...(ex[sourceReference] || { first: 0, last: 0 }),
|
|
843
|
+
globalConstant: ex,
|
|
844
|
+
};
|
|
840
845
|
}
|
|
841
846
|
return ret;
|
|
842
847
|
}
|
|
843
|
-
if (
|
|
848
|
+
if (this.opt?.expandMacros !== undefined ? this.opt?.expandMacros : true) {
|
|
844
849
|
const ret = expandMacros(ex, this.opt);
|
|
845
850
|
if (ret !== ex) {
|
|
846
|
-
ret[sourceReference] =
|
|
851
|
+
ret[sourceReference] = { ...(ex[sourceReference] || { first: 0, last: 0 }), macro: ex };
|
|
847
852
|
}
|
|
848
853
|
return ret;
|
|
849
854
|
}
|
|
@@ -852,7 +857,6 @@ class Parser {
|
|
|
852
857
|
}
|
|
853
858
|
}
|
|
854
859
|
parseListExpr(scanner, start) {
|
|
855
|
-
var _a;
|
|
856
860
|
const ref = {
|
|
857
861
|
first: start.first,
|
|
858
862
|
last: start.last,
|
|
@@ -899,14 +903,13 @@ class Parser {
|
|
|
899
903
|
else {
|
|
900
904
|
ret.args = ret.args || [];
|
|
901
905
|
const arg = this.parseExpr(scanner, tok.value);
|
|
902
|
-
ref.last =
|
|
906
|
+
ref.last = arg[sourceReference]?.last || ref.last;
|
|
903
907
|
ret.args.push(arg);
|
|
904
908
|
}
|
|
905
909
|
}
|
|
906
910
|
return this.expand(ret);
|
|
907
911
|
}
|
|
908
912
|
parseArgs(scanner, start) {
|
|
909
|
-
var _a;
|
|
910
913
|
// Identifier with arguments
|
|
911
914
|
const ref = {
|
|
912
915
|
first: start.first,
|
|
@@ -928,14 +931,13 @@ class Parser {
|
|
|
928
931
|
}
|
|
929
932
|
else {
|
|
930
933
|
const arg = this.parseExpr(scanner, t.value);
|
|
931
|
-
ref.last =
|
|
934
|
+
ref.last = arg[sourceReference]?.last || ref.last;
|
|
932
935
|
p.args = p.args || [];
|
|
933
936
|
p.args.push(arg);
|
|
934
937
|
}
|
|
935
938
|
}
|
|
936
939
|
}
|
|
937
940
|
parseSequenceExpr(scanner, start) {
|
|
938
|
-
var _a, _b;
|
|
939
941
|
const ref = {
|
|
940
942
|
first: start.first,
|
|
941
943
|
last: start.last,
|
|
@@ -970,14 +972,14 @@ class Parser {
|
|
|
970
972
|
else if (tok.value.t === Literal.Ident) {
|
|
971
973
|
// Identifier with arguments
|
|
972
974
|
const [itm, n] = this.parseArgs(scanner, tok.value);
|
|
973
|
-
ref.last =
|
|
975
|
+
ref.last = itm[sourceReference]?.last || ref.last;
|
|
974
976
|
seq.push(this.expand(itm));
|
|
975
977
|
tok = n;
|
|
976
978
|
}
|
|
977
979
|
else {
|
|
978
980
|
// Other
|
|
979
981
|
const ex = this.parseExpr(scanner, tok.value);
|
|
980
|
-
ref.last =
|
|
982
|
+
ref.last = ex[sourceReference]?.last || ref.last;
|
|
981
983
|
seq.push(ex);
|
|
982
984
|
tok = null;
|
|
983
985
|
}
|
|
@@ -1156,9 +1158,8 @@ class Formatter {
|
|
|
1156
1158
|
this.lev = lev;
|
|
1157
1159
|
}
|
|
1158
1160
|
indent(n = 0) {
|
|
1159
|
-
var _a;
|
|
1160
1161
|
let ret = '';
|
|
1161
|
-
if (
|
|
1162
|
+
if (this.opt?.indent !== undefined) {
|
|
1162
1163
|
for (let i = this.lev + n; i > 0; i--) {
|
|
1163
1164
|
ret += this.opt.indent;
|
|
1164
1165
|
}
|
|
@@ -1166,12 +1167,10 @@ class Formatter {
|
|
|
1166
1167
|
return ret;
|
|
1167
1168
|
}
|
|
1168
1169
|
get lf() {
|
|
1169
|
-
|
|
1170
|
-
return ((_a = this.opt) === null || _a === void 0 ? void 0 : _a.newline) || '';
|
|
1170
|
+
return this.opt?.newline || '';
|
|
1171
1171
|
}
|
|
1172
1172
|
get lfsp() {
|
|
1173
|
-
|
|
1174
|
-
return ((_a = this.opt) === null || _a === void 0 ? void 0 : _a.newline) || ' ';
|
|
1173
|
+
return this.opt?.newline || ' ';
|
|
1175
1174
|
}
|
|
1176
1175
|
down(n) {
|
|
1177
1176
|
return new Formatter(this.opt, this.lev + n);
|
|
@@ -1193,8 +1192,7 @@ function isMultiline(node) {
|
|
|
1193
1192
|
return false;
|
|
1194
1193
|
}
|
|
1195
1194
|
function emitExpr(node, f, foldMacros) {
|
|
1196
|
-
|
|
1197
|
-
const macro = (_a = node[sourceReference]) === null || _a === void 0 ? void 0 : _a.macro;
|
|
1195
|
+
const macro = node[sourceReference]?.macro;
|
|
1198
1196
|
if (foldMacros && macro) {
|
|
1199
1197
|
return emitExpr(macro, f, foldMacros);
|
|
1200
1198
|
}
|
|
@@ -1357,7 +1355,7 @@ const K = [
|
|
|
1357
1355
|
];
|
|
1358
1356
|
/**
|
|
1359
1357
|
* @category Error
|
|
1360
|
-
*
|
|
1358
|
+
* Error that indicates a failure when decoding a base58 encoding
|
|
1361
1359
|
*/
|
|
1362
1360
|
class Base58DecodingError extends TaquitoError {
|
|
1363
1361
|
constructor(message) {
|
|
@@ -1528,7 +1526,7 @@ function encodeBase58Check(src) {
|
|
|
1528
1526
|
|
|
1529
1527
|
/**
|
|
1530
1528
|
* @category Error
|
|
1531
|
-
*
|
|
1529
|
+
* Error that indicates an invalid Michelson being passed or used
|
|
1532
1530
|
*/
|
|
1533
1531
|
class InvalidMichelsonError extends ParameterValidationError {
|
|
1534
1532
|
constructor(message) {
|
|
@@ -1539,7 +1537,7 @@ class InvalidMichelsonError extends ParameterValidationError {
|
|
|
1539
1537
|
}
|
|
1540
1538
|
/**
|
|
1541
1539
|
* @category Error
|
|
1542
|
-
*
|
|
1540
|
+
* Error that indicates an invalid type expression being passed or used
|
|
1543
1541
|
*/
|
|
1544
1542
|
class InvalidTypeExpressionError extends ParameterValidationError {
|
|
1545
1543
|
constructor(message) {
|
|
@@ -1550,7 +1548,7 @@ class InvalidTypeExpressionError extends ParameterValidationError {
|
|
|
1550
1548
|
}
|
|
1551
1549
|
/**
|
|
1552
1550
|
* @category Error
|
|
1553
|
-
*
|
|
1551
|
+
* Error that indicates an invalid data expression being passed or used
|
|
1554
1552
|
*/
|
|
1555
1553
|
class InvalidDataExpressionError extends ParameterValidationError {
|
|
1556
1554
|
constructor(message) {
|
|
@@ -1561,7 +1559,7 @@ class InvalidDataExpressionError extends ParameterValidationError {
|
|
|
1561
1559
|
}
|
|
1562
1560
|
/**
|
|
1563
1561
|
* @category Error
|
|
1564
|
-
*
|
|
1562
|
+
* Error that indicates an invalid contract entrypoint being referenced or passed
|
|
1565
1563
|
*/
|
|
1566
1564
|
class InvalidEntrypointError extends ParameterValidationError {
|
|
1567
1565
|
constructor(entrypoint) {
|
|
@@ -1573,7 +1571,7 @@ class InvalidEntrypointError extends ParameterValidationError {
|
|
|
1573
1571
|
}
|
|
1574
1572
|
/**
|
|
1575
1573
|
* @category Error
|
|
1576
|
-
*
|
|
1574
|
+
* Error that indicates a failure happening when trying to encode Tezos ID
|
|
1577
1575
|
*/
|
|
1578
1576
|
class TezosIdEncodeError extends ParameterValidationError {
|
|
1579
1577
|
constructor(message) {
|
|
@@ -1584,7 +1582,7 @@ class TezosIdEncodeError extends ParameterValidationError {
|
|
|
1584
1582
|
}
|
|
1585
1583
|
/**
|
|
1586
1584
|
* @category Error
|
|
1587
|
-
*
|
|
1585
|
+
* Error that indicates a general error happening when trying to create a LongInteger
|
|
1588
1586
|
*/
|
|
1589
1587
|
class LongIntegerError extends TaquitoError {
|
|
1590
1588
|
constructor(message) {
|
|
@@ -1595,7 +1593,7 @@ class LongIntegerError extends TaquitoError {
|
|
|
1595
1593
|
}
|
|
1596
1594
|
/**
|
|
1597
1595
|
* @category Error
|
|
1598
|
-
*
|
|
1596
|
+
* Error that indicates a failure occurring when trying to parse a hex byte
|
|
1599
1597
|
*/
|
|
1600
1598
|
class HexParseError extends TaquitoError {
|
|
1601
1599
|
constructor(hexByte) {
|
|
@@ -1608,12 +1606,11 @@ class HexParseError extends TaquitoError {
|
|
|
1608
1606
|
|
|
1609
1607
|
/**
|
|
1610
1608
|
* @category Error
|
|
1611
|
-
*
|
|
1609
|
+
* Error that indicates a Michelson failure occurring
|
|
1612
1610
|
*/
|
|
1613
1611
|
class MichelsonError extends TaquitoError {
|
|
1614
1612
|
/**
|
|
1615
1613
|
* @param val Value of a AST node caused the error
|
|
1616
|
-
* @param path Path to a node caused the error
|
|
1617
1614
|
* @param message An error message
|
|
1618
1615
|
*/
|
|
1619
1616
|
constructor(val, message) {
|
|
@@ -1719,7 +1716,7 @@ function isDecimal(x) {
|
|
|
1719
1716
|
new LongInteger(x);
|
|
1720
1717
|
return true;
|
|
1721
1718
|
}
|
|
1722
|
-
catch
|
|
1719
|
+
catch {
|
|
1723
1720
|
return false;
|
|
1724
1721
|
}
|
|
1725
1722
|
}
|
|
@@ -1727,7 +1724,7 @@ function isNatural(x) {
|
|
|
1727
1724
|
try {
|
|
1728
1725
|
return new LongInteger(x).sign >= 0;
|
|
1729
1726
|
}
|
|
1730
|
-
catch
|
|
1727
|
+
catch {
|
|
1731
1728
|
return false;
|
|
1732
1729
|
}
|
|
1733
1730
|
}
|
|
@@ -1743,13 +1740,13 @@ function unpackAnnotations(p, opt) {
|
|
|
1743
1740
|
for (const v of p.annots) {
|
|
1744
1741
|
if (v.length !== 0) {
|
|
1745
1742
|
if (!annRe.test(v) ||
|
|
1746
|
-
(!
|
|
1747
|
-
(!
|
|
1743
|
+
(!opt?.specialVar && (v === '@%' || v === '@%%')) ||
|
|
1744
|
+
(!opt?.specialFields && v === '%@')) {
|
|
1748
1745
|
throw new MichelsonError(p, `${p.prim}: unexpected annotation: ${v}`);
|
|
1749
1746
|
}
|
|
1750
1747
|
switch (v[0]) {
|
|
1751
1748
|
case '%':
|
|
1752
|
-
if (
|
|
1749
|
+
if (opt?.emptyFields || v.length > 1) {
|
|
1753
1750
|
field = field || [];
|
|
1754
1751
|
field.push(v);
|
|
1755
1752
|
}
|
|
@@ -1761,7 +1758,7 @@ function unpackAnnotations(p, opt) {
|
|
|
1761
1758
|
}
|
|
1762
1759
|
break;
|
|
1763
1760
|
case '@':
|
|
1764
|
-
if (
|
|
1761
|
+
if (opt?.emptyVar || v.length > 1) {
|
|
1765
1762
|
vars = vars || [];
|
|
1766
1763
|
vars.push(v);
|
|
1767
1764
|
}
|
|
@@ -1842,13 +1839,16 @@ function unpackComb(id, v) {
|
|
|
1842
1839
|
};
|
|
1843
1840
|
return ret;
|
|
1844
1841
|
}
|
|
1845
|
-
return
|
|
1842
|
+
return {
|
|
1843
|
+
...(Array.isArray(vv) ? { prim: id } : vv),
|
|
1844
|
+
args: [
|
|
1846
1845
|
args[0],
|
|
1847
1846
|
{
|
|
1848
1847
|
prim: id,
|
|
1849
1848
|
args: args.slice(1),
|
|
1850
1849
|
},
|
|
1851
|
-
]
|
|
1850
|
+
],
|
|
1851
|
+
};
|
|
1852
1852
|
}
|
|
1853
1853
|
function isPairType(t) {
|
|
1854
1854
|
return Array.isArray(t) || t.prim === 'pair';
|
|
@@ -2104,8 +2104,7 @@ function assertStringOrBytes(ex) {
|
|
|
2104
2104
|
throw new MichelsonValidationError(ex, 'string or bytes literal expected');
|
|
2105
2105
|
}
|
|
2106
2106
|
function assertArgs(ex, n) {
|
|
2107
|
-
|
|
2108
|
-
if ((n === 0 && ex.args === undefined) || ((_a = ex.args) === null || _a === void 0 ? void 0 : _a.length) === n) {
|
|
2107
|
+
if ((n === 0 && ex.args === undefined) || ex.args?.length === n) {
|
|
2109
2108
|
return true;
|
|
2110
2109
|
}
|
|
2111
2110
|
throw new MichelsonValidationError(ex, `${n} arguments expected`);
|
|
@@ -2116,7 +2115,6 @@ function assertArgs(ex, n) {
|
|
|
2116
2115
|
* @param ex An AST node
|
|
2117
2116
|
*/
|
|
2118
2117
|
function assertMichelsonInstruction(ex) {
|
|
2119
|
-
var _a, _b;
|
|
2120
2118
|
if (Array.isArray(ex)) {
|
|
2121
2119
|
for (const n of ex) {
|
|
2122
2120
|
if (!Array.isArray(n) && !isPrim(n)) {
|
|
@@ -2210,7 +2208,7 @@ function assertMichelsonInstruction(ex) {
|
|
|
2210
2208
|
}
|
|
2211
2209
|
break;
|
|
2212
2210
|
case 'DIP':
|
|
2213
|
-
if (
|
|
2211
|
+
if (ex.args?.length === 2) {
|
|
2214
2212
|
/* istanbul ignore else */
|
|
2215
2213
|
if (assertIntLiteral(ex.args[0])) {
|
|
2216
2214
|
assertNatural(ex.args[0]);
|
|
@@ -2220,7 +2218,7 @@ function assertMichelsonInstruction(ex) {
|
|
|
2220
2218
|
assertMichelsonInstruction(ex.args[1]);
|
|
2221
2219
|
}
|
|
2222
2220
|
}
|
|
2223
|
-
else if (
|
|
2221
|
+
else if (ex.args?.length === 1) {
|
|
2224
2222
|
/* istanbul ignore else */
|
|
2225
2223
|
if (assertSeq(ex.args[0])) {
|
|
2226
2224
|
assertMichelsonInstruction(ex.args[0]);
|
|
@@ -2641,7 +2639,7 @@ function isMichelsonScript(ex) {
|
|
|
2641
2639
|
assertMichelsonContract(ex);
|
|
2642
2640
|
return true;
|
|
2643
2641
|
}
|
|
2644
|
-
catch
|
|
2642
|
+
catch {
|
|
2645
2643
|
return false;
|
|
2646
2644
|
}
|
|
2647
2645
|
}
|
|
@@ -2654,7 +2652,7 @@ function isMichelsonData(ex) {
|
|
|
2654
2652
|
assertMichelsonData(ex);
|
|
2655
2653
|
return true;
|
|
2656
2654
|
}
|
|
2657
|
-
catch
|
|
2655
|
+
catch {
|
|
2658
2656
|
return false;
|
|
2659
2657
|
}
|
|
2660
2658
|
}
|
|
@@ -2667,7 +2665,7 @@ function isMichelsonCode(ex) {
|
|
|
2667
2665
|
assertMichelsonInstruction(ex);
|
|
2668
2666
|
return true;
|
|
2669
2667
|
}
|
|
2670
|
-
catch
|
|
2668
|
+
catch {
|
|
2671
2669
|
return false;
|
|
2672
2670
|
}
|
|
2673
2671
|
}
|
|
@@ -2680,7 +2678,7 @@ function isMichelsonType(ex) {
|
|
|
2680
2678
|
assertMichelsonType(ex);
|
|
2681
2679
|
return true;
|
|
2682
2680
|
}
|
|
2683
|
-
catch
|
|
2681
|
+
catch {
|
|
2684
2682
|
return false;
|
|
2685
2683
|
}
|
|
2686
2684
|
}
|
|
@@ -2704,40 +2702,6 @@ function assertDataListIfAny(d) {
|
|
|
2704
2702
|
return true;
|
|
2705
2703
|
}
|
|
2706
2704
|
|
|
2707
|
-
/******************************************************************************
|
|
2708
|
-
Copyright (c) Microsoft Corporation.
|
|
2709
|
-
|
|
2710
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2711
|
-
purpose with or without fee is hereby granted.
|
|
2712
|
-
|
|
2713
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2714
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2715
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2716
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2717
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2718
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2719
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2720
|
-
***************************************************************************** */
|
|
2721
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
function __rest(s, e) {
|
|
2725
|
-
var t = {};
|
|
2726
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2727
|
-
t[p] = s[p];
|
|
2728
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2729
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2730
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2731
|
-
t[p[i]] = s[p[i]];
|
|
2732
|
-
}
|
|
2733
|
-
return t;
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2737
|
-
var e = new Error(message);
|
|
2738
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2739
|
-
};
|
|
2740
|
-
|
|
2741
2705
|
// The order is important!
|
|
2742
2706
|
// The position represent the encoding value.
|
|
2743
2707
|
const primitives = [
|
|
@@ -3168,7 +3132,6 @@ function writePublicKey(pk, w) {
|
|
|
3168
3132
|
w.writeBytes(Array.from(pk.publicKey));
|
|
3169
3133
|
}
|
|
3170
3134
|
function writeExpr(expr, wr, tf) {
|
|
3171
|
-
var _a, _b;
|
|
3172
3135
|
const [e, args] = tf(expr);
|
|
3173
3136
|
if (Array.isArray(e)) {
|
|
3174
3137
|
const w = new Writer();
|
|
@@ -3226,9 +3189,9 @@ function writeExpr(expr, wr, tf) {
|
|
|
3226
3189
|
if (prim === undefined) {
|
|
3227
3190
|
throw new TypeError(`Can't encode primary: ${e.prim}`);
|
|
3228
3191
|
}
|
|
3229
|
-
const tag = (
|
|
3192
|
+
const tag = (e.args?.length || 0) < 3
|
|
3230
3193
|
? Tag.Prim0 +
|
|
3231
|
-
(
|
|
3194
|
+
(e.args?.length || 0) * 2 +
|
|
3232
3195
|
(e.annots === undefined || e.annots.length === 0 ? 0 : 1)
|
|
3233
3196
|
: Tag.Prim;
|
|
3234
3197
|
wr.writeUint8(tag);
|
|
@@ -4073,19 +4036,18 @@ function assertStacksEqual(a, b) {
|
|
|
4073
4036
|
}
|
|
4074
4037
|
}
|
|
4075
4038
|
function assertTypeAnnotationsValid(t, field = false) {
|
|
4076
|
-
var _a, _b, _c;
|
|
4077
4039
|
if (!Array.isArray(t)) {
|
|
4078
4040
|
const ann = unpackAnnotations(t);
|
|
4079
|
-
if ((
|
|
4041
|
+
if ((ann.t?.length || 0) > 1) {
|
|
4080
4042
|
throw new MichelsonTypeError(t, `${t.prim}: at most one type annotation allowed: ${t.annots}`, undefined);
|
|
4081
4043
|
}
|
|
4082
4044
|
if (field) {
|
|
4083
|
-
if ((
|
|
4045
|
+
if ((ann.f?.length || 0) > 1) {
|
|
4084
4046
|
throw new MichelsonTypeError(t, `${t.prim}: at most one field annotation allowed: ${t.annots}`, undefined);
|
|
4085
4047
|
}
|
|
4086
4048
|
}
|
|
4087
4049
|
else {
|
|
4088
|
-
if ((
|
|
4050
|
+
if ((ann.f?.length || 0) > 0) {
|
|
4089
4051
|
throw new MichelsonTypeError(t, `${t.prim}: field annotations aren't allowed: ${t.annots}`, undefined);
|
|
4090
4052
|
}
|
|
4091
4053
|
}
|
|
@@ -4359,7 +4321,7 @@ function instructionListType(inst, stack, ctx) {
|
|
|
4359
4321
|
i !== inst.length - 1) {
|
|
4360
4322
|
throw new MichelsonInstructionError(inst, ret, 'FAIL must appear in a tail position');
|
|
4361
4323
|
}
|
|
4362
|
-
if (
|
|
4324
|
+
if (ctx?.traceCallback !== undefined) {
|
|
4363
4325
|
const trace = {
|
|
4364
4326
|
op: inst,
|
|
4365
4327
|
in: stack,
|
|
@@ -4370,7 +4332,7 @@ function instructionListType(inst, stack, ctx) {
|
|
|
4370
4332
|
return 'failed' in ret ? { failed: ret.failed, level: ret.level + 1 } : ret;
|
|
4371
4333
|
}
|
|
4372
4334
|
function functionTypeInternal(inst, stack, ctx) {
|
|
4373
|
-
const proto =
|
|
4335
|
+
const proto = ctx?.protocol || DefaultProtocol;
|
|
4374
4336
|
if (Array.isArray(inst)) {
|
|
4375
4337
|
return instructionListType(inst, stack, ctx);
|
|
4376
4338
|
}
|
|
@@ -4435,7 +4397,11 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4435
4397
|
const ensureBigMapStorableType = rethrowTypeGuard(assertMichelsonBigMapStorableType);
|
|
4436
4398
|
// unpack instruction annotations and assert their maximum number
|
|
4437
4399
|
function instructionAnn(num, opt) {
|
|
4438
|
-
const a = argAnn(instruction,
|
|
4400
|
+
const a = argAnn(instruction, {
|
|
4401
|
+
...opt,
|
|
4402
|
+
emptyFields: num.f !== undefined && num.f > 1,
|
|
4403
|
+
emptyVar: num.v !== undefined && num.v > 1,
|
|
4404
|
+
});
|
|
4439
4405
|
const assertNum = (a, n, type) => {
|
|
4440
4406
|
if (a && a.length > (n || 0)) {
|
|
4441
4407
|
throw new MichelsonInstructionError(instruction, stack, `${instruction.prim}: at most ${n || 0} ${type} annotations allowed`);
|
|
@@ -4458,8 +4424,8 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4458
4424
|
...((a.f === null ? src.f : a.f) || []),
|
|
4459
4425
|
]
|
|
4460
4426
|
: undefined;
|
|
4461
|
-
const { annots: _annots
|
|
4462
|
-
return
|
|
4427
|
+
const { annots: _annots, ...rest } = t;
|
|
4428
|
+
return { ...rest, ...(ann && ann.length !== 0 && { annots: ann }) };
|
|
4463
4429
|
}
|
|
4464
4430
|
// shortcut to copy at most one variable annotation from the instruction to the type
|
|
4465
4431
|
function annotateVar(t, def) {
|
|
@@ -4471,17 +4437,16 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4471
4437
|
}
|
|
4472
4438
|
// annotate CAR/CDR/UNPAIR/GET
|
|
4473
4439
|
function annotateField(arg, field, insAnn, n, defField) {
|
|
4474
|
-
|
|
4475
|
-
const
|
|
4476
|
-
const insFieldAnn = (_b = insAnn.f) === null || _b === void 0 ? void 0 : _b[n];
|
|
4440
|
+
const fieldAnn = argAnn(field).f?.[0]; // field's field annotation
|
|
4441
|
+
const insFieldAnn = insAnn.f?.[n];
|
|
4477
4442
|
if (insFieldAnn !== undefined &&
|
|
4478
4443
|
insFieldAnn !== '%' &&
|
|
4479
4444
|
fieldAnn !== undefined &&
|
|
4480
4445
|
insFieldAnn !== fieldAnn) {
|
|
4481
4446
|
throw new MichelsonInstructionError(instruction, stack, `${instruction.prim}: field names doesn't match: ${insFieldAnn} !== ${fieldAnn}`);
|
|
4482
4447
|
}
|
|
4483
|
-
const insVarAnn =
|
|
4484
|
-
const varAnn =
|
|
4448
|
+
const insVarAnn = insAnn.v?.[n]; // nth instruction's variable annotation
|
|
4449
|
+
const varAnn = argAnn(arg).v?.[0]; // instruction argument's variable annotation
|
|
4485
4450
|
return annotate(field, {
|
|
4486
4451
|
t: null,
|
|
4487
4452
|
v: insVarAnn
|
|
@@ -4539,14 +4504,23 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4539
4504
|
}
|
|
4540
4505
|
const p = unpackComb('pair', src);
|
|
4541
4506
|
if (i === 1) {
|
|
4542
|
-
return
|
|
4507
|
+
return {
|
|
4508
|
+
...p,
|
|
4509
|
+
args: [x, p.args[1]],
|
|
4510
|
+
};
|
|
4543
4511
|
}
|
|
4544
4512
|
const right = p.args[1];
|
|
4545
4513
|
if (isPairType(right)) {
|
|
4546
|
-
return
|
|
4514
|
+
return {
|
|
4515
|
+
...p,
|
|
4516
|
+
args: [p.args[0], updateNth(right, x, n, i - 2)],
|
|
4517
|
+
};
|
|
4547
4518
|
}
|
|
4548
4519
|
else if (i === 2) {
|
|
4549
|
-
return
|
|
4520
|
+
return {
|
|
4521
|
+
...p,
|
|
4522
|
+
args: [p.args[0], x],
|
|
4523
|
+
};
|
|
4550
4524
|
}
|
|
4551
4525
|
throw new MichelsonInstructionError(instruction, stack, `${instruction.prim}: at least ${n + 1} fields are expected`);
|
|
4552
4526
|
}
|
|
@@ -4563,7 +4537,6 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4563
4537
|
}
|
|
4564
4538
|
}
|
|
4565
4539
|
const retStack = ((instruction) => {
|
|
4566
|
-
var _a, _b, _c, _d, _e;
|
|
4567
4540
|
switch (instruction.prim) {
|
|
4568
4541
|
case 'DUP': {
|
|
4569
4542
|
const n = instruction.args ? parseInt(instruction.args[0].int, 10) : 1;
|
|
@@ -4600,12 +4573,11 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4600
4573
|
return s.slice(i > 0 ? i + 1 : 1);
|
|
4601
4574
|
};
|
|
4602
4575
|
const retArgs = s.map((v, i) => {
|
|
4603
|
-
var _a;
|
|
4604
4576
|
const va = argAnn(v);
|
|
4605
4577
|
const f = ia.f && ia.f.length > i && ia.f[i] !== '%'
|
|
4606
4578
|
? ia.f[i] === '%@'
|
|
4607
4579
|
? va.v
|
|
4608
|
-
? ['%' + trim(
|
|
4580
|
+
? ['%' + trim(va.v?.[0] || '')]
|
|
4609
4581
|
: undefined
|
|
4610
4582
|
: [ia.f[i]]
|
|
4611
4583
|
: undefined;
|
|
@@ -4718,24 +4690,24 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4718
4690
|
ensureComparableType(s[0]);
|
|
4719
4691
|
ensureTypesEqual(s[0], s[2].args[0]);
|
|
4720
4692
|
ensureTypesEqual(s[1].args[0], s[2].args[1]);
|
|
4721
|
-
const va =
|
|
4693
|
+
const va = ia.v?.map((v) => (v !== '@' ? [v] : undefined));
|
|
4722
4694
|
if (s[2].prim === 'map') {
|
|
4723
4695
|
return [
|
|
4724
|
-
annotate({ prim: 'option', args: [s[2].args[1]] }, { v: va
|
|
4696
|
+
annotate({ prim: 'option', args: [s[2].args[1]] }, { v: va?.[0] }),
|
|
4725
4697
|
annotate({
|
|
4726
4698
|
prim: 'map',
|
|
4727
4699
|
args: [annotate(s[0], { t: null }), annotate(s[1].args[0], { t: null })],
|
|
4728
|
-
}, { v: va
|
|
4700
|
+
}, { v: va?.[1] }),
|
|
4729
4701
|
...stack.slice(3),
|
|
4730
4702
|
];
|
|
4731
4703
|
}
|
|
4732
4704
|
ensureBigMapStorableType(s[1].args[0]);
|
|
4733
4705
|
return [
|
|
4734
|
-
annotate({ prim: 'option', args: [s[2].args[1]] }, { v: va
|
|
4706
|
+
annotate({ prim: 'option', args: [s[2].args[1]] }, { v: va?.[0] }),
|
|
4735
4707
|
annotate({
|
|
4736
4708
|
prim: 'big_map',
|
|
4737
4709
|
args: [annotate(s[0], { t: null }), annotate(s[1].args[0], { t: null })],
|
|
4738
|
-
}, { v: va
|
|
4710
|
+
}, { v: va?.[1] }),
|
|
4739
4711
|
...stack.slice(3),
|
|
4740
4712
|
];
|
|
4741
4713
|
}
|
|
@@ -4943,11 +4915,11 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
4943
4915
|
args(0, ['int']);
|
|
4944
4916
|
return [annotateVar({ prim: 'bool' }), ...stack.slice(1)];
|
|
4945
4917
|
case 'SELF': {
|
|
4946
|
-
if (
|
|
4918
|
+
if (ctx?.contract === undefined) {
|
|
4947
4919
|
throw new MichelsonInstructionError(instruction, stack, `${instruction.prim}: contract required`);
|
|
4948
4920
|
}
|
|
4949
4921
|
const ia = instructionAnn({ f: 1, v: 1 });
|
|
4950
|
-
const ep = contractEntryPoint(ctx.contract,
|
|
4922
|
+
const ep = contractEntryPoint(ctx.contract, ia.f?.[0]);
|
|
4951
4923
|
if (ep === null) {
|
|
4952
4924
|
throw new MichelsonInstructionError(instruction, stack, `${instruction.prim}: contract has no entrypoint ${ep}`);
|
|
4953
4925
|
}
|
|
@@ -5004,7 +4976,7 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
5004
4976
|
}
|
|
5005
4977
|
case 'SELF_ADDRESS': {
|
|
5006
4978
|
const addr = { prim: 'address' };
|
|
5007
|
-
if (
|
|
4979
|
+
if (ctx?.contract !== undefined) {
|
|
5008
4980
|
addr[refContract] = {
|
|
5009
4981
|
prim: 'contract',
|
|
5010
4982
|
args: [contractSection(ctx.contract, 'parameter').args[0]],
|
|
@@ -5085,7 +5057,7 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
5085
5057
|
const ia = instructionAnn({ v: 1, f: 1 });
|
|
5086
5058
|
const contract = s[refContract];
|
|
5087
5059
|
if (contract !== undefined) {
|
|
5088
|
-
const ep = contractEntryPoint(contract,
|
|
5060
|
+
const ep = contractEntryPoint(contract, ia.f?.[0]);
|
|
5089
5061
|
if (ep === null) {
|
|
5090
5062
|
throw new MichelsonInstructionError(instruction, stack, `${instruction.prim}: contract has no entrypoint ${ep}`);
|
|
5091
5063
|
}
|
|
@@ -5235,22 +5207,25 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
5235
5207
|
assertContractValid(instruction.args[0]);
|
|
5236
5208
|
assertScalarTypesEqual(contractSection(instruction.args[0], 'storage').args[0], s[2]);
|
|
5237
5209
|
}
|
|
5238
|
-
const va =
|
|
5210
|
+
const va = ia.v?.map((v) => (v !== '@' ? [v] : undefined));
|
|
5239
5211
|
return [
|
|
5240
|
-
annotate({ prim: 'operation' }, { v: va
|
|
5212
|
+
annotate({ prim: 'operation' }, { v: va?.[0] }),
|
|
5241
5213
|
annotate({
|
|
5242
5214
|
prim: 'address',
|
|
5243
5215
|
[refContract]: {
|
|
5244
5216
|
prim: 'contract',
|
|
5245
5217
|
args: [contractSection(instruction.args[0], 'parameter').args[0]],
|
|
5246
5218
|
},
|
|
5247
|
-
}, { v: va
|
|
5219
|
+
}, { v: va?.[1] }),
|
|
5248
5220
|
...stack.slice(3),
|
|
5249
5221
|
];
|
|
5250
5222
|
}
|
|
5251
5223
|
case 'PUSH':
|
|
5252
5224
|
assertTypeAnnotationsValid(instruction.args[0]);
|
|
5253
|
-
assertDataValidInternal(instruction.args[1], instruction.args[0],
|
|
5225
|
+
assertDataValidInternal(instruction.args[1], instruction.args[0], {
|
|
5226
|
+
...ctx,
|
|
5227
|
+
contract: undefined,
|
|
5228
|
+
});
|
|
5254
5229
|
return [annotateVar(instruction.args[0]), ...stack];
|
|
5255
5230
|
case 'EMPTY_SET':
|
|
5256
5231
|
assertTypeAnnotationsValid(instruction.args[0]);
|
|
@@ -5284,7 +5259,10 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
5284
5259
|
if (instruction.prim === 'LAMBDA_REC') {
|
|
5285
5260
|
s.push({ prim: 'lambda', args: [instruction.args[0], instruction.args[1]] });
|
|
5286
5261
|
}
|
|
5287
|
-
const body = functionTypeInternal(instruction.args[2], s,
|
|
5262
|
+
const body = functionTypeInternal(instruction.args[2], s, {
|
|
5263
|
+
...ctx,
|
|
5264
|
+
contract: undefined,
|
|
5265
|
+
});
|
|
5288
5266
|
if ('failed' in body) {
|
|
5289
5267
|
return { failed: body.failed, level: body.level + 1 };
|
|
5290
5268
|
}
|
|
@@ -5360,13 +5338,13 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
5360
5338
|
case 'READ_TICKET': {
|
|
5361
5339
|
const ia = instructionAnn({ v: 2 });
|
|
5362
5340
|
const s = args(0, ['ticket'])[0];
|
|
5363
|
-
const va =
|
|
5341
|
+
const va = ia.v?.map((v) => (v !== '@' ? [v] : undefined));
|
|
5364
5342
|
return [
|
|
5365
5343
|
annotate({
|
|
5366
5344
|
prim: 'pair',
|
|
5367
5345
|
args: [{ prim: 'address' }, annotate(s.args[0], { t: null }), { prim: 'nat' }],
|
|
5368
|
-
}, { v: va
|
|
5369
|
-
annotate(s, { v: va
|
|
5346
|
+
}, { v: va?.[0] }),
|
|
5347
|
+
annotate(s, { v: va?.[1], t: null }),
|
|
5370
5348
|
...stack.slice(1),
|
|
5371
5349
|
];
|
|
5372
5350
|
}
|
|
@@ -5461,7 +5439,7 @@ function functionTypeInternal(inst, stack, ctx) {
|
|
|
5461
5439
|
throw new MichelsonError(instruction, `unexpected instruction: ${instruction.prim}`);
|
|
5462
5440
|
}
|
|
5463
5441
|
})(instruction);
|
|
5464
|
-
if (
|
|
5442
|
+
if (ctx?.traceCallback !== undefined) {
|
|
5465
5443
|
const trace = {
|
|
5466
5444
|
op: instruction,
|
|
5467
5445
|
in: stack,
|
|
@@ -5541,11 +5519,11 @@ function assertContractValid(contract, ctx) {
|
|
|
5541
5519
|
const arg = {
|
|
5542
5520
|
prim: 'pair',
|
|
5543
5521
|
args: [
|
|
5544
|
-
|
|
5545
|
-
|
|
5522
|
+
{ ...parameter, ...{ annots: ['@parameter'] } },
|
|
5523
|
+
{ ...storage, ...{ annots: ['@storage'] } },
|
|
5546
5524
|
],
|
|
5547
5525
|
};
|
|
5548
|
-
const out = functionTypeInternal(code, [arg],
|
|
5526
|
+
const out = functionTypeInternal(code, [arg], { ...ctx, ...{ contract } });
|
|
5549
5527
|
if ('failed' in out) {
|
|
5550
5528
|
return out;
|
|
5551
5529
|
}
|
|
@@ -5584,7 +5562,7 @@ function functionType(inst, stack, ctx) {
|
|
|
5584
5562
|
for (const t of stack) {
|
|
5585
5563
|
assertTypeAnnotationsValid(t);
|
|
5586
5564
|
}
|
|
5587
|
-
if (
|
|
5565
|
+
if (ctx?.contract !== undefined) {
|
|
5588
5566
|
for (const typesec of ['parameter', 'storage']) {
|
|
5589
5567
|
const sec = contractSection(ctx.contract, typesec).args[0];
|
|
5590
5568
|
assertTypeAnnotationsValid(sec);
|
|
@@ -5613,7 +5591,7 @@ function isTypeAnnotationsValid(t, field = false) {
|
|
|
5613
5591
|
assertTypeAnnotationsValid(t, field);
|
|
5614
5592
|
return true;
|
|
5615
5593
|
}
|
|
5616
|
-
catch
|
|
5594
|
+
catch {
|
|
5617
5595
|
return false;
|
|
5618
5596
|
}
|
|
5619
5597
|
}
|
|
@@ -5621,7 +5599,7 @@ function isContractValid(contract, ctx) {
|
|
|
5621
5599
|
try {
|
|
5622
5600
|
return assertContractValid(contract, ctx);
|
|
5623
5601
|
}
|
|
5624
|
-
catch
|
|
5602
|
+
catch {
|
|
5625
5603
|
return null;
|
|
5626
5604
|
}
|
|
5627
5605
|
}
|
|
@@ -5630,7 +5608,7 @@ function isDataValid(d, t, ctx) {
|
|
|
5630
5608
|
assertDataValid(d, t, ctx);
|
|
5631
5609
|
return true;
|
|
5632
5610
|
}
|
|
5633
|
-
catch
|
|
5611
|
+
catch {
|
|
5634
5612
|
return false;
|
|
5635
5613
|
}
|
|
5636
5614
|
}
|
|
@@ -5639,7 +5617,7 @@ function isTypeEqual(a, b, field = false) {
|
|
|
5639
5617
|
assertTypesEqual(a, b, field);
|
|
5640
5618
|
return true;
|
|
5641
5619
|
}
|
|
5642
|
-
catch
|
|
5620
|
+
catch {
|
|
5643
5621
|
return false;
|
|
5644
5622
|
}
|
|
5645
5623
|
}
|
|
@@ -5647,7 +5625,7 @@ function isTypeEqual(a, b, field = false) {
|
|
|
5647
5625
|
class Contract {
|
|
5648
5626
|
constructor(contract, opt) {
|
|
5649
5627
|
this.contract = contract;
|
|
5650
|
-
this.ctx =
|
|
5628
|
+
this.ctx = { contract, ...opt };
|
|
5651
5629
|
this.output = assertContractValid(contract, this.ctx);
|
|
5652
5630
|
}
|
|
5653
5631
|
static parse(src, opt) {
|
|
@@ -5701,7 +5679,7 @@ class Contract {
|
|
|
5701
5679
|
assertParameterValid(ep, d) {
|
|
5702
5680
|
const t = this.entryPoint(ep || undefined);
|
|
5703
5681
|
if (t === null) {
|
|
5704
|
-
throw new InvalidEntrypointError(ep
|
|
5682
|
+
throw new InvalidEntrypointError(ep?.toString());
|
|
5705
5683
|
}
|
|
5706
5684
|
this.assertDataValid(d, t);
|
|
5707
5685
|
}
|
|
@@ -5710,7 +5688,7 @@ class Contract {
|
|
|
5710
5688
|
this.assertParameterValid(ep, d);
|
|
5711
5689
|
return true;
|
|
5712
5690
|
}
|
|
5713
|
-
catch
|
|
5691
|
+
catch {
|
|
5714
5692
|
return false;
|
|
5715
5693
|
}
|
|
5716
5694
|
}
|
|
@@ -5741,11 +5719,10 @@ function formatStack(s) {
|
|
|
5741
5719
|
}
|
|
5742
5720
|
function traceDumpFunc(blocks, cb) {
|
|
5743
5721
|
return (v) => {
|
|
5744
|
-
var _a;
|
|
5745
5722
|
if (Array.isArray(v) && !blocks) {
|
|
5746
5723
|
return;
|
|
5747
5724
|
}
|
|
5748
|
-
const macro =
|
|
5725
|
+
const macro = v.op[sourceReference]?.macro;
|
|
5749
5726
|
const msg = `${macro ? 'Macro' : 'Op'}: ${macro ? emitMicheline(macro, undefined, true) + ' / ' : ''}${emitMicheline(v.op)}
|
|
5750
5727
|
Input:
|
|
5751
5728
|
${formatStack(v.in)}
|
|
@@ -5756,9 +5733,8 @@ ${formatStack(v.out)}
|
|
|
5756
5733
|
};
|
|
5757
5734
|
}
|
|
5758
5735
|
function formatError(err) {
|
|
5759
|
-
var _a;
|
|
5760
5736
|
if (err instanceof MichelsonInstructionError) {
|
|
5761
|
-
const macro =
|
|
5737
|
+
const macro = err.val[sourceReference]?.macro;
|
|
5762
5738
|
return `${macro ? 'Macro' : 'Op'}: ${macro ? emitMicheline(macro, undefined, true) + ' / ' : ''}${emitMicheline(err.val)}
|
|
5763
5739
|
Stack:
|
|
5764
5740
|
${formatStack(err.stackState)}
|
|
@@ -5782,8 +5758,8 @@ ${err.data
|
|
|
5782
5758
|
|
|
5783
5759
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
|
|
5784
5760
|
const VERSION = {
|
|
5785
|
-
"commitHash": "
|
|
5786
|
-
"version": "24.
|
|
5761
|
+
"commitHash": "27675679db6515e8b092195ef5c58c2c0ea5f5c8",
|
|
5762
|
+
"version": "24.3.0-beta.0"
|
|
5787
5763
|
};
|
|
5788
5764
|
|
|
5789
5765
|
export { Contract, DefaultProtocol, JSONParseError, MacroError, MichelineParseError, MichelsonError, MichelsonInstructionError, MichelsonTypeError, MichelsonValidationError, Parser, ProtoGreaterOrEqual, ProtoInferiorTo, Protocol, VERSION, assertContractValid, assertDataListIfAny, assertDataValid, assertMichelsonBigMapStorableType, assertMichelsonComparableType, assertMichelsonContract, assertMichelsonData, assertMichelsonInstruction, assertMichelsonPackableType, assertMichelsonPassableType, assertMichelsonPushableType, assertMichelsonStorableType, assertMichelsonType, assertTypeAnnotationsValid, assertTypesEqual, assertViewNameValid, contractEntryPoint, contractEntryPoints, contractSection, contractViews, decodeAddressBytes, decodePublicKeyBytes, decodePublicKeyHashBytes, dummyContract, emitMicheline, formatError, formatStack, functionType, instructionIDs, isContractValid, isDataValid, isInstruction, isMichelsonCode, isMichelsonData, isMichelsonError, isMichelsonScript, isMichelsonType, isTypeAnnotationsValid, isTypeEqual, packData, packDataBytes, refContract, sourceReference, traceDumpFunc, unpackData, unpackDataBytes };
|