@taquito/michelson-encoder 23.0.2 → 23.1.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.
Files changed (89) hide show
  1. package/dist/lib/constants.js +11 -0
  2. package/dist/lib/michelson-map.js +8 -14
  3. package/dist/lib/schema/parameter.js +1 -8
  4. package/dist/lib/schema/storage.js +18 -25
  5. package/dist/lib/schema/view-schema.js +2 -2
  6. package/dist/lib/taquito-michelson-encoder.js +3 -2
  7. package/dist/lib/tokens/bigmap.js +0 -12
  8. package/dist/lib/tokens/bls12-381-fr.js +0 -7
  9. package/dist/lib/tokens/bls12-381-g1.js +0 -7
  10. package/dist/lib/tokens/bls12-381-g2.js +0 -7
  11. package/dist/lib/tokens/chain-id.js +0 -7
  12. package/dist/lib/tokens/chest-key.js +0 -7
  13. package/dist/lib/tokens/chest.js +0 -7
  14. package/dist/lib/tokens/comparable/address.js +0 -7
  15. package/dist/lib/tokens/comparable/bool.js +0 -7
  16. package/dist/lib/tokens/comparable/bytes.js +0 -7
  17. package/dist/lib/tokens/comparable/int.js +0 -7
  18. package/dist/lib/tokens/comparable/key_hash.js +0 -7
  19. package/dist/lib/tokens/comparable/mutez.js +0 -7
  20. package/dist/lib/tokens/comparable/nat.js +0 -7
  21. package/dist/lib/tokens/comparable/string.js +0 -7
  22. package/dist/lib/tokens/comparable/timestamp.js +0 -7
  23. package/dist/lib/tokens/constant.js +0 -7
  24. package/dist/lib/tokens/contract.js +0 -7
  25. package/dist/lib/tokens/key.js +10 -29
  26. package/dist/lib/tokens/lambda.js +0 -12
  27. package/dist/lib/tokens/list.js +0 -9
  28. package/dist/lib/tokens/map.js +0 -12
  29. package/dist/lib/tokens/never.js +0 -7
  30. package/dist/lib/tokens/operation.js +0 -7
  31. package/dist/lib/tokens/option.js +0 -7
  32. package/dist/lib/tokens/or.js +7 -13
  33. package/dist/lib/tokens/pair.js +3 -10
  34. package/dist/lib/tokens/sapling-state.js +0 -11
  35. package/dist/lib/tokens/sapling-transaction-deprecated.js +0 -11
  36. package/dist/lib/tokens/sapling-transaction.js +0 -11
  37. package/dist/lib/tokens/set.js +0 -7
  38. package/dist/lib/tokens/signature.js +0 -7
  39. package/dist/lib/tokens/ticket-deprecated.js +0 -11
  40. package/dist/lib/tokens/ticket.js +0 -11
  41. package/dist/lib/tokens/token.js +1 -1
  42. package/dist/lib/tokens/unit.js +3 -10
  43. package/dist/lib/version.js +2 -2
  44. package/dist/taquito-michelson-encoder.es6.js +63 -374
  45. package/dist/taquito-michelson-encoder.es6.js.map +1 -1
  46. package/dist/taquito-michelson-encoder.umd.js +65 -376
  47. package/dist/taquito-michelson-encoder.umd.js.map +1 -1
  48. package/dist/types/constants.d.ts +8 -0
  49. package/dist/types/schema/parameter.d.ts +1 -6
  50. package/dist/types/schema/storage.d.ts +8 -12
  51. package/dist/types/schema/view-schema.d.ts +2 -2
  52. package/dist/types/taquito-michelson-encoder.d.ts +1 -2
  53. package/dist/types/tokens/bigmap.d.ts +0 -10
  54. package/dist/types/tokens/bls12-381-fr.d.ts +0 -5
  55. package/dist/types/tokens/bls12-381-g1.d.ts +0 -5
  56. package/dist/types/tokens/bls12-381-g2.d.ts +0 -5
  57. package/dist/types/tokens/chain-id.d.ts +0 -5
  58. package/dist/types/tokens/chest-key.d.ts +0 -5
  59. package/dist/types/tokens/chest.d.ts +0 -5
  60. package/dist/types/tokens/comparable/address.d.ts +0 -5
  61. package/dist/types/tokens/comparable/bool.d.ts +0 -5
  62. package/dist/types/tokens/comparable/bytes.d.ts +0 -5
  63. package/dist/types/tokens/comparable/int.d.ts +0 -5
  64. package/dist/types/tokens/comparable/key_hash.d.ts +0 -5
  65. package/dist/types/tokens/comparable/mutez.d.ts +0 -5
  66. package/dist/types/tokens/comparable/nat.d.ts +0 -5
  67. package/dist/types/tokens/comparable/string.d.ts +0 -5
  68. package/dist/types/tokens/comparable/timestamp.d.ts +0 -5
  69. package/dist/types/tokens/constant.d.ts +0 -5
  70. package/dist/types/tokens/contract.d.ts +0 -5
  71. package/dist/types/tokens/key.d.ts +0 -6
  72. package/dist/types/tokens/lambda.d.ts +0 -10
  73. package/dist/types/tokens/list.d.ts +0 -7
  74. package/dist/types/tokens/map.d.ts +0 -10
  75. package/dist/types/tokens/never.d.ts +0 -5
  76. package/dist/types/tokens/operation.d.ts +0 -5
  77. package/dist/types/tokens/option.d.ts +1 -8
  78. package/dist/types/tokens/or.d.ts +0 -5
  79. package/dist/types/tokens/pair.d.ts +0 -5
  80. package/dist/types/tokens/sapling-state.d.ts +0 -9
  81. package/dist/types/tokens/sapling-transaction-deprecated.d.ts +0 -9
  82. package/dist/types/tokens/sapling-transaction.d.ts +0 -9
  83. package/dist/types/tokens/set.d.ts +0 -5
  84. package/dist/types/tokens/signature.d.ts +0 -5
  85. package/dist/types/tokens/ticket-deprecated.d.ts +0 -9
  86. package/dist/types/tokens/ticket.d.ts +0 -9
  87. package/dist/types/tokens/token.d.ts +1 -6
  88. package/dist/types/tokens/unit.d.ts +0 -5
  89. 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 = {};
