@taquito/michelson-encoder 23.0.3 → 24.0.0-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/constants.js +11 -0
- package/dist/lib/schema/parameter.js +1 -8
- package/dist/lib/schema/storage.js +0 -20
- package/dist/lib/schema/view-schema.js +2 -2
- package/dist/lib/taquito-michelson-encoder.js +3 -2
- package/dist/lib/tokens/bigmap.js +0 -12
- package/dist/lib/tokens/bls12-381-fr.js +0 -7
- package/dist/lib/tokens/bls12-381-g1.js +0 -7
- package/dist/lib/tokens/bls12-381-g2.js +0 -7
- package/dist/lib/tokens/chain-id.js +0 -7
- package/dist/lib/tokens/chest-key.js +0 -7
- package/dist/lib/tokens/chest.js +0 -7
- package/dist/lib/tokens/comparable/address.js +0 -7
- package/dist/lib/tokens/comparable/bool.js +0 -7
- package/dist/lib/tokens/comparable/bytes.js +0 -7
- package/dist/lib/tokens/comparable/int.js +0 -7
- package/dist/lib/tokens/comparable/key_hash.js +0 -7
- package/dist/lib/tokens/comparable/mutez.js +0 -7
- package/dist/lib/tokens/comparable/nat.js +0 -7
- package/dist/lib/tokens/comparable/string.js +0 -7
- package/dist/lib/tokens/comparable/timestamp.js +0 -7
- package/dist/lib/tokens/constant.js +0 -7
- package/dist/lib/tokens/contract.js +0 -7
- package/dist/lib/tokens/key.js +10 -29
- package/dist/lib/tokens/lambda.js +0 -12
- package/dist/lib/tokens/list.js +0 -9
- package/dist/lib/tokens/map.js +0 -12
- package/dist/lib/tokens/never.js +0 -7
- package/dist/lib/tokens/operation.js +0 -7
- package/dist/lib/tokens/option.js +0 -7
- package/dist/lib/tokens/or.js +7 -13
- package/dist/lib/tokens/pair.js +3 -10
- package/dist/lib/tokens/sapling-state.js +0 -11
- package/dist/lib/tokens/sapling-transaction-deprecated.js +0 -11
- package/dist/lib/tokens/sapling-transaction.js +0 -11
- package/dist/lib/tokens/set.js +0 -7
- package/dist/lib/tokens/signature.js +0 -7
- package/dist/lib/tokens/ticket-deprecated.js +0 -11
- package/dist/lib/tokens/ticket.js +0 -11
- package/dist/lib/tokens/token.js +1 -1
- package/dist/lib/tokens/unit.js +3 -10
- package/dist/lib/version.js +2 -2
- package/dist/taquito-michelson-encoder.es6.js +37 -355
- package/dist/taquito-michelson-encoder.es6.js.map +1 -1
- package/dist/taquito-michelson-encoder.umd.js +39 -357
- package/dist/taquito-michelson-encoder.umd.js.map +1 -1
- package/dist/types/constants.d.ts +8 -0
- package/dist/types/schema/parameter.d.ts +1 -6
- package/dist/types/schema/storage.d.ts +0 -11
- package/dist/types/schema/view-schema.d.ts +2 -2
- package/dist/types/taquito-michelson-encoder.d.ts +1 -2
- package/dist/types/tokens/bigmap.d.ts +0 -10
- package/dist/types/tokens/bls12-381-fr.d.ts +0 -5
- package/dist/types/tokens/bls12-381-g1.d.ts +0 -5
- package/dist/types/tokens/bls12-381-g2.d.ts +0 -5
- package/dist/types/tokens/chain-id.d.ts +0 -5
- package/dist/types/tokens/chest-key.d.ts +0 -5
- package/dist/types/tokens/chest.d.ts +0 -5
- package/dist/types/tokens/comparable/address.d.ts +0 -5
- package/dist/types/tokens/comparable/bool.d.ts +0 -5
- package/dist/types/tokens/comparable/bytes.d.ts +0 -5
- package/dist/types/tokens/comparable/int.d.ts +0 -5
- package/dist/types/tokens/comparable/key_hash.d.ts +0 -5
- package/dist/types/tokens/comparable/mutez.d.ts +0 -5
- package/dist/types/tokens/comparable/nat.d.ts +0 -5
- package/dist/types/tokens/comparable/string.d.ts +0 -5
- package/dist/types/tokens/comparable/timestamp.d.ts +0 -5
- package/dist/types/tokens/constant.d.ts +0 -5
- package/dist/types/tokens/contract.d.ts +0 -5
- package/dist/types/tokens/key.d.ts +0 -6
- package/dist/types/tokens/lambda.d.ts +0 -10
- package/dist/types/tokens/list.d.ts +0 -7
- package/dist/types/tokens/map.d.ts +0 -10
- package/dist/types/tokens/never.d.ts +0 -5
- package/dist/types/tokens/operation.d.ts +0 -5
- package/dist/types/tokens/option.d.ts +1 -8
- package/dist/types/tokens/or.d.ts +0 -5
- package/dist/types/tokens/pair.d.ts +0 -5
- package/dist/types/tokens/sapling-state.d.ts +0 -9
- package/dist/types/tokens/sapling-transaction-deprecated.d.ts +0 -9
- package/dist/types/tokens/sapling-transaction.d.ts +0 -9
- package/dist/types/tokens/set.d.ts +0 -5
- package/dist/types/tokens/signature.d.ts +0 -5
- package/dist/types/tokens/ticket-deprecated.d.ts +0 -9
- package/dist/types/tokens/ticket.d.ts +0 -9
- package/dist/types/tokens/token.d.ts +1 -6
- package/dist/types/tokens/unit.d.ts +0 -5
- package/package.json +9 -8
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaplingStateValue = exports.UnitValue = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Symbol representing Unit value in Michelson
|
|
6
|
+
*/
|
|
7
|
+
exports.UnitValue = Symbol();
|
|
8
|
+
/**
|
|
9
|
+
* Sapling state placeholder value
|
|
10
|
+
*/
|
|
11
|
+
exports.SaplingStateValue = {};
|
|
@@ -49,7 +49,7 @@ class ParameterSchema {
|
|
|
49
49
|
*/
|
|
50
50
|
get hasAnnotation() {
|
|
51
51
|
if (this.isMultipleEntryPoint) {
|
|
52
|
-
return Object.keys(this.
|
|
52
|
+
return Object.keys(this.generateSchema())[0] !== '0';
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
return true;
|
|
@@ -100,13 +100,6 @@ class ParameterSchema {
|
|
|
100
100
|
throw new errors_1.ParameterEncodingError('Unable to encode parameter object', this.root, value, ex);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
ExtractSchema() {
|
|
108
|
-
return this.root.ExtractSchema();
|
|
109
|
-
}
|
|
110
103
|
/**
|
|
111
104
|
* @description Produce a schema grouping together all the entry points of a contract.
|
|
112
105
|
*/
|
|
@@ -193,13 +193,6 @@ class Schema {
|
|
|
193
193
|
throw new errors_1.StorageEncodingError('storage object', ex, this.root, value, semantics);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
/**
|
|
197
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
198
|
-
*
|
|
199
|
-
*/
|
|
200
|
-
ExtractSchema() {
|
|
201
|
-
return this.removeTopLevelAnnotation(this.root.ExtractSchema());
|
|
202
|
-
}
|
|
203
196
|
/**
|
|
204
197
|
* @description Produce a representation of the storage schema.
|
|
205
198
|
* Note: Provide guidance on how to write the storage object for the origination operation with Taquito.
|
|
@@ -207,19 +200,6 @@ class Schema {
|
|
|
207
200
|
generateSchema() {
|
|
208
201
|
return this.removeTopLevelAnnotation(this.root.generateSchema());
|
|
209
202
|
}
|
|
210
|
-
/**
|
|
211
|
-
* @deprecated
|
|
212
|
-
* @throws {@link InvalidBigMapSchemaError}
|
|
213
|
-
*/
|
|
214
|
-
ComputeState(tx, state) {
|
|
215
|
-
if (!this.bigMap) {
|
|
216
|
-
throw new errors_1.InvalidBigMapSchemaError('Big map schema is undefined');
|
|
217
|
-
}
|
|
218
|
-
const bigMap = tx.reduce((prev, current) => {
|
|
219
|
-
return Object.assign(Object.assign({}, prev), this.ExecuteOnBigMapDiff(current.contents[0].metadata.operation_result.big_map_diff));
|
|
220
|
-
}, {});
|
|
221
|
-
return Object.assign(Object.assign({}, this.Execute(state)), { [this.bigMap.annot()]: bigMap });
|
|
222
|
-
}
|
|
223
203
|
/**
|
|
224
204
|
* @description Look up in top-level pairs of the storage to find a value matching the specified type
|
|
225
205
|
*
|
|
@@ -77,14 +77,14 @@ class ViewSchema {
|
|
|
77
77
|
* @description Return the signature of the view parameter
|
|
78
78
|
*/
|
|
79
79
|
extractArgsSchema() {
|
|
80
|
-
return this.rootArgsType.
|
|
80
|
+
return this.rootArgsType.generateSchema();
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
*
|
|
84
84
|
* @description Return the format of the view result
|
|
85
85
|
*/
|
|
86
86
|
extractResultSchema() {
|
|
87
|
-
return this.rootReturnType.
|
|
87
|
+
return this.rootReturnType.generateSchema();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
exports.ViewSchema = ViewSchema;
|
|
@@ -26,8 +26,9 @@ __exportStar(require("./schema/event-schema"), exports);
|
|
|
26
26
|
__exportStar(require("./schema/errors"), exports);
|
|
27
27
|
__exportStar(require("./schema/types"), exports);
|
|
28
28
|
__exportStar(require("./errors"), exports);
|
|
29
|
-
|
|
30
|
-
exports
|
|
29
|
+
var constants_1 = require("./constants");
|
|
30
|
+
Object.defineProperty(exports, "UnitValue", { enumerable: true, get: function () { return constants_1.UnitValue; } });
|
|
31
|
+
Object.defineProperty(exports, "SaplingStateValue", { enumerable: true, get: function () { return constants_1.SaplingStateValue; } });
|
|
31
32
|
__exportStar(require("./michelson-map"), exports);
|
|
32
33
|
var version_1 = require("./version");
|
|
33
34
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
@@ -29,18 +29,6 @@ class BigMapToken extends token_1.Token {
|
|
|
29
29
|
get KeySchema() {
|
|
30
30
|
return this.createToken(this.val.args[0], 0);
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
ExtractSchema() {
|
|
37
|
-
return {
|
|
38
|
-
big_map: {
|
|
39
|
-
key: this.KeySchema.ExtractSchema(),
|
|
40
|
-
value: this.ValueSchema.ExtractSchema(),
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
32
|
generateSchema() {
|
|
45
33
|
return {
|
|
46
34
|
__michelsonType: BigMapToken.prim,
|
|
@@ -67,13 +67,6 @@ class Bls12381frToken extends token_1.Token {
|
|
|
67
67
|
Execute(val) {
|
|
68
68
|
return val.bytes;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
ExtractSchema() {
|
|
75
|
-
return Bls12381frToken.prim;
|
|
76
|
-
}
|
|
77
70
|
generateSchema() {
|
|
78
71
|
return {
|
|
79
72
|
__michelsonType: Bls12381frToken.prim,
|
|
@@ -57,13 +57,6 @@ class Bls12381g1Token extends token_1.Token {
|
|
|
57
57
|
Execute(val) {
|
|
58
58
|
return val.bytes;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
ExtractSchema() {
|
|
65
|
-
return Bls12381g1Token.prim;
|
|
66
|
-
}
|
|
67
60
|
generateSchema() {
|
|
68
61
|
return {
|
|
69
62
|
__michelsonType: Bls12381g1Token.prim,
|
|
@@ -57,13 +57,6 @@ class Bls12381g2Token extends token_1.Token {
|
|
|
57
57
|
Execute(val) {
|
|
58
58
|
return val.bytes;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
ExtractSchema() {
|
|
65
|
-
return Bls12381g2Token.prim;
|
|
66
|
-
}
|
|
67
60
|
generateSchema() {
|
|
68
61
|
return {
|
|
69
62
|
__michelsonType: Bls12381g2Token.prim,
|
|
@@ -34,13 +34,6 @@ class ChainIDToken extends token_1.ComparableToken {
|
|
|
34
34
|
Execute(val) {
|
|
35
35
|
return val[Object.keys(val)[0]];
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
ExtractSchema() {
|
|
42
|
-
return ChainIDToken.prim;
|
|
43
|
-
}
|
|
44
37
|
generateSchema() {
|
|
45
38
|
return {
|
|
46
39
|
__michelsonType: ChainIDToken.prim,
|
|
@@ -57,13 +57,6 @@ class ChestKeyToken extends token_1.Token {
|
|
|
57
57
|
Execute(val) {
|
|
58
58
|
return val.bytes;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
ExtractSchema() {
|
|
65
|
-
return ChestKeyToken.prim;
|
|
66
|
-
}
|
|
67
60
|
generateSchema() {
|
|
68
61
|
return {
|
|
69
62
|
__michelsonType: ChestKeyToken.prim,
|
package/dist/lib/tokens/chest.js
CHANGED
|
@@ -57,13 +57,6 @@ class ChestToken extends token_1.Token {
|
|
|
57
57
|
Execute(val) {
|
|
58
58
|
return val.bytes;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
ExtractSchema() {
|
|
65
|
-
return ChestToken.prim;
|
|
66
|
-
}
|
|
67
60
|
generateSchema() {
|
|
68
61
|
return {
|
|
69
62
|
__michelsonType: ChestToken.prim,
|
|
@@ -71,13 +71,6 @@ class AddressToken extends token_1.ComparableToken {
|
|
|
71
71
|
}
|
|
72
72
|
return (0, utils_1.encodeAddress)(val.bytes);
|
|
73
73
|
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
ExtractSchema() {
|
|
79
|
-
return AddressToken.prim;
|
|
80
|
-
}
|
|
81
74
|
generateSchema() {
|
|
82
75
|
return {
|
|
83
76
|
__michelsonType: AddressToken.prim,
|
|
@@ -22,13 +22,6 @@ class BoolToken extends token_1.ComparableToken {
|
|
|
22
22
|
}
|
|
23
23
|
return { prim: val ? 'True' : 'False' };
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
ExtractSchema() {
|
|
30
|
-
return BoolToken.prim;
|
|
31
|
-
}
|
|
32
25
|
generateSchema() {
|
|
33
26
|
return {
|
|
34
27
|
__michelsonType: BoolToken.prim,
|
|
@@ -67,13 +67,6 @@ class BytesToken extends token_1.ComparableToken {
|
|
|
67
67
|
Execute(val) {
|
|
68
68
|
return val.bytes;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
ExtractSchema() {
|
|
75
|
-
return BytesToken.prim;
|
|
76
|
-
}
|
|
77
70
|
generateSchema() {
|
|
78
71
|
return {
|
|
79
72
|
__michelsonType: BytesToken.prim,
|
|
@@ -26,13 +26,6 @@ class IntToken extends token_1.ComparableToken {
|
|
|
26
26
|
Execute(val) {
|
|
27
27
|
return new bignumber_js_1.default(val[Object.keys(val)[0]]);
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
ExtractSchema() {
|
|
34
|
-
return IntToken.prim;
|
|
35
|
-
}
|
|
36
29
|
generateSchema() {
|
|
37
30
|
return {
|
|
38
31
|
__michelsonType: IntToken.prim,
|
|
@@ -55,13 +55,6 @@ class KeyHashToken extends token_1.ComparableToken {
|
|
|
55
55
|
}
|
|
56
56
|
return { string: val };
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
ExtractSchema() {
|
|
63
|
-
return KeyHashToken.prim;
|
|
64
|
-
}
|
|
65
58
|
generateSchema() {
|
|
66
59
|
return {
|
|
67
60
|
__michelsonType: KeyHashToken.prim,
|
|
@@ -26,13 +26,6 @@ class MutezToken extends token_1.ComparableToken {
|
|
|
26
26
|
Execute(val) {
|
|
27
27
|
return new bignumber_js_1.default(val[Object.keys(val)[0]]);
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
ExtractSchema() {
|
|
34
|
-
return MutezToken.prim;
|
|
35
|
-
}
|
|
36
29
|
generateSchema() {
|
|
37
30
|
return {
|
|
38
31
|
__michelsonType: MutezToken.prim,
|
|
@@ -56,13 +56,6 @@ class NatToken extends token_1.ComparableToken {
|
|
|
56
56
|
}
|
|
57
57
|
return { int: new bignumber_js_1.default(val).toFixed() };
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
ExtractSchema() {
|
|
64
|
-
return NatToken.prim;
|
|
65
|
-
}
|
|
66
59
|
generateSchema() {
|
|
67
60
|
return {
|
|
68
61
|
__michelsonType: NatToken.prim,
|
|
@@ -12,13 +12,6 @@ class StringToken extends token_1.ComparableToken {
|
|
|
12
12
|
Execute(val) {
|
|
13
13
|
return val[Object.keys(val)[0]];
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
ExtractSchema() {
|
|
20
|
-
return StringToken.prim;
|
|
21
|
-
}
|
|
22
15
|
generateSchema() {
|
|
23
16
|
return {
|
|
24
17
|
__michelsonType: StringToken.prim,
|
|
@@ -40,13 +40,6 @@ class TimestampToken extends token_1.ComparableToken {
|
|
|
40
40
|
return { string: val };
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
ExtractSchema() {
|
|
48
|
-
return TimestampToken.prim;
|
|
49
|
-
}
|
|
50
43
|
generateSchema() {
|
|
51
44
|
return {
|
|
52
45
|
__michelsonType: TimestampToken.prim,
|
|
@@ -61,13 +61,6 @@ class GlobalConstantToken extends token_1.Token {
|
|
|
61
61
|
}
|
|
62
62
|
throw new GlobalConstantEncodingError(val, this, `Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0]['string']}.`);
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
ExtractSchema() {
|
|
69
|
-
return GlobalConstantToken.prim;
|
|
70
|
-
}
|
|
71
64
|
generateSchema() {
|
|
72
65
|
return {
|
|
73
66
|
__michelsonType: GlobalConstantToken.prim,
|
|
@@ -66,13 +66,6 @@ class ContractToken extends token_1.Token {
|
|
|
66
66
|
}
|
|
67
67
|
return { string: val };
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
ExtractSchema() {
|
|
74
|
-
return ContractToken.prim;
|
|
75
|
-
}
|
|
76
69
|
generateSchema() {
|
|
77
70
|
const valueSchema = this.createToken(this.val.args[0], 0);
|
|
78
71
|
return {
|
package/dist/lib/tokens/key.js
CHANGED
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.KeyToken = exports.KeyValidationError = void 0;
|
|
4
4
|
const token_1 = require("./token");
|
|
5
5
|
const utils_1 = require("@taquito/utils");
|
|
6
|
-
const
|
|
7
|
-
const ec = new elliptic_1.default.ec('p256');
|
|
6
|
+
const signer_1 = require("@taquito/signer");
|
|
8
7
|
/**
|
|
9
8
|
* @category Error
|
|
10
9
|
* @description Error that indicates a failure happening when parsing encoding/executing a Key
|
|
@@ -57,13 +56,6 @@ class KeyToken extends token_1.ComparableToken {
|
|
|
57
56
|
}
|
|
58
57
|
return { string: val };
|
|
59
58
|
}
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
ExtractSchema() {
|
|
65
|
-
return KeyToken.prim;
|
|
66
|
-
}
|
|
67
59
|
generateSchema() {
|
|
68
60
|
return {
|
|
69
61
|
__michelsonType: KeyToken.prim,
|
|
@@ -79,31 +71,20 @@ class KeyToken extends token_1.ComparableToken {
|
|
|
79
71
|
type: { prim: KeyToken.prim },
|
|
80
72
|
};
|
|
81
73
|
}
|
|
82
|
-
decompressP256PublicKey(compressedKey) {
|
|
83
|
-
const compressedArray = Array.from(compressedKey);
|
|
84
|
-
const keyPair = ec.keyFromPublic(compressedArray);
|
|
85
|
-
const publicKey = keyPair.getPublic();
|
|
86
|
-
const uncompressedArray = publicKey.encode('array', false);
|
|
87
|
-
return Buffer.concat([new Uint8Array([0x02]), new Uint8Array(uncompressedArray)]); // add back prefix 0x02
|
|
88
|
-
}
|
|
89
74
|
compare(key1, key2) {
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (bytes1[0] ===
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
array1 = bytes1;
|
|
75
|
+
const publicKey1 = (0, signer_1.publicKeyFromString)(key1);
|
|
76
|
+
const publicKey2 = (0, signer_1.publicKeyFromString)(key2);
|
|
77
|
+
const bytes1 = publicKey1.toProtocol();
|
|
78
|
+
const bytes2 = publicKey2.toProtocol();
|
|
79
|
+
if (bytes1[0] === bytes2[0]) {
|
|
80
|
+
return publicKey1.compare(publicKey2);
|
|
99
81
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
82
|
+
else if (bytes1[0] > bytes2[0]) {
|
|
83
|
+
return 1;
|
|
102
84
|
}
|
|
103
85
|
else {
|
|
104
|
-
|
|
86
|
+
return -1;
|
|
105
87
|
}
|
|
106
|
-
return (0, utils_1.compareArrays)(array1, array2);
|
|
107
88
|
}
|
|
108
89
|
findAndReturnTokens(tokenToFind, tokens) {
|
|
109
90
|
if (KeyToken.prim === tokenToFind) {
|
|
@@ -33,18 +33,6 @@ class LambdaToken extends token_1.Token {
|
|
|
33
33
|
}
|
|
34
34
|
return val;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
ExtractSchema() {
|
|
41
|
-
return {
|
|
42
|
-
[LambdaToken.prim]: {
|
|
43
|
-
parameters: this.paramSchema.ExtractSchema(),
|
|
44
|
-
returns: this.returnSchema.ExtractSchema(),
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
36
|
generateSchema() {
|
|
49
37
|
return {
|
|
50
38
|
__michelsonType: LambdaToken.prim,
|
package/dist/lib/tokens/list.js
CHANGED
|
@@ -67,15 +67,6 @@ class ListToken extends token_1.Token {
|
|
|
67
67
|
return [...prev, schema.EncodeObject(current)];
|
|
68
68
|
}, []);
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
ExtractSchema() {
|
|
75
|
-
return {
|
|
76
|
-
[ListToken.prim]: this.valueSchema.ExtractSchema(),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
70
|
generateSchema() {
|
|
80
71
|
return {
|
|
81
72
|
__michelsonType: ListToken.prim,
|
package/dist/lib/tokens/map.js
CHANGED
|
@@ -90,18 +90,6 @@ class MapToken extends token_1.Token {
|
|
|
90
90
|
};
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
ExtractSchema() {
|
|
98
|
-
return {
|
|
99
|
-
map: {
|
|
100
|
-
key: this.KeySchema.ExtractSchema(),
|
|
101
|
-
value: this.ValueSchema.ExtractSchema(),
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
93
|
generateSchema() {
|
|
106
94
|
return {
|
|
107
95
|
__michelsonType: MapToken.prim,
|
package/dist/lib/tokens/never.js
CHANGED
|
@@ -44,13 +44,6 @@ class NeverToken extends token_1.Token {
|
|
|
44
44
|
Execute(val) {
|
|
45
45
|
throw new NeverTokenError(val, this, `There is no literal value for the type never. Trying to execute ${JSON.stringify(val)}.`);
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
ExtractSchema() {
|
|
52
|
-
return NeverToken.prim;
|
|
53
|
-
}
|
|
54
47
|
generateSchema() {
|
|
55
48
|
return {
|
|
56
49
|
__michelsonType: NeverToken.prim,
|
|
@@ -22,13 +22,6 @@ class OperationToken extends token_1.Token {
|
|
|
22
22
|
}
|
|
23
23
|
return { string: val };
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
ExtractSchema() {
|
|
30
|
-
return OperationToken.prim;
|
|
31
|
-
}
|
|
32
25
|
generateSchema() {
|
|
33
26
|
return {
|
|
34
27
|
__michelsonType: OperationToken.prim,
|
|
@@ -46,13 +46,6 @@ class OptionToken extends token_1.ComparableToken {
|
|
|
46
46
|
}
|
|
47
47
|
return { Some: this.schema().Execute(val.args[0], semantics) };
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
ExtractSchema() {
|
|
54
|
-
return { Some: this.schema().ExtractSchema() };
|
|
55
|
-
}
|
|
56
49
|
generateSchema() {
|
|
57
50
|
return {
|
|
58
51
|
__michelsonType: OptionToken.prim,
|
package/dist/lib/tokens/or.js
CHANGED
|
@@ -28,7 +28,7 @@ class OrToken extends token_1.ComparableToken {
|
|
|
28
28
|
const leftToken = this.createToken(this.val.args[0], this.getIdxForChildren(), 'Or');
|
|
29
29
|
let keyCount = 1;
|
|
30
30
|
if (leftToken instanceof OrToken) {
|
|
31
|
-
keyCount = Object.keys(leftToken.
|
|
31
|
+
keyCount = Object.keys(leftToken.generateSchema().schema).length;
|
|
32
32
|
}
|
|
33
33
|
const rightToken = this.createToken(this.val.args[1], this.getIdxForChildren() + keyCount, 'Or');
|
|
34
34
|
if (String(leftToken.annot()) === String(label) && !(leftToken instanceof OrToken)) {
|
|
@@ -59,7 +59,7 @@ class OrToken extends token_1.ComparableToken {
|
|
|
59
59
|
const leftToken = this.createToken(this.val.args[0], this.getIdxForChildren(), 'Or');
|
|
60
60
|
let keyCount = 1;
|
|
61
61
|
if (leftToken instanceof OrToken) {
|
|
62
|
-
keyCount = Object.keys(leftToken.
|
|
62
|
+
keyCount = Object.keys(leftToken.generateSchema().schema).length;
|
|
63
63
|
}
|
|
64
64
|
const rightToken = this.createToken(this.val.args[1], this.getIdxForChildren() + keyCount, 'Or');
|
|
65
65
|
const newSig = [];
|
|
@@ -90,7 +90,7 @@ class OrToken extends token_1.ComparableToken {
|
|
|
90
90
|
const leftToken = this.createToken(this.val.args[0], this.getIdxForChildren(), 'Or');
|
|
91
91
|
let keyCount = 1;
|
|
92
92
|
if (leftToken instanceof OrToken) {
|
|
93
|
-
keyCount = Object.keys(leftToken.
|
|
93
|
+
keyCount = Object.keys(leftToken.generateSchema().schema).length;
|
|
94
94
|
}
|
|
95
95
|
const rightToken = this.createToken(this.val.args[1], this.getIdxForChildren() + keyCount, 'Or');
|
|
96
96
|
if (String(leftToken.annot()) === String(label) && !(leftToken instanceof OrToken)) {
|
|
@@ -133,7 +133,7 @@ class OrToken extends token_1.ComparableToken {
|
|
|
133
133
|
const leftToken = this.createToken(this.val.args[0], this.getIdxForChildren(), 'Or');
|
|
134
134
|
let keyCount = 1;
|
|
135
135
|
if (leftToken instanceof OrToken) {
|
|
136
|
-
keyCount = Object.keys(leftToken.
|
|
136
|
+
keyCount = Object.keys(leftToken.generateSchema().schema).length;
|
|
137
137
|
}
|
|
138
138
|
const rightToken = this.createToken(this.val.args[1], this.getIdxForChildren() + keyCount, 'Or');
|
|
139
139
|
if (val.prim === 'Right') {
|
|
@@ -164,7 +164,7 @@ class OrToken extends token_1.ComparableToken {
|
|
|
164
164
|
let leftValue;
|
|
165
165
|
if (leftToken instanceof OrToken) {
|
|
166
166
|
leftValue = getLeftValue(leftToken);
|
|
167
|
-
keyCount = Object.keys(leftToken.
|
|
167
|
+
keyCount = Object.keys(leftToken.generateSchema().schema).length;
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
170
|
leftValue = { [leftToken.annot()]: getLeftValue(leftToken) };
|
|
@@ -180,13 +180,6 @@ class OrToken extends token_1.ComparableToken {
|
|
|
180
180
|
const res = concat(leftValue, rightValue);
|
|
181
181
|
return res;
|
|
182
182
|
}
|
|
183
|
-
/**
|
|
184
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
185
|
-
*
|
|
186
|
-
*/
|
|
187
|
-
ExtractSchema() {
|
|
188
|
-
return this.traversal((leftToken) => leftToken.ExtractSchema(), (rightToken) => rightToken.ExtractSchema(), (leftValue, rightValue) => (Object.assign(Object.assign({}, leftValue), rightValue)));
|
|
189
|
-
}
|
|
190
183
|
generateSchema() {
|
|
191
184
|
return {
|
|
192
185
|
__michelsonType: OrToken.prim,
|
|
@@ -211,7 +204,8 @@ class OrToken extends token_1.ComparableToken {
|
|
|
211
204
|
const leftToken = this.createToken(this.val.args[0], this.getIdxForChildren(), 'Or');
|
|
212
205
|
let keyCount = 1;
|
|
213
206
|
if (leftToken instanceof OrToken) {
|
|
214
|
-
|
|
207
|
+
const schema = leftToken.generateSchema();
|
|
208
|
+
keyCount = Object.keys(schema.schema).length;
|
|
215
209
|
}
|
|
216
210
|
const rightToken = this.createToken(this.val.args[1], this.getIdxForChildren() + keyCount, 'Or');
|
|
217
211
|
if (String(leftToken.annot()) === String(label) &&
|
package/dist/lib/tokens/pair.js
CHANGED
|
@@ -78,7 +78,7 @@ class PairToken extends token_1.ComparableToken {
|
|
|
78
78
|
return this.args().map((a) => {
|
|
79
79
|
const tok = this.createToken(a, this.getIdxForChildren() + cnt, 'Pair');
|
|
80
80
|
if (tok instanceof PairToken) {
|
|
81
|
-
cnt += Object.keys(tok.
|
|
81
|
+
cnt += Object.keys(tok.generateSchema()).length;
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
84
|
cnt++;
|
|
@@ -97,7 +97,7 @@ class PairToken extends token_1.ComparableToken {
|
|
|
97
97
|
const leftToken = this.createToken(args[0], this.getIdxForChildren(), 'Pair');
|
|
98
98
|
let keyCount = 1;
|
|
99
99
|
if (leftToken instanceof or_1.OrToken) {
|
|
100
|
-
keyCount = Object.keys(leftToken.
|
|
100
|
+
keyCount = Object.keys(leftToken.generateSchema()).length;
|
|
101
101
|
}
|
|
102
102
|
const rightToken = this.createToken(args[1], this.getIdxForChildren() + keyCount, 'Pair');
|
|
103
103
|
const newSig = [];
|
|
@@ -149,7 +149,7 @@ class PairToken extends token_1.ComparableToken {
|
|
|
149
149
|
if (leftToken instanceof PairToken && !leftToken.hasAnnotations()) {
|
|
150
150
|
leftValue = getLeftValue(leftToken);
|
|
151
151
|
if (leftToken instanceof PairToken) {
|
|
152
|
-
keyCount = Object.keys(leftToken.
|
|
152
|
+
keyCount = Object.keys(leftToken.generateSchema()).length;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
@@ -170,13 +170,6 @@ class PairToken extends token_1.ComparableToken {
|
|
|
170
170
|
const args = collapse(val, 'Pair');
|
|
171
171
|
return this.traversal((leftToken) => leftToken.Execute(args[0], semantics), (rightToken) => rightToken.Execute(args[1], semantics));
|
|
172
172
|
}
|
|
173
|
-
/**
|
|
174
|
-
* @deprecated ExtractSchema has been deprecated in favor of generateSchema
|
|
175
|
-
*
|
|
176
|
-
*/
|
|
177
|
-
ExtractSchema() {
|
|
178
|
-
return this.traversal((leftToken) => leftToken.ExtractSchema(), (rightToken) => rightToken.ExtractSchema());
|
|
179
|
-
}
|
|
180
173
|
generateSchema() {
|
|
181
174
|
return {
|
|
182
175
|
__michelsonType: PairToken.prim,
|