@taquito/core 22.0.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.
@@ -1,9 +1,26 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PublicKeyNotFoundError = exports.ProhibitedActionError = exports.DeprecationError = exports.InvalidOperationKindError = exports.InvalidOperationHashError = exports.InvalidKeyHashError = exports.InvalidChainIdError = exports.InvalidContractAddressError = exports.InvalidSignatureError = exports.InvalidPublicKeyError = exports.InvalidKeyError = exports.InvalidViewParameterError = exports.InvalidMessageError = exports.InvalidHexStringError = exports.InvalidDerivationPathError = exports.InvalidAmountError = exports.InvalidBlockHashError = exports.InvalidFinalizeUnstakeAmountError = exports.InvalidStakingAddressError = exports.InvalidAddressError = exports.PermissionDeniedError = exports.NetworkError = exports.UnsupportedActionError = exports.TezosToolkitConfigError = exports.RpcError = exports.ParameterValidationError = exports.TaquitoError = void 0;
4
2
  // ==========================================================================================
5
3
  // parent error classes for Taquito
6
4
  // ==========================================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PublicKeyNotFoundError = exports.ProhibitedActionError = exports.DeprecationError = exports.InvalidOperationKindError = exports.InvalidOperationHashError = exports.InvalidKeyHashError = exports.InvalidChainIdError = exports.InvalidContractAddressError = exports.InvalidSignatureError = exports.InvalidPublicKeyError = exports.InvalidKeyError = exports.InvalidViewParameterError = exports.InvalidMessageError = exports.InvalidHexStringError = exports.InvalidDerivationPathError = exports.InvalidAmountError = exports.InvalidBlockHashError = exports.InvalidFinalizeUnstakeAmountError = exports.InvalidStakingAddressError = exports.InvalidProofError = exports.InvalidAddressError = exports.PermissionDeniedError = exports.NetworkError = exports.UnsupportedActionError = exports.TezosToolkitConfigError = exports.RpcError = exports.ParameterValidationError = exports.TaquitoError = exports.ValidationResult = void 0;
7
+ var ValidationResult;
8
+ (function (ValidationResult) {
9
+ ValidationResult[ValidationResult["NO_PREFIX_MATCHED"] = 0] = "NO_PREFIX_MATCHED";
10
+ ValidationResult[ValidationResult["INVALID_CHECKSUM"] = 1] = "INVALID_CHECKSUM";
11
+ ValidationResult[ValidationResult["INVALID_LENGTH"] = 2] = "INVALID_LENGTH";
12
+ ValidationResult[ValidationResult["VALID"] = 3] = "VALID";
13
+ ValidationResult[ValidationResult["PREFIX_NOT_ALLOWED"] = 4] = "PREFIX_NOT_ALLOWED";
14
+ ValidationResult[ValidationResult["INVALID_ENCODING"] = 5] = "INVALID_ENCODING";
15
+ ValidationResult[ValidationResult["OTHER"] = 6] = "OTHER";
16
+ })(ValidationResult || (exports.ValidationResult = ValidationResult = {}));
17
+ const resultDesc = {
18
+ [ValidationResult.NO_PREFIX_MATCHED]: 'unsupported Base58 prefix',
19
+ [ValidationResult.INVALID_CHECKSUM]: 'invalid checksum',
20
+ [ValidationResult.INVALID_LENGTH]: 'invalid length',
21
+ [ValidationResult.PREFIX_NOT_ALLOWED]: 'Base58 prefix not allowed in this context',
22
+ [ValidationResult.INVALID_ENCODING]: 'invalid Base58 encoding',
23
+ };
7
24
  /**
8
25
  * @category Error
9
26
  * @description Parent error class all taquito errors to extend from
@@ -16,6 +33,39 @@ exports.TaquitoError = TaquitoError;
16
33
  * @description Error that indicates invalid user inputs
17
34
  */
18
35
  class ParameterValidationError extends TaquitoError {
36
+ constructor(message, validationResult, errorDetail) {
37
+ let detail;
38
+ let result;
39
+ let msg;
40
+ if (message !== undefined) {
41
+ if (typeof message === 'string') {
42
+ msg = message;
43
+ if (validationResult !== undefined) {
44
+ if (typeof validationResult === 'string') {
45
+ detail = validationResult;
46
+ }
47
+ else {
48
+ result = validationResult;
49
+ if (errorDetail !== undefined) {
50
+ detail = errorDetail;
51
+ }
52
+ else {
53
+ detail = resultDesc[validationResult];
54
+ }
55
+ }
56
+ }
57
+ }
58
+ else {
59
+ result = message;
60
+ detail = resultDesc[message];
61
+ msg = detail;
62
+ }
63
+ }
64
+ super(msg);
65
+ this.name = this.constructor.name;
66
+ this.result = result;
67
+ this.errorDetail = detail;
68
+ }
19
69
  }
20
70
  exports.ParameterValidationError = ParameterValidationError;
21
71
  /**
@@ -62,32 +112,33 @@ exports.PermissionDeniedError = PermissionDeniedError;
62
112
  */
63
113
  class InvalidAddressError extends ParameterValidationError {
64
114
  constructor(address, errorDetail) {
65
- super();
115
+ super(`Invalid address "${address}"`, errorDetail);
66
116
  this.address = address;
67
- this.errorDetail = errorDetail;
68
- this.name = 'InvalidAddressError';
69
- this.message = `Invalid address "${address}"`;
70
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
117
+ this.name = this.constructor.name;
71
118
  }
72
119
  }
73
120
  exports.InvalidAddressError = InvalidAddressError;
121
+ class InvalidProofError extends ParameterValidationError {
122
+ constructor(proof, errorDetail) {
123
+ super(`Invalid proof "${proof}"`, errorDetail);
124
+ this.proof = proof;
125
+ this.name = this.constructor.name;
126
+ }
127
+ }
128
+ exports.InvalidProofError = InvalidProofError;
74
129
  class InvalidStakingAddressError extends ParameterValidationError {
75
130
  constructor(address, errorDetail) {
76
- super();
131
+ super(`Invalid staking address "${address}", you can only set destination as your own address`, errorDetail);
77
132
  this.address = address;
78
- this.errorDetail = errorDetail;
79
- this.name = 'InvalidStakingAddressError';
80
- this.message = `Invalid staking address "${address}", you can only set destination as your own address`;
133
+ this.name = this.constructor.name;
81
134
  }
82
135
  }
83
136
  exports.InvalidStakingAddressError = InvalidStakingAddressError;
84
137
  class InvalidFinalizeUnstakeAmountError extends ParameterValidationError {
85
138
  constructor(address, errorDetail) {
86
- super();
139
+ super(`The amount can only be 0 when finalizing an unstake`, errorDetail);
87
140
  this.address = address;
88
- this.errorDetail = errorDetail;
89
- this.name = 'InvalidFinalizeUnstakeAmountError';
90
- this.message = `The amount can only be 0 when finalizing an unstake`;
141
+ this.name = this.constructor.name;
91
142
  }
92
143
  }
93
144
  exports.InvalidFinalizeUnstakeAmountError = InvalidFinalizeUnstakeAmountError;
@@ -97,12 +148,9 @@ exports.InvalidFinalizeUnstakeAmountError = InvalidFinalizeUnstakeAmountError;
97
148
  */
98
149
  class InvalidBlockHashError extends ParameterValidationError {
99
150
  constructor(blockHash, errorDetail) {
100
- super();
151
+ super(`Invalid block hash "${blockHash}"`, errorDetail);
101
152
  this.blockHash = blockHash;
102
- this.errorDetail = errorDetail;
103
- this.name = 'InvalidBlockHashError';
104
- this.message = `Invalid block hash "${blockHash}"`;
105
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
153
+ this.name = this.constructor.name;
106
154
  }
107
155
  }
