Socket
Socket
Sign inDemoInstall

@taquito/michel-codec

Package Overview
Dependencies
Maintainers
2
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@taquito/michel-codec - npm Package Compare versions

Comparing version 7.0.1-beta.0 to 7.1.0-preview.1

dist/lib/base58.js

41

dist/lib/micheline-emitter.js

@@ -15,2 +15,3 @@ "use strict";

exports.emitMicheline = void 0;
var micheline_1 = require("./micheline");
var Formatter = /** @class */ (function () {

@@ -80,6 +81,11 @@ function Formatter(opt, lev) {

}
function emitExpr(node, f) {
function emitExpr(node, f, foldMacros) {
var e_2, _a, e_3, _b;
var _c;
var macro = (_c = node[micheline_1.sourceReference]) === null || _c === void 0 ? void 0 : _c.macro;
if (foldMacros && macro) {
return emitExpr(macro, f, foldMacros);
}
if (Array.isArray(node)) {
return emitSeq(node, f);
return emitSeq(node, f, foldMacros);
}

@@ -103,4 +109,4 @@ else if ("string" in node) {

try {
for (var _c = __values(node.annots), _d = _c.next(); !_d.done; _d = _c.next()) {
var a = _d.value;
for (var _d = __values(node.annots), _e = _d.next(); !_e.done; _e = _d.next()) {
var a = _e.value;
ret += " " + a;

@@ -112,3 +118,3 @@ }

try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
}

@@ -121,9 +127,9 @@ finally { if (e_2) throw e_2.error; }

try {
for (var _e = __values(node.args), _f = _e.next(); !_f.done; _f = _e.next()) {
var a = _f.value;
for (var _f = __values(node.args), _g = _f.next(); !_g.done; _g = _f.next()) {
var a = _g.value;
if (multiline) {
ret += f.lfsp + f.indent(1) + emitExpr(a, f.down(1));
ret += f.lfsp + f.indent(1) + emitExpr(a, f.down(1), foldMacros);
}
else {
ret += " " + emitExpr(a, f);
ret += " " + emitExpr(a, f, foldMacros);
}

@@ -135,3 +141,3 @@ }

try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
}

@@ -144,3 +150,3 @@ finally { if (e_3) throw e_3.error; }

}
function emitSeq(node, f) {
function emitSeq(node, f, foldMacros) {
var e_4, _a, e_5, _b, e_6, _c;

@@ -176,6 +182,6 @@ var ret = "{" + f.lf;

if (multiline) {
ret += f.lfsp + f.indent(2) + emitExpr(a, f.down(2));
ret += f.lfsp + f.indent(2) + emitExpr(a, f.down(2), foldMacros);
}
else {
ret += " " + emitExpr(a, f);
ret += " " + emitExpr(a, f, foldMacros);
}

@@ -194,5 +200,5 @@ }

else {
ret += emitExpr(el, f.down(1));
ret += emitExpr(el, f.down(1), foldMacros);
}
ret += (i > 1 ? ";" : "") + f.lf;
ret += (i > 1 ? ";" + f.lfsp : f.lf);
i--;

@@ -215,3 +221,4 @@ }

*/
function emitMicheline(expr, opt) {
function emitMicheline(expr, opt, foldMacros) {
if (foldMacros === void 0) { foldMacros = false; }
// tslint:disable-next-line: strict-type-predicates

@@ -221,5 +228,5 @@ if (typeof expr !== "object") {

}
return emitExpr(expr, new Formatter(opt));
return emitExpr(expr, new Formatter(opt), foldMacros);
}
exports.emitMicheline = emitMicheline;
//# sourceMappingURL=micheline-emitter.js.map

@@ -15,2 +15,13 @@ "use strict";

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {

@@ -46,2 +57,3 @@ var m = typeof Symbol === "function" && o[Symbol.iterator];

var scan_1 = require("./scan");
var micheline_1 = require("./micheline");
var macros_1 = require("./macros");

@@ -57,2 +69,3 @@ var MichelineParseError = /** @class */ (function (_super) {

_this.token = token;
Object.setPrototypeOf(_this, MichelineParseError.prototype);
return _this;

@@ -72,2 +85,3 @@ }

_this.node = node;
Object.setPrototypeOf(_this, JSONParseError.prototype);
return _this;

@@ -83,3 +97,3 @@ }

var intRe = new RegExp('^-?[0-9]+$');
var bytesRe = new RegExp('^([0-9a-fA-F]{2})+$');
var bytesRe = new RegExp('^([0-9a-fA-F]{2})*$');
/**

@@ -123,5 +137,14 @@ * Converts and validates Michelson expressions between JSON-based Michelson and Micheline

var _a;
return ((_a = this.opt) === null || _a === void 0 ? void 0 : _a.expandMacros) ? macros_1.expandMacros(ex) : ex;
if ((_a = this.opt) === null || _a === void 0 ? void 0 : _a.expandMacros) {
var ret = macros_1.expandMacros(ex);
if (ret !== ex) {
ret[micheline_1.sourceReference] = __assign(__assign({}, (ex[micheline_1.sourceReference] || { first: 0, last: 0 })), { macro: ex });
}
return ret;
}
else {
return ex;
}
};
Parser.prototype.parseList = function (scanner) {
Parser.prototype.parseList = function (scanner, start) {
var tok = scanner.next();

@@ -132,3 +155,3 @@ if (tok.done) {

if (tok.value.t !== scan_1.Literal.Ident) {
throw new MichelineParseError(tok.value, "List: not an identifier: " + tok.value.v);
throw new MichelineParseError(tok.value, "not an identifier: " + tok.value.v);
}

@@ -138,2 +161,3 @@ var ret = {

};
var last;
for (;;) {

@@ -145,2 +169,3 @@ var tok_1 = scanner.next();

if (tok_1.value.t === ')') {
last = tok_1.value.last;
break;

@@ -157,29 +182,24 @@ }

}
ret[micheline_1.sourceReference] = {
first: start.first,
last: last,
};
return this.expand(ret);
};
Parser.prototype.parseArgs = function (scanner, prim, expectBracket) {
Parser.prototype.parseArgs = function (scanner, start) {
var _a;
var _b;
// Identifier with arguments
var p = { prim: prim };
var ref = {
first: start.first,
last: start.last,
};
var p = (_a = { prim: start.v }, _a[micheline_1.sourceReference] = ref, _a);
for (;;) {
var t = scanner.next();
if (t.done) {
if (expectBracket) {
throw errEOF;
}
else {
return [p, true];
}
if (t.done || t.value.t === '}' || t.value.t === ';') {
return [p, t];
}
else if (t.value.t === '}') {
if (!expectBracket) {
throw new MichelineParseError(t.value, "Seq: unexpected token: " + t.value.v);
}
else {
return [p, true];
}
}
else if (t.value.t === ';') {
return [p, false];
}
if (isAnnotation(t.value)) {
ref.last = t.value.last;
p.annots = p.annots || [];

@@ -189,30 +209,37 @@ p.annots.push(t.value.v);

else {
var arg = this.parseExpr(scanner, t.value);
ref.last = ((_b = arg[micheline_1.sourceReference]) === null || _b === void 0 ? void 0 : _b.last) || ref.last;
p.args = p.args || [];
p.args.push(this.parseExpr(scanner, t.value));
p.args.push(arg);
}
}
};
Parser.prototype.parseSequence = function (scanner, initialToken, expectBracket) {
Parser.prototype.parseSequence = function (scanner, start) {
var _a, _b;
var ref = {
first: start.first,
last: start.last,
};
var seq = [];
seq[micheline_1.sourceReference] = ref;
var expectBracket = start.t === "{";
var tok = start.t === "{" ? null : { value: start };
for (;;) {
var tok = void 0;
if (initialToken !== null) {
tok = initialToken;
initialToken = null;
if (tok === null) {
tok = scanner.next();
if (!tok.done) {
ref.last = tok.value.last;
}
}
else {
var t = scanner.next();
if (t.done) {
if (expectBracket) {
throw errEOF;
}
else {
return seq;
}
if (tok.done) {
if (expectBracket) {
throw errEOF;
}
tok = t.value;
else {
return seq;
}
}
if (tok.t === '}') {
if (tok.value.t === "}") {
if (!expectBracket) {
throw new MichelineParseError(tok, "Seq: unexpected token: " + tok.v);
throw new MichelineParseError(tok.value, "unexpected closing bracket");
}

@@ -223,52 +250,44 @@ else {

}
else if (tok.t === scan_1.Literal.Ident) {
else if (tok.value.t === scan_1.Literal.Ident) {
// Identifier with arguments
var _a = __read(this.parseArgs(scanner, tok.v, expectBracket), 2), itm = _a[0], done = _a[1];
var _c = __read(this.parseArgs(scanner, tok.value), 2), itm = _c[0], n = _c[1];
ref.last = ((_a = itm[micheline_1.sourceReference]) === null || _a === void 0 ? void 0 : _a.last) || ref.last;
seq.push(this.expand(itm));
if (done) {
return seq;
}
tok = n;
}
else {
// Other
seq.push(this.parseExpr(scanner, tok));
var t = scanner.next();
if (t.done) {
if (expectBracket) {
throw errEOF;
}
else {
return seq;
}
var ex = this.parseExpr(scanner, tok.value);
ref.last = ((_b = ex[micheline_1.sourceReference]) === null || _b === void 0 ? void 0 : _b.last) || ref.last;
seq.push(ex);
tok = null;
}
if (tok === null) {
tok = scanner.next();
if (!tok.done) {
ref.last = tok.value.last;
}
else if (t.value.t === '}') {
if (!expectBracket) {
throw new MichelineParseError(t.value, "Seq: unexpected token: " + t.value.v);
}
else {
return seq;
}
}
else if (t.value.t !== ';') {
throw new MichelineParseError(t.value, "Seq: unexpected token: " + t.value.v);
}
}
if (!tok.done && tok.value.t === ";") {
tok = null;
}
}
};
Parser.prototype.parseExpr = function (scanner, tok) {
var _a, _b, _c, _d;
switch (tok.t) {
case scan_1.Literal.Ident:
return this.expand({ prim: tok.v });
return this.expand((_a = { prim: tok.v }, _a[micheline_1.sourceReference] = { first: tok.first, last: tok.last }, _a));
case scan_1.Literal.Number:
return { int: tok.v };
return _b = { int: tok.v }, _b[micheline_1.sourceReference] = { first: tok.first, last: tok.last }, _b;
case scan_1.Literal.String:
return { string: JSON.parse(tok.v) };
return _c = { string: JSON.parse(tok.v) }, _c[micheline_1.sourceReference] = { first: tok.first, last: tok.last }, _c;
case scan_1.Literal.Bytes:
return { bytes: tok.v.substr(2) };
return _d = { bytes: tok.v.slice(2) }, _d[micheline_1.sourceReference] = { first: tok.first, last: tok.last }, _d;
case '(':
return this.parseList(scanner);
return this.parseList(scanner, tok);
case '{':
return this.parseSequence(scanner, null, true);
return this.parseSequence(scanner, tok);
default:
throw new MichelineParseError(tok, "Expr: unexpected token: " + tok.v);
throw new MichelineParseError(tok, "unexpected token: " + tok.v);
}

@@ -290,5 +309,3 @@ };

}
return tok.value.t === '{'
? this.parseSequence(scanner, null, true)
: this.parseSequence(scanner, tok.value, false);
return this.parseSequence(scanner, tok.value);
};

@@ -295,0 +312,0 @@ /**

"use strict";
// Michelson abstract syntax tree types https://tezos.gitlab.io/whitedoc/michelson.html#concrete-syntax
Object.defineProperty(exports, "__esModule", { value: true });
exports.sourceReference = void 0;
exports.sourceReference = Symbol("source_reference");
//# sourceMappingURL=micheline.js.map
"use strict";
// Michelson types
var __extends = (this && this.__extends) || (function () {

@@ -27,67 +26,71 @@ var extendStatics = function (d, b) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMichelsonType = exports.isMichelsonCode = exports.isMichelsonData = exports.isMichelsonScript = exports.assertMichelsonContract = exports.assertMichelsonData = exports.assertMichelsonType = exports.assertMichelsonPassableType = exports.assertMichelsonStorableType = exports.assertMichelsonPushableType = exports.assertMichelsonSerializableType = exports.assertMichelsonComparableType = exports.assertMichelsonInstruction = exports.MichelsonValidationError = exports.instructionIDs = void 0;
var utils_1 = require("./utils");
// Michelson validator
var noArgInstructionIDs = {
"DUP": true, "SWAP": true, "SOME": true, "UNIT": true, "PAIR": true, "CAR": true, "CDR": true,
"CONS": true, "SIZE": true, "MEM": true, "GET": true, "UPDATE": true, "EXEC": true, "APPLY": true, "FAILWITH": true, "RENAME": true, "CONCAT": true, "SLICE": true,
"PACK": true, "ADD": true, "SUB": true, "MUL": true, "EDIV": true, "ABS": true, "ISNAT": true, "INT": true, "NEG": true, "LSL": true, "LSR": true, "OR": true,
"AND": true, "XOR": true, "NOT": true, "COMPARE": true, "EQ": true, "NEQ": true, "LT": true, "GT": true, "LE": true, "GE": true, "SELF": true,
"TRANSFER_TOKENS": true, "SET_DELEGATE": true, "CREATE_ACCOUNT": true, "IMPLICIT_ACCOUNT": true, "NOW": true, "AMOUNT": true,
"BALANCE": true, "CHECK_SIGNATURE": true, "BLAKE2B": true, "SHA256": true, "SHA512": true, "HASH_KEY": true, "STEPS_TO_QUOTA": true,
"SOURCE": true, "SENDER": true, "ADDRESS": true, "CHAIN_ID": true,
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
exports.instructionIDs = Object.assign({}, noArgInstructionIDs, {
"DROP": true, "DIG": true, "DUG": true, "NONE": true, "LEFT": true, "RIGHT": true, "NIL": true, "UNPACK": true, "CONTRACT": true, "CAST": true,
"IF_NONE": true, "IF_LEFT": true, "IF_CONS": true, "IF": true, "MAP": true, "ITER": true, "LOOP": true, "LOOP_LEFT": true, "DIP": true,
"CREATE_CONTRACT": true, "PUSH": true, "EMPTY_SET": true, "EMPTY_MAP": true, "EMPTY_BIG_MAP": true, "LAMBDA": true,
});
var simpleComparableTypeIDs = {
"int": true, "nat": true, "string": true, "bytes": true, "mutez": true,
"bool": true, "key_hash": true, "timestamp": true, "address": true,
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertMichelsonType = exports.assertMichelsonCode = exports.assertMichelsonData = exports.assertMichelsonScript = exports.ValidationError = void 0;
var ValidationError = /** @class */ (function (_super) {
__extends(ValidationError, _super);
var typeIDs = {
"address": true, "big_map": true, "bool": true, "bytes": true, "chain_id": true, "contract": true, "int": true,
"key_hash": true, "key": true, "lambda": true, "list": true, "map": true, "mutez": true, "nat": true, "operation": true, "option": true,
"or": true, "pair": true, "set": true, "signature": true, "string": true, "timestamp": true, "unit": true,
};
var MichelsonValidationError = /** @class */ (function (_super) {
__extends(MichelsonValidationError, _super);
/**
* @param val Value of a node caused the error
* @param path Path to a node caused the error in the AST tree
* @param message An error message
*/
function ValidationError(val, path, message) {
var _this = _super.call(this, message) || this;
function MichelsonValidationError(val, message) {
var _this = _super.call(this, val, message) || this;
_this.val = val;
_this.path = path;
Object.setPrototypeOf(_this, MichelsonValidationError.prototype);
return _this;
}
return ValidationError;
}(Error));
exports.ValidationError = ValidationError;
return MichelsonValidationError;
}(utils_1.MichelsonError));
exports.MichelsonValidationError = MichelsonValidationError;
function isPrim(ex) {
return "prim" in ex;
}
function assertPrim(ex, path) {
function assertPrim(ex) {
if (isPrim(ex)) {
return true;
}
throw new ValidationError(ex, path, "prim expression expected");
throw new MichelsonValidationError(ex, "prim expression expected");
}
function assertSeq(ex, path) {
function assertSeq(ex) {
if (Array.isArray(ex)) {
return true;
}
throw new ValidationError(ex, path, "sequence expression expected");
throw new MichelsonValidationError(ex, "sequence expression expected");
}
function assertNatural(i, path) {
function assertNatural(i) {
if (i.int[0] === "-") {
throw new ValidationError(i, path, "natural number expected");
throw new MichelsonValidationError(i, "natural number expected");
}
}
function assertIntLiteral(ex, path) {
function assertIntLiteral(ex) {
if ("int" in ex) {
return true;
}
throw new ValidationError(ex, path, "int literal expected");
throw new MichelsonValidationError(ex, "int literal expected");
}
function assertArgs(ex, n, path) {
function assertArgs(ex, n) {
var _a;

@@ -97,32 +100,20 @@ if ((n === 0 && ex.args === undefined) || ((_a = ex.args) === null || _a === void 0 ? void 0 : _a.length) === n) {

}
throw new ValidationError(ex, path, n + " arguments expected");
throw new MichelsonValidationError(ex, n + " arguments expected");
}
var unaryInstructionTable = {
"DUP": true, "SWAP": true, "SOME": true, "UNIT": true, "PAIR": true, "CAR": true, "CDR": true,
"CONS": true, "SIZE": true, "MEM": true, "GET": true, "UPDATE": true, "EXEC": true, "FAILWITH": true, "RENAME": true, "CONCAT": true, "SLICE": true,
"PACK": true, "ADD": true, "SUB": true, "MUL": true, "EDIV": true, "ABS": true, "ISNAT": true, "INT": true, "NEG": true, "LSL": true, "LSR": true, "OR": true,
"AND": true, "XOR": true, "NOT": true, "COMPARE": true, "EQ": true, "NEQ": true, "LT": true, "GT": true, "LE": true, "GE": true, "SELF": true,
"TRANSFER_TOKENS": true, "SET_DELEGATE": true, "CREATE_ACCOUNT": true, "IMPLICIT_ACCOUNT": true, "NOW": true, "AMOUNT": true,
"BALANCE": true, "CHECK_SIGNATURE": true, "BLAKE2B": true, "SHA256": true, "SHA512": true, "HASH_KEY": true, "STEPS_TO_QUOTA": true,
"SOURCE": true, "SENDER": true, "ADDRESS": true, "CHAIN_ID": true,
};
var instructionTable = Object.assign({}, unaryInstructionTable, {
"DROP": true, "DIG": true, "DUG": true, "NONE": true, "LEFT": true, "RIGHT": true, "NIL": true, "UNPACK": true, "CONTRACT": true, "CAST": true,
"IF_NONE": true, "IF_LEFT": true, "IF_CONS": true, "IF": true, "MAP": true, "ITER": true, "LOOP": true, "LOOP_LEFT": true, "DIP": true,
"CREATE_CONTRACT": true, "PUSH": true, "EMPTY_SET": true, "EMPTY_MAP": true, "EMPTY_BIG_MAP": true, "LAMBDA": true,
});
function assertMichelsonInstruction(ex, path) {
/**
* Checks if the node is a valid Michelson code (sequence of instructions).
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonInstruction(ex) {
var e_1, _a;
var _b, _c;
if (Array.isArray(ex)) {
var i = 0;
try {
for (var ex_1 = __values(ex), ex_1_1 = ex_1.next(); !ex_1_1.done; ex_1_1 = ex_1.next()) {
var n = ex_1_1.value;
var p = __spread(path, [{ index: i, val: n }]);
if (!Array.isArray(n) && !isPrim(n)) {
throw new ValidationError(ex, p, "sequence or prim expected");
throw new MichelsonValidationError(ex, "sequence or prim expected");
}
assertMichelsonInstruction(n, p);
i++;
assertMichelsonInstruction(n);
}

@@ -137,14 +128,15 @@ }

}
return true;
}
else if (Object.prototype.hasOwnProperty.call(unaryInstructionTable, ex.prim)) {
assertArgs(ex, 0, path);
}
else {
if (assertPrim(ex)) {
if (Object.prototype.hasOwnProperty.call(noArgInstructionIDs, ex.prim)) {
assertArgs(ex, 0);
return true;
}
switch (ex.prim) {
case "DROP":
if (ex.args !== undefined && assertArgs(ex, 1, path)) {
var p = __spread(path, [{ index: 0, val: ex.args[0] }]);
if (ex.args !== undefined && assertArgs(ex, 1)) {
/* istanbul ignore else */
if (assertIntLiteral(ex.args[0], p)) {
assertNatural(ex.args[0], p);
if (assertIntLiteral(ex.args[0])) {
assertNatural(ex.args[0]);
}

@@ -156,7 +148,6 @@ }

/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
var p = __spread(path, [{ index: 0, val: ex.args[0] }]);
if (assertArgs(ex, 1)) {
/* istanbul ignore else */
if (assertIntLiteral(ex.args[0], p)) {
assertNatural(ex.args[0], p);
if (assertIntLiteral(ex.args[0])) {
assertNatural(ex.args[0]);
}

@@ -169,8 +160,18 @@ }

case "NIL":
case "CAST":
/* istanbul ignore else */
if (assertArgs(ex, 1)) {
assertMichelsonType(ex.args[0]);
}
break;
case "UNPACK":
/* istanbul ignore else */
if (assertArgs(ex, 1)) {
assertMichelsonSerializableType(ex.args[0]);
}
break;
case "CONTRACT":
case "CAST":
/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
assertMichelsonTypeInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
if (assertArgs(ex, 1)) {
assertMichelsonPassableType(ex.args[0]);
}

@@ -183,12 +184,10 @@ break;

/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
var p0 = __spread(path, [{ index: 0, val: ex.args[0] }]);
if (assertArgs(ex, 2)) {
/* istanbul ignore else */
if (assertSeq(ex.args[0], p0)) {
assertMichelsonInstruction(ex.args[0], p0);
if (assertSeq(ex.args[0])) {
assertMichelsonInstruction(ex.args[0]);
}
var p1 = __spread(path, [{ index: 1, val: ex.args[1] }]);
/* istanbul ignore else */
if (assertSeq(ex.args[1], p1)) {
assertMichelsonInstruction(ex.args[1], p1);
if (assertSeq(ex.args[1])) {
assertMichelsonInstruction(ex.args[1]);
}

@@ -201,10 +200,11 @@ }

case "LOOP_LEFT":
/* istanbul ignore else */
if (assertArgs(ex, 1)) {
assertMichelsonInstruction(ex.args[0]);
}
break;
case "CREATE_CONTRACT":
/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
var p = __spread(path, [{ index: 0, val: ex.args[0] }]);
/* istanbul ignore else */
if (assertSeq(ex.args[0], p)) {
assertMichelsonInstruction(ex.args[0], p);
}
if (assertArgs(ex, 1)) {
assertMichelsonContract(ex.args[0]);
}

@@ -214,22 +214,19 @@ break;

if (((_b = ex.args) === null || _b === void 0 ? void 0 : _b.length) === 2) {
var p0 = __spread(path, [{ index: 0, val: ex.args[0] }]);
/* istanbul ignore else */
if (assertIntLiteral(ex.args[0], p0)) {
assertNatural(ex.args[0], p0);
if (assertIntLiteral(ex.args[0])) {
assertNatural(ex.args[0]);
}
var p1 = __spread(path, [{ index: 1, val: ex.args[1] }]);
/* istanbul ignore else */
if (assertSeq(ex.args[1], p1)) {
assertMichelsonInstruction(ex.args[1], p1);
if (assertSeq(ex.args[1])) {
assertMichelsonInstruction(ex.args[1]);
}
}
else if (((_c = ex.args) === null || _c === void 0 ? void 0 : _c.length) === 1) {
var p = __spread(path, [{ index: 0, val: ex.args[0] }]);
/* istanbul ignore else */
if (assertSeq(ex.args[0], p)) {
assertMichelsonInstruction(ex.args[0], p);
if (assertSeq(ex.args[0])) {
assertMichelsonInstruction(ex.args[0]);
}
}
else {
throw new ValidationError(ex, path, "1 or 2 arguments expected");
throw new MichelsonValidationError(ex, "1 or 2 arguments expected");
}

@@ -239,5 +236,5 @@ break;

/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
assertMichelsonTypeInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonDataInternal(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
if (assertArgs(ex, 2)) {
assertMichelsonPushableType(ex.args[0]);
assertMichelsonData(ex.args[1]);
}

@@ -247,12 +244,18 @@ break;

/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
assertMichelsonComparableType(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
if (assertArgs(ex, 1)) {
assertMichelsonComparableType(ex.args[0]);
}
break;
case "EMPTY_MAP":
/* istanbul ignore else */
if (assertArgs(ex, 2)) {
assertMichelsonComparableType(ex.args[0]);
assertMichelsonType(ex.args[1]);
}
break;
case "EMPTY_BIG_MAP":
/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
assertMichelsonComparableType(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonTypeInternal(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
if (assertArgs(ex, 2)) {
assertMichelsonComparableType(ex.args[0]);
assertMichelsonSerializableType(ex.args[1]);
}

@@ -262,9 +265,8 @@ break;

/* istanbul ignore else */
if (assertArgs(ex, 3, path)) {
assertMichelsonTypeInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonTypeInternal(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
var p2 = __spread(path, [{ index: 2, val: ex.args[2] }]);
if (assertArgs(ex, 3)) {
assertMichelsonType(ex.args[0]);
assertMichelsonType(ex.args[1]);
/* istanbul ignore else */
if (assertSeq(ex.args[2], p2)) {
assertMichelsonInstruction(ex.args[2], p2);
if (assertSeq(ex.args[2])) {
assertMichelsonInstruction(ex.args[2]);
}

@@ -274,3 +276,3 @@ }

default:
throw new ValidationError(ex, path, "instruction expected");
throw new MichelsonValidationError(ex, "instruction expected");
}

@@ -280,84 +282,155 @@ }

}
var simpleComparableTypeTable = {
"int": true, "nat": true, "string": true, "bytes": true, "mutez": true,
"bool": true, "key_hash": true, "timestamp": true, "address": true,
};
function assertMichelsonSimpleComparableType(ex, path) {
exports.assertMichelsonInstruction = assertMichelsonInstruction;
function assertMichelsonComparableType(ex) {
/* istanbul ignore else */
if (assertPrim(ex, path)) {
if (!Object.prototype.hasOwnProperty.call(simpleComparableTypeTable, ex.prim)) {
throw new ValidationError(ex, path, "simple comparable type expected");
if (assertPrim(ex)) {
if (!Object.prototype.hasOwnProperty.call(simpleComparableTypeIDs, ex.prim) && ex.prim !== "pair") {
throw new MichelsonValidationError(ex, ex.prim + ": type is not comparable");
}
assertArgs(ex, 0, path);
traverseType(ex, function (ex) {
if (!Object.prototype.hasOwnProperty.call(simpleComparableTypeIDs, ex.prim)) {
throw new MichelsonValidationError(ex, ex.prim + ": type is not comparable");
}
assertArgs(ex, 0);
}, function (ex) { return assertMichelsonComparableType(ex); });
}
return true;
}
function assertMichelsonComparableType(ex, path) {
exports.assertMichelsonComparableType = assertMichelsonComparableType;
function assertMichelsonSerializableType(ex) {
/* istanbul ignore else */
if (assertPrim(ex, path)) {
if (Object.prototype.hasOwnProperty.call(simpleComparableTypeTable, ex.prim)) {
assertArgs(ex, 0, path);
if (assertPrim(ex)) {
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
ex.prim === "big_map" ||
ex.prim === "operation") {
throw new MichelsonValidationError(ex, ex.prim + ": type can't be used inside big_map or PACK/UNPACK instructions");
}
else if (ex.prim === "pair") {
/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
assertMichelsonSimpleComparableType(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonComparableType(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
}
traverseType(ex, function (ex) { return assertMichelsonSerializableType(ex); }, function (ex) { return assertMichelsonSerializableType(ex); });
}
return true;
}
exports.assertMichelsonSerializableType = assertMichelsonSerializableType;
function assertMichelsonPushableType(ex) {
/* istanbul ignore else */
if (assertPrim(ex)) {
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
ex.prim === "big_map" ||
ex.prim === "operation" ||
ex.prim === "contract") {
throw new MichelsonValidationError(ex, ex.prim + ": type can't be pushed");
}
else {
throw new ValidationError(ex, path, "comparable type expected");
traverseType(ex, function (ex) { return assertMichelsonPushableType(ex); }, function (ex) { return assertMichelsonPushableType(ex); });
}
return true;
}
exports.assertMichelsonPushableType = assertMichelsonPushableType;
function assertMichelsonStorableType(ex) {
/* istanbul ignore else */
if (assertPrim(ex)) {
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
ex.prim === "operation" ||
ex.prim === "contract") {
throw new MichelsonValidationError(ex, ex.prim + ": type can't be used as part of a storage");
}
traverseType(ex, function (ex) { return assertMichelsonStorableType(ex); }, function (ex) { return assertMichelsonStorableType(ex); });
}
return true;
}
function assertMichelsonTypeInternal(ex, path) {
exports.assertMichelsonStorableType = assertMichelsonStorableType;
function assertMichelsonPassableType(ex) {
/* istanbul ignore else */
if (assertPrim(ex, path)) {
switch (ex.prim) {
case "key":
case "unit":
case "signature":
case "operation":
case "chain_id":
assertArgs(ex, 0, path);
break;
case "option":
case "list":
case "contract":
/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
assertMichelsonTypeInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
}
break;
case "pair":
case "or":
case "lambda":
/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
assertMichelsonTypeInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonTypeInternal(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
}
break;
case "set":
/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
assertMichelsonComparableType(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
}
break;
case "map":
case "big_map":
/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
assertMichelsonComparableType(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonTypeInternal(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
}
break;
default:
assertMichelsonComparableType(ex, path);
if (assertPrim(ex)) {
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim) ||
ex.prim === "operation") {
throw new MichelsonValidationError(ex, ex.prim + ": type can't be used as part of a parameter");
}
traverseType(ex, function (ex) { return assertMichelsonPassableType(ex); }, function (ex) { return assertMichelsonPassableType(ex); });
}
return true;
}
function assertMichelsonDataInternal(ex, path) {
exports.assertMichelsonPassableType = assertMichelsonPassableType;
/**
* Checks if the node is a valid Michelson type expression.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonType(ex) {
/* istanbul ignore else */
if (assertPrim(ex)) {
if (!Object.prototype.hasOwnProperty.call(typeIDs, ex.prim)) {
throw new MichelsonValidationError(ex, "type expected");
}
traverseType(ex, function (ex) { return assertMichelsonType(ex); }, function (ex) { return assertMichelsonType(ex); });
}
return true;
}
exports.assertMichelsonType = assertMichelsonType;
function traverseType(ex, left, child) {
switch (ex.prim) {
case "option":
case "list":
/* istanbul ignore else */
if (assertArgs(ex, 1) && assertPrim(ex.args[0])) {
child(ex.args[0]);
}
break;
case "contract":
/* istanbul ignore else */
if (assertArgs(ex, 1)) {
assertMichelsonPassableType(ex.args[0]);
}
break;
case "pair":
/* istanbul ignore else */
if (assertArgs(ex, 2) && assertPrim(ex.args[0]) && assertPrim(ex.args[1])) {
left(ex.args[0]);
child(ex.args[1]);
}
break;
case "or":
/* istanbul ignore else */
if (assertArgs(ex, 2) && assertPrim(ex.args[0]) && assertPrim(ex.args[1])) {
child(ex.args[0]);
child(ex.args[1]);
}
break;
case "lambda":
/* istanbul ignore else */
if (assertArgs(ex, 2)) {
assertMichelsonType(ex.args[0]);
assertMichelsonType(ex.args[1]);
}
break;
case "set":
/* istanbul ignore else */
if (assertArgs(ex, 1)) {
assertMichelsonComparableType(ex.args[0]);
}
break;
case "map":
/* istanbul ignore else */
if (assertArgs(ex, 2) && assertPrim(ex.args[0]) && assertPrim(ex.args[1])) {
assertMichelsonComparableType(ex.args[0]);
child(ex.args[1]);
}
break;
case "big_map":
/* istanbul ignore else */
if (assertArgs(ex, 2) && assertPrim(ex.args[0]) && assertPrim(ex.args[1])) {
assertMichelsonComparableType(ex.args[0]);
assertMichelsonSerializableType(ex.args[1]);
child(ex.args[1]);
}
break;
default:
assertArgs(ex, 0);
}
return true;
}
/**
* Checks if the node is a valid Michelson data literal such as `(Pair {Elt "0" 0} 0)`.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonData(ex) {
var e_2, _a;

@@ -369,12 +442,10 @@ if (("int" in ex) || ("string" in ex) || ("bytes" in ex)) {

var mapElts = 0;
var i = 0;
try {
for (var ex_2 = __values(ex), ex_2_1 = ex_2.next(); !ex_2_1.done; ex_2_1 = ex_2.next()) {
var n = ex_2_1.value;
var p = __spread(path, [{ index: i, val: n }]);
if (isPrim(n) && n.prim === "Elt") {
/* istanbul ignore else */
if (assertArgs(n, 2, p)) {
assertMichelsonDataInternal(n.args[0], __spread(p, [{ index: 0, val: n.args[0] }]));
assertMichelsonDataInternal(n.args[1], __spread(p, [{ index: 1, val: n.args[1] }]));
if (assertArgs(n, 2)) {
assertMichelsonData(n.args[0]);
assertMichelsonData(n.args[1]);
}

@@ -384,5 +455,4 @@ mapElts++;

else {
assertMichelsonDataInternal(n, p);
assertMichelsonData(n);
}
i++;
}

@@ -398,3 +468,3 @@ }

if (mapElts !== 0 && mapElts !== ex.length) {
throw new ValidationError(ex, path, "data entries and map elements can't be intermixed");
throw new MichelsonValidationError(ex, "data entries and map elements can't be intermixed");
}

@@ -409,9 +479,9 @@ return true;

case "None":
assertArgs(ex, 0, path);
assertArgs(ex, 0);
break;
case "Pair":
/* istanbul ignore else */
if (assertArgs(ex, 2, path)) {
assertMichelsonDataInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
assertMichelsonDataInternal(ex.args[1], __spread(path, [{ index: 1, val: ex.args[1] }]));
if (assertArgs(ex, 2)) {
assertMichelsonData(ex.args[0]);
assertMichelsonData(ex.args[1]);
}

@@ -423,12 +493,12 @@ break;

/* istanbul ignore else */
if (assertArgs(ex, 1, path)) {
assertMichelsonDataInternal(ex.args[0], __spread(path, [{ index: 0, val: ex.args[0] }]));
if (assertArgs(ex, 1)) {
assertMichelsonData(ex.args[0]);
}
break;
default:
if (Object.prototype.hasOwnProperty.call(instructionTable, ex.prim)) {
assertMichelsonInstruction(ex, path);
if (Object.prototype.hasOwnProperty.call(exports.instructionIDs, ex.prim)) {
assertMichelsonInstruction(ex);
}
else {
throw new ValidationError(ex, path, "data entry or instruction expected");
throw new MichelsonValidationError(ex, "data entry or instruction expected");
}

@@ -438,36 +508,37 @@ }

else {
throw new ValidationError(ex, path, "data entry expected");
throw new MichelsonValidationError(ex, "data entry expected");
}
return true;
}
function assertMichelsonScriptInternal(ex, path) {
exports.assertMichelsonData = assertMichelsonData;
/**
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonContract(ex) {
var e_3, _a;
/* istanbul ignore else */
if (assertSeq(ex, path) && ex.length === 3 &&
assertPrim(ex[0], __spread(path, [{ index: 0, val: ex[0] }])) &&
assertPrim(ex[1], __spread(path, [{ index: 1, val: ex[1] }])) &&
assertPrim(ex[2], __spread(path, [{ index: 2, val: ex[2] }]))) {
if (assertSeq(ex) && ex.length === 3 && assertPrim(ex[0]) && assertPrim(ex[1]) && assertPrim(ex[2])) {
var p = [ex[0].prim, ex[1].prim, ex[2].prim].sort();
if (p[0] === "code" && p[1] === "parameter" && p[2] === "storage") {
var i = 0;
try {
for (var _b = __values(ex), _c = _b.next(); !_c.done; _c = _b.next()) {
var n = _c.value;
var p_1 = __spread(path, [{ index: i, val: n }]);
/* istanbul ignore else */
if (assertArgs(n, 1, p_1)) {
var pp = __spread(p_1, [{ index: 0, val: n.args[0] }]);
if (assertArgs(n, 1)) {
switch (n.prim) {
case "code":
/* istanbul ignore else */
if (assertSeq(n.args[0], pp)) {
assertMichelsonInstruction(n.args[0], pp);
if (assertSeq(n.args[0])) {
assertMichelsonInstruction(n.args[0]);
}
break;
case "parameter":
assertMichelsonPassableType(n.args[0]);
break;
case "storage":
assertMichelsonTypeInternal(n.args[0], pp);
assertMichelsonStorableType(n.args[0]);
}
}
i++;
}

@@ -484,3 +555,3 @@ }

else {
throw new ValidationError(ex, path, "valid Michelson script expected");
throw new MichelsonValidationError(ex, "valid Michelson script expected");
}

@@ -490,38 +561,59 @@ }

}
exports.assertMichelsonContract = assertMichelsonContract;
/**
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonScript(ex) {
return assertMichelsonScriptInternal(ex, []);
function isMichelsonScript(ex) {
try {
assertMichelsonContract(ex);
return true;
}
catch (_a) {
return false;
}
}
exports.assertMichelsonScript = assertMichelsonScript;
exports.isMichelsonScript = isMichelsonScript;
/**
* Checks if the node is a valid Michelson data literal such as `(Pair {Elt "0" 0} 0)`.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonData(ex) {
return assertMichelsonDataInternal(ex, []);
function isMichelsonData(ex) {
try {
assertMichelsonData(ex);
return true;
}
catch (_a) {
return false;
}
}
exports.assertMichelsonData = assertMichelsonData;
exports.isMichelsonData = isMichelsonData;
/**
* Checks if the node is a valid Michelson code (sequence of instructions).
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonCode(ex) {
return assertMichelsonInstruction(ex, []);
function isMichelsonCode(ex) {
try {
assertMichelsonInstruction(ex);
return true;
}
catch (_a) {
return false;
}
}
exports.assertMichelsonCode = assertMichelsonCode;
exports.isMichelsonCode = isMichelsonCode;
/**
* Checks if the node is a valid Michelson type expression.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
function assertMichelsonType(ex) {
return assertMichelsonTypeInternal(ex, []);
function isMichelsonType(ex) {
try {
assertMichelsonType(ex);
return true;
}
catch (_a) {
return false;
}
}
exports.assertMichelsonType = assertMichelsonType;
exports.isMichelsonType = isMichelsonType;
//# sourceMappingURL=michelson-validator.js.map

@@ -50,2 +50,3 @@ "use strict";

_this.idx = idx;
Object.setPrototypeOf(_this, ScanError.prototype);
return _this;

@@ -78,3 +79,3 @@ }

case 1:
if (!(i < src.length)) return [3 /*break*/, 16];
if (!(i < src.length)) return [3 /*break*/, 19];
// Skip space

@@ -95,6 +96,6 @@ while (i < src.length && isSpace.test(src[i])) {

}
return [4 /*yield*/, { t: Literal.Ident, v: src.slice(start, i), offset: i }];
return [4 /*yield*/, { t: Literal.Ident, v: src.slice(start, i), first: start, last: i }];
case 2:
_a.sent();
return [3 /*break*/, 15];
return [3 /*break*/, 18];
case 3:

@@ -107,12 +108,9 @@ if (!(src.length - i > 1 && src.substr(i, 2) === "0x")) return [3 /*break*/, 5];

}
if (i - start === 2) {
throw new ScanError(src, i, "Bytes literal is too short");
}
else if (((i - start) & 1) !== 0) {
if (((i - start) & 1) !== 0) {
throw new ScanError(src, i, "Bytes literal length is expected to be power of two");
}
return [4 /*yield*/, { t: Literal.Bytes, v: src.slice(start, i), offset: i }];
return [4 /*yield*/, { t: Literal.Bytes, v: src.slice(start, i), first: start, last: i }];
case 4:
_a.sent();
return [3 /*break*/, 15];
return [3 /*break*/, 18];
case 5:

@@ -131,6 +129,6 @@ if (!(isDigit.test(s) || s === "-")) return [3 /*break*/, 7];

}
return [4 /*yield*/, { t: Literal.Number, v: src.slice(start, i), offset: i }];
return [4 /*yield*/, { t: Literal.Number, v: src.slice(start, i), first: start, last: i }];
case 6:
_a.sent();
return [3 /*break*/, 15];
return [3 /*break*/, 18];
case 7:

@@ -153,6 +151,6 @@ if (!(s === "\"")) return [3 /*break*/, 9];

i++;
return [4 /*yield*/, { t: Literal.String, v: src.slice(start, i), offset: i }];
return [4 /*yield*/, { t: Literal.String, v: src.slice(start, i), first: start, last: i }];
case 8:
_a.sent();
return [3 /*break*/, 15];
return [3 /*break*/, 18];
case 9:

@@ -166,17 +164,34 @@ if (!(s === "#")) return [3 /*break*/, 12];

if (!scanComments) return [3 /*break*/, 11];
return [4 /*yield*/, { t: Literal.Comment, v: src.slice(start, i), offset: i }];
return [4 /*yield*/, { t: Literal.Comment, v: src.slice(start, i), first: start, last: i }];
case 10:
_a.sent();
_a.label = 11;
case 11: return [3 /*break*/, 15];
case 11: return [3 /*break*/, 18];
case 12:
if (!(s === "(" || s === ")" || s === "{" || s === "}" || s === ";")) return [3 /*break*/, 14];
i++;
return [4 /*yield*/, { t: s, v: s, offset: i }];
if (!(src.length - i > 1 && src.substr(i, 2) === "/*")) return [3 /*break*/, 15];
// C style comment
i += 2;
while (i < src.length && !(src.length - i > 1 && src.substr(i, 2) === "*/")) {
i++;
}
if (i === src.length) {
throw new ScanError(src, i, "Unterminated C style comment");
}
i += 2;
if (!scanComments) return [3 /*break*/, 14];
return [4 /*yield*/, { t: Literal.Comment, v: src.slice(start, i), first: start, last: i }];
case 13:
_a.sent();
return [3 /*break*/, 15];
case 14: throw new ScanError(src, i, "Invalid character at offset " + i + ": `" + s + "'");
case 15: return [3 /*break*/, 1];
case 16: return [2 /*return*/];
_a.label = 14;
case 14: return [3 /*break*/, 18];
case 15:
if (!(s === "(" || s === ")" || s === "{" || s === "}" || s === ";")) return [3 /*break*/, 17];
i++;
return [4 /*yield*/, { t: s, v: s, first: start, last: i }];
case 16:
_a.sent();
return [3 /*break*/, 18];
case 17: throw new ScanError(src, i, "Invalid character at offset " + i + ": `" + s + "'");
case 18: return [3 /*break*/, 1];
case 19: return [2 /*return*/];
}

@@ -183,0 +198,0 @@ });

@@ -13,3 +13,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.MacroError = void 0;
exports.MacroError = exports.isMichelsonError = exports.MichelsonError = void 0;
__exportStar(require("./micheline"), exports);

@@ -19,4 +19,11 @@ __exportStar(require("./micheline-parser"), exports);

__exportStar(require("./michelson-validator"), exports);
__exportStar(require("./michelson-types"), exports);
__exportStar(require("./michelson-typecheck"), exports);
__exportStar(require("./michelson-contract"), exports);
__exportStar(require("./formatters"), exports);
var utils_1 = require("./utils");
Object.defineProperty(exports, "MichelsonError", { enumerable: true, get: function () { return utils_1.MichelsonError; } });
Object.defineProperty(exports, "isMichelsonError", { enumerable: true, get: function () { return utils_1.isMichelsonError; } });
var macros_1 = require("./macros");
Object.defineProperty(exports, "MacroError", { enumerable: true, get: function () { return macros_1.MacroError; } });
//# sourceMappingURL=taquito-michel-codec.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkTezosID = exports.tezosPrefix = exports.unpackAnnotations = exports.isNatural = exports.isDecimal = exports.compareBytes = exports.parseBytes = exports.LongInteger = exports.isMichelsonError = exports.MichelsonError = void 0;
var base58_1 = require("./base58");
var MichelsonError = /** @class */ (function (_super) {
__extends(MichelsonError, _super);
/**
* @param val Value of a AST node caused the error
* @param path Path to a node caused the error
* @param message An error message
*/
function MichelsonError(val, message) {
var _this = _super.call(this, message) || this;
_this.val = val;
Object.setPrototypeOf(_this, MichelsonError.prototype);
return _this;
}
return MichelsonError;
}(Error));
exports.MichelsonError = MichelsonError;
function isMichelsonError(err) {
return err instanceof MichelsonError;
}
exports.isMichelsonError = isMichelsonError;
// Ad hoc big integer parser
var LongInteger = /** @class */ (function () {
function LongInteger(arg) {
this.neg = false;
this.buf = [];
if (arg === undefined) {
return;
}
if (typeof arg === "string") {
for (var i = 0; i < arg.length; i++) {
var c = arg.charCodeAt(i);
if (i === 0 && c === 0x2d) {
this.neg = true;
}
else {
if (c < 0x30 || c > 0x39) {
throw new Error("unexpected character in integer constant: " + arg[i]);
}
this.append(c - 0x30);
}
}
}
else if (arg < 0) {
this.neg = true;
this.append(-arg);
}
else {
this.append(arg);
}
}
LongInteger.prototype.append = function (c) {
var i = 0;
while (c !== 0 || i < this.buf.length) {
var m = (this.buf[i] || 0) * 10 + c;
this.buf[i++] = m % 256;
c = Math.floor(m / 256);
}
};
LongInteger.prototype.cmp = function (arg) {
if (this.neg !== arg.neg) {
return (arg.neg ? 1 : 0) - (this.neg ? 1 : 0);
}
else {
var ret = 0;
if (this.buf.length !== arg.buf.length) {
ret = this.buf.length < arg.buf.length ? -1 : 1;
}
else if (this.buf.length !== 0) {
var i = arg.buf.length - 1;
while (i >= 0 && this.buf[i] === arg.buf[i]) {
i--;
}
ret = i < 0 ? 0 : this.buf[i] < arg.buf[i] ? -1 : 1;
}
return !this.neg ? ret : ret === 0 ? 0 : -ret;
}
};
Object.defineProperty(LongInteger.prototype, "sign", {
get: function () {
return this.buf.length === 0 ? 0 : this.neg ? -1 : 1;
},
enumerable: false,
configurable: true
});
return LongInteger;
}());
exports.LongInteger = LongInteger;
function parseBytes(s) {
var ret = [];
for (var i = 0; i < s.length; i += 2) {
var x = parseInt(s.slice(i, i + 2), 16);
if (Number.isNaN(x)) {
return null;
}
ret.push(x);
}
return ret;
}
exports.parseBytes = parseBytes;
function compareBytes(a, b) {
if (a.length !== b.length) {
return a.length < b.length ? -1 : 1;
}
else if (a.length !== 0) {
var i = 0;
while (i < a.length && a[i] === b[i]) {
i++;
}
return i === a.length ? 0 : a[i] < b[i] ? -1 : 1;
}
else {
return 0;
}
}
exports.compareBytes = compareBytes;
function isDecimal(x) {
try {
// tslint:disable-next-line: no-unused-expression
new LongInteger(x);
return true;
}
catch (_a) {
return false;
}
}
exports.isDecimal = isDecimal;
function isNatural(x) {
try {
return new LongInteger(x).sign >= 0;
}
catch (_a) {
return false;
}
}
exports.isNatural = isNatural;
var annRe = /^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z\.%@]*)?)$/;
function unpackAnnotations(p, opt) {
var e_1, _a;
var field;
var type;
var vars;
if (p.annots !== undefined) {
try {
for (var _b = __values(p.annots), _c = _b.next(); !_c.done; _c = _b.next()) {
var v = _c.value;
if (v.length !== 0) {
if (!annRe.test(v) ||
(!(opt === null || opt === void 0 ? void 0 : opt.specialVar) && (v === "@%" || v === "@%%")) ||
(!(opt === null || opt === void 0 ? void 0 : opt.specialFields) && v === "%@")) {
throw new MichelsonError(p, p.prim + ": unexpected annotation: " + v);
}
switch (v[0]) {
case "%":
if ((opt === null || opt === void 0 ? void 0 : opt.emptyFields) || v.length > 1) {
field = field || [];
field.push(v);
}
break;
case ":":
if (v.length > 1) {
type = type || [];
type.push(v);
}
break;
case "@":
if ((opt === null || opt === void 0 ? void 0 : opt.emptyVar) || v.length > 1) {
vars = vars || [];
vars.push(v);
}
break;
}
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
}
return { f: field, t: type, v: vars };
}
exports.unpackAnnotations = unpackAnnotations;
exports.tezosPrefix = {
BlockHash: [32, [1, 52]],
OperationHash: [32, [5, 116]],
OperationListHash: [32, [133, 233]],
OperationListListHash: [32, [29, 159, 109]],
ProtocolHash: [32, [2, 170]],
ContextHash: [32, [79, 199]],
ED25519PublicKeyHash: [20, [6, 161, 159]],
SECP256K1PublicKeyHash: [20, [6, 161, 161]],
P256PublicKeyHash: [20, [6, 161, 164]],
ContractHash: [20, [2, 90, 121]],
CryptoboxPublicKeyHash: [16, [153, 103]],
ED25519Seed: [32, [13, 15, 58, 7]],
ED25519PublicKey: [32, [13, 15, 37, 217]],
SECP256K1SecretKey: [32, [17, 162, 224, 201]],
P256SecretKey: [32, [16, 81, 238, 189]],
ED25519EncryptedSeed: [56, [7, 90, 60, 179, 41]],
SECP256K1EncryptedSecretKey: [56, [9, 237, 241, 174, 150]],
P256EncryptedSecretKey: [56, [9, 48, 57, 115, 171]],
SECP256K1PublicKey: [33, [3, 254, 226, 86]],
P256PublicKey: [33, [3, 178, 139, 127]],
SECP256K1Scalar: [33, [38, 248, 136]],
SECP256K1Element: [33, [5, 92, 0]],
ED25519SecretKey: [64, [43, 246, 78, 7]],
ED25519Signature: [64, [9, 245, 205, 134, 18]],
SECP256K1Signature: [64, [13, 115, 101, 19, 63]],
P256Signature: [64, [54, 240, 44, 52]],
GenericSignature: [64, [4, 130, 43]],
ChainID: [4, [87, 82, 0]],
};
function checkTezosID(id) {
var e_2, _a;
var types = [];
for (var _i = 1; _i < arguments.length; _i++) {
types[_i - 1] = arguments[_i];
}
var buf = Array.isArray(id) ? id : base58_1.decodeBase58Check(id);
try {
for (var types_1 = __values(types), types_1_1 = types_1.next(); !types_1_1.done; types_1_1 = types_1.next()) {
var t = types_1_1.value;
var prefix = exports.tezosPrefix[t];
if (buf.length === prefix[0] + prefix[1].length) {
var i = 0;
while (i < prefix[1].length && buf[i] === prefix[1][i]) {
i++;
}
if (i === prefix[1].length) {
return [t, buf.slice(prefix[1].length)];
}
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (types_1_1 && !types_1_1.done && (_a = types_1.return)) _a.call(types_1);
}
finally { if (e_2) throw e_2.error; }
}
return null;
}
exports.checkTezosID = checkTezosID;
//# sourceMappingURL=utils.js.map

@@ -17,2 +17,2 @@ import { Expr } from "./micheline";

*/
export declare function emitMicheline(expr: Expr, opt?: FormatOptions): string;
export declare function emitMicheline(expr: Expr, opt?: FormatOptions, foldMacros?: boolean): string;

@@ -0,5 +1,14 @@

export declare type SourceReference = {
first: number;
last: number;
macro?: Expr;
};
export declare const sourceReference: unique symbol;
export interface Node {
[sourceReference]?: SourceReference;
}
/**
* An AST node representing Michelson string literal.
*/
export interface StringLiteral {
export interface StringLiteral extends Node {
string: string;

@@ -10,3 +19,3 @@ }

*/
export interface IntLiteral {
export interface IntLiteral extends Node {
int: string;

@@ -17,3 +26,3 @@ }

*/
export interface BytesLiteral {
export interface BytesLiteral extends Node {
bytes: string;

@@ -24,3 +33,3 @@ }

*/
export interface Prim<PT extends string = string, AT extends Expr[] = Expr[]> {
export interface Prim<PT extends string = string, AT extends Expr[] = Expr[]> extends Node {
prim: PT;

@@ -30,5 +39,9 @@ args?: AT;

}
export declare type List<T extends Expr> = T[] & Node;
interface ExprList extends List<Expr> {
}
/**
* An AST node representing valid Michelson expression. Directly corresponds to JSON-encoded Michelson node
*/
export declare type Expr = Prim | StringLiteral | IntLiteral | BytesLiteral | Expr[];
export declare type Expr = Prim | StringLiteral | IntLiteral | BytesLiteral | ExprList;
export {};

@@ -1,59 +0,31 @@

import { Prim, Expr, IntLiteral, StringLiteral, BytesLiteral } from "./micheline";
import { NoArgs, ReqArgs } from "./utils";
export declare type MichelsonUnaryInstructionId = "DUP" | "SWAP" | "SOME" | "UNIT" | "PAIR" | "CAR" | "CDR" | "CONS" | "SIZE" | "MEM" | "GET" | "UPDATE" | "EXEC" | "FAILWITH" | "RENAME" | "CONCAT" | "SLICE" | "PACK" | "ADD" | "SUB" | "MUL" | "EDIV" | "ABS" | "ISNAT" | "INT" | "NEG" | "LSL" | "LSR" | "OR" | "AND" | "XOR" | "NOT" | "COMPARE" | "EQ" | "NEQ" | "LT" | "GT" | "LE" | "GE" | "SELF" | "TRANSFER_TOKENS" | "SET_DELEGATE" | "CREATE_ACCOUNT" | "IMPLICIT_ACCOUNT" | "NOW" | "AMOUNT" | "BALANCE" | "CHECK_SIGNATURE" | "BLAKE2B" | "SHA256" | "SHA512" | "HASH_KEY" | "STEPS_TO_QUOTA" | "SOURCE" | "SENDER" | "ADDRESS" | "CHAIN_ID";
export declare type MichelsonInstructionId = MichelsonUnaryInstructionId | "DROP" | "DIG" | "DUG" | "NONE" | "LEFT" | "RIGHT" | "NIL" | "UNPACK" | "CONTRACT" | "CAST" | "IF_NONE" | "IF_LEFT" | "IF_CONS" | "IF" | "MAP" | "ITER" | "LOOP" | "LOOP_LEFT" | "DIP" | "CREATE_CONTRACT" | "PUSH" | "EMPTY_SET" | "EMPTY_MAP" | "EMPTY_BIG_MAP" | "LAMBDA";
declare type InstrPrim<PT extends MichelsonInstructionId, AT extends Expr[] = never> = Prim<PT, AT>;
export declare type MichelsonInstruction = MichelsonInstruction[] | NoArgs<InstrPrim<MichelsonUnaryInstructionId>> | ReqArgs<InstrPrim<"DIG" | "DUG", [IntLiteral]>> | InstrPrim<"DROP", [IntLiteral]> | // Keep optional argument
ReqArgs<InstrPrim<"NONE" | "LEFT" | "RIGHT" | "NIL" | "UNPACK" | "CONTRACT" | "CAST", [MichelsonType]>> | ReqArgs<InstrPrim<"IF_NONE" | "IF_LEFT" | "IF_CONS" | "IF", [MichelsonInstruction[], MichelsonInstruction[]]>> | ReqArgs<InstrPrim<"MAP" | "ITER" | "LOOP" | "LOOP_LEFT" | "DIP" | "CREATE_CONTRACT", [MichelsonInstruction[]]>> | ReqArgs<InstrPrim<"PUSH", [MichelsonType, MichelsonData]>> | ReqArgs<InstrPrim<"EMPTY_SET", [MichelsonComparableType]>> | ReqArgs<InstrPrim<"EMPTY_MAP" | "EMPTY_BIG_MAP", [MichelsonComparableType, MichelsonType]>> | ReqArgs<InstrPrim<"LAMBDA", [MichelsonType, MichelsonType, MichelsonInstruction[]]>> | ReqArgs<InstrPrim<"DIP", [IntLiteral, MichelsonInstruction[]] | [MichelsonInstruction[]]>>;
export declare type MichelsonSimpleComparableTypeId = "int" | "nat" | "string" | "bytes" | "mutez" | "bool" | "key_hash" | "timestamp" | "address";
export declare type MichelsonTypeId = MichelsonSimpleComparableTypeId | "key" | "unit" | "signature" | "operation" | "chain_id" | "option" | "list" | "contract" | "pair" | "or" | "lambda" | "set" | "map" | "big_map";
declare type TypePrim<PT extends MichelsonTypeId, AT extends MichelsonType[] = never> = Prim<PT, AT>;
export declare type MichelsonSimpleComparableType = NoArgs<TypePrim<MichelsonSimpleComparableTypeId>>;
export declare type MichelsonComparableType = MichelsonSimpleComparableType | ReqArgs<TypePrim<"pair", [MichelsonSimpleComparableType, MichelsonComparableType]>>;
export declare type MichelsonType = MichelsonComparableType | NoArgs<TypePrim<"key" | "unit" | "signature" | "operation" | "chain_id">> | ReqArgs<TypePrim<"option" | "list" | "contract", [MichelsonType]>> | ReqArgs<TypePrim<"pair" | "or" | "lambda", [MichelsonType, MichelsonType]>> | ReqArgs<TypePrim<"set", [MichelsonComparableType]>> | ReqArgs<TypePrim<"map" | "big_map", [MichelsonComparableType, MichelsonType]>>;
export declare type MichelsonMapElt = ReqArgs<Prim<"Elt", [MichelsonData, MichelsonData]>>;
export declare type MichelsonDataId = "Unit" | "True" | "False" | "None" | "Pair" | "Left" | "Right" | "Some";
declare type DataPrim<PT extends MichelsonDataId, AT extends MichelsonData[] = never> = Prim<PT, AT>;
export declare type MichelsonData = IntLiteral | StringLiteral | BytesLiteral | NoArgs<DataPrim<"Unit" | "True" | "False" | "None">> | ReqArgs<DataPrim<"Pair", [MichelsonData, MichelsonData]>> | ReqArgs<DataPrim<"Left" | "Right" | "Some", [MichelsonData]>> | MichelsonData[] | MichelsonMapElt[] | MichelsonInstruction;
declare type MichelsonSectionId = "parameter" | "storage" | "code";
declare type SectionPrim<PT extends MichelsonSectionId, AT extends Expr[]> = ReqArgs<Prim<PT, AT>>;
export declare type MichelsonParameter = SectionPrim<"parameter", [MichelsonType]>;
export declare type MichelsonStorage = SectionPrim<"storage", [MichelsonType]>;
export declare type MichelsonCode = SectionPrim<"code", [MichelsonInstruction[]]>;
export declare type MichelsonScript = [MichelsonParameter, MichelsonStorage, MichelsonCode] | [
MichelsonStorage,
MichelsonCode,
MichelsonParameter
] | [
MichelsonCode,
MichelsonParameter,
MichelsonStorage
];
interface PathElem {
/**
* Node's index. Either argument index or sequence index.
*/
index: number;
/**
* Node's value.
*/
import { Expr } from "./micheline";
import { MichelsonError } from "./utils";
import { MichelsonCode, MichelsonType, MichelsonComparableType, MichelsonData, MichelsonContract, MichelsonInstruction, MichelsonSerializableType, MichelsonPushableType, MichelsonStorableType, MichelsonPassableType } from "./michelson-types";
export declare const instructionIDs: Record<MichelsonInstruction["prim"], true>;
export declare class MichelsonValidationError extends MichelsonError {
val: Expr;
}
export declare class ValidationError extends Error {
val: Expr;
path?: PathElem[] | undefined;
/**
* @param val Value of a node caused the error
* @param path Path to a node caused the error in the AST tree
* @param message An error message
*/
constructor(val: Expr, path?: PathElem[] | undefined, message?: string);
constructor(val: Expr, message?: string);
}
/**
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
* Checks if the node is a valid Michelson code (sequence of instructions).
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
export declare function assertMichelsonScript(ex: Expr): ex is MichelsonScript;
export declare function assertMichelsonInstruction(ex: Expr): ex is MichelsonCode;
export declare function assertMichelsonComparableType(ex: Expr): ex is MichelsonComparableType;
export declare function assertMichelsonSerializableType(ex: Expr): ex is MichelsonSerializableType;
export declare function assertMichelsonPushableType(ex: Expr): ex is MichelsonPushableType;
export declare function assertMichelsonStorableType(ex: Expr): ex is MichelsonStorableType;
export declare function assertMichelsonPassableType(ex: Expr): ex is MichelsonPassableType;
/**
* Checks if the node is a valid Michelson type expression.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
export declare function assertMichelsonType(ex: Expr): ex is MichelsonType;
/**
* Checks if the node is a valid Michelson data literal such as `(Pair {Elt "0" 0} 0)`.

@@ -65,13 +37,26 @@ * This is a type guard function which either returns true of throws an exception.

/**
* Checks if the node is a valid Michelson code (sequence of instructions).
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
export declare function assertMichelsonCode(ex: Expr[]): ex is MichelsonInstruction[];
export declare function assertMichelsonContract(ex: Expr): ex is MichelsonContract;
/**
* Checks if the node is a valid Michelson smart contract source containing all required and valid properties such as `parameter`, `storage` and `code`.
* @param ex An AST node
*/
export declare function isMichelsonScript(ex: Expr): ex is MichelsonContract;
/**
* Checks if the node is a valid Michelson data literal such as `(Pair {Elt "0" 0} 0)`.
* @param ex An AST node
*/
export declare function isMichelsonData(ex: Expr): ex is MichelsonData;
/**
* Checks if the node is a valid Michelson code (sequence of instructions).
* @param ex An AST node
*/
export declare function isMichelsonCode(ex: Expr): ex is MichelsonCode[];
/**
* Checks if the node is a valid Michelson type expression.
* This is a type guard function which either returns true of throws an exception.
* @param ex An AST node
*/
export declare function assertMichelsonType(ex: Expr): ex is MichelsonType;
export {};
export declare function isMichelsonType(ex: Expr): ex is MichelsonType;

@@ -17,4 +17,5 @@ export declare class ScanError extends Error {

v: string;
offset: number;
first: number;
last: number;
}
export declare function scan(src: string, scanComments?: boolean): Generator<Token, void>;

@@ -5,2 +5,7 @@ export * from "./micheline";

export * from "./michelson-validator";
export * from "./michelson-types";
export * from "./michelson-typecheck";
export * from "./michelson-contract";
export * from "./formatters";
export { MichelsonError, isMichelsonError } from "./utils";
export { MacroError } from "./macros";

@@ -1,3 +0,3 @@

import { Prim } from "./micheline";
export declare type Tuple<T, N extends number> = N extends 1 ? [T] : N extends 2 ? [T, T] : N extends 3 ? [T, T, T] : N extends 4 ? [T, T, T, T] : never;
import { Prim, Expr } from "./micheline";
export declare type Tuple<N extends number, T> = N extends 1 ? [T] : N extends 2 ? [T, T] : N extends 3 ? [T, T, T] : N extends 4 ? [T, T, T, T] : never;
declare type RequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;

@@ -10,2 +10,43 @@ declare type OmitProp<T, K extends keyof T> = Omit<T, K> & {

export declare type NoAnnots<T extends Prim> = OmitProp<T, "annots">;
export declare type Nullable<T> = {
[P in keyof T]: T[P] | null;
};
export declare class MichelsonError<T extends Expr = Expr> extends Error {
val: T;
/**
* @param val Value of a AST node caused the error
* @param path Path to a node caused the error
* @param message An error message
*/
constructor(val: T, message?: string);
}
export declare function isMichelsonError<T extends Expr = Expr>(err: any): err is MichelsonError<T>;
export declare class LongInteger {
private neg;
private buf;
private append;
constructor(arg?: string | number);
cmp(arg: LongInteger): number;
get sign(): number;
}
export declare function parseBytes(s: string): number[] | null;
export declare function compareBytes(a: number[] | Uint8Array, b: number[] | Uint8Array): number;
export declare function isDecimal(x: string): boolean;
export declare function isNatural(x: string): boolean;
export interface UnpackedAnnotations {
f?: string[];
t?: string[];
v?: string[];
}
export interface UnpackAnnotationsOptions {
specialVar?: boolean;
emptyVar?: boolean;
specialFields?: boolean;
emptyFields?: boolean;
}
export declare function unpackAnnotations(p: Prim, opt?: UnpackAnnotationsOptions): UnpackedAnnotations;
export declare type TezosIDType = "BlockHash" | "OperationHash" | "OperationListHash" | "OperationListListHash" | "ProtocolHash" | "ContextHash" | "ED25519PublicKeyHash" | "SECP256K1PublicKeyHash" | "P256PublicKeyHash" | "ContractHash" | "CryptoboxPublicKeyHash" | "ED25519Seed" | "ED25519PublicKey" | "SECP256K1SecretKey" | "P256SecretKey" | "ED25519EncryptedSeed" | "SECP256K1EncryptedSecretKey" | "P256EncryptedSecretKey" | "SECP256K1PublicKey" | "P256PublicKey" | "SECP256K1Scalar" | "SECP256K1Element" | "ED25519SecretKey" | "ED25519Signature" | "SECP256K1Signature" | "P256Signature" | "GenericSignature" | "ChainID";
export declare type TezosIDPrefix = [number, number[]];
export declare const tezosPrefix: Record<TezosIDType, TezosIDPrefix>;
export declare function checkTezosID(id: string | number[], ...types: TezosIDType[]): [TezosIDType, number[]] | null;
export {};
{
"name": "@taquito/michel-codec",
"version": "7.0.1-beta.0",
"version": "7.1.0-preview.1",
"description": "Michelson parser/validator/formatter",

@@ -89,3 +89,3 @@ "keywords": [

},
"gitHead": "7eb1e3ac9c023eae86b292c10fd79f9ad6ac1303"
"gitHead": "bf165096acaea8cc76b1a61d300c894ebc80d92c"
}

@@ -8,2 +8,10 @@ {

{
"path": "dist/lib/base58.js",
"sha512": "9783d1d58adfc0bf9863004939fb25b87891ba7882cf705f803181012ee99f6bf9296a11e11d03dffae6915f987ffaa815d0704b997bb83a565bd61c34a1adf0"
},
{
"path": "dist/lib/formatters.js",
"sha512": "cb0319e6e80fafa5b05db9984b410f9617f2f05b9f842d517e8afda6b8d5ddd9cddb1c0445e7edc2e35acf89402548b0c613010962cb6d5b3172fa254579f4fc"
},
{
"path": "dist/lib/macros.js",

@@ -14,37 +22,57 @@ "sha512": "71767970e60c3df2cf2142882edae72078bfc78da82d0f5ae5260b90b5bbe113c836e4a6b6ec80ac3d44dec34d43facc23fb76bb6c4e3532d54f9c277bd32a1c"

"path": "dist/lib/micheline-emitter.js",
"sha512": "56f73f23bacf5801aa50fa617b7b31e45216097b5de17369812f02b2563ca46508682f574e5afa58dfec97569714e04fbf562189d0429f33c131a615bc0d7586"
"sha512": "3b580f3b6514603e2061c1ffc6180fd7983ab38902fe556d097b1e2cb2781a66b038a80974c1258efee415333a3d7f016e7b5eff2f329ddd4f29e3ec17b8b28c"
},
{
"path": "dist/lib/micheline-parser.js",
"sha512": "6bf533fdee767bf9a49786c44d2f9899a7108795ff4fa131fbe79770f590a535b4a7ce6c63f96efd6705ce46482fe4a4f4f82d539ed9985771b4120249115ffa"
"sha512": "891b0ff5122ef246d04f07772ec4495eeed9822d3b2062a6b3caa90524c3758bbad06d68f1c5e2a7090cc83af8daaedade64ffef536823fc539cffe5a0b1c1a7"
},
{
"path": "dist/lib/micheline.js",
"sha512": "218a17cfa785c8edcc052b09d63113ffa3bb90a455168a5930933ff4a7a3ee752e05ee9e2f7cef91984fdb743309a0308a8faa9f1d8ed348a6364e0cdf083ece"
"sha512": "769739b48ab6bd971c7108fcb1d56ddf856281a42ad3b3333cab8c4c2128602d025cb7b347cc2e203725169c52b90df802af9407a24b2693f11b5c9ce06087fd"
},
{
"path": "dist/lib/michelson-contract.js",
"sha512": "1e274274740fbe4a1df0f33b90d924dc660d3f2e3cf351a99a4e328102216b819a9c0e5eb1a3b013babd3a75478b6f1bc5e340b42d5c65da63276a47851ad440"
},
{
"path": "dist/lib/michelson-typecheck.js",
"sha512": "06ed8dd041e40b55ddab8cbb0b65a972373620165e883471bc823fadc7f53ba7de26cc02f836f28a14da893eed4e31505e6fe7d87f32c0e4f05a45f057e321bf"
},
{
"path": "dist/lib/michelson-types.js",
"sha512": "0134f50a60267d8f886f345274ec4736850f93b4cc09195b920a9da6420c0c8ee6fe40eee6a711f4a1f4753c762475de0df34268e7dbce24f687de71a1ada259"
},
{
"path": "dist/lib/michelson-validator.js",
"sha512": "f7ad869098f9b14075ee3a5cfb637a5fd9adc15a208855aeb21057f95e6445823b9f133ba4d6ada246ac60e32166425a54c4f605dc799acd62e238f8c065ac6e"
"sha512": "587b88b16acaacd2a8d966d0a20a7e9329f016fb3de273961f09f55438e7935b22a10db5f0462f0613bf4ea4b8bd08fd2de939c98f181df47011cabe0e95738b"
},
{
"path": "dist/lib/scan.js",
"sha512": "3fc4001e2511a6d662051bf5af519633417335e9c3e4591c4668159c19479b20d8186e562e6f83fadafe5ece908562f0e214737da0acab5adebaeecbfb525b66"
"sha512": "0688fa100679dd93e764a8068e22ab6b58225602ad77328d728e44257db5bda57b7864f0f8420b7e84b9a4c8965a722b501eaec01c45ae8502ddde7ed402874e"
},
{
"path": "dist/taquito-michel-codec.es5.js",
"sha512": "deb753006266e416af69d39ff4be2b7b83f067d5c2cc036fe372f3f5cc563c45c7e817b422da5acbd65064ec6bad4595012bbb470b55d67cd398f9be67aa34c5"
"sha512": "60d8cf3ee0b0d95e9c2cfa994160c600064e17c3c0f2769e3a5a2a1c74fe01c2dc49920c595f43cd28a4d5341d7fe80a334ef3abeebfacc05fdd3df25df9fe1a"
},
{
"path": "dist/lib/taquito-michel-codec.js",
"sha512": "c19b943903bba9fcfe2eaabfe93ad6794ce7be153939c80c4f514fd170c4c246a23d5cfe3bfc34372f7c8f1834d9ced57b1852309570a93dbad0359182f7f56c"
"sha512": "c58d417f064dac7d608ac96dca038be7f1956ab985a0e62dfb7265e5a62e117d8c0a8affe82afd21d62962568082a37b5fa736e028ac38374599482a8c0960e8"
},
{
"path": "dist/taquito-michel-codec.umd.js",
"sha512": "3bca5259bcc556079b5276e01133e05a027c3dbb3df52ba3b03d481b2c72719e2b971667290a2af91bba1760e5996cb21c29fb38ee35a2f3677cd464b8cf5996"
"sha512": "cf4bc1714cf3b75da587734bd80483b9827a1c000421b32f1806d67682caef48f951bce444dda540ccfaaaba843a6112992bf03fc8236a5b11d6bf7de5492d72"
},
{
"path": "dist/lib/utils.js",
"sha512": "619ea44928db93957cb156e936adc83c5063834a086c6a943df83c829307e85b2946689bd2364d648e59c6718b5f21e8d3822c2dc2617f8021001b61155f95f8"
"sha512": "e200bb2a11b7864e106e13e7f88b0e9bb5f599efb3fcca2d6d730ffb2983c211325c1bf28fe97d01d08593dc23fff70fa9af454a24be28713780094dadf810e8"
},
{
"path": "dist/lib/base58.js.map",
"sha512": "e0517d428078af62e19e39f0483d2634ed89a8da771bdf2d6df8f86edb6bb1cc54784d8e07c320b3575f023f530213ca1bdca24bbb281e55c6ce91ade994e588"
},
{
"path": "dist/lib/formatters.js.map",
"sha512": "41aa0a57ad716ea947cfd53d0b9c4a1013402eb4bd09082000793f51563d86165f1234d39e68caff4fc1f7a03fe8ce12bfa5c53093ca457fabbe1763500c8ac0"
},
{
"path": "dist/lib/macros.js.map",

@@ -55,35 +83,47 @@ "sha512": "79c861a84173276d15a59789b164231ecd6cf0ab7be29a8e4eed01dc42d63a4e65b26a6bfcb9c479198986a3cfdd2c639b4ed21196d179bf9a72296dec1ecb62"

"path": "dist/lib/micheline-emitter.js.map",
"sha512": "0b608bd9611c274cb5af19b2d0bcf58b64835673634ca84d15236a88f56f320394ea9110bf72599f0c33960735034ba8881a5955b57e21e584b9c1ef7498452a"
"sha512": "ec51a8ce1e8e11f4b5332554fbd175b89811683541b7ac87ddf106963d270dfea8e28906109293c7bcd0f63d0a463c66fac6647b50b27a5662449b365df8f85c"
},
{
"path": "dist/lib/micheline-parser.js.map",
"sha512": "911dfb2a9f32b97762405264534f68be9f7e384b080bb2bc928aedac52a6491d2f480c37d3571dcb700580404dea6d02abbc1f5e22d84c759760437c0da2b9cd"
"sha512": "b8c27424d589d38ba6d5c5616aad2be23bd44743bbcd5ab0e7d87e3cb4f16a36a51c45735bf8e694841d2ae5a4699da9dc7cbda876a1bc3c529fa52843f41363"
},
{
"path": "dist/lib/micheline.js.map",
"sha512": "455a724848456ea4d5270d3f011e6bbc89f11e8c21940f09617810f2e956e77095dfd65375ab5b8f490e98fa71dc982d686615766fae71731eee6dab4d83baa4"
"sha512": "aa0811ebfa33e72860bf7e15eaadae1aeba198e42cfaf22256f18456c9caa9b5a49c59bcece25ccf84f5cdf9a8a13329ae1dca9bd0d13a80e2766cbeb4bef79c"
},
{
"path": "dist/lib/michelson-contract.js.map",
"sha512": "b817227d118283e0971e6cf889b016eab9ea9704b6c5dec6940b2e39e256561b434bdb74fa7d86b3378749d8f4ec8bf03146535028350383a65726364bcb8de3"
},
{
"path": "dist/lib/michelson-typecheck.js.map",
"sha512": "d9f56d97c8adb91b99ad2ffe95f4dd4aede47ee97f54c98f0aafec507f19e7f5efa590cb8d8c450eb7e80a4494cfe0d03b4bb57024c178dd0a606278ed4cb36b"
},
{
"path": "dist/lib/michelson-types.js.map",
"sha512": "70f169e4653b21f17d4bffa6741281eac445eb1408ffa77d9e67b6b91ae92dd519ac55ed2311884628be69ac4adf6bf50aac8f0387f33ad45de3ea973ecdf5db"
},
{
"path": "dist/lib/michelson-validator.js.map",
"sha512": "22794b7330d1b00eebbb79ad68b97ae535cdea19fe1af46ab16708d857702a9ee2f3c4d0399883bbe3a4e32b82565debb2cfc2cfe8b5d2e8c03f795e2dc1c74a"
"sha512": "c2268d917685ee39e18393a4853a22ff57cab0c8ae9788b0cb6494c564c68dacbc15acb373834345f1c963b60805e15be2543477103cd3b86a12681b11ddb96e"
},
{
"path": "dist/lib/scan.js.map",
"sha512": "a258d524ebee859676ea5dfc52751fcb3ec5be8ec0f71224dc4fae54e380eb23c314c5cdc79b33da9c8e3efaf8c285dfdfaa57fd4895e11966f32f42e4cb51a0"
"sha512": "c2cc3bf2b9bcd7a8bb6f0f10caf1e6c8915bbf8dc03cab9ce589e28297764818ca018a208c3acadbcba06b5bfb3e49be858a3672da708cec33cc27ffbbb50e5f"
},
{
"path": "dist/taquito-michel-codec.es5.js.map",
"sha512": "bacc545ccdd1e3ebab26d9dac09bd17d14bd6bcbed6cb49be1e17f75b0d07d526e320a5f8c50944194b5bc2de9327a88dcee8d7275b4f5ee384812abf2d6513a"
"sha512": "c426529d8a1dadf7f10eff74817f248022f0dc5a614d16dc3d8e2b641f33403cb311afb6df6e9b8b1351d52d9b89f07179d31f783a0520f1ff7dd8e769534aaa"
},
{
"path": "dist/lib/taquito-michel-codec.js.map",
"sha512": "862e4da1b18c31072fa0c3b8376de58ba38622ad9b5f3c6c7e2b689f5e409d7a7c417749749467af88386a90bb681f4e6ea81aa564e68db57e4dc2f7f05429e6"
"sha512": "79ece36220a2ac2efcc119c3523c272ebcaa80d0d5ba267db2a9d441165e04520cb3df5227a9d8368a85ea1ba81709902d2a587bb3458eca4eacf06314caac00"
},
{
"path": "dist/taquito-michel-codec.umd.js.map",
"sha512": "4aa7f99058ffbbd7bdd510ea1c8b84522b8482024b43a502e43b04ff7e40f530de5a6b742c89ce7fd485eec764e27c7df763597b072139a86a73239cee606016"
"sha512": "7e2dc59719662a17e7c08d1fc0e7ef52669d4d227e808143ef65fad727c2e22d91063a0873137025ab35f906a0382e3d948dafd862ee30405110d2a5dfd76a49"
},
{
"path": "dist/lib/utils.js.map",
"sha512": "331165254d9426a498f3a6f2d251a85aac9ac0790ef5dbec07bbae0dcb139a50be1a4dc944559da1ceef7ead386071ac69c11cc40aec6c04440fd7c797b67cbe"
"sha512": "f2e747d81a3b90551c084e5ab44b4ab9b9a32104fd54c02244c2c5ab3a3d4b8e93a680edd7eb6f9ad4599a860b82e740c7ac0eabb76bef1ecf28e89f5aaddfe7"
},

@@ -95,2 +135,10 @@ {

{
"path": "dist/types/base58.d.ts",
"sha512": "cae9e29223d37f6b49677e3a368320cedd68673205ad3cfdf8aacfce1facfbb50bbf14e3fd5708e7c6fe900b52e5866ddb090a6e16118177bc698baf1b531d99"
},
{
"path": "dist/types/formatters.d.ts",
"sha512": "d5b2a6fcc1ed59c26750e8f3f07f55e7ca162a3d043cc99ad50d91315d42a91093a00d2912a12f19d512729c40750c8d1f0677a04821e9d2640329600ce2180f"
},
{
"path": "dist/types/macros.d.ts",

@@ -101,3 +149,3 @@ "sha512": "a94b3979543e579099fd19d7906e1eb9c2bcb7afc12d016a88e022d57ac64f1924535cffc149076d1e7017226a7872face8f194e7a6291a1a7b9394b2f674e51"

"path": "dist/types/micheline-emitter.d.ts",
"sha512": "2bfccbbf88b217b82b459aacad7cf0e64d08fabd32e47c9163a145bf56e28dba3a1f06d1f2070c893acdd3ae9582f47c04490fbe1458ac71f0f00a3692fcac08"
"sha512": "1d37e5307bc23e5c30ea22c172b217e025f43288c2edab293b909864b8fb1fda707e48d9e0f57443f1549a7c271be8b54b8c31c5dd5e8a8899acff0844cfdbea"
},

@@ -110,19 +158,31 @@ {

"path": "dist/types/micheline.d.ts",
"sha512": "c024236ba94653e2d24557742d641f5420a1dfd9b703cb4c61ecf76740dad3b9d504f92f48898e907129e65c8965bb436b962714dd96bf53648ca1ac110a89a9"
"sha512": "38b513a4abae68170472ddc0a99c6b7d6d5b38c2526eca5146e7985df8ce90dc763bf0f56c1030d128aa2ac6202c40510d4ab855107d61f7c524ca8c7ebc429e"
},
{
"path": "dist/types/michelson-contract.d.ts",
"sha512": "15426c5b4a3566b1c8f5bb7a736f77cc77867dba11ec1c776686b1d3803488f2b5144aff77835eba9e34acdde08ea7b037a52247c70de61bb4d3137d0dea58e8"
},
{
"path": "dist/types/michelson-typecheck.d.ts",
"sha512": "1c38be88d7300732c222e7d1a8bd5833ada38ed1702140a69c0f8ea48285e1972b1882bb65ca9197d9bc01d1541425b60530f986391aacae28b22fc14596d2ff"
},
{
"path": "dist/types/michelson-types.d.ts",
"sha512": "9793bb73b3f2a2a528f500df38bb3cf11b5a23ddb41c0bd93c7afe18c8cb0cf0ef76bffddfeb3c0f437b6fdd3e97891084e7b845d1dce8e8945138f55deb9948"
},
{
"path": "dist/types/michelson-validator.d.ts",
"sha512": "e55946387f16033565075e77e796ef9dd513c56772d9a4392daa9f9fa7e5e2a9c11313b9fb629f97a779e45e9ae00591b09af80670f26b44ff9a39b02f7337da"
"sha512": "3cbb89248795af8cca35e8f751b0c14f8bd464fc3696f6dc09380c0966ab0b408214f8e7d38699a7bb32e66e7e23882d0289fdf20880f2ed7e67925e9a496788"
},
{
"path": "dist/types/scan.d.ts",
"sha512": "043cdcef0b09a72c367f4ea5a87cfd5fc3d35d32674c0ad0fe3e31d2dfdf928e41c5cc263a459e7edb9c60e3820bd80c04c97f7a7bbbaf6ec10b84409c999a4e"
"sha512": "1daa1b109b5d67852086ecb506ce955538040c76faca6a1c3a754f989c97acdf9b37254539daf98e2fa9ea23b01a9b88b4ade9c1ee536e8496963f3146c3f806"
},
{
"path": "dist/types/taquito-michel-codec.d.ts",
"sha512": "42857719385142d441574a06229929cd29070c20c123fc7afde078f10fdea2325ef572237f0d0442db2a07d323c07258d414067ad8a69573e67718514cdc0f5b"
"sha512": "f8ff56477917f2903392692f066c45c9216590ef01e0a986599a3bfbd2402a354cdb2a521b933578652de068d480075264e2a6b76e06ceb12ec741203a6e1950"
},
{
"path": "dist/types/utils.d.ts",
"sha512": "0cdbaccb9de4493013d861d2fa6c152444014813886752e318d0b956163d999b523936e770e1b0263cedaca58ec5032800145ae5f0a15df8230edd9419527fab"
"sha512": "e793873aa0f0c94f4f0234111f4019a9305b9b4f66fe51373ea5a7c7d9fb716fbe92a1d7f9a7713598276eb784168ea4ac5c983b8420534ffac0f305a9f15aae"
}

@@ -163,3 +223,3 @@ ]

],
"sha512": "fbf3b891c44470ef267767f5c80b2922c51781d271034aabe1db5887bd75e7cfdf07fb89e49acc8bbd235dc7d05910833f533c0d7472118c2f5be8704f0d0ece"
"sha512": "7ced1cee79ecb72441b6f672b0f094959112ac79922039bec799e1e2c17ca8b9912ed41f8c121be34b59993e4a528e07a3376654c9b639f28ef9196fd8f794b2"
}

@@ -172,3 +232,3 @@ },

"name": "@taquito/michel-codec",
"version": "7.0.1-beta.0",
"version": "7.1.0-preview.1",
"description": "Michelson parser/validator/formatter",

@@ -264,3 +324,3 @@ "keywords": [

],
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJftZgnCRAD9Qy5GYHsngAAGYoQAGM4RoyNn6WV/HIKrXrKflrv\nDWi/Wk3YsNv0Z+qnSOh355eF6/39JSrxkg594wbEvhUiczEBIw3e1JwjoglvDChL\npsQybcRB+5DAiS89xVzSkPZkX6qORlp1ubCKf4GRNE/JJoZ+KFbXipuovZYOUUJR\nxMDTAyvUrkYtkSZ51cziHxbITdairYMmduz0aRMldzsXB59Cepf3soMwCi0LHdZ4\neK+0fqsWkgxTDvGwiP134atuoZRb1LlyMbEuYQ3yqaVfh5yX0KGBwGH5mkQxBIcT\n6Ueb0FwLzMnZL5kPawBRpoRmGjTOTJHV2nc1Wi3nJhjGvwHMcTeT5qdqnj88Vpgj\nMvaR/O/h5o9IZSFvHkOlE/py9T8vJ2SJc+JMnJWRildqC3Crow+/6G6qc9ToLhRX\nlHlH8GIDy/wkecwyG0X04ne+6dez0RmE5+hOGMr8x5HBCqfb6XYCsonrQW/kGTZi\nrngwLZAjHOdixwMspiaQDvCQ/nktfw+zN2LL/F1VsIgqyIloepL9kdc2wHuEcuyo\n3gY42ZfymBQWTqdnQwfeMKG2XgcyfjcD3naAbOsf07ly8FxmUXROdDbblS0esOIE\nh4Bu8PczPGfBwv7PoOpy4NMFehv/UewaSbH9LOm9rnsfFNio3np6zRzT5BZjPE/w\n7PsUGsmv9BJccjgvXoi+\n=mlBp\n-----END PGP SIGNATURE-----\n"
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJftcSpCRAD9Qy5GYHsngAAywoQAGk9kVKRj0ZsoLuxeip1YSl/\nuULrH0bB+C8K1RlK1SQlzYe0r1KaDAe99VvzpDD8Wl5blXIuX7aceiLmBXckUwMF\nckycOVeU7Ar0CsxEqnsUvcQ+q2b7MHLXgV7rSOWvHm3+RYPIN2J7HK6NzSuaXSld\nkgevE8ZFaGzBIC48Pc4UNJ0wPFeRwygUtSPOkk7Un0wEOPKo66EzGSTe/bKmzXn1\n6QPxeJgFDdFf5260l2RTziIiX6CUjeJmrfPqPq/0ct9zzPPM/0nS0GzFXn42oX12\nZhY8O8MF4wspAkvgjpBBMNX1dOX8rHx2W0ghrDj2kIqUwj6FeIgAP52mdUqbjXYg\nXFt4ruHy0zPRQLo811r0JUIUfZCDqJqklzeQM30Jj1WJIuAA0/INrArHzN6FTXeg\nfDqgplPZnWndiLapOy8QIgosEYdHIUIJ30r5/m++kh5DJq+lWOW56SIFLpKsCs6F\nY/nPD+CHSHDxXmTnDTFfDWeIsmqd76BD02tT/MhPMBIg+RI+2u3zYzBKkTdbdMRF\nDxXkGUV4IAlfkF0lvaN4lJDwiRYNRM5IChkB+osYta5TqWpNnflLPxN6khg5H57X\n3rig5fC9Zxz6bf3U7LhsmxAgU2OzrBkwLLl6wCdYPpYRB2FfVcmruvfGuI8XTE/W\nWE7x21RnRHAoHd/TaLYO\n=5NJi\n-----END PGP SIGNATURE-----\n"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc