@taquito/michel-codec 18.0.0-RC.0 → 19.0.0-beta-RC.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/base58.js +0 -1
- package/dist/lib/binary.js +39 -40
- package/dist/lib/errors.js +0 -1
- package/dist/lib/formatters.js +9 -10
- package/dist/lib/global-constants.js +0 -1
- package/dist/lib/macros.js +2 -3
- package/dist/lib/micheline-emitter.js +0 -1
- package/dist/lib/micheline-parser.js +7 -8
- package/dist/lib/micheline.js +0 -1
- package/dist/lib/michelson-contract.js +11 -12
- package/dist/lib/michelson-typecheck.js +57 -58
- package/dist/lib/michelson-types.js +5 -8
- package/dist/lib/michelson-validator.js +0 -1
- package/dist/lib/scan.js +1 -2
- package/dist/lib/taquito-michel-codec.js +5 -2
- package/dist/lib/utils.js +10 -11
- package/dist/lib/version.js +2 -3
- package/dist/taquito-michel-codec.es6.js +5657 -5657
- package/dist/taquito-michel-codec.es6.js.map +1 -1
- package/dist/taquito-michel-codec.umd.js +5657 -5659
- package/dist/taquito-michel-codec.umd.js.map +1 -1
- package/dist/types/base58.d.ts +13 -13
- package/dist/types/binary.d.ts +127 -127
- package/dist/types/errors.d.ts +57 -57
- package/dist/types/formatters.d.ts +6 -6
- package/dist/types/global-constants.d.ts +3 -3
- package/dist/types/macros.d.ts +13 -13
- package/dist/types/micheline-emitter.d.ts +17 -17
- package/dist/types/micheline-parser.d.ts +130 -130
- package/dist/types/micheline.d.ts +44 -44
- package/dist/types/michelson-contract.d.ts +24 -24
- package/dist/types/michelson-typecheck.d.ts +38 -38
- package/dist/types/michelson-types.d.ts +135 -137
- package/dist/types/michelson-validator.d.ts +66 -66
- package/dist/types/scan.d.ts +26 -26
- package/dist/types/taquito-michel-codec.d.ts +16 -16
- package/dist/types/utils.d.ts +77 -77
- package/dist/types/version.d.ts +4 -4
- package/package.json +24 -26
- package/signature.json +28 -10
- package/dist/lib/base58.js.map +0 -1
- package/dist/lib/binary.js.map +0 -1
- package/dist/lib/errors.js.map +0 -1
- package/dist/lib/formatters.js.map +0 -1
- package/dist/lib/global-constants.js.map +0 -1
- package/dist/lib/macros.js.map +0 -1
- package/dist/lib/micheline-emitter.js.map +0 -1
- package/dist/lib/micheline-parser.js.map +0 -1
- package/dist/lib/micheline.js.map +0 -1
- package/dist/lib/michelson-contract.js.map +0 -1
- package/dist/lib/michelson-typecheck.js.map +0 -1
- package/dist/lib/michelson-types.js.map +0 -1
- package/dist/lib/michelson-validator.js.map +0 -1
- package/dist/lib/scan.js.map +0 -1
- package/dist/lib/taquito-michel-codec.js.map +0 -1
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/version.js.map +0 -1
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import { Token } from './scan';
|
|
2
|
-
import { Expr } from './micheline';
|
|
3
|
-
import { ProtocolOptions } from './michelson-types';
|
|
4
|
-
import { TaquitoError } from '@taquito/core';
|
|
5
|
-
/**
|
|
6
|
-
* @category Error
|
|
7
|
-
* @description Error that indicates a failure when parsing Micheline expressions
|
|
8
|
-
*/
|
|
9
|
-
export declare class MichelineParseError extends TaquitoError {
|
|
10
|
-
readonly token: Token | null;
|
|
11
|
-
readonly message: string;
|
|
12
|
-
/**
|
|
13
|
-
* @param token A token caused the error
|
|
14
|
-
* @param message An error message
|
|
15
|
-
*/
|
|
16
|
-
constructor(token: Token | null, message: string);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @category Error
|
|
20
|
-
* @description Error
|
|
21
|
-
*/
|
|
22
|
-
export declare class JSONParseError extends TaquitoError {
|
|
23
|
-
readonly node: unknown;
|
|
24
|
-
readonly message: string;
|
|
25
|
-
/**
|
|
26
|
-
* @param node A node caused the error
|
|
27
|
-
* @param message An error message
|
|
28
|
-
*/
|
|
29
|
-
constructor(node: unknown, message: string);
|
|
30
|
-
}
|
|
31
|
-
export interface GlobalConstantHashAndValue {
|
|
32
|
-
[globalConstantHash: string]: Expr;
|
|
33
|
-
}
|
|
34
|
-
export interface ParserOptions extends ProtocolOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Expand [Michelson macros](https://tezos.gitlab.io/whitedoc/michelson.html#macros) during parsing.
|
|
37
|
-
*/
|
|
38
|
-
expandMacros?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Expand global constants during parsing.
|
|
41
|
-
* `expandGlobalConstant` expects an object where the keys are global constant hashes and the values are the corresponding JSON Micheline expressions.
|
|
42
|
-
* @example
|
|
43
|
-
* ```
|
|
44
|
-
* const parserOptions: ParserOptions = {
|
|
45
|
-
* expandGlobalConstant: {
|
|
46
|
-
* 'expr...': { prim: 'DROP', args: [{ int: '2' }] }
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
*
|
|
50
|
-
* const p = new Parser(parserOptions);
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
expandGlobalConstant?: GlobalConstantHashAndValue;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Converts and validates Michelson expressions between JSON-based Michelson and Micheline
|
|
57
|
-
*
|
|
58
|
-
* Pretty Print a Michelson Smart Contract:
|
|
59
|
-
* ```
|
|
60
|
-
* const contract = await Tezos.contract.at("KT1Vsw3kh9638gqWoHTjvHCoHLPKvCbMVbCg");
|
|
61
|
-
* const p = new Parser();
|
|
62
|
-
*
|
|
63
|
-
* const michelsonCode = p.parseJSON(contract.script.code);
|
|
64
|
-
* const storage = p.parseJSON(contract.script.storage);
|
|
65
|
-
*
|
|
66
|
-
* console.log("Pretty print Michelson smart contract:");
|
|
67
|
-
* console.log(emitMicheline(michelsonCode, {indent:" ", newline: "\n",}));
|
|
68
|
-
*
|
|
69
|
-
* console.log("Pretty print Storage:");
|
|
70
|
-
* console.log(emitMicheline(storage, {indent:" ", newline: "\n",}));
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* Encode a Michelson expression for
|
|
74
|
-
* ```
|
|
75
|
-
* const src = `(Pair (Pair { Elt 1
|
|
76
|
-
* (Pair (Pair "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx")
|
|
77
|
-
* 0x0501000000026869) }
|
|
78
|
-
* 10000000)
|
|
79
|
-
* (Pair 2 333))`;
|
|
80
|
-
*
|
|
81
|
-
* const p = new Parser();
|
|
82
|
-
*
|
|
83
|
-
* const exp = p.parseMichelineExpression(src);
|
|
84
|
-
* console.log(JSON.stringify(exp));
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export declare class Parser {
|
|
88
|
-
private opt?;
|
|
89
|
-
constructor(opt?: ParserOptions | undefined);
|
|
90
|
-
private expand;
|
|
91
|
-
private parseListExpr;
|
|
92
|
-
private parseArgs;
|
|
93
|
-
private parseSequenceExpr;
|
|
94
|
-
private parseExpr;
|
|
95
|
-
/**
|
|
96
|
-
* Parses a Micheline sequence expression, such as smart contract source. Enclosing curly brackets may be omitted.
|
|
97
|
-
* @param src A Micheline sequence `{parameter ...; storage int; code { DUP ; ...};}` or `parameter ...; storage int; code { DUP ; ...};`
|
|
98
|
-
*/
|
|
99
|
-
parseSequence(src: string): Expr[] | null;
|
|
100
|
-
/**
|
|
101
|
-
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted.
|
|
102
|
-
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0`
|
|
103
|
-
* @returns An AST node or null for empty document.
|
|
104
|
-
*/
|
|
105
|
-
parseList(src: string): Expr | null;
|
|
106
|
-
/**
|
|
107
|
-
* Parse any Michelson expression
|
|
108
|
-
* @param src A Michelson expression such as `(Pair {Elt "0" 0} 0)` or `{parameter ...; storage int; code { DUP ; ...};}`
|
|
109
|
-
* @returns An AST node or null for empty document.
|
|
110
|
-
*/
|
|
111
|
-
parseMichelineExpression(src: string): Expr | null;
|
|
112
|
-
/**
|
|
113
|
-
* Parse a Micheline sequence expression, such as smart contract source. Enclosing curly brackets may be omitted.
|
|
114
|
-
* An alias for `parseSequence`
|
|
115
|
-
* @param src A Micheline sequence `{parameter ...; storage int; code { DUP ; ...};}` or `parameter ...; storage int; code { DUP ; ...};`
|
|
116
|
-
*/
|
|
117
|
-
parseScript(src: string): Expr[] | null;
|
|
118
|
-
/**
|
|
119
|
-
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted.
|
|
120
|
-
* An alias for `parseList`
|
|
121
|
-
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0`
|
|
122
|
-
* @returns An AST node or null for empty document.
|
|
123
|
-
*/
|
|
124
|
-
parseData(src: string): Expr | null;
|
|
125
|
-
/**
|
|
126
|
-
* Takes a JSON-encoded Michelson, validates it, strips away unneeded properties and optionally expands macros (See {@link ParserOptions}).
|
|
127
|
-
* @param src An object containing JSON-encoded Michelson, usually returned by `JSON.parse()`
|
|
128
|
-
*/
|
|
129
|
-
parseJSON(src: object): Expr;
|
|
130
|
-
}
|
|
1
|
+
import { Token } from './scan';
|
|
2
|
+
import { Expr } from './micheline';
|
|
3
|
+
import { ProtocolOptions } from './michelson-types';
|
|
4
|
+
import { TaquitoError } from '@taquito/core';
|
|
5
|
+
/**
|
|
6
|
+
* @category Error
|
|
7
|
+
* @description Error that indicates a failure when parsing Micheline expressions
|
|
8
|
+
*/
|
|
9
|
+
export declare class MichelineParseError extends TaquitoError {
|
|
10
|
+
readonly token: Token | null;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
/**
|
|
13
|
+
* @param token A token caused the error
|
|
14
|
+
* @param message An error message
|
|
15
|
+
*/
|
|
16
|
+
constructor(token: Token | null, message: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @category Error
|
|
20
|
+
* @description Error indicates a failure when parsing Micheline JSON
|
|
21
|
+
*/
|
|
22
|
+
export declare class JSONParseError extends TaquitoError {
|
|
23
|
+
readonly node: unknown;
|
|
24
|
+
readonly message: string;
|
|
25
|
+
/**
|
|
26
|
+
* @param node A node caused the error
|
|
27
|
+
* @param message An error message
|
|
28
|
+
*/
|
|
29
|
+
constructor(node: unknown, message: string);
|
|
30
|
+
}
|
|
31
|
+
export interface GlobalConstantHashAndValue {
|
|
32
|
+
[globalConstantHash: string]: Expr;
|
|
33
|
+
}
|
|
34
|
+
export interface ParserOptions extends ProtocolOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Expand [Michelson macros](https://tezos.gitlab.io/whitedoc/michelson.html#macros) during parsing.
|
|
37
|
+
*/
|
|
38
|
+
expandMacros?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Expand global constants during parsing.
|
|
41
|
+
* `expandGlobalConstant` expects an object where the keys are global constant hashes and the values are the corresponding JSON Micheline expressions.
|
|
42
|
+
* @example
|
|
43
|
+
* ```
|
|
44
|
+
* const parserOptions: ParserOptions = {
|
|
45
|
+
* expandGlobalConstant: {
|
|
46
|
+
* 'expr...': { prim: 'DROP', args: [{ int: '2' }] }
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* const p = new Parser(parserOptions);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
expandGlobalConstant?: GlobalConstantHashAndValue;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Converts and validates Michelson expressions between JSON-based Michelson and Micheline
|
|
57
|
+
*
|
|
58
|
+
* Pretty Print a Michelson Smart Contract:
|
|
59
|
+
* ```
|
|
60
|
+
* const contract = await Tezos.contract.at("KT1Vsw3kh9638gqWoHTjvHCoHLPKvCbMVbCg");
|
|
61
|
+
* const p = new Parser();
|
|
62
|
+
*
|
|
63
|
+
* const michelsonCode = p.parseJSON(contract.script.code);
|
|
64
|
+
* const storage = p.parseJSON(contract.script.storage);
|
|
65
|
+
*
|
|
66
|
+
* console.log("Pretty print Michelson smart contract:");
|
|
67
|
+
* console.log(emitMicheline(michelsonCode, {indent:" ", newline: "\n",}));
|
|
68
|
+
*
|
|
69
|
+
* console.log("Pretty print Storage:");
|
|
70
|
+
* console.log(emitMicheline(storage, {indent:" ", newline: "\n",}));
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* Encode a Michelson expression for initial storage of a smart contract
|
|
74
|
+
* ```
|
|
75
|
+
* const src = `(Pair (Pair { Elt 1
|
|
76
|
+
* (Pair (Pair "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx")
|
|
77
|
+
* 0x0501000000026869) }
|
|
78
|
+
* 10000000)
|
|
79
|
+
* (Pair 2 333))`;
|
|
80
|
+
*
|
|
81
|
+
* const p = new Parser();
|
|
82
|
+
*
|
|
83
|
+
* const exp = p.parseMichelineExpression(src);
|
|
84
|
+
* console.log(JSON.stringify(exp));
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare class Parser {
|
|
88
|
+
private opt?;
|
|
89
|
+
constructor(opt?: ParserOptions | undefined);
|
|
90
|
+
private expand;
|
|
91
|
+
private parseListExpr;
|
|
92
|
+
private parseArgs;
|
|
93
|
+
private parseSequenceExpr;
|
|
94
|
+
private parseExpr;
|
|
95
|
+
/**
|
|
96
|
+
* Parses a Micheline sequence expression, such as smart contract source. Enclosing curly brackets may be omitted.
|
|
97
|
+
* @param src A Micheline sequence `{parameter ...; storage int; code { DUP ; ...};}` or `parameter ...; storage int; code { DUP ; ...};`
|
|
98
|
+
*/
|
|
99
|
+
parseSequence(src: string): Expr[] | null;
|
|
100
|
+
/**
|
|
101
|
+
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted.
|
|
102
|
+
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0`
|
|
103
|
+
* @returns An AST node or null for empty document.
|
|
104
|
+
*/
|
|
105
|
+
parseList(src: string): Expr | null;
|
|
106
|
+
/**
|
|
107
|
+
* Parse any Michelson expression
|
|
108
|
+
* @param src A Michelson expression such as `(Pair {Elt "0" 0} 0)` or `{parameter ...; storage int; code { DUP ; ...};}`
|
|
109
|
+
* @returns An AST node or null for empty document.
|
|
110
|
+
*/
|
|
111
|
+
parseMichelineExpression(src: string): Expr | null;
|
|
112
|
+
/**
|
|
113
|
+
* Parse a Micheline sequence expression, such as smart contract source. Enclosing curly brackets may be omitted.
|
|
114
|
+
* An alias for `parseSequence`
|
|
115
|
+
* @param src A Micheline sequence `{parameter ...; storage int; code { DUP ; ...};}` or `parameter ...; storage int; code { DUP ; ...};`
|
|
116
|
+
*/
|
|
117
|
+
parseScript(src: string): Expr[] | null;
|
|
118
|
+
/**
|
|
119
|
+
* Parse a Micheline sequence expression. Enclosing curly brackets may be omitted.
|
|
120
|
+
* An alias for `parseList`
|
|
121
|
+
* @param src A Michelson list expression such as `(Pair {Elt "0" 0} 0)` or `Pair {Elt "0" 0} 0`
|
|
122
|
+
* @returns An AST node or null for empty document.
|
|
123
|
+
*/
|
|
124
|
+
parseData(src: string): Expr | null;
|
|
125
|
+
/**
|
|
126
|
+
* Takes a JSON-encoded Michelson, validates it, strips away unneeded properties and optionally expands macros (See {@link ParserOptions}).
|
|
127
|
+
* @param src An object containing JSON-encoded Michelson, usually returned by `JSON.parse()`
|
|
128
|
+
*/
|
|
129
|
+
parseJSON(src: object): Expr;
|
|
130
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export
|
|
2
|
-
first: number;
|
|
3
|
-
last: number;
|
|
4
|
-
macro?: Expr;
|
|
5
|
-
globalConstant?: Expr;
|
|
6
|
-
};
|
|
7
|
-
export declare const sourceReference: unique symbol;
|
|
8
|
-
export interface Node {
|
|
9
|
-
[sourceReference]?: SourceReference;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* An AST node representing Michelson string literal.
|
|
13
|
-
*/
|
|
14
|
-
export interface StringLiteral extends Node {
|
|
15
|
-
string: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* An AST node representing Michelson int literal.
|
|
19
|
-
*/
|
|
20
|
-
export interface IntLiteral<T extends string = string> extends Node {
|
|
21
|
-
int: T;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* An AST node representing Michelson bytes literal.
|
|
25
|
-
*/
|
|
26
|
-
export interface BytesLiteral extends Node {
|
|
27
|
-
bytes: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* An AST node representing Michelson primitive.
|
|
31
|
-
*/
|
|
32
|
-
export interface Prim<PT extends string = string, AT extends Expr[] = Expr[]> extends Node {
|
|
33
|
-
prim: PT;
|
|
34
|
-
args?: AT;
|
|
35
|
-
annots?: string[];
|
|
36
|
-
}
|
|
37
|
-
export
|
|
38
|
-
interface ExprList extends List<Expr> {
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* An AST node representing valid Michelson expression. Directly corresponds to JSON-encoded Michelson node
|
|
42
|
-
*/
|
|
43
|
-
export
|
|
44
|
-
export {};
|
|
1
|
+
export type SourceReference = {
|
|
2
|
+
first: number;
|
|
3
|
+
last: number;
|
|
4
|
+
macro?: Expr;
|
|
5
|
+
globalConstant?: Expr;
|
|
6
|
+
};
|
|
7
|
+
export declare const sourceReference: unique symbol;
|
|
8
|
+
export interface Node {
|
|
9
|
+
[sourceReference]?: SourceReference;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An AST node representing Michelson string literal.
|
|
13
|
+
*/
|
|
14
|
+
export interface StringLiteral extends Node {
|
|
15
|
+
string: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* An AST node representing Michelson int literal.
|
|
19
|
+
*/
|
|
20
|
+
export interface IntLiteral<T extends string = string> extends Node {
|
|
21
|
+
int: T;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An AST node representing Michelson bytes literal.
|
|
25
|
+
*/
|
|
26
|
+
export interface BytesLiteral extends Node {
|
|
27
|
+
bytes: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* An AST node representing Michelson primitive.
|
|
31
|
+
*/
|
|
32
|
+
export interface Prim<PT extends string = string, AT extends Expr[] = Expr[]> extends Node {
|
|
33
|
+
prim: PT;
|
|
34
|
+
args?: AT;
|
|
35
|
+
annots?: string[];
|
|
36
|
+
}
|
|
37
|
+
export type List<T extends Expr> = T[] & Node;
|
|
38
|
+
interface ExprList extends List<Expr> {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* An AST node representing valid Michelson expression. Directly corresponds to JSON-encoded Michelson node
|
|
42
|
+
*/
|
|
43
|
+
export type Expr = Prim | StringLiteral | IntLiteral | BytesLiteral | ExprList;
|
|
44
|
+
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { MichelsonContract, MichelsonContractSection, MichelsonType, MichelsonData, MichelsonCode, MichelsonReturnType } from './michelson-types';
|
|
2
|
-
import { InstructionTrace } from './michelson-typecheck';
|
|
3
|
-
import { ParserOptions } from './micheline-parser';
|
|
4
|
-
export interface ContractOptions extends ParserOptions {
|
|
5
|
-
traceCallback?: (t: InstructionTrace) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare class Contract {
|
|
8
|
-
readonly contract: MichelsonContract;
|
|
9
|
-
private ctx;
|
|
10
|
-
readonly output: MichelsonReturnType;
|
|
11
|
-
constructor(contract: MichelsonContract, opt?: ContractOptions);
|
|
12
|
-
static parse(src: string | object, opt?: ContractOptions): Contract;
|
|
13
|
-
static parseTypeExpression(src: string | object, opt?: ParserOptions): MichelsonType;
|
|
14
|
-
static parseDataExpression(src: string | object, opt?: ParserOptions): MichelsonData;
|
|
15
|
-
section<T extends 'parameter' | 'storage' | 'code'>(section: T): MichelsonContractSection<T>;
|
|
16
|
-
entryPoints(): [string, MichelsonType][];
|
|
17
|
-
entryPoint(ep?: string): MichelsonType | null;
|
|
18
|
-
assertDataValid(d: MichelsonData, t: MichelsonType): void;
|
|
19
|
-
isDataValid(d: MichelsonData, t: MichelsonType): boolean;
|
|
20
|
-
assertParameterValid(ep: string | null, d: MichelsonData): void;
|
|
21
|
-
isParameterValid(ep: string | null, d: MichelsonData): boolean;
|
|
22
|
-
functionType(inst: MichelsonCode, stack: MichelsonType[]): MichelsonReturnType;
|
|
23
|
-
}
|
|
24
|
-
export declare const dummyContract: Contract;
|
|
1
|
+
import { MichelsonContract, MichelsonContractSection, MichelsonType, MichelsonData, MichelsonCode, MichelsonReturnType } from './michelson-types';
|
|
2
|
+
import { InstructionTrace } from './michelson-typecheck';
|
|
3
|
+
import { ParserOptions } from './micheline-parser';
|
|
4
|
+
export interface ContractOptions extends ParserOptions {
|
|
5
|
+
traceCallback?: (t: InstructionTrace) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class Contract {
|
|
8
|
+
readonly contract: MichelsonContract;
|
|
9
|
+
private ctx;
|
|
10
|
+
readonly output: MichelsonReturnType;
|
|
11
|
+
constructor(contract: MichelsonContract, opt?: ContractOptions);
|
|
12
|
+
static parse(src: string | object, opt?: ContractOptions): Contract;
|
|
13
|
+
static parseTypeExpression(src: string | object, opt?: ParserOptions): MichelsonType;
|
|
14
|
+
static parseDataExpression(src: string | object, opt?: ParserOptions): MichelsonData;
|
|
15
|
+
section<T extends 'parameter' | 'storage' | 'code'>(section: T): MichelsonContractSection<T>;
|
|
16
|
+
entryPoints(): [string, MichelsonType][];
|
|
17
|
+
entryPoint(ep?: string): MichelsonType | null;
|
|
18
|
+
assertDataValid(d: MichelsonData, t: MichelsonType): void;
|
|
19
|
+
isDataValid(d: MichelsonData, t: MichelsonType): boolean;
|
|
20
|
+
assertParameterValid(ep: string | null, d: MichelsonData): void;
|
|
21
|
+
isParameterValid(ep: string | null, d: MichelsonData): boolean;
|
|
22
|
+
functionType(inst: MichelsonCode, stack: MichelsonType[]): MichelsonReturnType;
|
|
23
|
+
}
|
|
24
|
+
export declare const dummyContract: Contract;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { MichelsonType, MichelsonData, MichelsonCode, MichelsonContract, MichelsonContractSection, MichelsonReturnType, MichelsonContractView } from './michelson-types';
|
|
2
|
-
import { MichelsonError } from './utils';
|
|
3
|
-
import { ParserOptions } from './micheline-parser';
|
|
4
|
-
export interface Context extends ParserOptions {
|
|
5
|
-
contract?: MichelsonContract;
|
|
6
|
-
traceCallback?: (t: InstructionTrace) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare class MichelsonInstructionError extends MichelsonError<MichelsonCode> {
|
|
9
|
-
readonly val: MichelsonCode;
|
|
10
|
-
readonly stackState: MichelsonReturnType;
|
|
11
|
-
readonly message: string;
|
|
12
|
-
/**
|
|
13
|
-
* @param val Value of a type node caused the error
|
|
14
|
-
* @param stackState Current stack state
|
|
15
|
-
* @param message An error message
|
|
16
|
-
*/
|
|
17
|
-
constructor(val: MichelsonCode, stackState: MichelsonReturnType, message: string);
|
|
18
|
-
}
|
|
19
|
-
export declare function assertTypeAnnotationsValid(t: MichelsonType, field?: boolean): void;
|
|
20
|
-
export interface InstructionTrace {
|
|
21
|
-
op: MichelsonCode;
|
|
22
|
-
in: MichelsonType[];
|
|
23
|
-
out: MichelsonReturnType;
|
|
24
|
-
}
|
|
25
|
-
export declare function contractSection<T extends 'parameter' | 'storage' | 'code'>(contract: MichelsonContract, section: T): MichelsonContractSection<T>;
|
|
26
|
-
export declare function contractViews(contract: MichelsonContract): {
|
|
27
|
-
[name: string]: MichelsonContractView;
|
|
28
|
-
};
|
|
29
|
-
export declare function contractEntryPoint(src: MichelsonContract | MichelsonType, ep?: string): MichelsonType | null;
|
|
30
|
-
export declare function contractEntryPoints(src: MichelsonContract | MichelsonType): [string, MichelsonType][];
|
|
31
|
-
export declare function assertContractValid(contract: MichelsonContract, ctx?: Context): MichelsonReturnType;
|
|
32
|
-
export declare function assertDataValid(d: MichelsonData, t: MichelsonType, ctx?: Context): void;
|
|
33
|
-
export declare function functionType(inst: MichelsonCode, stack: MichelsonType[], ctx?: Context): MichelsonReturnType;
|
|
34
|
-
export declare function assertTypesEqual<T1 extends MichelsonType | MichelsonType[], T2 extends T1>(a: T1, b: T2, field?: boolean): void;
|
|
35
|
-
export declare function isTypeAnnotationsValid(t: MichelsonType, field?: boolean): boolean;
|
|
36
|
-
export declare function isContractValid(contract: MichelsonContract, ctx?: Context): MichelsonReturnType | null;
|
|
37
|
-
export declare function isDataValid(d: MichelsonData, t: MichelsonType, ctx?: Context): boolean;
|
|
38
|
-
export declare function isTypeEqual<T1 extends MichelsonType | MichelsonType[], T2 extends T1>(a: T1, b: T2, field?: boolean): boolean;
|
|
1
|
+
import { MichelsonType, MichelsonData, MichelsonCode, MichelsonContract, MichelsonContractSection, MichelsonReturnType, MichelsonContractView } from './michelson-types';
|
|
2
|
+
import { MichelsonError } from './utils';
|
|
3
|
+
import { ParserOptions } from './micheline-parser';
|
|
4
|
+
export interface Context extends ParserOptions {
|
|
5
|
+
contract?: MichelsonContract;
|
|
6
|
+
traceCallback?: (t: InstructionTrace) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare class MichelsonInstructionError extends MichelsonError<MichelsonCode> {
|
|
9
|
+
readonly val: MichelsonCode;
|
|
10
|
+
readonly stackState: MichelsonReturnType;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
/**
|
|
13
|
+
* @param val Value of a type node caused the error
|
|
14
|
+
* @param stackState Current stack state
|
|
15
|
+
* @param message An error message
|
|
16
|
+
*/
|
|
17
|
+
constructor(val: MichelsonCode, stackState: MichelsonReturnType, message: string);
|
|
18
|
+
}
|
|
19
|
+
export declare function assertTypeAnnotationsValid(t: MichelsonType, field?: boolean): void;
|
|
20
|
+
export interface InstructionTrace {
|
|
21
|
+
op: MichelsonCode;
|
|
22
|
+
in: MichelsonType[];
|
|
23
|
+
out: MichelsonReturnType;
|
|
24
|
+
}
|
|
25
|
+
export declare function contractSection<T extends 'parameter' | 'storage' | 'code'>(contract: MichelsonContract, section: T): MichelsonContractSection<T>;
|
|
26
|
+
export declare function contractViews(contract: MichelsonContract): {
|
|
27
|
+
[name: string]: MichelsonContractView;
|
|
28
|
+
};
|
|
29
|
+
export declare function contractEntryPoint(src: MichelsonContract | MichelsonType, ep?: string): MichelsonType | null;
|
|
30
|
+
export declare function contractEntryPoints(src: MichelsonContract | MichelsonType): [string, MichelsonType][];
|
|
31
|
+
export declare function assertContractValid(contract: MichelsonContract, ctx?: Context): MichelsonReturnType;
|
|
32
|
+
export declare function assertDataValid(d: MichelsonData, t: MichelsonType, ctx?: Context): void;
|
|
33
|
+
export declare function functionType(inst: MichelsonCode, stack: MichelsonType[], ctx?: Context): MichelsonReturnType;
|
|
34
|
+
export declare function assertTypesEqual<T1 extends MichelsonType | MichelsonType[], T2 extends T1>(a: T1, b: T2, field?: boolean): void;
|
|
35
|
+
export declare function isTypeAnnotationsValid(t: MichelsonType, field?: boolean): boolean;
|
|
36
|
+
export declare function isContractValid(contract: MichelsonContract, ctx?: Context): MichelsonReturnType | null;
|
|
37
|
+
export declare function isDataValid(d: MichelsonData, t: MichelsonType, ctx?: Context): boolean;
|
|
38
|
+
export declare function isTypeEqual<T1 extends MichelsonType | MichelsonType[], T2 extends T1>(a: T1, b: T2, field?: boolean): boolean;
|