108
156
  exports.InvalidBlockHashError = InvalidBlockHashError;
@@ -111,11 +159,10 @@ exports.InvalidBlockHashError = InvalidBlockHashError;
111
159
  * @description Error that indicates an invalid amount of tez being passed as a parameter
112
160
  */
113
161
  class InvalidAmountError extends ParameterValidationError {
114
- constructor(amount) {
115
- super();
162
+ constructor(amount, errorDetail) {
163
+ super(`Invalid amount "${amount}"`, errorDetail);
116
164
  this.amount = amount;
117
- this.name = 'InvalidAmountError';
118
- this.message = `Invalid amount "${amount}"`;
165
+ this.name = this.constructor.name;
119
166
  }
120
167
  }
121
168
  exports.InvalidAmountError = InvalidAmountError;
@@ -125,12 +172,9 @@ exports.InvalidAmountError = InvalidAmountError;
125
172
  */
126
173
  class InvalidDerivationPathError extends ParameterValidationError {
127
174
  constructor(derivationPath, errorDetail) {
128
- super();
175
+ super(`Invalid derivation path "${derivationPath}"`, errorDetail);
129
176
  this.derivationPath = derivationPath;
130
- this.errorDetail = errorDetail;
131
- this.name = 'InvalidDerivationPathError';
132
- this.message = `Invalid derivation path "${derivationPath}"`;
133
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
177
+ this.name = this.constructor.name;
134
178
  }
135
179
  }
136
180
  exports.InvalidDerivationPathError = InvalidDerivationPathError;
@@ -140,12 +184,9 @@ exports.InvalidDerivationPathError = InvalidDerivationPathError;
140
184
  */
141
185
  class InvalidHexStringError extends ParameterValidationError {
142
186
  constructor(hexString, errorDetail) {
143
- super();
187
+ super(`Invalid hex string "${hexString}"`, errorDetail);
144
188
  this.hexString = hexString;
145
- this.errorDetail = errorDetail;
146
- this.name = 'InvalidHexStringError';
147
- this.message = `Invalid hex string "${hexString}"`;
148
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
189
+ this.name = this.constructor.name;
149
190
  }
150
191
  }
151
192
  exports.InvalidHexStringError = InvalidHexStringError;
@@ -155,12 +196,9 @@ exports.InvalidHexStringError = InvalidHexStringError;
155
196
  */
156
197
  class InvalidMessageError extends ParameterValidationError {
157
198
  constructor(msg, errorDetail) {
158
- super();
199
+ super(`Invalid message "${msg}"`, errorDetail);
159
200
  this.msg = msg;
160
- this.errorDetail = errorDetail;
161
- this.name = 'InvalidMessageError';
162
- this.message = `Invalid message "${msg}"`;
163
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
201
+ this.name = this.constructor.name;
164
202
  }
165
203
  }
166
204
  exports.InvalidMessageError = InvalidMessageError;
@@ -169,14 +207,14 @@ exports.InvalidMessageError = InvalidMessageError;
169
207
  * @description Error that indicates invalid view parameter of a smart contract
170
208
  */
171
209
  class InvalidViewParameterError extends ParameterValidationError {
172
- constructor(viewName, sigs, args, cause) {
173
- super();
210
+ constructor(viewName, sigs, args, cause, errorDetail) {
211
+ const message = `Invalid view arguments ${JSON.stringify(args)} received for name "${viewName}" expecting one of the following signatures ${JSON.stringify(sigs)}.`;
212
+ super(message, errorDetail);
174
213
  this.viewName = viewName;
175
214
  this.sigs = sigs;
176
215
  this.args = args;
177
216
  this.cause = cause;
178
- this.name = 'InvalidViewParameterError';
179
- this.message = `Invalid view arguments ${JSON.stringify(args)} received for name "${viewName}" expecting one of the following signatures ${JSON.stringify(sigs)}.`;
217
+ this.name = this.constructor.name;
180
218
  }
181
219
  }
182
220
  exports.InvalidViewParameterError = InvalidViewParameterError;
@@ -186,11 +224,8 @@ exports.InvalidViewParameterError = InvalidViewParameterError;
186
224
  */
187
225
  class InvalidKeyError extends ParameterValidationError {
188
226
  constructor(errorDetail) {
189
- super();
190
- this.errorDetail = errorDetail;
191
- this.name = 'InvalidKeyError';
192
- this.message = `Invalid private key`;
193
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
227
+ super(`Invalid private key`, errorDetail);
228
+ this.name = this.constructor.name;
194
229
  }
195
230
  }
196
231
  exports.InvalidKeyError = InvalidKeyError;
@@ -200,12 +235,10 @@ exports.InvalidKeyError = InvalidKeyError;
200
235
  */
201
236
  class InvalidPublicKeyError extends ParameterValidationError {
202
237
  constructor(publicKey, errorDetail) {
203
- super();
238
+ const msg = publicKey !== undefined ? `Invalid public key "${publicKey}"` : `Invalid public key`;
239
+ super(msg, errorDetail);
204
240
  this.publicKey = publicKey;
205
- this.errorDetail = errorDetail;
206
- this.name = 'InvalidPublicKeyError';
207
- this.message = `Invalid public key "${publicKey}"`;
208
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
241
+ this.name = this.constructor.name;
209
242
  }
210
243
  }
211
244
  exports.InvalidPublicKeyError = InvalidPublicKeyError;
@@ -215,12 +248,9 @@ exports.InvalidPublicKeyError = InvalidPublicKeyError;
215
248
  */
216
249
  class InvalidSignatureError extends ParameterValidationError {
217
250
  constructor(signature, errorDetail) {
218
- super();
251
+ super(`Invalid signature "${signature}"`, errorDetail);
219
252
  this.signature = signature;
220
- this.errorDetail = errorDetail;
221
- this.name = 'InvalidSignatureError';
222
- this.message = `Invalid signature "${signature}"`;
223
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
253
+ this.name = this.constructor.name;
224
254
  }
225
255
  }
226
256
  exports.InvalidSignatureError = InvalidSignatureError;
@@ -230,12 +260,9 @@ exports.InvalidSignatureError = InvalidSignatureError;
230
260
  */
231
261
  class InvalidContractAddressError extends ParameterValidationError {
232
262
  constructor(contractAddress, errorDetail) {
233
- super();
263
+ super(`Invalid contract address "${contractAddress}"`, errorDetail);
234
264
  this.contractAddress = contractAddress;
235
- this.errorDetail = errorDetail;
236
- this.name = 'InvalidContractAddressError';
237
- this.message = `Invalid contract address "${contractAddress}"`;
238
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
265
+ this.name = this.constructor.name;
239
266
  }
240
267
  }
241
268
  exports.InvalidContractAddressError = InvalidContractAddressError;
@@ -245,12 +272,9 @@ exports.InvalidContractAddressError = InvalidContractAddressError;
245
272
  */
246
273
  class InvalidChainIdError extends ParameterValidationError {
247
274
  constructor(chainId, errorDetail) {
248
- super();
275
+ super(`Invalid chain id "${chainId}"`, errorDetail);
249
276
  this.chainId = chainId;
250
- this.errorDetail = errorDetail;
251
- this.name = 'InvalidChainIdError';
252
- this.message = `Invalid chain id "${chainId}"`;
253
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
277
+ this.name = this.constructor.name;
254
278
  }
255
279
  }
256
280
  exports.InvalidChainIdError = InvalidChainIdError;
@@ -260,12 +284,9 @@ exports.InvalidChainIdError = InvalidChainIdError;
260
284
  */
261
285
  class InvalidKeyHashError extends ParameterValidationError {
262
286
  constructor(keyHash, errorDetail) {
263
- super();
287
+ super(`Invalid public key hash "${keyHash}"`, errorDetail);
264
288
  this.keyHash = keyHash;
265
- this.errorDetail = errorDetail;
266
- this.name = 'InvalidKeyHashError';
267
- this.message = `Invalid public key hash "${keyHash}"`;
268
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
289
+ this.name = this.constructor.name;
269
290
  }
270
291
  }
271
292
  exports.InvalidKeyHashError = InvalidKeyHashError;
@@ -275,12 +296,9 @@ exports.InvalidKeyHashError = InvalidKeyHashError;
275
296
  */
276
297
  class InvalidOperationHashError extends ParameterValidationError {
277
298
  constructor(operationHash, errorDetail) {
278
- super();
299
+ super(`Invalid operation hash "${operationHash}"`, errorDetail);
279
300
  this.operationHash = operationHash;
280
- this.errorDetail = errorDetail;
281
- this.name = 'InvalidOperationHashError';
282
- this.message = `Invalid operation hash "${operationHash}"`;
283
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
301
+ this.name = this.constructor.name;
284
302
  }
285
303
  }
286
304
  exports.InvalidOperationHashError = InvalidOperationHashError;
@@ -290,12 +308,9 @@ exports.InvalidOperationHashError = InvalidOperationHashError;
290
308
  */
291
309
  class InvalidOperationKindError extends ParameterValidationError {
292
310
  constructor(operationKind, errorDetail) {
293
- super();
311
+ super(`Invalid operation kind "${operationKind}"`, errorDetail);
294
312
  this.operationKind = operationKind;
295
- this.errorDetail = errorDetail;
296
- this.name = 'InvalidOperationKindError';
297
- this.message = `Invalid operation kind "${operationKind}"`;
298
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
313
+ this.name = this.constructor.name;
299
314
  }
300
315
  }
301
316
  exports.InvalidOperationKindError = InvalidOperationKindError;
@@ -305,9 +320,8 @@ exports.InvalidOperationKindError = InvalidOperationKindError;
305
320
  */
306
321
  class DeprecationError extends UnsupportedActionError {
307
322
  constructor(message) {
308
- super();
309
- this.message = message;
310
- this.name = 'DeprecationError';
323
+ super(message);
324
+ this.name = this.constructor.name;
311
325
  }
312
326
  }
313
327
  exports.DeprecationError = DeprecationError;
@@ -317,9 +331,8 @@ exports.DeprecationError = DeprecationError;
317
331
  */
318
332
  class ProhibitedActionError extends UnsupportedActionError {
319
333
  constructor(message) {
320
- super();
321
- this.message = message;
322
- this.name = 'ProhibitedActionError';
334
+ super(message);
335
+ this.name = this.constructor.name;
323
336
  }
324
337
  }
325
338
  exports.ProhibitedActionError = ProhibitedActionError;
@@ -329,11 +342,10 @@ exports.ProhibitedActionError = ProhibitedActionError;
329
342
  */
330
343
  class PublicKeyNotFoundError extends TaquitoError {
331
344
  constructor(pkh, cause) {
332
- super();
345
+ super(`Public key not found of this address "${pkh}" in either wallet or contract API.`);
333
346
  this.pkh = pkh;
334
347
  this.cause = cause;
335
- this.name = 'PublicKeyNotFoundError';
336
- this.message = `Public key not found of this address "${pkh}" in either wallet or contract API.`;
348
+ this.name = this.constructor.name;
337
349
  }
338
350
  }
339
351
  exports.PublicKeyNotFoundError = PublicKeyNotFoundError;
@@ -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": "6a2c52b9e48b299dfc856149c1fa3388e77180ad",
7
- "version": "22.0.0"
6
+ "commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
7
+ "version": "23.0.0-beta.1"
8
8
  };
@@ -1,6 +1,23 @@
1
1
  // ==========================================================================================
2
2
  // parent error classes for Taquito
3
3
  // ==========================================================================================
4
+ var ValidationResult;
5
+ (function (ValidationResult) {
6
+ ValidationResult[ValidationResult["NO_PREFIX_MATCHED"] = 0] = "NO_PREFIX_MATCHED";
7
+ ValidationResult[ValidationResult["INVALID_CHECKSUM"] = 1] = "INVALID_CHECKSUM";
8
+ ValidationResult[ValidationResult["INVALID_LENGTH"] = 2] = "INVALID_LENGTH";
9
+ ValidationResult[ValidationResult["VALID"] = 3] = "VALID";
10
+ ValidationResult[ValidationResult["PREFIX_NOT_ALLOWED"] = 4] = "PREFIX_NOT_ALLOWED";
11
+ ValidationResult[ValidationResult["INVALID_ENCODING"] = 5] = "INVALID_ENCODING";
12
+ ValidationResult[ValidationResult["OTHER"] = 6] = "OTHER";
13
+ })(ValidationResult || (ValidationResult = {}));
14
+ const resultDesc = {
15
+ [ValidationResult.NO_PREFIX_MATCHED]: 'unsupported Base58 prefix',
16
+ [ValidationResult.INVALID_CHECKSUM]: 'invalid checksum',
17
+ [ValidationResult.INVALID_LENGTH]: 'invalid length',
18
+ [ValidationResult.PREFIX_NOT_ALLOWED]: 'Base58 prefix not allowed in this context',
19
+ [ValidationResult.INVALID_ENCODING]: 'invalid Base58 encoding',
20
+ };
4
21
  /**
5
22
  * @category Error
6
23
  * @description Parent error class all taquito errors to extend from
@@ -12,6 +29,39 @@ class TaquitoError extends Error {
12
29
  * @description Error that indicates invalid user inputs
13
30
  */
14
31
  class ParameterValidationError extends TaquitoError {
32
+ constructor(message, validationResult, errorDetail) {
33
+ let detail;
34
+ let result;
35
+ let msg;
36
+ if (message !== undefined) {
37
+ if (typeof message === 'string') {
38
+ msg = message;
39
+ if (validationResult !== undefined) {
40
+ if (typeof validationResult === 'string') {
41
+ detail = validationResult;
42
+ }
43
+ else {
44
+ result = validationResult;
45
+ if (errorDetail !== undefined) {
46
+ detail = errorDetail;
47
+ }
48
+ else {
49
+ detail = resultDesc[validationResult];
50
+ }
51
+ }
52
+ }
53
+ }
54
+ else {
55
+ result = message;
56
+ detail = resultDesc[message];
57
+ msg = detail;
58
+ }
59
+ }
60
+ super(msg);
61
+ this.name = this.constructor.name;
62
+ this.result = result;
63
+ this.errorDetail = detail;
64
+ }
15
65
  }
16
66
  /**
17
67
  * @category Error
@@ -52,30 +102,30 @@ class PermissionDeniedError extends TaquitoError {
52
102
  */
53
103
  class InvalidAddressError extends ParameterValidationError {
54
104
  constructor(address, errorDetail) {
55
- super();
105
+ super(`Invalid address "${address}"`, errorDetail);
56
106
  this.address = address;
57
- this.errorDetail = errorDetail;
58
- this.name = 'InvalidAddressError';
59
- this.message = `Invalid address "${address}"`;
60
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
107
+ this.name = this.constructor.name;
108
+ }
109
+ }
110
+ class InvalidProofError extends ParameterValidationError {
111
+ constructor(proof, errorDetail) {
112
+ super(`Invalid proof "${proof}"`, errorDetail);
113
+ this.proof = proof;
114
+ this.name = this.constructor.name;
61
115
  }
62
116
  }
63
117
  class InvalidStakingAddressError extends ParameterValidationError {
64
118
  constructor(address, errorDetail) {
65
- super();
119
+ super(`Invalid staking address "${address}", you can only set destination as your own address`, errorDetail);
66
120
  this.address = address;
67
- this.errorDetail = errorDetail;
68
- this.name = 'InvalidStakingAddressError';
69
- this.message = `Invalid staking address "${address}", you can only set destination as your own address`;
121
+ this.name = this.constructor.name;
70
122
  }
71
123
  }
72
124
  class InvalidFinalizeUnstakeAmountError extends ParameterValidationError {
73
125
  constructor(address, errorDetail) {
74
- super();
126
+ super(`The amount can only be 0 when finalizing an unstake`, errorDetail);
75
127
  this.address = address;
76
- this.errorDetail = errorDetail;
77
- this.name = 'InvalidFinalizeUnstakeAmountError';
78
- this.message = `The amount can only be 0 when finalizing an unstake`;
128
+ this.name = this.constructor.name;
79
129
  }
80
130
  }
81
131
  /**
@@ -84,12 +134,9 @@ class InvalidFinalizeUnstakeAmountError extends ParameterValidationError {
84
134
  */
85
135
  class InvalidBlockHashError extends ParameterValidationError {
86
136
  constructor(blockHash, errorDetail) {
87
- super();
137
+ super(`Invalid block hash "${blockHash}"`, errorDetail);
88
138
  this.blockHash = blockHash;
89
- this.errorDetail = errorDetail;
90
- this.name = 'InvalidBlockHashError';
91
- this.message = `Invalid block hash "${blockHash}"`;
92
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
139
+ this.name = this.constructor.name;
93
140
  }
94
141
  }
95
142
  /**
@@ -97,11 +144,10 @@ class InvalidBlockHashError extends ParameterValidationError {
97
144
  * @description Error that indicates an invalid amount of tez being passed as a parameter
98
145
  */
99
146
  class InvalidAmountError extends ParameterValidationError {
100
- constructor(amount) {
101
- super();
147
+ constructor(amount, errorDetail) {
148
+ super(`Invalid amount "${amount}"`, errorDetail);
102
149
  this.amount = amount;
103
- this.name = 'InvalidAmountError';
104
- this.message = `Invalid amount "${amount}"`;
150
+ this.name = this.constructor.name;
105
151
  }
106
152
  }
107
153
  /**
@@ -110,12 +156,9 @@ class InvalidAmountError extends ParameterValidationError {
110
156
  */
111
157
  class InvalidDerivationPathError extends ParameterValidationError {
112
158
  constructor(derivationPath, errorDetail) {
113
- super();
159
+ super(`Invalid derivation path "${derivationPath}"`, errorDetail);
114
160
  this.derivationPath = derivationPath;
115
- this.errorDetail = errorDetail;
116
- this.name = 'InvalidDerivationPathError';
117
- this.message = `Invalid derivation path "${derivationPath}"`;
118
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
161
+ this.name = this.constructor.name;
119
162
  }
120
163
  }
121
164
  /**
@@ -124,12 +167,9 @@ class InvalidDerivationPathError extends ParameterValidationError {
124
167
  */
125
168
  class InvalidHexStringError extends ParameterValidationError {
126
169
  constructor(hexString, errorDetail) {
127
- super();
170
+ super(`Invalid hex string "${hexString}"`, errorDetail);
128
171
  this.hexString = hexString;
129
- this.errorDetail = errorDetail;
130
- this.name = 'InvalidHexStringError';
131
- this.message = `Invalid hex string "${hexString}"`;
132
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
172
+ this.name = this.constructor.name;
133
173
  }
134
174
  }
135
175
  /**
@@ -138,12 +178,9 @@ class InvalidHexStringError extends ParameterValidationError {
138
178
  */
139
179
  class InvalidMessageError extends ParameterValidationError {
140
180
  constructor(msg, errorDetail) {
141
- super();
181
+ super(`Invalid message "${msg}"`, errorDetail);
142
182
  this.msg = msg;
143
- this.errorDetail = errorDetail;
144
- this.name = 'InvalidMessageError';
145
- this.message = `Invalid message "${msg}"`;
146
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
183
+ this.name = this.constructor.name;
147
184
  }
148
185
  }
149
186
  /**
@@ -151,14 +188,14 @@ class InvalidMessageError extends ParameterValidationError {
151
188
  * @description Error that indicates invalid view parameter of a smart contract
152
189
  */
153
190
  class InvalidViewParameterError extends ParameterValidationError {
154
- constructor(viewName, sigs, args, cause) {
155
- super();
191
+ constructor(viewName, sigs, args, cause, errorDetail) {
192
+ const message = `Invalid view arguments ${JSON.stringify(args)} received for name "${viewName}" expecting one of the following signatures ${JSON.stringify(sigs)}.`;
193
+ super(message, errorDetail);
156
194
  this.viewName = viewName;
157
195
  this.sigs = sigs;
158
196
  this.args = args;
159
197
  this.cause = cause;
160
- this.name = 'InvalidViewParameterError';
161
- this.message = `Invalid view arguments ${JSON.stringify(args)} received for name "${viewName}" expecting one of the following signatures ${JSON.stringify(sigs)}.`;
198
+ this.name = this.constructor.name;
162
199
  }
163
200
  }
164
201
  /**
@@ -167,11 +204,8 @@ class InvalidViewParameterError extends ParameterValidationError {
167
204
  */
168
205
  class InvalidKeyError extends ParameterValidationError {
169
206
  constructor(errorDetail) {
170
- super();
171
- this.errorDetail = errorDetail;
172
- this.name = 'InvalidKeyError';
173
- this.message = `Invalid private key`;
174
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
207
+ super(`Invalid private key`, errorDetail);
208
+ this.name = this.constructor.name;
175
209
  }
176
210
  }
177
211
  /**
@@ -180,12 +214,10 @@ class InvalidKeyError extends ParameterValidationError {
180
214
  */
181
215
  class InvalidPublicKeyError extends ParameterValidationError {
182
216
  constructor(publicKey, errorDetail) {
183
- super();
217
+ const msg = publicKey !== undefined ? `Invalid public key "${publicKey}"` : `Invalid public key`;
218
+ super(msg, errorDetail);
184
219
  this.publicKey = publicKey;
185
- this.errorDetail = errorDetail;
186
- this.name = 'InvalidPublicKeyError';
187
- this.message = `Invalid public key "${publicKey}"`;
188
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
220
+ this.name = this.constructor.name;
189
221
  }
190
222
  }
191
223
  /**
@@ -194,12 +226,9 @@ class InvalidPublicKeyError extends ParameterValidationError {
194
226
  */
195
227
  class InvalidSignatureError extends ParameterValidationError {
196
228
  constructor(signature, errorDetail) {
197
- super();
229
+ super(`Invalid signature "${signature}"`, errorDetail);
198
230
  this.signature = signature;
199
- this.errorDetail = errorDetail;
200
- this.name = 'InvalidSignatureError';
201
- this.message = `Invalid signature "${signature}"`;
202
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
231
+ this.name = this.constructor.name;
203
232
  }
204
233
  }
205
234
  /**
@@ -208,12 +237,9 @@ class InvalidSignatureError extends ParameterValidationError {
208
237
  */
209
238
  class InvalidContractAddressError extends ParameterValidationError {
210
239
  constructor(contractAddress, errorDetail) {
211
- super();
240
+ super(`Invalid contract address "${contractAddress}"`, errorDetail);
212
241
  this.contractAddress = contractAddress;
213
- this.errorDetail = errorDetail;
214
- this.name = 'InvalidContractAddressError';
215
- this.message = `Invalid contract address "${contractAddress}"`;
216
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
242
+ this.name = this.constructor.name;
217
243
  }
218
244
  }
219
245
  /**
@@ -222,12 +248,9 @@ class InvalidContractAddressError extends ParameterValidationError {
222
248
  */
223
249
  class InvalidChainIdError extends ParameterValidationError {
224
250
  constructor(chainId, errorDetail) {
225
- super();
251
+ super(`Invalid chain id "${chainId}"`, errorDetail);
226
252
  this.chainId = chainId;
227
- this.errorDetail = errorDetail;
228
- this.name = 'InvalidChainIdError';
229
- this.message = `Invalid chain id "${chainId}"`;
230
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
253
+ this.name = this.constructor.name;
231
254
  }
232
255
  }
233
256
  /**
@@ -236,12 +259,9 @@ class InvalidChainIdError extends ParameterValidationError {
236
259
  */
237
260
  class InvalidKeyHashError extends ParameterValidationError {
238
261
  constructor(keyHash, errorDetail) {
239
- super();
262
+ super(`Invalid public key hash "${keyHash}"`, errorDetail);
240
263
  this.keyHash = keyHash;
241
- this.errorDetail = errorDetail;
242
- this.name = 'InvalidKeyHashError';
243
- this.message = `Invalid public key hash "${keyHash}"`;
244
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
264
+ this.name = this.constructor.name;
245
265
  }
246
266
  }
247
267
  /**
@@ -250,12 +270,9 @@ class InvalidKeyHashError extends ParameterValidationError {
250
270
  */
251
271
  class InvalidOperationHashError extends ParameterValidationError {
252
272
  constructor(operationHash, errorDetail) {
253
- super();
273
+ super(`Invalid operation hash "${operationHash}"`, errorDetail);
254
274
  this.operationHash = operationHash;
255
- this.errorDetail = errorDetail;
256
- this.name = 'InvalidOperationHashError';
257
- this.message = `Invalid operation hash "${operationHash}"`;
258
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
275
+ this.name = this.constructor.name;
259
276
  }
260
277
  }
261
278
  /**
@@ -264,12 +281,9 @@ class InvalidOperationHashError extends ParameterValidationError {
264
281
  */
265
282
  class InvalidOperationKindError extends ParameterValidationError {
266
283
  constructor(operationKind, errorDetail) {
267
- super();
284
+ super(`Invalid operation kind "${operationKind}"`, errorDetail);
268
285
  this.operationKind = operationKind;
269
- this.errorDetail = errorDetail;
270
- this.name = 'InvalidOperationKindError';
271
- this.message = `Invalid operation kind "${operationKind}"`;
272
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
286
+ this.name = this.constructor.name;
273
287
  }
274
288
  }
275
289
  /**
@@ -278,9 +292,8 @@ class InvalidOperationKindError extends ParameterValidationError {
278
292
  */
279
293
  class DeprecationError extends UnsupportedActionError {
280
294
  constructor(message) {
281
- super();
282
- this.message = message;
283
- this.name = 'DeprecationError';
295
+ super(message);
296
+ this.name = this.constructor.name;
284
297
  }
285
298
  }
286
299
  /**
@@ -289,9 +302,8 @@ class DeprecationError extends UnsupportedActionError {
289
302
  */
290
303
  class ProhibitedActionError extends UnsupportedActionError {
291
304
  constructor(message) {
292
- super();
293
- this.message = message;
294
- this.name = 'ProhibitedActionError';
305
+ super(message);
306
+ this.name = this.constructor.name;
295
307
  }
296
308
  }
297
309
  /**
@@ -300,13 +312,12 @@ class ProhibitedActionError extends UnsupportedActionError {
300
312
  */
301
313
  class PublicKeyNotFoundError extends TaquitoError {
302
314
  constructor(pkh, cause) {
303
- super();
315
+ super(`Public key not found of this address "${pkh}" in either wallet or contract API.`);
304
316
  this.pkh = pkh;
305
317
  this.cause = cause;
306
- this.name = 'PublicKeyNotFoundError';
307
- this.message = `Public key not found of this address "${pkh}" in either wallet or contract API.`;
318
+ this.name = this.constructor.name;
308
319
  }
309
320
  }
310
321
 
311
- export { DeprecationError, InvalidAddressError, InvalidAmountError, InvalidBlockHashError, InvalidChainIdError, InvalidContractAddressError, InvalidDerivationPathError, InvalidFinalizeUnstakeAmountError, InvalidHexStringError, InvalidKeyError, InvalidKeyHashError, InvalidMessageError, InvalidOperationHashError, InvalidOperationKindError, InvalidPublicKeyError, InvalidSignatureError, InvalidStakingAddressError, InvalidViewParameterError, NetworkError, ParameterValidationError, PermissionDeniedError, ProhibitedActionError, PublicKeyNotFoundError, RpcError, TaquitoError, TezosToolkitConfigError, UnsupportedActionError };
322
+ export { DeprecationError, InvalidAddressError, InvalidAmountError, InvalidBlockHashError, InvalidChainIdError, InvalidContractAddressError, InvalidDerivationPathError, InvalidFinalizeUnstakeAmountError, InvalidHexStringError, InvalidKeyError, InvalidKeyHashError, InvalidMessageError, InvalidOperationHashError, InvalidOperationKindError, InvalidProofError, InvalidPublicKeyError, InvalidSignatureError, InvalidStakingAddressError, InvalidViewParameterError, NetworkError, ParameterValidationError, PermissionDeniedError, ProhibitedActionError, PublicKeyNotFoundError, RpcError, TaquitoError, TezosToolkitConfigError, UnsupportedActionError, ValidationResult };
312
323
  //# sourceMappingURL=taquito-core.es6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-core.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-core.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -7,6 +7,23 @@
7
7
  // ==========================================================================================
8
8
  // parent error classes for Taquito
9
9
  // ==========================================================================================
10
+ exports.ValidationResult = void 0;
11
+ (function (ValidationResult) {
12
+ ValidationResult[ValidationResult["NO_PREFIX_MATCHED"] = 0] = "NO_PREFIX_MATCHED";
13
+ ValidationResult[ValidationResult["INVALID_CHECKSUM"] = 1] = "INVALID_CHECKSUM";
14
+ ValidationResult[ValidationResult["INVALID_LENGTH"] = 2] = "INVALID_LENGTH";
15
+ ValidationResult[ValidationResult["VALID"] = 3] = "VALID";
16
+ ValidationResult[ValidationResult["PREFIX_NOT_ALLOWED"] = 4] = "PREFIX_NOT_ALLOWED";
17
+ ValidationResult[ValidationResult["INVALID_ENCODING"] = 5] = "INVALID_ENCODING";
18
+ ValidationResult[ValidationResult["OTHER"] = 6] = "OTHER";
19
+ })(exports.ValidationResult || (exports.ValidationResult = {}));
20
+ const resultDesc = {
21
+ [exports.ValidationResult.NO_PREFIX_MATCHED]: 'unsupported Base58 prefix',
22
+ [exports.ValidationResult.INVALID_CHECKSUM]: 'invalid checksum',
23
+ [exports.ValidationResult.INVALID_LENGTH]: 'invalid length',
24
+ [exports.ValidationResult.PREFIX_NOT_ALLOWED]: 'Base58 prefix not allowed in this context',
25
+ [exports.ValidationResult.INVALID_ENCODING]: 'invalid Base58 encoding',
26
+ };
10
27
  /**
11
28
  * @category Error
12
29
  * @description Parent error class all taquito errors to extend from
@@ -18,6 +35,39 @@
18
35
  * @description Error that indicates invalid user inputs
19
36
  */
20
37
  class ParameterValidationError extends TaquitoError {
38
+ constructor(message, validationResult, errorDetail) {
39
+ let detail;
40
+ let result;
41
+ let msg;
42
+ if (message !== undefined) {
43
+ if (typeof message === 'string') {
44
+ msg = message;
45
+ if (validationResult !== undefined) {
46
+ if (typeof validationResult === 'string') {
47
+ detail = validationResult;
48
+ }
49
+ else {
50
+ result = validationResult;
51
+ if (errorDetail !== undefined) {
52
+ detail = errorDetail;
53
+ }
54
+ else {
55
+ detail = resultDesc[validationResult];
56
+ }
57
+ }
58
+ }
59
+ }
60
+ else {
61
+ result = message;
62
+ detail = resultDesc[message];
63
+ msg = detail;
64
+ }
65
+ }
66
+ super(msg);
67
+ this.name = this.constructor.name;
68
+ this.result = result;
69
+ this.errorDetail = detail;
70
+ }
21
71
  }
22
72
  /**
23
73
  * @category Error
@@ -58,30 +108,30 @@
58
108
  */
59
109
  class InvalidAddressError extends ParameterValidationError {
60
110
  constructor(address, errorDetail) {
61
- super();
111
+ super(`Invalid address "${address}"`, errorDetail);
62
112
  this.address = address;
63
- this.errorDetail = errorDetail;
64
- this.name = 'InvalidAddressError';
65
- this.message = `Invalid address "${address}"`;
66
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
113
+ this.name = this.constructor.name;
114
+ }
115
+ }
116
+ class InvalidProofError extends ParameterValidationError {
117
+ constructor(proof, errorDetail) {
118
+ super(`Invalid proof "${proof}"`, errorDetail);
119
+ this.proof = proof;
120
+ this.name = this.constructor.name;
67
121
  }
68
122
  }
69
123
  class InvalidStakingAddressError extends ParameterValidationError {
70
124
  constructor(address, errorDetail) {
71
- super();
125
+ super(`Invalid staking address "${address}", you can only set destination as your own address`, errorDetail);
72
126
  this.address = address;
73
- this.errorDetail = errorDetail;
74
- this.name = 'InvalidStakingAddressError';
75
- this.message = `Invalid staking address "${address}", you can only set destination as your own address`;
127
+ this.name = this.constructor.name;
76
128
  }
77
129
  }
78
130
  class InvalidFinalizeUnstakeAmountError extends ParameterValidationError {
79
131
  constructor(address, errorDetail) {
80
- super();
132
+ super(`The amount can only be 0 when finalizing an unstake`, errorDetail);
81
133
  this.address = address;
82
- this.errorDetail = errorDetail;
83
- this.name = 'InvalidFinalizeUnstakeAmountError';
84
- this.message = `The amount can only be 0 when finalizing an unstake`;
134
+ this.name = this.constructor.name;
85
135
  }
86
136
  }
87
137
  /**
@@ -90,12 +140,9 @@
90
140
  */
91
141
  class InvalidBlockHashError extends ParameterValidationError {
92
142
  constructor(blockHash, errorDetail) {
93
- super();
143
+ super(`Invalid block hash "${blockHash}"`, errorDetail);
94
144
  this.blockHash = blockHash;
95
- this.errorDetail = errorDetail;
96
- this.name = 'InvalidBlockHashError';
97
- this.message = `Invalid block hash "${blockHash}"`;
98
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
145
+ this.name = this.constructor.name;
99
146
  }
100
147
  }
101
148
  /**
@@ -103,11 +150,10 @@
103
150
  * @description Error that indicates an invalid amount of tez being passed as a parameter
104
151
  */
105
152
  class InvalidAmountError extends ParameterValidationError {
106
- constructor(amount) {
107
- super();
153
+ constructor(amount, errorDetail) {
154
+ super(`Invalid amount "${amount}"`, errorDetail);
108
155
  this.amount = amount;
109
- this.name = 'InvalidAmountError';
110
- this.message = `Invalid amount "${amount}"`;
156
+ this.name = this.constructor.name;
111
157
  }
112
158
  }
113
159
  /**
@@ -116,12 +162,9 @@
116
162
  */
117
163
  class InvalidDerivationPathError extends ParameterValidationError {
118
164
  constructor(derivationPath, errorDetail) {
119
- super();
165
+ super(`Invalid derivation path "${derivationPath}"`, errorDetail);
120
166
  this.derivationPath = derivationPath;
121
- this.errorDetail = errorDetail;
122
- this.name = 'InvalidDerivationPathError';
123
- this.message = `Invalid derivation path "${derivationPath}"`;
124
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
167
+ this.name = this.constructor.name;
125
168
  }
126
169
  }
127
170
  /**
@@ -130,12 +173,9 @@
130
173
  */
131
174
  class InvalidHexStringError extends ParameterValidationError {
132
175
  constructor(hexString, errorDetail) {
133
- super();
176
+ super(`Invalid hex string "${hexString}"`, errorDetail);
134
177
  this.hexString = hexString;
135
- this.errorDetail = errorDetail;
136
- this.name = 'InvalidHexStringError';
137
- this.message = `Invalid hex string "${hexString}"`;
138
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
178
+ this.name = this.constructor.name;
139
179
  }
140
180
  }
141
181
  /**
@@ -144,12 +184,9 @@
144
184
  */
145
185
  class InvalidMessageError extends ParameterValidationError {
146
186
  constructor(msg, errorDetail) {
147
- super();
187
+ super(`Invalid message "${msg}"`, errorDetail);
148
188
  this.msg = msg;
149
- this.errorDetail = errorDetail;
150
- this.name = 'InvalidMessageError';
151
- this.message = `Invalid message "${msg}"`;
152
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
189
+ this.name = this.constructor.name;
153
190
  }
154
191
  }
155
192
  /**
@@ -157,14 +194,14 @@
157
194
  * @description Error that indicates invalid view parameter of a smart contract
158
195
  */
159
196
  class InvalidViewParameterError extends ParameterValidationError {
160
- constructor(viewName, sigs, args, cause) {
161
- super();
197
+ constructor(viewName, sigs, args, cause, errorDetail) {
198
+ const message = `Invalid view arguments ${JSON.stringify(args)} received for name "${viewName}" expecting one of the following signatures ${JSON.stringify(sigs)}.`;
199
+ super(message, errorDetail);
162
200
  this.viewName = viewName;
163
201
  this.sigs = sigs;
164
202
  this.args = args;
165
203
  this.cause = cause;
166
- this.name = 'InvalidViewParameterError';
167
- this.message = `Invalid view arguments ${JSON.stringify(args)} received for name "${viewName}" expecting one of the following signatures ${JSON.stringify(sigs)}.`;
204
+ this.name = this.constructor.name;
168
205
  }
169
206
  }
170
207
  /**
@@ -173,11 +210,8 @@
173
210
  */
174
211
  class InvalidKeyError extends ParameterValidationError {
175
212
  constructor(errorDetail) {
176
- super();
177
- this.errorDetail = errorDetail;
178
- this.name = 'InvalidKeyError';
179
- this.message = `Invalid private key`;
180
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
213
+ super(`Invalid private key`, errorDetail);
214
+ this.name = this.constructor.name;
181
215
  }
182
216
  }
183
217
  /**
@@ -186,12 +220,10 @@
186
220
  */
187
221
  class InvalidPublicKeyError extends ParameterValidationError {
188
222
  constructor(publicKey, errorDetail) {
189
- super();
223
+ const msg = publicKey !== undefined ? `Invalid public key "${publicKey}"` : `Invalid public key`;
224
+ super(msg, errorDetail);
190
225
  this.publicKey = publicKey;
191
- this.errorDetail = errorDetail;
192
- this.name = 'InvalidPublicKeyError';
193
- this.message = `Invalid public key "${publicKey}"`;
194
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
226
+ this.name = this.constructor.name;
195
227
  }
196
228
  }
197
229
  /**
@@ -200,12 +232,9 @@
200
232
  */
201
233
  class InvalidSignatureError extends ParameterValidationError {
202
234
  constructor(signature, errorDetail) {
203
- super();
235
+ super(`Invalid signature "${signature}"`, errorDetail);
204
236
  this.signature = signature;
205
- this.errorDetail = errorDetail;
206
- this.name = 'InvalidSignatureError';
207
- this.message = `Invalid signature "${signature}"`;
208
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
237
+ this.name = this.constructor.name;
209
238
  }
210
239
  }
211
240
  /**
@@ -214,12 +243,9 @@
214
243
  */
215
244
  class InvalidContractAddressError extends ParameterValidationError {
216
245
  constructor(contractAddress, errorDetail) {
217
- super();
246
+ super(`Invalid contract address "${contractAddress}"`, errorDetail);
218
247
  this.contractAddress = contractAddress;
219
- this.errorDetail = errorDetail;
220
- this.name = 'InvalidContractAddressError';
221
- this.message = `Invalid contract address "${contractAddress}"`;
222
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
248
+ this.name = this.constructor.name;
223
249
  }
224
250
  }
225
251
  /**
@@ -228,12 +254,9 @@
228
254
  */
229
255
  class InvalidChainIdError extends ParameterValidationError {
230
256
  constructor(chainId, errorDetail) {
231
- super();
257
+ super(`Invalid chain id "${chainId}"`, errorDetail);
232
258
  this.chainId = chainId;
233
- this.errorDetail = errorDetail;
234
- this.name = 'InvalidChainIdError';
235
- this.message = `Invalid chain id "${chainId}"`;
236
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
259
+ this.name = this.constructor.name;
237
260
  }
238
261
  }
239
262
  /**
@@ -242,12 +265,9 @@
242
265
  */
243
266
  class InvalidKeyHashError extends ParameterValidationError {
244
267
  constructor(keyHash, errorDetail) {
245
- super();
268
+ super(`Invalid public key hash "${keyHash}"`, errorDetail);
246
269
  this.keyHash = keyHash;
247
- this.errorDetail = errorDetail;
248
- this.name = 'InvalidKeyHashError';
249
- this.message = `Invalid public key hash "${keyHash}"`;
250
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
270
+ this.name = this.constructor.name;
251
271
  }
252
272
  }
253
273
  /**
@@ -256,12 +276,9 @@
256
276
  */
257
277
  class InvalidOperationHashError extends ParameterValidationError {
258
278
  constructor(operationHash, errorDetail) {
259
- super();
279
+ super(`Invalid operation hash "${operationHash}"`, errorDetail);
260
280
  this.operationHash = operationHash;
261
- this.errorDetail = errorDetail;
262
- this.name = 'InvalidOperationHashError';
263
- this.message = `Invalid operation hash "${operationHash}"`;
264
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
281
+ this.name = this.constructor.name;
265
282
  }
266
283
  }
267
284
  /**
@@ -270,12 +287,9 @@
270
287
  */
271
288
  class InvalidOperationKindError extends ParameterValidationError {
272
289
  constructor(operationKind, errorDetail) {
273
- super();
290
+ super(`Invalid operation kind "${operationKind}"`, errorDetail);
274
291
  this.operationKind = operationKind;
275
- this.errorDetail = errorDetail;
276
- this.name = 'InvalidOperationKindError';
277
- this.message = `Invalid operation kind "${operationKind}"`;
278
- this.message += errorDetail ? ` ${errorDetail}.` : '.';
292
+ this.name = this.constructor.name;
279
293
  }
280
294
  }
281
295
  /**
@@ -284,9 +298,8 @@
284
298
  */
285
299
  class DeprecationError extends UnsupportedActionError {
286
300
  constructor(message) {
287
- super();
288
- this.message = message;
289
- this.name = 'DeprecationError';
301
+ super(message);
302
+ this.name = this.constructor.name;
290
303
  }
291
304
  }
292
305
  /**
@@ -295,9 +308,8 @@
295
308
  */
296
309
  class ProhibitedActionError extends UnsupportedActionError {
297
310
  constructor(message) {
298
- super();
299
- this.message = message;
300
- this.name = 'ProhibitedActionError';
311
+ super(message);
312
+ this.name = this.constructor.name;
301
313
  }
302
314
  }
303
315
  /**
@@ -306,11 +318,10 @@
306
318
  */
307
319
  class PublicKeyNotFoundError extends TaquitoError {
308
320
  constructor(pkh, cause) {
309
- super();
321
+ super(`Public key not found of this address "${pkh}" in either wallet or contract API.`);
310
322
  this.pkh = pkh;
311
323
  this.cause = cause;
312
- this.name = 'PublicKeyNotFoundError';
313
- this.message = `Public key not found of this address "${pkh}" in either wallet or contract API.`;
324
+ this.name = this.constructor.name;
314
325
  }
315
326
  }
316
327
 
@@ -328,6 +339,7 @@
328
339
  exports.InvalidMessageError = InvalidMessageError;
329
340
  exports.InvalidOperationHashError = InvalidOperationHashError;
330
341
  exports.InvalidOperationKindError = InvalidOperationKindError;
342
+ exports.InvalidProofError = InvalidProofError;
331
343
  exports.InvalidPublicKeyError = InvalidPublicKeyError;
332
344
  exports.InvalidSignatureError = InvalidSignatureError;
333
345
  exports.InvalidStakingAddressError = InvalidStakingAddressError;
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-core.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"taquito-core.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,3 +1,12 @@
1
+ export declare enum ValidationResult {
2
+ NO_PREFIX_MATCHED = 0,
3
+ INVALID_CHECKSUM = 1,
4
+ INVALID_LENGTH = 2,
5
+ VALID = 3,
6
+ PREFIX_NOT_ALLOWED = 4,
7
+ INVALID_ENCODING = 5,
8
+ OTHER = 6
9
+ }
1
10
  /**
2
11
  * @category Error
3
12
  * @description Parent error class all taquito errors to extend from
@@ -9,6 +18,11 @@ export declare class TaquitoError extends Error {
9
18
  * @description Error that indicates invalid user inputs
10
19
  */
11
20
  export declare class ParameterValidationError extends TaquitoError {
21
+ readonly errorDetail?: string;
22
+ readonly result?: ValidationResult;
23
+ constructor(validationResult?: ValidationResult);
24
+ constructor(message?: string, errorDetail?: string | ValidationResult);
25
+ constructor(message?: string, validationResult?: ValidationResult, errorDetail?: string);
12
26
  }
13
27
  /**
14
28
  * @category Error
@@ -46,18 +60,19 @@ export declare class PermissionDeniedError extends TaquitoError {
46
60
  */
47
61
  export declare class InvalidAddressError extends ParameterValidationError {
48
62
  readonly address: string;
49
- readonly errorDetail?: string | undefined;
50
- constructor(address: string, errorDetail?: string | undefined);
63
+ constructor(address: string, errorDetail?: string | ValidationResult);
64
+ }
65
+ export declare class InvalidProofError extends ParameterValidationError {
66
+ readonly proof: string;
67
+ constructor(proof: string, errorDetail?: string | ValidationResult);
51
68
  }
52
69
  export declare class InvalidStakingAddressError extends ParameterValidationError {
53
70
  readonly address: string;
54
- readonly errorDetail?: string | undefined;
55
- constructor(address: string, errorDetail?: string | undefined);
71
+ constructor(address: string, errorDetail?: string | ValidationResult);
56
72
  }
57
73
  export declare class InvalidFinalizeUnstakeAmountError extends ParameterValidationError {
58
74
  readonly address: string;
59
- readonly errorDetail?: string | undefined;
60
- constructor(address: string, errorDetail?: string | undefined);
75
+ constructor(address: string, errorDetail?: string | ValidationResult);
61
76
  }
62
77
  /**
63
78
  * @category Error
@@ -65,8 +80,7 @@ export declare class InvalidFinalizeUnstakeAmountError extends ParameterValidati
65
80
  */
66
81
  export declare class InvalidBlockHashError extends ParameterValidationError {
67
82
  readonly blockHash: string;
68
- readonly errorDetail?: string | undefined;
69
- constructor(blockHash: string, errorDetail?: string | undefined);
83
+ constructor(blockHash: string, errorDetail?: string | ValidationResult);
70
84
  }
71
85
  /**
72
86
  * @category Error
@@ -74,7 +88,7 @@ export declare class InvalidBlockHashError extends ParameterValidationError {
74
88
  */
75
89
  export declare class InvalidAmountError extends ParameterValidationError {
76
90
  readonly amount: string;
77
- constructor(amount: string);
91
+ constructor(amount: string, errorDetail?: string | ValidationResult);
78
92
  }
79
93
  /**
80
94
  * @category Error
@@ -82,8 +96,7 @@ export declare class InvalidAmountError extends ParameterValidationError {
82
96
  */
83
97
  export declare class InvalidDerivationPathError extends ParameterValidationError {
84
98
  readonly derivationPath: string;
85
- readonly errorDetail?: string | undefined;
86
- constructor(derivationPath: string, errorDetail?: string | undefined);
99
+ constructor(derivationPath: string, errorDetail?: string | ValidationResult);
87
100
  }
88
101
  /**
89
102
  * @category Error
@@ -91,8 +104,7 @@ export declare class InvalidDerivationPathError extends ParameterValidationError
91
104
  */
92
105
  export declare class InvalidHexStringError extends ParameterValidationError {
93
106
  readonly hexString: string;
94
- readonly errorDetail?: string | undefined;
95
- constructor(hexString: string, errorDetail?: string | undefined);
107
+ constructor(hexString: string, errorDetail?: string | ValidationResult);
96
108
  }
97
109
  /**
98
110
  * @category Error
@@ -100,8 +112,7 @@ export declare class InvalidHexStringError extends ParameterValidationError {
100
112
  */
101
113
  export declare class InvalidMessageError extends ParameterValidationError {
102
114
  readonly msg: string;
103
- readonly errorDetail?: string | undefined;
104
- constructor(msg: string, errorDetail?: string | undefined);
115
+ constructor(msg: string, errorDetail?: string | ValidationResult);
105
116
  }
106
117
  /**
107
118
  * @category Error
@@ -112,24 +123,22 @@ export declare class InvalidViewParameterError extends ParameterValidationError
112
123
  readonly sigs: any;
113
124
  readonly args: any;
114
125
  readonly cause?: any;
115
- constructor(viewName: string, sigs: any, args: any, cause?: any);
126
+ constructor(viewName: string, sigs: any, args: any, cause?: any, errorDetail?: string);
116
127
  }
117
128
  /**
118
129
  * @category Error
119
130
  * @description Error that indicates an invalid private key being passed or used
120
131
  */
121
132
  export declare class InvalidKeyError extends ParameterValidationError {
122
- readonly errorDetail?: string | undefined;
123
- constructor(errorDetail?: string | undefined);
133
+ constructor(errorDetail?: string | ValidationResult);
124
134
  }
125
135
  /**
126
136
  * @category Error
127
137
  * @description Error that indicates an Invalid Public Key being passed or used
128
138
  */
129
139
  export declare class InvalidPublicKeyError extends ParameterValidationError {
130
- readonly publicKey: string;
131
- readonly errorDetail?: string | undefined;
132
- constructor(publicKey: string, errorDetail?: string | undefined);
140
+ readonly publicKey?: string | undefined;
141
+ constructor(publicKey?: string | undefined, errorDetail?: string | ValidationResult);
133
142
  }
134
143
  /**
135
144
  * @category Error
@@ -137,8 +146,7 @@ export declare class InvalidPublicKeyError extends ParameterValidationError {
137
146
  */
138
147
  export declare class InvalidSignatureError extends ParameterValidationError {
139
148
  readonly signature: string;
140
- readonly errorDetail?: string | undefined;
141
- constructor(signature: string, errorDetail?: string | undefined);
149
+ constructor(signature: string, errorDetail?: string | ValidationResult);
142
150
  }
143
151
  /**
144
152
  * @category Error
@@ -146,8 +154,7 @@ export declare class InvalidSignatureError extends ParameterValidationError {
146
154
  */
147
155
  export declare class InvalidContractAddressError extends ParameterValidationError {
148
156
  readonly contractAddress: string;
149
- readonly errorDetail?: string | undefined;
150
- constructor(contractAddress: string, errorDetail?: string | undefined);
157
+ constructor(contractAddress: string, errorDetail?: string | ValidationResult);
151
158
  }
152
159
  /**
153
160
  * @category Error
@@ -155,8 +162,7 @@ export declare class InvalidContractAddressError extends ParameterValidationErro
155
162
  */
156
163
  export declare class InvalidChainIdError extends ParameterValidationError {
157
164
  readonly chainId: string;
158
- readonly errorDetail?: string | undefined;
159
- constructor(chainId: string, errorDetail?: string | undefined);
165
+ constructor(chainId: string, errorDetail?: string | ValidationResult);
160
166
  }
161
167
  /**
162
168
  * @category Error
@@ -164,8 +170,7 @@ export declare class InvalidChainIdError extends ParameterValidationError {
164
170
  */
165
171
  export declare class InvalidKeyHashError extends ParameterValidationError {
166
172
  readonly keyHash: string;
167
- readonly errorDetail?: string | undefined;
168
- constructor(keyHash: string, errorDetail?: string | undefined);
173
+ constructor(keyHash: string, errorDetail?: string | ValidationResult);
169
174
  }
170
175
  /**
171
176
  * @category Error
@@ -173,8 +178,7 @@ export declare class InvalidKeyHashError extends ParameterValidationError {
173
178
  */
174
179
  export declare class InvalidOperationHashError extends ParameterValidationError {
175
180
  readonly operationHash: string;
176
- readonly errorDetail?: string | undefined;
177
- constructor(operationHash: string, errorDetail?: string | undefined);
181
+ constructor(operationHash: string, errorDetail?: string | ValidationResult);
178
182
  }
179
183
  /**
180
184
  * @category Error
@@ -182,15 +186,13 @@ export declare class InvalidOperationHashError extends ParameterValidationError
182
186
  */
183
187
  export declare class InvalidOperationKindError extends ParameterValidationError {
184
188
  readonly operationKind: string;
185
- readonly errorDetail?: string | undefined;
186
- constructor(operationKind: string, errorDetail?: string | undefined);
189
+ constructor(operationKind: string, errorDetail?: string | ValidationResult);
187
190
  }
188
191
  /**
189
192
  * @category Error
190
193
  * @description General error that indicates something is no longer supported and/or deprecated
191
194
  */
192
195
  export declare class DeprecationError extends UnsupportedActionError {
193
- readonly message: string;
194
196
  constructor(message: string);
195
197
  }
196
198
  /**
@@ -198,7 +200,6 @@ export declare class DeprecationError extends UnsupportedActionError {
198
200
  * @description General error that indicates an action is prohibited or not allowed
199
201
  */
200
202
  export declare class ProhibitedActionError extends UnsupportedActionError {
201
- readonly message: string;
202
203
  constructor(message: string);
203
204
  }
204
205
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/core",
3
- "version": "22.0.0",
3
+ "version": "23.0.0-beta.1",
4
4
  "description": "Classes, interfaces, and types shared across Taquito packages",
5
5
  "keywords": [
6
6
  "tezos",
@@ -68,5 +68,5 @@
68
68
  "rollup": "^4.22.4",
69
69
  "rollup-plugin-typescript2": "^0.36.0"
70
70
  },
71
- "gitHead": "134ec228acbee03b4f40b80c89d78c718557569b"
71
+ "gitHead": "1469d6f0d55134a4b853598a2eec48e6f71b3da3"
72
72
  }