@taquito/michel-codec 17.3.2 → 17.4.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 +0 -1
- package/dist/lib/binary.js +39 -40
- package/dist/lib/errors.js +0 -1
- package/dist/lib/formatters.js +9 -10
- package/dist/lib/global-constants.js +0 -1
- package/dist/lib/macros.js +2 -3
- package/dist/lib/micheline-emitter.js +0 -1
- package/dist/lib/micheline-parser.js +7 -8
- package/dist/lib/micheline.js +0 -1
- package/dist/lib/michelson-contract.js +11 -12
- package/dist/lib/michelson-typecheck.js +57 -58
- package/dist/lib/michelson-types.js +1 -4
- package/dist/lib/michelson-validator.js +0 -1
- package/dist/lib/scan.js +1 -2
- package/dist/lib/taquito-michel-codec.js +5 -2
- package/dist/lib/utils.js +10 -11
- package/dist/lib/version.js +2 -3
- package/dist/taquito-michel-codec.es6.js +5656 -5656
- package/dist/taquito-michel-codec.es6.js.map +1 -1
- package/dist/taquito-michel-codec.umd.js +5656 -5658
- package/dist/taquito-michel-codec.umd.js.map +1 -1
- package/dist/types/base58.d.ts +13 -13
- package/dist/types/binary.d.ts +127 -127
- package/dist/types/errors.d.ts +57 -57
- package/dist/types/formatters.d.ts +6 -6
- package/dist/types/global-constants.d.ts +3 -3
- package/dist/types/macros.d.ts +13 -13
- package/dist/types/micheline-emitter.d.ts +17 -17
- package/dist/types/micheline-parser.d.ts +130 -130
- package/dist/types/micheline.d.ts +44 -44
- package/dist/types/michelson-contract.d.ts +24 -24
- package/dist/types/michelson-typecheck.d.ts +38 -38
- package/dist/types/michelson-types.d.ts +134 -136
- package/dist/types/michelson-validator.d.ts +66 -66
- package/dist/types/scan.d.ts +26 -26
- package/dist/types/taquito-michel-codec.d.ts +16 -16
- package/dist/types/utils.d.ts +77 -77
- package/dist/types/version.d.ts +4 -4
- package/package.json +24 -26
- package/signature.json +28 -10
- package/dist/lib/base58.js.map +0 -1
- package/dist/lib/binary.js.map +0 -1
- package/dist/lib/errors.js.map +0 -1
- package/dist/lib/formatters.js.map +0 -1
- package/dist/lib/global-constants.js.map +0 -1
- package/dist/lib/macros.js.map +0 -1
- package/dist/lib/micheline-emitter.js.map +0 -1
- package/dist/lib/micheline-parser.js.map +0 -1
- package/dist/lib/micheline.js.map +0 -1
- package/dist/lib/michelson-contract.js.map +0 -1
- package/dist/lib/michelson-typecheck.js.map +0 -1
- package/dist/lib/michelson-types.js.map +0 -1
- package/dist/lib/michelson-validator.js.map +0 -1
- package/dist/lib/scan.js.map +0 -1
- package/dist/lib/taquito-michel-codec.js.map +0 -1
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/version.js.map +0 -1
package/dist/lib/base58.js
CHANGED
package/dist/lib/binary.js
CHANGED
|
@@ -477,7 +477,7 @@ function writeExpr(expr, wr, tf) {
|
|
|
477
477
|
return;
|
|
478
478
|
}
|
|
479
479
|
if ('bytes' in e) {
|
|
480
|
-
const bytes = utils_1.parseHex(e.bytes);
|
|
480
|
+
const bytes = (0, utils_1.parseHex)(e.bytes);
|
|
481
481
|
wr.writeUint8(Tag.Bytes);
|
|
482
482
|
wr.writeUint32(bytes.length);
|
|
483
483
|
wr.writeBytes(bytes);
|
|
@@ -568,7 +568,7 @@ function readExpr(rd, tf) {
|
|
|
568
568
|
case Tag.Bytes: {
|
|
569
569
|
const length = rd.readUint32();
|
|
570
570
|
const bytes = rd.readBytes(length);
|
|
571
|
-
const hex = utils_1.hexBytes(Array.from(bytes));
|
|
571
|
+
const hex = (0, utils_1.hexBytes)(Array.from(bytes));
|
|
572
572
|
return tr({ bytes: hex });
|
|
573
573
|
}
|
|
574
574
|
case Tag.Sequence: {
|
|
@@ -651,15 +651,15 @@ function readExpr(rd, tf) {
|
|
|
651
651
|
const isOrData = (e) => 'prim' in e && (e.prim === 'Left' || e.prim === 'Right');
|
|
652
652
|
const isOptionData = (e) => 'prim' in e && (e.prim === 'Some' || e.prim === 'None');
|
|
653
653
|
const getWriteTransformFunc = (t) => {
|
|
654
|
-
if (utils_1.isPairType(t)) {
|
|
654
|
+
if ((0, utils_1.isPairType)(t)) {
|
|
655
655
|
return (d) => {
|
|
656
|
-
if (!utils_1.isPairData(d)) {
|
|
656
|
+
if (!(0, utils_1.isPairData)(d)) {
|
|
657
657
|
throw new utils_1.MichelsonTypeError(t, `pair expected: ${JSON.stringify(d)}`, d);
|
|
658
658
|
}
|
|
659
|
-
michelson_validator_1.assertDataListIfAny(d);
|
|
659
|
+
(0, michelson_validator_1.assertDataListIfAny)(d);
|
|
660
660
|
// combs aren't used in pack format
|
|
661
|
-
const tc = utils_1.unpackComb('pair', t);
|
|
662
|
-
const dc = utils_1.unpackComb('Pair', d);
|
|
661
|
+
const tc = (0, utils_1.unpackComb)('pair', t);
|
|
662
|
+
const dc = (0, utils_1.unpackComb)('Pair', d);
|
|
663
663
|
return [
|
|
664
664
|
dc,
|
|
665
665
|
(function* () {
|
|
@@ -749,11 +749,11 @@ const getWriteTransformFunc = (t) => {
|
|
|
749
749
|
}
|
|
750
750
|
let bytes;
|
|
751
751
|
if ('string' in d) {
|
|
752
|
-
const id = utils_1.checkDecodeTezosID(d.string, 'ChainID');
|
|
752
|
+
const id = (0, utils_1.checkDecodeTezosID)(d.string, 'ChainID');
|
|
753
753
|
if (id === null) {
|
|
754
754
|
throw new utils_1.MichelsonTypeError(t, `chain id base58 expected: ${d.string}`, d);
|
|
755
755
|
}
|
|
756
|
-
bytes = { bytes: utils_1.hexBytes(id[1]) };
|
|
756
|
+
bytes = { bytes: (0, utils_1.hexBytes)(id[1]) };
|
|
757
757
|
}
|
|
758
758
|
else {
|
|
759
759
|
bytes = d;
|
|
@@ -767,11 +767,11 @@ const getWriteTransformFunc = (t) => {
|
|
|
767
767
|
}
|
|
768
768
|
let bytes;
|
|
769
769
|
if ('string' in d) {
|
|
770
|
-
const sig = utils_1.checkDecodeTezosID(d.string, 'ED25519Signature', 'SECP256K1Signature', 'P256Signature', 'GenericSignature');
|
|
770
|
+
const sig = (0, utils_1.checkDecodeTezosID)(d.string, 'ED25519Signature', 'SECP256K1Signature', 'P256Signature', 'GenericSignature');
|
|
771
771
|
if (sig === null) {
|
|
772
772
|
throw new utils_1.MichelsonTypeError(t, `signature base58 expected: ${d.string}`, d);
|
|
773
773
|
}
|
|
774
|
-
bytes = { bytes: utils_1.hexBytes(sig[1]) };
|
|
774
|
+
bytes = { bytes: (0, utils_1.hexBytes)(sig[1]) };
|
|
775
775
|
}
|
|
776
776
|
else {
|
|
777
777
|
bytes = d;
|
|
@@ -785,13 +785,13 @@ const getWriteTransformFunc = (t) => {
|
|
|
785
785
|
}
|
|
786
786
|
let bytes;
|
|
787
787
|
if ('string' in d) {
|
|
788
|
-
const pkh = utils_1.checkDecodeTezosID(d.string, 'ED25519PublicKeyHash', 'SECP256K1PublicKeyHash', 'P256PublicKeyHash');
|
|
788
|
+
const pkh = (0, utils_1.checkDecodeTezosID)(d.string, 'ED25519PublicKeyHash', 'SECP256K1PublicKeyHash', 'P256PublicKeyHash');
|
|
789
789
|
if (pkh === null) {
|
|
790
790
|
throw new utils_1.MichelsonTypeError(t, `key hash base58 expected: ${d.string}`, d);
|
|
791
791
|
}
|
|
792
792
|
const w = new Writer();
|
|
793
793
|
writePublicKeyHash({ type: pkh[0], hash: pkh[1] }, w);
|
|
794
|
-
bytes = { bytes: utils_1.hexBytes(w.buffer) };
|
|
794
|
+
bytes = { bytes: (0, utils_1.hexBytes)(w.buffer) };
|
|
795
795
|
}
|
|
796
796
|
else {
|
|
797
797
|
bytes = d;
|
|
@@ -805,13 +805,13 @@ const getWriteTransformFunc = (t) => {
|
|
|
805
805
|
}
|
|
806
806
|
let bytes;
|
|
807
807
|
if ('string' in d) {
|
|
808
|
-
const key = utils_1.checkDecodeTezosID(d.string, 'ED25519PublicKey', 'SECP256K1PublicKey', 'P256PublicKey');
|
|
808
|
+
const key = (0, utils_1.checkDecodeTezosID)(d.string, 'ED25519PublicKey', 'SECP256K1PublicKey', 'P256PublicKey');
|
|
809
809
|
if (key === null) {
|
|
810
810
|
throw new utils_1.MichelsonTypeError(t, `public key base58 expected: ${d.string}`, d);
|
|
811
811
|
}
|
|
812
812
|
const w = new Writer();
|
|
813
813
|
writePublicKey({ type: key[0], publicKey: key[1] }, w);
|
|
814
|
-
bytes = { bytes: utils_1.hexBytes(w.buffer) };
|
|
814
|
+
bytes = { bytes: (0, utils_1.hexBytes)(w.buffer) };
|
|
815
815
|
}
|
|
816
816
|
else {
|
|
817
817
|
bytes = d;
|
|
@@ -826,13 +826,13 @@ const getWriteTransformFunc = (t) => {
|
|
|
826
826
|
let bytes;
|
|
827
827
|
if ('string' in d) {
|
|
828
828
|
const s = d.string.split('%');
|
|
829
|
-
const address = utils_1.checkDecodeTezosID(s[0], 'ED25519PublicKeyHash', 'SECP256K1PublicKeyHash', 'P256PublicKeyHash', 'ContractHash');
|
|
829
|
+
const address = (0, utils_1.checkDecodeTezosID)(s[0], 'ED25519PublicKeyHash', 'SECP256K1PublicKeyHash', 'P256PublicKeyHash', 'ContractHash');
|
|
830
830
|
if (address === null) {
|
|
831
831
|
throw new utils_1.MichelsonTypeError(t, `address base58 expected: ${d.string}`, d);
|
|
832
832
|
}
|
|
833
833
|
const w = new Writer();
|
|
834
834
|
writeAddress({ type: address[0], hash: address[1], entryPoint: s.length > 1 ? s[1] : undefined }, w);
|
|
835
|
-
bytes = { bytes: utils_1.hexBytes(w.buffer) };
|
|
835
|
+
bytes = { bytes: (0, utils_1.hexBytes)(w.buffer) };
|
|
836
836
|
}
|
|
837
837
|
else {
|
|
838
838
|
bytes = d;
|
|
@@ -846,7 +846,7 @@ const getWriteTransformFunc = (t) => {
|
|
|
846
846
|
}
|
|
847
847
|
let int;
|
|
848
848
|
if ('string' in d) {
|
|
849
|
-
const p = utils_1.parseDate(d);
|
|
849
|
+
const p = (0, utils_1.parseDate)(d);
|
|
850
850
|
if (p === null) {
|
|
851
851
|
throw new utils_1.MichelsonTypeError(t, `can't parse date: ${d.string}`, d);
|
|
852
852
|
}
|
|
@@ -864,7 +864,7 @@ const getWriteTransformFunc = (t) => {
|
|
|
864
864
|
const isPushInstruction = (e) => 'prim' in e && e.prim === 'PUSH';
|
|
865
865
|
const writePassThrough = (e) => {
|
|
866
866
|
if (isPushInstruction(e)) {
|
|
867
|
-
michelson_validator_1.assertMichelsonInstruction(e);
|
|
867
|
+
(0, michelson_validator_1.assertMichelsonInstruction)(e);
|
|
868
868
|
// capture inlined type definition
|
|
869
869
|
return [
|
|
870
870
|
e,
|
|
@@ -948,17 +948,17 @@ exports.packData = packData;
|
|
|
948
948
|
* @returns Binary representation as a bytes literal
|
|
949
949
|
*/
|
|
950
950
|
function packDataBytes(d, t) {
|
|
951
|
-
return { bytes: utils_1.hexBytes(packData(d, t)) };
|
|
951
|
+
return { bytes: (0, utils_1.hexBytes)(packData(d, t)) };
|
|
952
952
|
}
|
|
953
953
|
exports.packDataBytes = packDataBytes;
|
|
954
954
|
const getReadTransformFuncs = (t) => {
|
|
955
|
-
if (utils_1.isPairType(t)) {
|
|
955
|
+
if ((0, utils_1.isPairType)(t)) {
|
|
956
956
|
return [
|
|
957
957
|
(d) => {
|
|
958
|
-
if (!utils_1.isPairData(d)) {
|
|
958
|
+
if (!(0, utils_1.isPairData)(d)) {
|
|
959
959
|
throw new utils_1.MichelsonTypeError(t, `pair expected: ${JSON.stringify(d)}`, d);
|
|
960
960
|
}
|
|
961
|
-
const tc = utils_1.unpackComb('pair', t);
|
|
961
|
+
const tc = (0, utils_1.unpackComb)('pair', t);
|
|
962
962
|
return (function* () {
|
|
963
963
|
for (const a of tc.args) {
|
|
964
964
|
yield getReadTransformFuncs(a);
|
|
@@ -1049,11 +1049,11 @@ const getReadTransformFuncs = (t) => {
|
|
|
1049
1049
|
if ('string' in d) {
|
|
1050
1050
|
return d;
|
|
1051
1051
|
}
|
|
1052
|
-
const bytes = utils_1.parseBytes(d.bytes);
|
|
1052
|
+
const bytes = (0, utils_1.parseBytes)(d.bytes);
|
|
1053
1053
|
if (bytes === null) {
|
|
1054
1054
|
throw new utils_1.MichelsonTypeError(t, `can't parse bytes: ${d.bytes}`, d);
|
|
1055
1055
|
}
|
|
1056
|
-
return { string: utils_1.encodeTezosID('ChainID', bytes) };
|
|
1056
|
+
return { string: (0, utils_1.encodeTezosID)('ChainID', bytes) };
|
|
1057
1057
|
},
|
|
1058
1058
|
];
|
|
1059
1059
|
case 'signature':
|
|
@@ -1066,11 +1066,11 @@ const getReadTransformFuncs = (t) => {
|
|
|
1066
1066
|
if ('string' in d) {
|
|
1067
1067
|
return d;
|
|
1068
1068
|
}
|
|
1069
|
-
const bytes = utils_1.parseBytes(d.bytes);
|
|
1069
|
+
const bytes = (0, utils_1.parseBytes)(d.bytes);
|
|
1070
1070
|
if (bytes === null) {
|
|
1071
1071
|
throw new utils_1.MichelsonTypeError(t, `can't parse bytes: ${d.bytes}`, d);
|
|
1072
1072
|
}
|
|
1073
|
-
return { string: utils_1.encodeTezosID('GenericSignature', bytes) };
|
|
1073
|
+
return { string: (0, utils_1.encodeTezosID)('GenericSignature', bytes) };
|
|
1074
1074
|
},
|
|
1075
1075
|
];
|
|
1076
1076
|
case 'key_hash':
|
|
@@ -1083,14 +1083,14 @@ const getReadTransformFuncs = (t) => {
|
|
|
1083
1083
|
if ('string' in d) {
|
|
1084
1084
|
return d;
|
|
1085
1085
|
}
|
|
1086
|
-
const bytes = utils_1.parseBytes(d.bytes);
|
|
1086
|
+
const bytes = (0, utils_1.parseBytes)(d.bytes);
|
|
1087
1087
|
if (bytes === null) {
|
|
1088
1088
|
throw new utils_1.MichelsonTypeError(t, `can't parse bytes: ${d.bytes}`, d);
|
|
1089
1089
|
}
|
|
1090
1090
|
const rd = new Reader(new Uint8Array(bytes));
|
|
1091
1091
|
const addr = readPublicKeyHash(rd);
|
|
1092
1092
|
return {
|
|
1093
|
-
string: utils_1.encodeTezosID(addr.type, addr.hash) + (addr.entryPoint ? '%' + addr.entryPoint : ''),
|
|
1093
|
+
string: (0, utils_1.encodeTezosID)(addr.type, addr.hash) + (addr.entryPoint ? '%' + addr.entryPoint : ''),
|
|
1094
1094
|
};
|
|
1095
1095
|
},
|
|
1096
1096
|
];
|
|
@@ -1104,13 +1104,13 @@ const getReadTransformFuncs = (t) => {
|
|
|
1104
1104
|
if ('string' in d) {
|
|
1105
1105
|
return d;
|
|
1106
1106
|
}
|
|
1107
|
-
const bytes = utils_1.parseBytes(d.bytes);
|
|
1107
|
+
const bytes = (0, utils_1.parseBytes)(d.bytes);
|
|
1108
1108
|
if (bytes === null) {
|
|
1109
1109
|
throw new utils_1.MichelsonTypeError(t, `can't parse bytes: ${d.bytes}`, d);
|
|
1110
1110
|
}
|
|
1111
1111
|
const rd = new Reader(new Uint8Array(bytes));
|
|
1112
1112
|
const pk = readPublicKey(rd);
|
|
1113
|
-
return { string: utils_1.encodeTezosID(pk.type, pk.publicKey) };
|
|
1113
|
+
return { string: (0, utils_1.encodeTezosID)(pk.type, pk.publicKey) };
|
|
1114
1114
|
},
|
|
1115
1115
|
];
|
|
1116
1116
|
case 'address':
|
|
@@ -1123,14 +1123,14 @@ const getReadTransformFuncs = (t) => {
|
|
|
1123
1123
|
if ('string' in d) {
|
|
1124
1124
|
return d;
|
|
1125
1125
|
}
|
|
1126
|
-
const bytes = utils_1.parseBytes(d.bytes);
|
|
1126
|
+
const bytes = (0, utils_1.parseBytes)(d.bytes);
|
|
1127
1127
|
if (bytes === null) {
|
|
1128
1128
|
throw new utils_1.MichelsonTypeError(t, `can't parse bytes: ${d.bytes}`, d);
|
|
1129
1129
|
}
|
|
1130
1130
|
const rd = new Reader(new Uint8Array(bytes));
|
|
1131
1131
|
const addr = readAddress(rd);
|
|
1132
1132
|
return {
|
|
1133
|
-
string: utils_1.encodeTezosID(addr.type, addr.hash) + (addr.entryPoint ? '%' + addr.entryPoint : ''),
|
|
1133
|
+
string: (0, utils_1.encodeTezosID)(addr.type, addr.hash) + (addr.entryPoint ? '%' + addr.entryPoint : ''),
|
|
1134
1134
|
};
|
|
1135
1135
|
},
|
|
1136
1136
|
];
|
|
@@ -1155,7 +1155,7 @@ const getReadTransformFuncs = (t) => {
|
|
|
1155
1155
|
const readPassThrough = [
|
|
1156
1156
|
(e) => {
|
|
1157
1157
|
if (isPushInstruction(e)) {
|
|
1158
|
-
michelson_validator_1.assertMichelsonInstruction(e);
|
|
1158
|
+
(0, michelson_validator_1.assertMichelsonInstruction)(e);
|
|
1159
1159
|
// capture inlined type definition
|
|
1160
1160
|
return (function* () {
|
|
1161
1161
|
yield readPassThrough;
|
|
@@ -1206,7 +1206,7 @@ function unpackData(src, t) {
|
|
|
1206
1206
|
throw new Error('incorrect packed data magic number');
|
|
1207
1207
|
}
|
|
1208
1208
|
const ex = readExpr(r, t !== undefined ? getReadTransformFuncs(t) : readPassThrough);
|
|
1209
|
-
if (michelson_validator_1.assertMichelsonData(ex)) {
|
|
1209
|
+
if ((0, michelson_validator_1.assertMichelsonData)(ex)) {
|
|
1210
1210
|
return ex;
|
|
1211
1211
|
}
|
|
1212
1212
|
throw new Error(); // never
|
|
@@ -1232,7 +1232,7 @@ exports.unpackData = unpackData;
|
|
|
1232
1232
|
* @returns Deserialized data
|
|
1233
1233
|
*/
|
|
1234
1234
|
function unpackDataBytes(src, t) {
|
|
1235
|
-
const bytes = utils_1.parseBytes(src.bytes);
|
|
1235
|
+
const bytes = (0, utils_1.parseBytes)(src.bytes);
|
|
1236
1236
|
if (bytes === null) {
|
|
1237
1237
|
throw new Error(`can't parse bytes: "${src.bytes}"`);
|
|
1238
1238
|
}
|
|
@@ -1241,7 +1241,7 @@ function unpackDataBytes(src, t) {
|
|
|
1241
1241
|
exports.unpackDataBytes = unpackDataBytes;
|
|
1242
1242
|
// helper functions also used by validator
|
|
1243
1243
|
function decodeAddressBytes(b) {
|
|
1244
|
-
const bytes = utils_1.parseBytes(b.bytes);
|
|
1244
|
+
const bytes = (0, utils_1.parseBytes)(b.bytes);
|
|
1245
1245
|
if (bytes === null) {
|
|
1246
1246
|
throw new Error(`can't parse bytes: "${b.bytes}"`);
|
|
1247
1247
|
}
|
|
@@ -1250,7 +1250,7 @@ function decodeAddressBytes(b) {
|
|
|
1250
1250
|
}
|
|
1251
1251
|
exports.decodeAddressBytes = decodeAddressBytes;
|
|
1252
1252
|
function decodePublicKeyHashBytes(b) {
|
|
1253
|
-
const bytes = utils_1.parseBytes(b.bytes);
|
|
1253
|
+
const bytes = (0, utils_1.parseBytes)(b.bytes);
|
|
1254
1254
|
if (bytes === null) {
|
|
1255
1255
|
throw new Error(`can't parse bytes: "${b.bytes}"`);
|
|
1256
1256
|
}
|
|
@@ -1259,7 +1259,7 @@ function decodePublicKeyHashBytes(b) {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
exports.decodePublicKeyHashBytes = decodePublicKeyHashBytes;
|
|
1261
1261
|
function decodePublicKeyBytes(b) {
|
|
1262
|
-
const bytes = utils_1.parseBytes(b.bytes);
|
|
1262
|
+
const bytes = (0, utils_1.parseBytes)(b.bytes);
|
|
1263
1263
|
if (bytes === null) {
|
|
1264
1264
|
throw new Error(`can't parse bytes: "${b.bytes}"`);
|
|
1265
1265
|
}
|
|
@@ -1267,4 +1267,3 @@ function decodePublicKeyBytes(b) {
|
|
|
1267
1267
|
return readPublicKey(rd);
|
|
1268
1268
|
}
|
|
1269
1269
|
exports.decodePublicKeyBytes = decodePublicKeyBytes;
|
|
1270
|
-
//# sourceMappingURL=binary.js.map
|
package/dist/lib/errors.js
CHANGED
package/dist/lib/formatters.js
CHANGED
|
@@ -7,12 +7,12 @@ const micheline_emitter_1 = require("./micheline-emitter");
|
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
8
|
function formatStack(s) {
|
|
9
9
|
if ('failed' in s) {
|
|
10
|
-
return `[FAILED: ${micheline_emitter_1.emitMicheline(s.failed)}]`;
|
|
10
|
+
return `[FAILED: ${(0, micheline_emitter_1.emitMicheline)(s.failed)}]`;
|
|
11
11
|
}
|
|
12
12
|
return s
|
|
13
13
|
.map((v, i) => {
|
|
14
|
-
const ann = utils_1.unpackAnnotations(v);
|
|
15
|
-
return `[${i}${ann.v ? '/' + ann.v[0] : ''}]: ${micheline_emitter_1.emitMicheline(v)}`;
|
|
14
|
+
const ann = (0, utils_1.unpackAnnotations)(v);
|
|
15
|
+
return `[${i}${ann.v ? '/' + ann.v[0] : ''}]: ${(0, micheline_emitter_1.emitMicheline)(v)}`;
|
|
16
16
|
})
|
|
17
17
|
.join('\n');
|
|
18
18
|
}
|
|
@@ -24,7 +24,7 @@ function traceDumpFunc(blocks, cb) {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
const macro = (_a = v.op[micheline_1.sourceReference]) === null || _a === void 0 ? void 0 : _a.macro;
|
|
27
|
-
const msg = `${macro ? 'Macro' : 'Op'}: ${macro ? micheline_emitter_1.emitMicheline(macro, undefined, true) + ' / ' : ''}${micheline_emitter_1.emitMicheline(v.op)}
|
|
27
|
+
const msg = `${macro ? 'Macro' : 'Op'}: ${macro ? (0, micheline_emitter_1.emitMicheline)(macro, undefined, true) + ' / ' : ''}${(0, micheline_emitter_1.emitMicheline)(v.op)}
|
|
28
28
|
Input:
|
|
29
29
|
${formatStack(v.in)}
|
|
30
30
|
Output:
|
|
@@ -38,25 +38,24 @@ function formatError(err) {
|
|
|
38
38
|
var _a;
|
|
39
39
|
if (err instanceof michelson_typecheck_1.MichelsonInstructionError) {
|
|
40
40
|
const macro = (_a = err.val[micheline_1.sourceReference]) === null || _a === void 0 ? void 0 : _a.macro;
|
|
41
|
-
return `${macro ? 'Macro' : 'Op'}: ${macro ? micheline_emitter_1.emitMicheline(macro, undefined, true) + ' / ' : ''}${micheline_emitter_1.emitMicheline(err.val)}
|
|
41
|
+
return `${macro ? 'Macro' : 'Op'}: ${macro ? (0, micheline_emitter_1.emitMicheline)(macro, undefined, true) + ' / ' : ''}${(0, micheline_emitter_1.emitMicheline)(err.val)}
|
|
42
42
|
Stack:
|
|
43
43
|
${formatStack(err.stackState)}
|
|
44
44
|
`;
|
|
45
45
|
}
|
|
46
46
|
else if (err instanceof utils_1.MichelsonTypeError) {
|
|
47
47
|
const type = Array.isArray(err.val)
|
|
48
|
-
? '[' + err.val.map((v, i) => `[${i}]: ${micheline_emitter_1.emitMicheline(v)}`).join('; ') + ']'
|
|
49
|
-
: micheline_emitter_1.emitMicheline(err.val);
|
|
48
|
+
? '[' + err.val.map((v, i) => `[${i}]: ${(0, micheline_emitter_1.emitMicheline)(v)}`).join('; ') + ']'
|
|
49
|
+
: (0, micheline_emitter_1.emitMicheline)(err.val);
|
|
50
50
|
return `Type: ${type}
|
|
51
51
|
${err.data
|
|
52
|
-
? `Data: ${micheline_emitter_1.emitMicheline(err.data)}
|
|
52
|
+
? `Data: ${(0, micheline_emitter_1.emitMicheline)(err.data)}
|
|
53
53
|
`
|
|
54
54
|
: ''}
|
|
55
55
|
`;
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
return `Value: ${micheline_emitter_1.emitMicheline(err.val)}`;
|
|
58
|
+
return `Value: ${(0, micheline_emitter_1.emitMicheline)(err.val)}`;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.formatError = formatError;
|
|
62
|
-
//# sourceMappingURL=formatters.js.map
|
package/dist/lib/macros.js
CHANGED
|
@@ -336,7 +336,7 @@ function expandMacros(ex, opt) {
|
|
|
336
336
|
}
|
|
337
337
|
// UNPAPPAIIR macro
|
|
338
338
|
if (unpairRe.test(ex.prim)) {
|
|
339
|
-
if (michelson_types_1.ProtoInferiorTo(proto, michelson_types_1.Protocol.PtEdo2Zk) && assertArgs(ex, 0)) {
|
|
339
|
+
if ((0, michelson_types_1.ProtoInferiorTo)(proto, michelson_types_1.Protocol.PtEdo2Zk) && assertArgs(ex, 0)) {
|
|
340
340
|
const { r } = parsePairUnpairExpr(ex, ex.prim.slice(3), ex.annots || [], (l, r, top) => [
|
|
341
341
|
top,
|
|
342
342
|
...(r || []),
|
|
@@ -497,7 +497,7 @@ function expandMacros(ex, opt) {
|
|
|
497
497
|
while (ex.prim[1 + n] === 'U') {
|
|
498
498
|
n++;
|
|
499
499
|
}
|
|
500
|
-
if (michelson_types_1.ProtoInferiorTo(proto, michelson_types_1.Protocol.PtEdo2Zk)) {
|
|
500
|
+
if ((0, michelson_types_1.ProtoInferiorTo)(proto, michelson_types_1.Protocol.PtEdo2Zk)) {
|
|
501
501
|
if (n === 1) {
|
|
502
502
|
if (ex.args === undefined) {
|
|
503
503
|
return ex; // skip
|
|
@@ -546,4 +546,3 @@ function expandMacros(ex, opt) {
|
|
|
546
546
|
return ex;
|
|
547
547
|
}
|
|
548
548
|
exports.expandMacros = expandMacros;
|
|
549
|
-
//# sourceMappingURL=macros.js.map
|
|
@@ -25,7 +25,7 @@ class MichelineParseError extends core_1.TaquitoError {
|
|
|
25
25
|
exports.MichelineParseError = MichelineParseError;
|
|
26
26
|
/**
|
|
27
27
|
* @category Error
|
|
28
|
-
* @description Error
|
|
28
|
+
* @description Error indicates a failure when parsing Micheline JSON
|
|
29
29
|
*/
|
|
30
30
|
class JSONParseError extends core_1.TaquitoError {
|
|
31
31
|
/**
|
|
@@ -64,7 +64,7 @@ const bytesRe = new RegExp('^([0-9a-fA-F]{2})*$');
|
|
|
64
64
|
* console.log(emitMicheline(storage, {indent:" ", newline: "\n",}));
|
|
65
65
|
* ```
|
|
66
66
|
*
|
|
67
|
-
* Encode a Michelson expression for
|
|
67
|
+
* Encode a Michelson expression for initial storage of a smart contract
|
|
68
68
|
* ```
|
|
69
69
|
* const src = `(Pair (Pair { Elt 1
|
|
70
70
|
* (Pair (Pair "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx")
|
|
@@ -85,14 +85,14 @@ class Parser {
|
|
|
85
85
|
expand(ex) {
|
|
86
86
|
var _a, _b, _c;
|
|
87
87
|
if (((_a = this.opt) === null || _a === void 0 ? void 0 : _a.expandGlobalConstant) !== undefined && ex.prim === 'constant') {
|
|
88
|
-
const ret = global_constants_1.expandGlobalConstants(ex, this.opt.expandGlobalConstant);
|
|
88
|
+
const ret = (0, global_constants_1.expandGlobalConstants)(ex, this.opt.expandGlobalConstant);
|
|
89
89
|
if (ret !== ex) {
|
|
90
90
|
ret[micheline_1.sourceReference] = Object.assign(Object.assign({}, (ex[micheline_1.sourceReference] || { first: 0, last: 0 })), { globalConstant: ex });
|
|
91
91
|
}
|
|
92
92
|
return ret;
|
|
93
93
|
}
|
|
94
94
|
if (((_b = this.opt) === null || _b === void 0 ? void 0 : _b.expandMacros) !== undefined ? (_c = this.opt) === null || _c === void 0 ? void 0 : _c.expandMacros : true) {
|
|
95
|
-
const ret = macros_1.expandMacros(ex, this.opt);
|
|
95
|
+
const ret = (0, macros_1.expandMacros)(ex, this.opt);
|
|
96
96
|
if (ret !== ex) {
|
|
97
97
|
ret[micheline_1.sourceReference] = Object.assign(Object.assign({}, (ex[micheline_1.sourceReference] || { first: 0, last: 0 })), { macro: ex });
|
|
98
98
|
}
|
|
@@ -273,7 +273,7 @@ class Parser {
|
|
|
273
273
|
if (typeof src !== 'string') {
|
|
274
274
|
throw new TypeError(`string type was expected, got ${typeof src} instead`);
|
|
275
275
|
}
|
|
276
|
-
const scanner = scan_1.scan(src);
|
|
276
|
+
const scanner = (0, scan_1.scan)(src);
|
|
277
277
|
const tok = scanner.next();
|
|
278
278
|
if (tok.done) {
|
|
279
279
|
return null;
|
|
@@ -289,7 +289,7 @@ class Parser {
|
|
|
289
289
|
if (typeof src !== 'string') {
|
|
290
290
|
throw new TypeError(`string type was expected, got ${typeof src} instead`);
|
|
291
291
|
}
|
|
292
|
-
const scanner = scan_1.scan(src);
|
|
292
|
+
const scanner = (0, scan_1.scan)(src);
|
|
293
293
|
const tok = scanner.next();
|
|
294
294
|
if (tok.done) {
|
|
295
295
|
return null;
|
|
@@ -305,7 +305,7 @@ class Parser {
|
|
|
305
305
|
if (typeof src !== 'string') {
|
|
306
306
|
throw new TypeError(`string type was expected, got ${typeof src} instead`);
|
|
307
307
|
}
|
|
308
|
-
const scanner = scan_1.scan(src);
|
|
308
|
+
const scanner = (0, scan_1.scan)(src);
|
|
309
309
|
const tok = scanner.next();
|
|
310
310
|
if (tok.done) {
|
|
311
311
|
return null;
|
|
@@ -401,4 +401,3 @@ class Parser {
|
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
exports.Parser = Parser;
|
|
404
|
-
//# sourceMappingURL=micheline-parser.js.map
|
package/dist/lib/micheline.js
CHANGED
|
@@ -9,7 +9,7 @@ class Contract {
|
|
|
9
9
|
constructor(contract, opt) {
|
|
10
10
|
this.contract = contract;
|
|
11
11
|
this.ctx = Object.assign({ contract }, opt);
|
|
12
|
-
this.output = michelson_typecheck_1.assertContractValid(contract, this.ctx);
|
|
12
|
+
this.output = (0, michelson_typecheck_1.assertContractValid)(contract, this.ctx);
|
|
13
13
|
}
|
|
14
14
|
static parse(src, opt) {
|
|
15
15
|
const p = new micheline_parser_1.Parser(opt);
|
|
@@ -17,7 +17,7 @@ class Contract {
|
|
|
17
17
|
if (expr === null) {
|
|
18
18
|
throw new errors_1.InvalidMichelsonError('empty Michelson');
|
|
19
19
|
}
|
|
20
|
-
if (michelson_validator_1.assertMichelsonContract(expr)) {
|
|
20
|
+
if ((0, michelson_validator_1.assertMichelsonContract)(expr)) {
|
|
21
21
|
return new Contract(expr, opt);
|
|
22
22
|
}
|
|
23
23
|
throw undefined;
|
|
@@ -29,8 +29,8 @@ class Contract {
|
|
|
29
29
|
throw new errors_1.InvalidTypeExpressionError('empty type expression');
|
|
30
30
|
}
|
|
31
31
|
// remove assertTypeAnnotationsValid from if block because: () => void || throw error
|
|
32
|
-
if (michelson_validator_1.assertMichelsonType(expr)) {
|
|
33
|
-
michelson_typecheck_1.assertTypeAnnotationsValid(expr);
|
|
32
|
+
if ((0, michelson_validator_1.assertMichelsonType)(expr)) {
|
|
33
|
+
(0, michelson_typecheck_1.assertTypeAnnotationsValid)(expr);
|
|
34
34
|
return expr;
|
|
35
35
|
}
|
|
36
36
|
throw undefined;
|
|
@@ -41,25 +41,25 @@ class Contract {
|
|
|
41
41
|
if (expr === null) {
|
|
42
42
|
throw new errors_1.InvalidDataExpressionError('empty data expression');
|
|
43
43
|
}
|
|
44
|
-
if (michelson_validator_1.assertMichelsonData(expr)) {
|
|
44
|
+
if ((0, michelson_validator_1.assertMichelsonData)(expr)) {
|
|
45
45
|
return expr;
|
|
46
46
|
}
|
|
47
47
|
throw undefined;
|
|
48
48
|
}
|
|
49
49
|
section(section) {
|
|
50
|
-
return michelson_typecheck_1.contractSection(this.contract, section);
|
|
50
|
+
return (0, michelson_typecheck_1.contractSection)(this.contract, section);
|
|
51
51
|
}
|
|
52
52
|
entryPoints() {
|
|
53
|
-
return michelson_typecheck_1.contractEntryPoints(this.contract);
|
|
53
|
+
return (0, michelson_typecheck_1.contractEntryPoints)(this.contract);
|
|
54
54
|
}
|
|
55
55
|
entryPoint(ep) {
|
|
56
|
-
return michelson_typecheck_1.contractEntryPoint(this.contract, ep);
|
|
56
|
+
return (0, michelson_typecheck_1.contractEntryPoint)(this.contract, ep);
|
|
57
57
|
}
|
|
58
58
|
assertDataValid(d, t) {
|
|
59
|
-
michelson_typecheck_1.assertDataValid(d, t, this.ctx);
|
|
59
|
+
(0, michelson_typecheck_1.assertDataValid)(d, t, this.ctx);
|
|
60
60
|
}
|
|
61
61
|
isDataValid(d, t) {
|
|
62
|
-
return michelson_typecheck_1.isDataValid(d, t, this.ctx);
|
|
62
|
+
return (0, michelson_typecheck_1.isDataValid)(d, t, this.ctx);
|
|
63
63
|
}
|
|
64
64
|
assertParameterValid(ep, d) {
|
|
65
65
|
const t = this.entryPoint(ep || undefined);
|
|
@@ -78,7 +78,7 @@ class Contract {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
functionType(inst, stack) {
|
|
81
|
-
return michelson_typecheck_1.functionType(inst, stack, this.ctx);
|
|
81
|
+
return (0, michelson_typecheck_1.functionType)(inst, stack, this.ctx);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
exports.Contract = Contract;
|
|
@@ -91,4 +91,3 @@ exports.dummyContract = new Contract([
|
|
|
91
91
|
args: [[{ prim: 'CAR' }, { prim: 'NIL', args: [{ prim: 'operation' }] }, { prim: 'PAIR' }]],
|
|
92
92
|
},
|
|
93
93
|
]);
|
|
94
|
-
//# sourceMappingURL=michelson-contract.js.map
|