@@ -102,35 +102,29 @@ class MichelsonMap {
102
102
  if (!this.keySchema) {
103
103
  return;
104
104
  }
105
- this.keySchema.Typecheck(key);
105
+ if (!this.keySchema.Typecheck(key)) {
106
+ throw new MapTypecheckError(key, this.keySchema, 'key', 'Type validation failed');
107
+ }
106
108
  }
107
109
  typecheckValue(value) {
108
110
  if (!this.valueSchema) {
109
111
  return;
110
112
  }
111
- this.valueSchema.Typecheck(value);
113
+ if (!this.valueSchema.Typecheck(value)) {
114
+ throw new MapTypecheckError(value, this.valueSchema, 'value', 'Type validation failed');
115
+ }
112
116
  }
113
117
  /**
114
118
  * @throws {@link MapTypecheckError} when the argument passed does not match the expected schema for value
115
119
  */
116
120
  assertTypecheckValue(value) {
117
- try {
118
- this.typecheckValue(value);
119
- }
120
- catch (e) {
121
- throw new MapTypecheckError(value, this.valueSchema, 'value', e);
122
- }
121
+ this.typecheckValue(value);
123
122
  }
124
123
  /**
125
124
  * @throws {@link MapTypecheckError} when the argument passed does not match the expected schema for key
126
125
  */
127
126
  assertTypecheckKey(key) {
128
- try {
129
- this.typecheckKey(key);
130
- }
131
- catch (e) {
132
- throw new MapTypecheckError(key, this.keySchema, 'key', e);
133
- }
127
+ this.typecheckKey(key);
134
128
  }
