@taquito/michelson-encoder 23.0.0-beta.0 → 23.0.0-beta.1

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.
@@ -24,7 +24,7 @@ class AddressToken extends token_1.ComparableToken {
24
24
  this.fac = fac;
25
25
  }
26
26
  ToBigMapKey(val) {
27
- const decoded = (0, utils_1.b58decode)(val);
27
+ const decoded = (0, utils_1.b58DecodeAddress)(val);
28
28
  return {
29
29
  key: { bytes: decoded },
30
30
  type: { prim: 'bytes' },
@@ -34,6 +34,9 @@ class AddressToken extends token_1.ComparableToken {
34
34
  * @throws {@link AddressValidationError}
35
35
  */
36
36
  validate(value) {
37
+ if (typeof value !== 'string') {
38
+ throw new AddressValidationError(value, this, 'Type error');
39
+ }
37
40
  if ((0, utils_1.validateAddress)(value) !== utils_1.ValidationResult.VALID) {
38
41
  throw new AddressValidationError(value, this, `Address is not valid: ${JSON.stringify(value)}`);
39
42
  }
@@ -94,18 +97,20 @@ class AddressToken extends token_1.ComparableToken {
94
97
  return (0, utils_1.encodeAddress)(bytes);
95
98
  }
96
99
  compare(address1, address2) {
97
- const isImplicit = (address) => {
98
- return address.startsWith('tz');
99
- };
100
- const implicit1 = isImplicit(address1);
101
- const implicit2 = isImplicit(address2);
102
- if (implicit1 && !implicit2) {
103
- return -1;
100
+ const [addr1, endpoint1] = (0, utils_1.splitAddress)(address1);
101
+ const [addr2, endpoint2] = (0, utils_1.splitAddress)(address2);
102
+ const ep1 = endpoint1 || '';
103
+ const ep2 = endpoint2 || '';
104
+ // binary type tag actually reflects the expected prefix order
105
+ const bytes1 = (0, utils_1.b58DecodeAddress)(addr1, 'array');
106
+ const bytes2 = (0, utils_1.b58DecodeAddress)(addr2, 'array');
107
+ const res = (0, utils_1.compareArrays)(bytes1, bytes2);
108
+ if (res === 0) {
109
+ return ep1 < ep2 ? -1 : ep1 > ep2 ? 1 : 0;
104
110
  }
105
- else if (implicit2 && !implicit1) {
106
- return 1;
111
+ else {
112
+ return res;
107
113
  }
108
- return super.compare(address1, address2);
109
114
  }
110
115
  findAndReturnTokens(tokenToFind, tokens) {
111
116
  if (AddressToken.prim === tokenToFind) {
@@ -80,6 +80,12 @@ class KeyHashToken extends token_1.ComparableToken {
80
80
  type: { prim: KeyHashToken.prim },
81
81
  };
82
82
  }
83
+ compare(pkh1, pkh2) {
84
+ // binary type tag actually reflects the expected prefix order
85
+ const h1 = (0, utils_1.b58DecodePublicKeyHash)(pkh1, 'array');
86
+ const h2 = (0, utils_1.b58DecodePublicKeyHash)(pkh2, 'array');
87
+ return (0, utils_1.compareArrays)(h1, h2);
88
+ }
83
89
  findAndReturnTokens(tokenToFind, tokens) {
84
90
  if (KeyHashToken.prim === tokenToFind) {
85
91
  tokens.push(this);
@@ -27,6 +27,9 @@ class ContractToken extends token_1.Token {
27
27
  * @throws {@link ContractValidationError}
28
28
  */
29
29
  validate(value) {
30
+ if (typeof value !== 'string') {
31
+ throw new ContractValidationError(value, this, 'Type error');
32
+ }
30
33
  // tz1,tz2 and tz3 seems to be valid contract values (for Unit contract)
31
34
  if ((0, utils_1.validateAddress)(value) !== utils_1.ValidationResult.VALID) {
32
35
  throw new ContractValidationError(value, this, `Value ${JSON.stringify(value)} is not a valid contract address.`);
@@ -3,7 +3,8 @@ 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 publicKeyPrefixLength = 4;
6
+ const elliptic_1 = require("elliptic");
7
+ const ec = new elliptic_1.default.ec('p256');
7
8
  /**
8
9
  * @category Error
9
10
  * @description Error that indicates a failure happening when parsing encoding/executing a Key
@@ -78,30 +79,31 @@ class KeyToken extends token_1.ComparableToken {
78
79
  type: { prim: KeyToken.prim },
79
80
  };
80
81
  }
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
+ }
81
89
  compare(key1, key2) {
82
- const keyPrefix1 = this.getPrefix(key1);
83
- const keyPrefix2 = this.getPrefix(key2);
84
- if (keyPrefix1 === utils_1.Prefix.EDPK && keyPrefix2 !== utils_1.Prefix.EDPK) {
85
- return -1;
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
86
96
  }
87
- else if (keyPrefix1 === utils_1.Prefix.SPPK && keyPrefix2 !== utils_1.Prefix.SPPK) {
88
- return keyPrefix2 === utils_1.Prefix.EDPK ? 1 : -1;
97
+ else {
98
+ array1 = bytes1;
89
99
  }
90
- else if (keyPrefix1 === utils_1.Prefix.P2PK) {
91
- if (keyPrefix2 !== utils_1.Prefix.P2PK) {
92
- return 1;
93
- }
94
- const keyBytes1 = this.getP256PublicKeyComparableBytes(key1);
95
- const keyBytes2 = this.getP256PublicKeyComparableBytes(key2);
96
- return Buffer.compare(keyBytes1, keyBytes2);
100
+ if (bytes2[0] === 0x02) {
101
+ array2 = this.decompressP256PublicKey(bytes2.slice(1)); // remove prefix 0x02
97
102
  }
98
- return super.compare(key1, key2);
99
- }
100
- getPrefix(val) {
101
- return val.substring(0, publicKeyPrefixLength);
102
- }
103
- getP256PublicKeyComparableBytes(p2pk) {
104
- return (0, utils_1.b58cdecode)(p2pk, utils_1.prefix[utils_1.Prefix.P2PK]).slice(1);
103
+ else {
104
+ array2 = bytes2;
105
+ }
106
+ return (0, utils_1.compareArrays)(array1, array2);
105
107
  }
106
108
  findAndReturnTokens(tokenToFind, tokens) {
107
109
  if (KeyToken.prim === tokenToFind) {
@@ -94,10 +94,7 @@ exports.Token = Token;
94
94
  Token._fieldNumberingStrategy = 'Latest';
95
95
  class ComparableToken extends Token {
96
96
  compare(o1, o2) {
97
- if (o1 === o2) {
98
- return 0;
99
- }
100
- return o1 < o2 ? -1 : 1;
97
+ return o1 < o2 ? -1 : o1 > o2 ? 1 : 0;
101
98
  }
102
99
  }
103
100
  exports.ComparableToken = ComparableToken;
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
5
5
  exports.VERSION = {
6
- "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
7
- "version": "23.0.0-beta.0"
6
+ "commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
7
+ "version": "23.0.0-beta.1"
8
8
  };
@@ -1,7 +1,8 @@
1
1
  import stringify from 'fast-json-stable-stringify';
2
2
  import { TaquitoError, InvalidViewParameterError } from '@taquito/core';
3
3
  import BigNumber from 'bignumber.js';
4
- import { b58decode, validateAddress, ValidationResult, encodeAddress, stripHexPrefix, encodeKey, validatePublicKey, Prefix, b58cdecode, prefix, encodeKeyHash, validateKeyHash, validateSignature, validateChain } from '@taquito/utils';
4
+ import { b58DecodeAddress, validateAddress, ValidationResult, encodeAddress, splitAddress, compareArrays, stripHexPrefix, encodeKey, validatePublicKey, b58DecodePublicKey, encodeKeyHash, validateKeyHash, b58DecodePublicKeyHash, validateSignature, validateChain } from '@taquito/utils';
5
+ import elliptic from 'elliptic';
5
6
 
6
7
  var _a$1;
7
8
  /**
@@ -289,10 +290,7 @@ class Token {
289
290
  Token._fieldNumberingStrategy = 'Latest';
290
291
  class ComparableToken extends Token {
291
292
  compare(o1, o2) {
292
- if (o1 === o2) {
293
- return 0;
294
- }
295
- return o1 < o2 ? -1 : 1;
293
+ return o1 < o2 ? -1 : o1 > o2 ? 1 : 0;
296
294
  }
297
295
  }
298
296
 
@@ -1100,7 +1098,7 @@ class AddressToken extends ComparableToken {
1100
1098
  this.fac = fac;
1101
1099
  }
1102
1100
  ToBigMapKey(val) {
1103
- const decoded = b58decode(val);
1101
+ const decoded = b58DecodeAddress(val);
1104
1102
  return {
1105
1103
  key: { bytes: decoded },
1106
1104
  type: { prim: 'bytes' },
@@ -1110,6 +1108,9 @@ class AddressToken extends ComparableToken {
1110
1108
  * @throws {@link AddressValidationError}
1111
1109
  */
1112
1110
  validate(value) {
1111
+ if (typeof value !== 'string') {
1112
+ throw new AddressValidationError(value, this, 'Type error');
1113
+ }
1113
1114
  if (validateAddress(value) !== ValidationResult.VALID) {
1114
1115
  throw new AddressValidationError(value, this, `Address is not valid: ${JSON.stringify(value)}`);
1115
1116
  }
@@ -1170,18 +1171,20 @@ class AddressToken extends ComparableToken {
1170
1171
  return encodeAddress(bytes);
1171
1172
  }
1172
1173
  compare(address1, address2) {
1173
- const isImplicit = (address) => {
1174
- return address.startsWith('tz');
1175
- };
1176
- const implicit1 = isImplicit(address1);
1177
- const implicit2 = isImplicit(address2);
1178
- if (implicit1 && !implicit2) {
1179
- return -1;
1174
+ const [addr1, endpoint1] = splitAddress(address1);
1175
+ const [addr2, endpoint2] = splitAddress(address2);
1176
+ const ep1 = endpoint1 || '';
1177
+ const ep2 = endpoint2 || '';
1178
+ // binary type tag actually reflects the expected prefix order
1179
+ const bytes1 = b58DecodeAddress(addr1, 'array');
1180
+ const bytes2 = b58DecodeAddress(addr2, 'array');
1181
+ const res = compareArrays(bytes1, bytes2);
1182
+ if (res === 0) {
1183
+ return ep1 < ep2 ? -1 : ep1 > ep2 ? 1 : 0;
1180
1184
  }
1181
- else if (implicit2 && !implicit1) {
1182
- return 1;
1185
+ else {
1186
+ return res;
1183
1187
  }
1184
- return super.compare(address1, address2);
1185
1188
  }
1186
1189
  findAndReturnTokens(tokenToFind, tokens) {
1187
1190
  if (AddressToken.prim === tokenToFind) {
@@ -1395,6 +1398,9 @@ class ContractToken extends Token {
1395
1398
  * @throws {@link ContractValidationError}
1396
1399
  */
1397
1400
  validate(value) {
1401
+ if (typeof value !== 'string') {
1402
+ throw new ContractValidationError(value, this, 'Type error');
1403
+ }
1398
1404
  // tz1,tz2 and tz3 seems to be valid contract values (for Unit contract)
1399
1405
  if (validateAddress(value) !== ValidationResult.VALID) {
1400
1406
  throw new ContractValidationError(value, this, `Value ${JSON.stringify(value)} is not a valid contract address.`);
@@ -2026,7 +2032,7 @@ class UnitToken extends ComparableToken {
2026
2032
  }
2027
2033
  UnitToken.prim = 'unit';
2028
2034
 
2029
- const publicKeyPrefixLength = 4;
2035
+ const ec = new elliptic.ec('p256');
2030
2036
  /**
2031
2037
  * @category Error
2032
2038
  * @description Error that indicates a failure happening when parsing encoding/executing a Key
@@ -2100,30 +2106,31 @@ class KeyToken extends ComparableToken {
2100
2106
  type: { prim: KeyToken.prim },
2101
2107
  };
2102
2108
  }
2109
+ decompressP256PublicKey(compressedKey) {
2110
+ const compressedArray = Array.from(compressedKey);
2111
+ const keyPair = ec.keyFromPublic(compressedArray);
2112
+ const publicKey = keyPair.getPublic();
2113
+ const uncompressedArray = publicKey.encode('array', false);
2114
+ return Buffer.concat([new Uint8Array([0x02]), new Uint8Array(uncompressedArray)]); // add back prefix 0x02
2115
+ }
2103
2116
  compare(key1, key2) {
2104
- const keyPrefix1 = this.getPrefix(key1);
2105
- const keyPrefix2 = this.getPrefix(key2);
2106
- if (keyPrefix1 === Prefix.EDPK && keyPrefix2 !== Prefix.EDPK) {
2107
- return -1;
2117
+ const bytes1 = b58DecodePublicKey(key1, 'array');
2118
+ const bytes2 = b58DecodePublicKey(key2, 'array');
2119
+ let array1;
2120
+ let array2;
2121
+ if (bytes1[0] === 0x02) {
2122
+ array1 = this.decompressP256PublicKey(bytes1.slice(1)); // remove prefix 0x02
2108
2123
  }
2109
- else if (keyPrefix1 === Prefix.SPPK && keyPrefix2 !== Prefix.SPPK) {
2110
- return keyPrefix2 === Prefix.EDPK ? 1 : -1;
2124
+ else {
2125
+ array1 = bytes1;
2111
2126
  }
2112
- else if (keyPrefix1 === Prefix.P2PK) {
2113
- if (keyPrefix2 !== Prefix.P2PK) {
2114
- return 1;
2115
- }
2116
- const keyBytes1 = this.getP256PublicKeyComparableBytes(key1);
2117
- const keyBytes2 = this.getP256PublicKeyComparableBytes(key2);
2118
- return Buffer.compare(keyBytes1, keyBytes2);
2127
+ if (bytes2[0] === 0x02) {
2128
+ array2 = this.decompressP256PublicKey(bytes2.slice(1)); // remove prefix 0x02
2119
2129
  }
2120
- return super.compare(key1, key2);
2121
- }
2122
- getPrefix(val) {
2123
- return val.substring(0, publicKeyPrefixLength);
2124
- }
2125
- getP256PublicKeyComparableBytes(p2pk) {
2126
- return b58cdecode(p2pk, prefix[Prefix.P2PK]).slice(1);
2130
+ else {
2131
+ array2 = bytes2;
2132
+ }
2133
+ return compareArrays(array1, array2);
2127
2134
  }
2128
2135
  findAndReturnTokens(tokenToFind, tokens) {
2129
2136
  if (KeyToken.prim === tokenToFind) {
@@ -2210,6 +2217,12 @@ class KeyHashToken extends ComparableToken {
2210
2217
  type: { prim: KeyHashToken.prim },
2211
2218
  };
2212
2219
  }
2220
+ compare(pkh1, pkh2) {
2221
+ // binary type tag actually reflects the expected prefix order
2222
+ const h1 = b58DecodePublicKeyHash(pkh1, 'array');
2223
+ const h2 = b58DecodePublicKeyHash(pkh2, 'array');
2224
+ return compareArrays(h1, h2);
2225
+ }
2213
2226
  findAndReturnTokens(tokenToFind, tokens) {
2214
2227
  if (KeyHashToken.prim === tokenToFind) {
2215
2228
  tokens.push(this);
@@ -4232,8 +4245,8 @@ class EventSchema {
4232
4245
 
4233
4246
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
4234
4247
  const VERSION = {
4235
- "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
4236
- "version": "23.0.0-beta.0"
4248
+ "commitHash": "10b3de10de15ae68d47b1fca922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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fast-json-stable-stringify'), require('@taquito/core'), require('bignumber.js'), require('@taquito/utils')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'fast-json-stable-stringify', '@taquito/core', 'bignumber.js', '@taquito/utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoMichelsonEncoder = {}, global.stringify, global.core, global.BigNumber, global.utils));
5
- })(this, (function (exports, stringify, core, BigNumber, utils) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fast-json-stable-stringify'), require('@taquito/core'), require('bignumber.js'), require('@taquito/utils'), require('elliptic')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'fast-json-stable-stringify', '@taquito/core', 'bignumber.js', '@taquito/utils', 'elliptic'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoMichelsonEncoder = {}, global.stringify, global.core, global.BigNumber, global.utils, global.elliptic));
5
+ })(this, (function (exports, stringify, core, BigNumber, utils, elliptic) { 'use strict';
6
6
 
7
7
  var _a$1;
8
8
  /**
@@ -290,10 +290,7 @@
290
290
  Token._fieldNumberingStrategy = 'Latest';
291
291
  class ComparableToken extends Token {
292
292
  compare(o1, o2) {
293
- if (o1 === o2) {
294
- return 0;
295
- }
296
- return o1 < o2 ? -1 : 1;
293
+ return o1 < o2 ? -1 : o1 > o2 ? 1 : 0;
297
294
  }
298
295
  }
299
296
 
@@ -1101,7 +1098,7 @@
1101
1098
  this.fac = fac;
1102
1099
  }
1103
1100
  ToBigMapKey(val) {
1104
- const decoded = utils.b58decode(val);
1101
+ const decoded = utils.b58DecodeAddress(val);
1105
1102
  return {
1106
1103
  key: { bytes: decoded },
1107
1104
  type: { prim: 'bytes' },
@@ -1111,6 +1108,9 @@
1111
1108
  * @throws {@link AddressValidationError}
1112
1109
  */
1113
1110
  validate(value) {
1111
+ if (typeof value !== 'string') {
1112
+ throw new AddressValidationError(value, this, 'Type error');
1113
+ }
1114
1114
  if (utils.validateAddress(value) !== utils.ValidationResult.VALID) {
1115
1115
  throw new AddressValidationError(value, this, `Address is not valid: ${JSON.stringify(value)}`);
1116
1116
  }
@@ -1171,18 +1171,20 @@
1171
1171
  return utils.encodeAddress(bytes);
1172
1172
  }
1173
1173
  compare(address1, address2) {
1174
- const isImplicit = (address) => {
1175
- return address.startsWith('tz');
1176
- };
1177
- const implicit1 = isImplicit(address1);
1178
- const implicit2 = isImplicit(address2);
1179
- if (implicit1 && !implicit2) {
1180
- return -1;
1174
+ const [addr1, endpoint1] = utils.splitAddress(address1);
1175
+ const [addr2, endpoint2] = utils.splitAddress(address2);
1176
+ const ep1 = endpoint1 || '';
1177
+ const ep2 = endpoint2 || '';
1178
+ // binary type tag actually reflects the expected prefix order
1179
+ const bytes1 = utils.b58DecodeAddress(addr1, 'array');
1180
+ const bytes2 = utils.b58DecodeAddress(addr2, 'array');
1181
+ const res = utils.compareArrays(bytes1, bytes2);
1182
+ if (res === 0) {
1183
+ return ep1 < ep2 ? -1 : ep1 > ep2 ? 1 : 0;
1181
1184
  }
1182
- else if (implicit2 && !implicit1) {
1183
- return 1;
1185
+ else {
1186
+ return res;
1184
1187
  }
1185
- return super.compare(address1, address2);
1186
1188
  }
1187
1189
  findAndReturnTokens(tokenToFind, tokens) {
1188
1190
  if (AddressToken.prim === tokenToFind) {
@@ -1396,6 +1398,9 @@
1396
1398
  * @throws {@link ContractValidationError}
1397
1399
  */
1398
1400
  validate(value) {
1401
+ if (typeof value !== 'string') {
1402
+ throw new ContractValidationError(value, this, 'Type error');
1403
+ }
1399
1404
  // tz1,tz2 and tz3 seems to be valid contract values (for Unit contract)
1400
1405
  if (utils.validateAddress(value) !== utils.ValidationResult.VALID) {
1401
1406
  throw new ContractValidationError(value, this, `Value ${JSON.stringify(value)} is not a valid contract address.`);
@@ -2027,7 +2032,7 @@
2027
2032
  }
2028
2033
  UnitToken.prim = 'unit';
2029
2034
 
2030
- const publicKeyPrefixLength = 4;
2035
+ const ec = new elliptic.ec('p256');
2031
2036
  /**
2032
2037
  * @category Error
2033
2038
  * @description Error that indicates a failure happening when parsing encoding/executing a Key
@@ -2101,30 +2106,31 @@
2101
2106
  type: { prim: KeyToken.prim },
2102
2107
  };
2103
2108
  }
2109
+ decompressP256PublicKey(compressedKey) {
2110
+ const compressedArray = Array.from(compressedKey);
2111
+ const keyPair = ec.keyFromPublic(compressedArray);
2112
+ const publicKey = keyPair.getPublic();
2113
+ const uncompressedArray = publicKey.encode('array', false);
2114
+ return Buffer.concat([new Uint8Array([0x02]), new Uint8Array(uncompressedArray)]); // add back prefix 0x02
2115
+ }
2104
2116
  compare(key1, key2) {
2105
- const keyPrefix1 = this.getPrefix(key1);
2106
- const keyPrefix2 = this.getPrefix(key2);
2107
- if (keyPrefix1 === utils.Prefix.EDPK && keyPrefix2 !== utils.Prefix.EDPK) {
2108
- return -1;
2117
+ const bytes1 = utils.b58DecodePublicKey(key1, 'array');
2118
+ const bytes2 = utils.b58DecodePublicKey(key2, 'array');
2119
+ let array1;
2120
+ let array2;
2121
+ if (bytes1[0] === 0x02) {
2122
+ array1 = this.decompressP256PublicKey(bytes1.slice(1)); // remove prefix 0x02
2109
2123
  }
2110
- else if (keyPrefix1 === utils.Prefix.SPPK && keyPrefix2 !== utils.Prefix.SPPK) {
2111
- return keyPrefix2 === utils.Prefix.EDPK ? 1 : -1;
2124
+ else {
2125
+ array1 = bytes1;
2112
2126
  }
2113
- else if (keyPrefix1 === utils.Prefix.P2PK) {
2114
- if (keyPrefix2 !== utils.Prefix.P2PK) {
2115
- return 1;
2116
- }
2117
- const keyBytes1 = this.getP256PublicKeyComparableBytes(key1);
2118
- const keyBytes2 = this.getP256PublicKeyComparableBytes(key2);
2119
- return Buffer.compare(keyBytes1, keyBytes2);
2127
+ if (bytes2[0] === 0x02) {
2128
+ array2 = this.decompressP256PublicKey(bytes2.slice(1)); // remove prefix 0x02
2120
2129
  }
2121
- return super.compare(key1, key2);
2122
- }
2123
- getPrefix(val) {
2124
- return val.substring(0, publicKeyPrefixLength);
2125
- }
2126
- getP256PublicKeyComparableBytes(p2pk) {
2127
- return utils.b58cdecode(p2pk, utils.prefix[utils.Prefix.P2PK]).slice(1);
2130
+ else {
2131
+ array2 = bytes2;
2132
+ }
2133
+ return utils.compareArrays(array1, array2);
2128
2134
  }
2129
2135
  findAndReturnTokens(tokenToFind, tokens) {
2130
2136
  if (KeyToken.prim === tokenToFind) {
@@ -2211,6 +2217,12 @@
2211
2217
  type: { prim: KeyHashToken.prim },
2212
2218
  };
2213
2219
  }
2220
+ compare(pkh1, pkh2) {
2221
+ // binary type tag actually reflects the expected prefix order
2222
+ const h1 = utils.b58DecodePublicKeyHash(pkh1, 'array');
2223
+ const h2 = utils.b58DecodePublicKeyHash(pkh2, 'array');
2224
+ return utils.compareArrays(h1, h2);
2225
+ }
2214
2226
  findAndReturnTokens(tokenToFind, tokens) {
2215
2227
  if (KeyHashToken.prim === tokenToFind) {
2216
2228
  tokens.push(this);
@@ -4233,8 +4245,8 @@
4233
4245
 
4234
4246
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
4235
4247
  const VERSION = {
4236
- "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
4237
- "version": "23.0.0-beta.0"
4248
+ "commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
4249
+ "version": "23.0.0-beta.1"
4238
4250
  };
4239
4251
 
4240
4252
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-michelson-encoder.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -27,7 +27,7 @@ export declare class KeyHashToken extends ComparableToken {
27
27
  Execute(val: {
28
28
  bytes: string;
29
29
  string: string;
30
- }): string | undefined;
30
+ }): string;
31
31
  /**
32
32
  * @throws {@link KeyHashValidationError}
33
33
  */
@@ -55,5 +55,6 @@ export declare class KeyHashToken extends ComparableToken {
55
55
  prim: "key_hash";
56
56
  };
57
57
  };
58
+ compare(pkh1: string, pkh2: string): number;
58
59
  findAndReturnTokens(tokenToFind: string, tokens: Token[]): Token[];
59
60
  }
@@ -27,7 +27,7 @@ export declare class KeyToken extends ComparableToken {
27
27
  Execute(val: {
28
28
  bytes: string;
29
29
  string: string;
30
- }): string | undefined;
30
+ }): string;
31
31
  /**
32
32
  * @throws {@link KeyValidationError}
33
33
  */
@@ -46,7 +46,7 @@ export declare class KeyToken extends ComparableToken {
46
46
  */
47
47
  ExtractSchema(): "key";
48
48
  generateSchema(): BaseTokenSchema;
49
- ToKey(val: any): string | undefined;
49
+ ToKey(val: any): string;
50
50
  ToBigMapKey(val: string): {
51
51
  key: {
52
52
  string: string;
@@ -55,8 +55,7 @@ export declare class KeyToken extends ComparableToken {
55
55
  prim: "key";
56
56
  };
57
57
  };
58
+ decompressP256PublicKey(compressedKey: Uint8Array): Buffer;
58
59
  compare(key1: string, key2: string): number;
59
- private getPrefix;
60
- private getP256PublicKeyComparableBytes;
61
60
  findAndReturnTokens(tokenToFind: string, tokens: Token[]): Token[];
62
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/michelson-encoder",
3
- "version": "23.0.0-beta.0",
3
+ "version": "23.0.0-beta.1",
4
4
  "description": "converts michelson data and types into convenient JS/TS objects",
5
5
  "keywords": [
6
6
  "tezos",
@@ -67,10 +67,11 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@taquito/core": "^23.0.0-beta.0",
71
- "@taquito/rpc": "^23.0.0-beta.0",
72
- "@taquito/utils": "^23.0.0-beta.0",
70
+ "@taquito/core": "^23.0.0-beta.1",
71
+ "@taquito/rpc": "^23.0.0-beta.1",
72
+ "@taquito/utils": "^23.0.0-beta.1",
73
73
  "bignumber.js": "^9.1.2",
74
+ "elliptic": "^6.6.1",
74
75
  "fast-json-stable-stringify": "^2.1.0"
75
76
  },
76
77
  "devDependencies": {
@@ -100,5 +101,5 @@
100
101
  "ts-toolbelt": "^9.6.0",
101
102
  "typescript": "~5.5.4"
102
103
  },
103
- "gitHead": "37cc766d60407d7909fbd2d841d9dd946243d04a"
104
+ "gitHead": "1469d6f0d55134a4b853598a2eec48e6f71b3da3"
104
105
  }