@taquito/core 23.0.0-beta.0 → 23.0.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.
@@ -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;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -19,3 +19,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  __exportStar(require("./errors"), exports);
22
+ __exportStar(require("./signer-interfaces"), exports);
@@ -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": "9065acc1b41ec205a49e64b54ef89f50bafa6210",
7
+ "version": "23.0.0"
8
8
  };