135
129
  serializeDeterministically(key) {
136
130
  return (0, fast_json_stable_stringify_1.default)(key);
@@ -49,7 +49,7 @@ class ParameterSchema {
49
49
  */
50
50
  get hasAnnotation() {
51
51
  if (this.isMultipleEntryPoint) {
52
- return Object.keys(this.ExtractSchema())[0] !== '0';
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
  */
@@ -112,20 +112,33 @@ class Schema {
112
112
  const storage = this.root.Execute(val, semantics);
113
113
  return this.removeTopLevelAnnotation(storage);
114
114
  }
115
+ /**
116
+ * @description Validates that a value matches the schema type.
117
+ * Performs type checking with special handling for BigMap, Ticket, and nested Map tokens.
118
+ *
119
+ * @param val - The value to validate against the schema
120
+ * @returns Returns true if validation passes, false if validation fails
121
+ */
115
122
  Typecheck(val) {
116
123
  if (this.root instanceof bigmap_1.BigMapToken && Number.isInteger(Number(val))) {
117
- return;
124
+ return true;
118
125
  }
119
126
  if (this.root instanceof ticket_1.TicketToken && val.ticketer && val.value && val.amount) {
120
- return;
127
+ return true;
121
128
  }
122
129
  if (this.root instanceof ticket_deprecated_1.TicketDeprecatedToken && val.ticketer && val.value && val.amount) {
123
- return;
130
+ return true;
124
131
  }
125
132
  if (this.root instanceof map_1.MapToken && this.root.ValueSchema instanceof bigmap_1.BigMapToken) {
126
- return;
133
+ return true;
134
+ }
135
+ try {
136
+ this.root.EncodeObject(val);
137
+ return true;
138
+ }
139
+ catch (error) {
140
+ return false;
127
141
  }
128
- this.root.EncodeObject(val);
129
142
  }
130
143
  /**
131
144
  * @throws {@link InvalidBigMapSchemaError}
@@ -180,13 +193,6 @@ class Schema {
180
193
  throw new errors_1.StorageEncodingError('storage object', ex, this.root, value, semantics);
181
194
  }
182
195
  }
183
- /**
184
- * @deprecated ExtractSchema has been deprecated in favor of generateSchema
185
- *
186
- */
187
- ExtractSchema() {
188
- return this.removeTopLevelAnnotation(this.root.ExtractSchema());
189
- }
190
196
  /**
191
197
  * @description Produce a representation of the storage schema.
192
198
  * Note: Provide guidance on how to write the storage object for the origination operation with Taquito.
@@ -194,19 +200,6 @@ class Schema {
194
200
  generateSchema() {
195
201
  return this.removeTopLevelAnnotation(this.root.generateSchema());
196
202
  }
197
- /**
198
- * @deprecated
199
- * @throws {@link InvalidBigMapSchemaError}
200
- */
201
- ComputeState(tx, state) {
202
- if (!this.bigMap) {
203
- throw new errors_1.InvalidBigMapSchemaError('Big map schema is undefined');
204
- }
205
- const bigMap = tx.reduce((prev, current) => {
206
- return Object.assign(Object.assign({}, prev), this.ExecuteOnBigMapDiff(current.contents[0].metadata.operation_result.big_map_diff));
207
- }, {});
208
- return Object.assign(Object.assign({}, this.Execute(state)), { [this.bigMap.annot()]: bigMap });
209
- }
210
203
  /**
211
204
  * @description Look up in top-level pairs of the storage to find a value matching the specified type
212
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.ExtractSchema();
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.ExtractSchema();
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
- exports.UnitValue = Symbol();
30
- exports.SaplingStateValue = {};
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,
@@ -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 {
@@ -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 elliptic_1 = require("elliptic");
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 bytes1 = (0, utils_1.b58DecodePublicKey)(key1, 'array');
91
- const bytes2 = (0, utils_1.b58DecodePublicKey)(key2, 'array');
92
- let array1;
93
- let array2;
94
- if (bytes1[0] === 0x02) {
95
- array1 = this.decompressP256PublicKey(bytes1.slice(1)); // remove prefix 0x02
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 (bytes2[0] === 0x02) {
101
- array2 = this.decompressP256PublicKey(bytes2.slice(1)); // remove prefix 0x02
82
+ else if (bytes1[0] > bytes2[0]) {
83
+ return 1;
102
84
  }
103
85
  else {
104
- array2 = bytes2;
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,
@@ -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,
@@ -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,
@@ -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,