@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.
- package/dist/lib/errors.js +104 -92
- package/dist/lib/signer-interfaces.js +2 -0
- package/dist/lib/taquito-core.js +1 -0
- package/dist/lib/version.js +2 -2
- package/dist/taquito-core.es6.js +102 -91
- package/dist/taquito-core.es6.js.map +1 -1
- package/dist/taquito-core.umd.js +102 -90
- package/dist/taquito-core.umd.js.map +1 -1
- package/dist/types/errors.d.ts +36 -35
- package/dist/types/signer-interfaces.d.ts +38 -0
- package/dist/types/taquito-core.d.ts +1 -0
- package/package.json +2 -2
package/dist/taquito-core.es6.js
CHANGED
|
@@ -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.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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 =
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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 =
|
|
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.
|
|
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
|
-
|
|
217
|
+
const msg = publicKey !== undefined ? `Invalid public key "${publicKey}"` : `Invalid public key`;
|
|
218
|
+
super(msg, errorDetail);
|
|
184
219
|
this.publicKey = publicKey;
|
|
185
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 =
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|