@taquito/michel-codec
Advanced tools
Comparing version 8.0.4-beta-RC.0 to 8.0.5-pack.0
@@ -36,3 +36,3 @@ "use strict"; | ||
} | ||
else if (err instanceof michelson_typecheck_1.MichelsonTypeError) { | ||
else if (err instanceof utils_1.MichelsonTypeError) { | ||
var type = Array.isArray(err.val) ? | ||
@@ -39,0 +39,0 @@ "[" + err.val.map(function (v, i) { return "[" + i + "]: " + micheline_emitter_1.emitMicheline(v); }).join("; ") + "]" : |
@@ -143,36 +143,56 @@ "use strict"; | ||
}; | ||
Parser.prototype.parseList = function (scanner, start) { | ||
var tok = scanner.next(); | ||
if (tok.done) { | ||
throw errEOF; | ||
Parser.prototype.parseListExpr = function (scanner, start) { | ||
var _a; | ||
var _b; | ||
var ref = { | ||
first: start.first, | ||
last: start.last, | ||
}; | ||
var expectBracket = start.t === "("; | ||
var tok; | ||
if (expectBracket) { | ||
tok = scanner.next(); | ||
if (tok.done) { | ||
throw errEOF; | ||
} | ||
ref.last = tok.value.last; | ||
} | ||
else { | ||
tok = { value: start }; | ||
} | ||
if (tok.value.t !== scan_1.Literal.Ident) { | ||
throw new MichelineParseError(tok.value, "not an identifier: " + tok.value.v); | ||
} | ||
var ret = { | ||
prim: tok.value.v, | ||
}; | ||
var last; | ||
var ret = (_a = { | ||
prim: tok.value.v | ||
}, | ||
_a[micheline_1.sourceReference] = ref, | ||
_a); | ||
for (;;) { | ||
var tok_1 = scanner.next(); | ||
if (tok_1.done) { | ||
throw errEOF; | ||
if (expectBracket) { | ||
throw errEOF; | ||
} | ||
break; | ||
} | ||
if (tok_1.value.t === ')') { | ||
last = tok_1.value.last; | ||
else if (tok_1.value.t === ')') { | ||
if (!expectBracket) { | ||
throw new MichelineParseError(tok_1.value, "unexpected closing bracket"); | ||
} | ||
ref.last = tok_1.value.last; | ||
break; | ||
} | ||
if (isAnnotation(tok_1.value)) { | ||
else if (isAnnotation(tok_1.value)) { | ||
ret.annots = ret.annots || []; | ||
ret.annots.push(tok_1.value.v); | ||
ref.last = tok_1.value.last; | ||
} | ||
else { | ||
ret.args = ret.args || []; | ||
ret.args.push(this.parseExpr(scanner, tok_1.value)); | ||
var arg = this.parseExpr(scanner, tok_1.value); | ||
ref.last = ((_b = arg[micheline_1.sourceReference]) === null || _b === void 0 ? void 0 : _b.last) || ref.last; | ||
ret.args.push(arg); | ||
} | ||
} | ||
ret[micheline_1.sourceReference] = { | ||
first: start.first, | ||
last: last, | ||
}; | ||
return this.expand(ret); | ||
@@ -188,3 +208,7 @@ }; | ||
}; | ||
var p = (_a = { prim: start.v }, _a[micheline_1.sourceReference] = ref, _a); | ||
var p = (_a = { | ||
prim: start.v | ||
}, | ||
_a[micheline_1.sourceReference] = ref, | ||
_a); | ||
for (;;) { | ||
@@ -208,3 +232,3 @@ var t = scanner.next(); | ||
}; | ||
Parser.prototype.parseSequence = function (scanner, start) { | ||
Parser.prototype.parseSequenceExpr = function (scanner, start) { | ||
var _a, _b; | ||
@@ -278,8 +302,6 @@ var ref = { | ||
return _d = { bytes: tok.v.slice(2) }, _d[micheline_1.sourceReference] = { first: tok.first, last: tok.last }, _d; | ||
case '(': | ||
return this.parseList(scanner, tok); | ||
case '{': | ||
return this.parseSequence(scanner, tok); | ||
return this.parseSequenceExpr(scanner, tok); | ||
default: | ||
throw new MichelineParseError(tok, "unexpected token: " + tok.v); | ||
return this.parseListExpr(scanner, tok); | ||
} | ||
@@ -291,3 +313,3 @@ }; | ||
*/ | ||
Parser.prototype.parseScript = function (src) { | ||
Parser.prototype.parseSequence = function (src) { | ||
// tslint:disable-next-line: strict-type-predicates | ||
@@ -302,5 +324,22 @@ if (typeof src !== "string") { | ||
} | ||
return this.parseSequence(scanner, tok.value); | ||
return this.parseSequenceExpr(scanner, tok.value); | ||
}; | ||
/** | ||
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted. | ||
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0` | ||
* @returns An AST node or null for empty document. | ||
*/ | ||
Parser.prototype.parseList = function (src) { | ||
// tslint:disable-next-line: strict-type-predicates | ||
if (typeof src !== "string") { | ||
throw new TypeError("string type was expected, got " + typeof src + " instead"); | ||
} | ||
var scanner = scan_1.scan(src); | ||
var tok = scanner.next(); | ||
if (tok.done) { | ||
return null; | ||
} | ||
return this.parseListExpr(scanner, tok.value); | ||
}; | ||
/** | ||
* Parse any Michelson expression | ||
@@ -323,2 +362,19 @@ * @param src A Michelson expression such as `(Pair {Elt "0" 0} 0)` or `{parameter ...; storage int; code { DUP ; ...};}` | ||
/** | ||
* Parse a Micheline sequence expression, such as smart contract source. Enclosing curly brackets may be omitted. | ||
* An alias for `parseSequence` | ||
* @param src A Micheline sequence `{parameter ...; storage int; code { DUP ; ...};}` or `parameter ...; storage int; code { DUP ; ...};` | ||
*/ | ||
Parser.prototype.parseScript = function (src) { | ||
return this.parseSequence(src); | ||
}; | ||
/** | ||
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted. | ||
* An alias for `parseList` | ||
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0` | ||
* @returns An AST node or null for empty document. | ||
*/ | ||
Parser.prototype.parseData = function (src) { | ||
return this.parseList(src); | ||
}; | ||
/** | ||
* Takes a JSON-encoded Michelson, validates it, strips away unneeded properties and optionally expands macros (See {@link ParserOptions}). | ||
@@ -325,0 +381,0 @@ * @param src An object containing JSON-encoded Michelson, usually returned by `JSON.parse()` |
@@ -13,3 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MacroError = exports.isMichelsonError = exports.MichelsonError = void 0; | ||
exports.MacroError = exports.MichelsonTypeError = exports.isMichelsonError = exports.MichelsonError = void 0; | ||
/** | ||
@@ -30,4 +30,5 @@ * @packageDocumentation | ||
Object.defineProperty(exports, "isMichelsonError", { enumerable: true, get: function () { return utils_1.isMichelsonError; } }); | ||
Object.defineProperty(exports, "MichelsonTypeError", { enumerable: true, get: function () { return utils_1.MichelsonTypeError; } }); | ||
var macros_1 = require("./macros"); | ||
Object.defineProperty(exports, "MacroError", { enumerable: true, get: function () { return macros_1.MacroError; } }); | ||
//# sourceMappingURL=taquito-michel-codec.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 __values = (this && this.__values) || function(o) { | ||
@@ -28,3 +39,3 @@ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
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; | ||
exports.parseDate = exports.isPairData = exports.isPairType = exports.unpackComb = exports.checkDecodeTezosID = exports.tezosPrefix = exports.unpackAnnotations = exports.isNatural = exports.isDecimal = exports.compareBytes = exports.parseBytes = exports.LongInteger = exports.MichelsonTypeError = exports.isMichelsonError = exports.MichelsonError = void 0; | ||
var base58_1 = require("./base58"); | ||
@@ -51,2 +62,20 @@ var MichelsonError = /** @class */ (function (_super) { | ||
exports.isMichelsonError = isMichelsonError; | ||
var MichelsonTypeError = /** @class */ (function (_super) { | ||
__extends(MichelsonTypeError, _super); | ||
/** | ||
* @param val Value of a type node caused the error | ||
* @param data Value of a data node caused the error | ||
* @param message An error message | ||
*/ | ||
function MichelsonTypeError(val, data, message) { | ||
var _this = _super.call(this, val, message) || this; | ||
if (data !== undefined) { | ||
_this.data = data; | ||
} | ||
Object.setPrototypeOf(_this, MichelsonTypeError.prototype); | ||
return _this; | ||
} | ||
return MichelsonTypeError; | ||
}(MichelsonError)); | ||
exports.MichelsonTypeError = MichelsonTypeError; | ||
// Ad hoc big integer parser | ||
@@ -250,3 +279,3 @@ var LongInteger = /** @class */ (function () { | ||
}; | ||
function checkTezosID(id) { | ||
function checkDecodeTezosID(id) { | ||
var e_2, _a; | ||
@@ -257,3 +286,3 @@ var types = []; | ||
} | ||
var buf = Array.isArray(id) ? id : base58_1.decodeBase58Check(id); | ||
var buf = base58_1.decodeBase58Check(id); | ||
try { | ||
@@ -283,3 +312,53 @@ for (var types_1 = __values(types), types_1_1 = types_1.next(); !types_1_1.done; types_1_1 = types_1.next()) { | ||
} | ||
exports.checkTezosID = checkTezosID; | ||
exports.checkDecodeTezosID = checkDecodeTezosID; | ||
function unpackComb(id, v) { | ||
var vv = v; | ||
var args = Array.isArray(vv) ? vv : vv.args; | ||
if (args.length === 2) { | ||
// it's a way to make a union of two interfaces not an interface with two independent properties of union types | ||
var ret = id === "pair" ? { | ||
prim: "pair", | ||
args: args, | ||
} : { | ||
prim: "Pair", | ||
args: args, | ||
}; | ||
return ret; | ||
} | ||
return __assign(__assign({}, v), { args: [ | ||
args[0], | ||
{ | ||
prim: id, | ||
args: args.slice(1), | ||
}, | ||
] }); | ||
} | ||
exports.unpackComb = unpackComb; | ||
function isPairType(t) { | ||
return Array.isArray(t) || t.prim === "pair"; | ||
} | ||
exports.isPairType = isPairType; | ||
function isPairData(d) { | ||
return Array.isArray(d) || "prim" in d && d.prim === "Pair"; | ||
} | ||
exports.isPairData = isPairData; | ||
var rfc3339Re = /^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])[T ]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):([0-5][0-9]))$/; | ||
function parseDate(a) { | ||
if ("string" in a) { | ||
if (isNatural(a.string)) { | ||
return new Date(parseInt(a.string, 10)); | ||
} | ||
else if (rfc3339Re.test(a.string)) { | ||
var x = new Date(a.string); | ||
if (!Number.isNaN(x.valueOf)) { | ||
return x; | ||
} | ||
} | ||
} | ||
else if (isNatural(a.int)) { | ||
return new Date(parseInt(a.int, 10)); | ||
} | ||
return null; | ||
} | ||
exports.parseDate = parseDate; | ||
//# sourceMappingURL=utils.js.map |
@@ -62,5 +62,5 @@ import { Token } from './scan'; | ||
private expand; | ||
private parseList; | ||
private parseListExpr; | ||
private parseArgs; | ||
private parseSequence; | ||
private parseSequenceExpr; | ||
private parseExpr; | ||
@@ -71,4 +71,10 @@ /** | ||
*/ | ||
parseScript(src: string): Expr[] | null; | ||
parseSequence(src: string): Expr[] | null; | ||
/** | ||
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted. | ||
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0` | ||
* @returns An AST node or null for empty document. | ||
*/ | ||
parseList(src: string): Expr | null; | ||
/** | ||
* Parse any Michelson expression | ||
@@ -80,2 +86,15 @@ * @param src A Michelson expression such as `(Pair {Elt "0" 0} 0)` or `{parameter ...; storage int; code { DUP ; ...};}` | ||
/** | ||
* Parse a Micheline sequence expression, such as smart contract source. Enclosing curly brackets may be omitted. | ||
* An alias for `parseSequence` | ||
* @param src A Micheline sequence `{parameter ...; storage int; code { DUP ; ...};}` or `parameter ...; storage int; code { DUP ; ...};` | ||
*/ | ||
parseScript(src: string): Expr[] | null; | ||
/** | ||
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted. | ||
* An alias for `parseList` | ||
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0` | ||
* @returns An AST node or null for empty document. | ||
*/ | ||
parseData(src: string): Expr | null; | ||
/** | ||
* Takes a JSON-encoded Michelson, validates it, strips away unneeded properties and optionally expands macros (See {@link ParserOptions}). | ||
@@ -82,0 +101,0 @@ * @param src An object containing JSON-encoded Michelson, usually returned by `JSON.parse()` |
@@ -1,2 +0,1 @@ | ||
import { Expr } from "./micheline"; | ||
import { MichelsonType, MichelsonData, MichelsonCode, MichelsonContract, MichelsonContractSection, MichelsonReturnType, ProtocolOptions } from "./michelson-types"; | ||
@@ -8,11 +7,2 @@ import { MichelsonError } from "./utils"; | ||
} | ||
export declare class MichelsonTypeError extends MichelsonError<MichelsonType | MichelsonType[]> { | ||
data?: Expr; | ||
/** | ||
* @param val Value of a type node caused the error | ||
* @param data Value of a data node caused the error | ||
* @param message An error message | ||
*/ | ||
constructor(val: MichelsonType | MichelsonType[], data?: Expr, message?: string); | ||
} | ||
export declare class MichelsonInstructionError extends MichelsonError<MichelsonCode> { | ||
@@ -19,0 +9,0 @@ stackState: MichelsonReturnType; |
@@ -9,4 +9,4 @@ import { Prim, Expr, IntLiteral, StringLiteral, BytesLiteral, List, Node } from "./micheline"; | ||
declare type MichelsonNoArgInstructionID = "ABS" | "ADD" | "ADDRESS" | "AMOUNT" | "AND" | "APPLY" | "BALANCE" | "BLAKE2B" | "CAR" | "CDR" | "CHAIN_ID" | "CHECK_SIGNATURE" | "COMPARE" | "CONCAT" | "CONS" | "EDIV" | "EQ" | "EXEC" | "FAILWITH" | "GE" | "GET_AND_UPDATE" | "GT" | "HASH_KEY" | "IMPLICIT_ACCOUNT" | "INT" | "ISNAT" | "JOIN_TICKETS" | "KECCAK" | "LE" | "LEVEL" | "LSL" | "LSR" | "LT" | "MEM" | "MUL" | "NEG" | "NEQ" | "NEVER" | "NOT" | "NOW" | "OR" | "PACK" | "PAIRING_CHECK" | "READ_TICKET" | "SAPLING_VERIFY_UPDATE" | "SELF" | "SELF_ADDRESS" | "SENDER" | "SET_DELEGATE" | "SHA256" | "SHA3" | "SHA512" | "SIZE" | "SLICE" | "SOME" | "SOURCE" | "SPLIT_TICKET" | "SUB" | "SWAP" | "TICKET" | "TOTAL_VOTING_POWER" | "TRANSFER_TOKENS" | "UNIT" | "VOTING_POWER" | "XOR" | "RENAME"; | ||
declare type MichelsonRegularInstructionID = "CONTRACT" | "CREATE_CONTRACT" | "DIG" | "DIP" | "DROP" | "DUG" | "DUP" | "EMPTY_BIG_MAP" | "EMPTY_MAP" | "EMPTY_SET" | "GET" | "IF" | "IF_CONS" | "IF_LEFT" | "IF_NONE" | "ITER" | "LAMBDA" | "LEFT" | "LOOP" | "LOOP_LEFT" | "MAP" | "NIL" | "NONE" | "PAIR" | "PUSH" | "RIGHT" | "SAPLING_EMPTY_STATE" | "UNPACK" | "UNPAIR" | "UPDATE" | "CAST"; | ||
declare type MichelsonInstructionID = MichelsonNoArgInstructionID | MichelsonRegularInstructionID; | ||
declare type MichelsonRegularInstructionID = "CONTRACT" | "CREATE_CONTRACT" | "DIG" | "DIP" | "DROP" | "DUG" | "DUP" | "EMPTY_BIG_MAP" | "EMPTY_MAP" | "EMPTY_SET" | "GET" | "IF" | "IF_CONS" | "IF_LEFT" | "IF_NONE" | "ITER" | "LAMBDA" | "LEFT" | "LOOP" | "LOOP_LEFT" | "MAP" | "NIL" | "NONE" | "PAIR" | "PUSH" | "RIGHT" | "SAPLING_EMPTY_STATE" | "UNPACK" | "UNPAIR" | "UPDATE" | "CAST" | "CREATE_ACCOUNT" | "STEPS_TO_QUOTA"; | ||
export declare type MichelsonInstructionID = MichelsonNoArgInstructionID | MichelsonRegularInstructionID; | ||
declare type InstrPrim<PT extends MichelsonInstructionID, AT extends Expr[]> = Prim<PT, AT>; | ||
@@ -70,6 +70,7 @@ declare type Instr0<PT extends MichelsonNoArgInstructionID> = Prim0<PT>; | ||
export declare type MichelsonType<T extends MichelsonTypeID = MichelsonTypeID> = T extends "int" ? MichelsonTypeInt : T extends "nat" ? MichelsonTypeNat : T extends "string" ? MichelsonTypeString : T extends "bytes" ? MichelsonTypeBytes : T extends "mutez" ? MichelsonTypeMutez : T extends "bool" ? MichelsonTypeBool : T extends "key_hash" ? MichelsonTypeKeyHash : T extends "timestamp" ? MichelsonTypeTimestamp : T extends "address" ? MichelsonTypeAddress : T extends "key" ? MichelsonTypeKey : T extends "unit" ? MichelsonTypeUnit : T extends "signature" ? MichelsonTypeSignature : T extends "operation" ? MichelsonTypeOperation : T extends "chain_id" ? MichelsonTypeChainID : T extends "option" ? MichelsonTypeOption<MichelsonType> : T extends "list" ? MichelsonTypeList<MichelsonType> : T extends "contract" ? MichelsonTypeContract<MichelsonType> : T extends "ticket" ? MichelsonTypeTicket<MichelsonType> : T extends "pair" ? MichelsonTypePair<MichelsonType[]> : T extends "or" ? MichelsonTypeOr<[MichelsonType, MichelsonType]> : T extends "lambda" ? MichelsonTypeLambda<MichelsonType, MichelsonType> : T extends "set" ? MichelsonTypeSet<MichelsonType> : T extends "map" ? MichelsonTypeMap<MichelsonType, MichelsonType> : T extends "big_map" ? MichelsonTypeBigMap<MichelsonType, MichelsonType> : T extends "never" ? MichelsonTypeNever : T extends "bls12_381_g1" ? MichelsonTypeBLS12_381_G1 : T extends "bls12_381_g2" ? MichelsonTypeBLS12_381_G2 : T extends "bls12_381_fr" ? MichelsonTypeBLS12_381_FR : T extends "sapling_transaction" ? MichelsonTypeSaplingTransaction : MichelsonTypeSaplingState; | ||
export declare type MichelsonDataId = "Unit" | "True" | "False" | "None" | "Pair" | "Left" | "Right" | "Some"; | ||
declare type Data0<PT extends MichelsonDataId> = Prim0<PT>; | ||
declare type DataX<PT extends MichelsonDataId, AT extends MichelsonData[]> = PrimX<PT, AT>; | ||
declare type PartialData = DataX<"Some" | "Left" | "Right", [MichelsonData]>; | ||
export declare type MichelsonDataID = "Unit" | "True" | "False" | "None" | "Pair" | "Left" | "Right" | "Some"; | ||
declare type Data0<PT extends MichelsonDataID> = Prim0<PT>; | ||
declare type DataX<PT extends MichelsonDataID, AT extends MichelsonData[]> = PrimX<PT, AT>; | ||
export declare type MichelsonDataOption = DataX<"Some", [MichelsonData]> | Data0<"None">; | ||
export declare type MichelsonDataOr = DataX<"Left" | "Right", [MichelsonData]>; | ||
declare type DataList<T extends MichelsonData[]> = T & Node; | ||
@@ -79,5 +80,5 @@ export declare type MichelsonDataPair<T extends MichelsonData[]> = DataX<"Pair", T> | DataList<T>; | ||
export declare type MichelsonMapEltList = List<MichelsonMapElt>; | ||
export declare type MichelsonData = IntLiteral | StringLiteral | BytesLiteral | Data0<"Unit" | "True" | "False" | "None"> | PartialData | DataList<MichelsonData[]> | MichelsonDataPair<MichelsonData[]> | InstructionList | MichelsonMapEltList; | ||
declare type MichelsonSectionId = "parameter" | "storage" | "code"; | ||
declare type SectionPrim<PT extends MichelsonSectionId, AT extends Expr[]> = PrimX<PT, AT>; | ||
export declare type MichelsonData = IntLiteral | StringLiteral | BytesLiteral | Data0<"Unit" | "True" | "False"> | MichelsonDataOption | MichelsonDataOr | DataList<MichelsonData[]> | MichelsonDataPair<MichelsonData[]> | InstructionList | MichelsonMapEltList; | ||
export declare type MichelsonSectionID = "parameter" | "storage" | "code"; | ||
declare type SectionPrim<PT extends MichelsonSectionID, AT extends Expr[]> = PrimX<PT, AT>; | ||
export declare type MichelsonContractParameter = SectionPrim<"parameter", [MichelsonType]>; | ||
@@ -111,3 +112,3 @@ export declare type MichelsonContractStorage = SectionPrim<"storage", [MichelsonType]>; | ||
]; | ||
export declare type MichelsonContractSection<T extends MichelsonSectionId> = T extends "parameter" ? MichelsonContractParameter : T extends "storage" ? MichelsonContractStorage : MichelsonContractCode; | ||
export declare type MichelsonContractSection<T extends MichelsonSectionID> = T extends "parameter" ? MichelsonContractParameter : T extends "storage" ? MichelsonContractStorage : MichelsonContractCode; | ||
export interface MichelsonTypeFailed { | ||
@@ -114,0 +115,0 @@ failed: MichelsonType; |
@@ -13,3 +13,3 @@ /** | ||
export * from "./formatters"; | ||
export { MichelsonError, isMichelsonError } from "./utils"; | ||
export { MichelsonError, isMichelsonError, MichelsonTypeError } from "./utils"; | ||
export { MacroError } from "./macros"; |
@@ -1,2 +0,3 @@ | ||
import { Prim, Expr } from "./micheline"; | ||
import { Prim, Expr, StringLiteral, IntLiteral } from "./micheline"; | ||
import { MichelsonData, MichelsonDataPair, MichelsonType, MichelsonTypePair } from "./michelson-types"; | ||
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] : N extends 5 ? [T, T, T, T, T] : N extends 6 ? [T, T, T, T, T, T] : N extends 7 ? [T, T, T, T, T, T, T] : N extends 8 ? [T, T, T, T, T, T, T, T] : T[]; | ||
@@ -23,2 +24,11 @@ declare type RequiredProp<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>; | ||
export declare function isMichelsonError<T extends Expr = Expr>(err: any): err is MichelsonError<T>; | ||
export declare class MichelsonTypeError extends MichelsonError<MichelsonType | MichelsonType[]> { | ||
data?: Expr; | ||
/** | ||
* @param val Value of a type node caused the error | ||
* @param data Value of a data node caused the error | ||
* @param message An error message | ||
*/ | ||
constructor(val: MichelsonType | MichelsonType[], data?: Expr, message?: string); | ||
} | ||
export declare class LongInteger { | ||
@@ -51,3 +61,8 @@ private neg; | ||
export declare const tezosPrefix: Record<TezosIDType, TezosIDPrefix>; | ||
export declare function checkTezosID(id: string | number[], ...types: TezosIDType[]): [TezosIDType, number[]] | null; | ||
export declare function checkDecodeTezosID<T extends TezosIDType[]>(id: string, ...types: T): [T[number], number[]] | null; | ||
declare type PairTypeOrDataPrim<I extends "pair" | "Pair"> = I extends "pair" ? Extract<MichelsonTypePair<MichelsonType[]>, Prim> : Extract<MichelsonDataPair<MichelsonData[]>, Prim>; | ||
export declare function unpackComb<I extends "pair" | "Pair">(id: I, v: I extends "pair" ? MichelsonTypePair<MichelsonType[]> : MichelsonDataPair<MichelsonData[]>): PairTypeOrDataPrim<I>; | ||
export declare function isPairType(t: MichelsonType): t is MichelsonTypePair<MichelsonType[]>; | ||
export declare function isPairData(d: Expr): d is MichelsonDataPair<MichelsonData[]>; | ||
export declare function parseDate(a: StringLiteral | IntLiteral): Date | null; | ||
export {}; |
{ | ||
"name": "@taquito/michel-codec", | ||
"version": "8.0.4-beta-RC.0", | ||
"version": "8.0.5-pack.0", | ||
"description": "Michelson parser/validator/formatter", | ||
@@ -89,3 +89,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "7650760a6fe6a1bfe101a9aa1bbe7fe85377022b" | ||
"gitHead": "e9b10d7170e54e0321389f4e08bf1c8c2159601d" | ||
} |
@@ -217,3 +217,3 @@ { | ||
], | ||
"sha512": "9354b9fcb6c793415fe7a11d44656237713f9e403af3e6e5a5ebc87469b54588a43538faefa0cb979bb7d5a2b81d93786c36b7e9bae418b8c16191287834e03c" | ||
"sha512": "beca59da371bc556ffb18948447bead2dded9d96698183a7bf00c086b7eeb9d2c3e025b6cff8a055b8b5199a527fd02e096856287cacb46c85c096701c373219" | ||
} | ||
@@ -226,3 +226,3 @@ }, | ||
"name": "@taquito/michel-codec", | ||
"version": "8.0.3-beta.0", | ||
"version": "8.0.2-beta.0", | ||
"description": "Michelson parser/validator/formatter", | ||
@@ -318,3 +318,3 @@ "keywords": [ | ||
], | ||
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJgLYOpCRAD9Qy5GYHsngAAN+UQABrPvw+cfHyX9I2AElZKk8DN\nwsDk+FRCmsSXEE/Vf4K25ZX0rLZDKUxt3OWWgxHziVPAgnRKFWB8ZT6xn9VHPELh\nsHHNCOMung7ntliLaX6O2CZ/gbT8rddVCgaEUtXecSg4kuKhoyV7EdRaE4uUnKoW\naAtpUoIglYZLGo9loZo3QLUloDm2e0joBX7zns6LxBY0OVBbinapm9vAdRmrpxOb\nxFfISEcaKxmdkCaObUnGsL16R0PUy/ZoojwBSjcekQB5TjQjoMa3Av70ykQwzjfR\n+ETjEEPtgq4m7GJoX9Z2nEgpy/9U9ebfr85FODnhYj7EX/1DWPfyDTyAHMCahedp\nHxUbaWeirqzg5CN3dRKukw1st53eVs2e0LZUrjgeFuK3sHJMU8LrngDVeDiFEwL/\nYgqZZSHu1uBOpaAuGDUztmIeFESccLP3dB3t4qQnZF5vxkuJjM7FLvMCrL7pYVVg\n5sWZM8wG57mnqoAy0s69S3S1fHDAQ6DeJgW27pcI2VwteH+bKhk5OXtGCAQmyb8G\nBw4d2AQ296YMJWlEgrr0PIeU2fbsAPV8Av7SFDckCrm06d5mk+mm9sSwEMGa+PZ/\nOjOiYv3rUn0KDIm8dqiZ7qxLfUiFOti7TwgS4NXTFzRQKq9ycNx6556lcQmbZEPz\nhMtPNvCQa76yzM/Cehz+\n=4KaL\n-----END PGP SIGNATURE-----\n" | ||
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJgLFSUCRAD9Qy5GYHsngAAOUwQAG668Rgz0mk8QPpa0ouScfg0\nOkBSMM+7Hta+i+lo9vwZdyjCPq955OesN0xBoGOmCfv7lo0Dix8sKb/MBYZxAWfW\nt/9+GMkNz7kyuYzf2n7KeyN2ot6/WC+8HBW7s15Isl6kUEuaER6ZBMk+nAJYsurv\nHl92RlUtd/HFTX9j3eO2IrQz46WMiImEYYSzBbiSQQ1Pp71TYi+xHNjswoBEgkPw\nkIYuGUNheKr6ksZaLeKUUDpgeTs+F0UZC/8cAs3d/UqtxnD4z5QB/bAYBKLD0Yhp\nNaDIctlpWjeSw+6gL3WKA2aGEiy+NNKwO+RskgFgzqd0Qlc/3tLMuHFAxtZ5bEk9\nR5eHzL1Hnvbu1q/2JSpTxAV/TjhfuxhETSBfMkd7L6mMPKhj3HgasRfpZkCD0YYV\nFpv9kswT01bqLjsmlf55z+4wAQ2kW5eJ4MZtfLng/durfUTtW/Zl7APa+LqtmvZm\nvPCOuomOZpBlBGok3oUq5BKg57eShJFe7AiyykCzz+KLWdcI5WIzUYDF7zc7TcDc\ncv4y1I4RirFFM0cSz9JDvaKfWhw6koQkOczp/8lz04n7V/I8N9KvYLQZR9W7OdOe\nLHjms+jG+Mf1snAaE+oTs3RFmMEth6dyXyVN9vKcMRbSIRXGV6XRJx8b36n2OQbD\nucahP4CAO3Qmj2fMvpsv\n=7tXy\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 too big to display
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1620275
50
15982