@taquito/local-forging 16.1.2 → 16.2.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/codec.js +25 -21
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/encoder.js +1 -1
- package/dist/lib/encoder.js.map +1 -1
- package/dist/lib/errors.js +162 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/michelson/codec.js +4 -3
- package/dist/lib/michelson/codec.js.map +1 -1
- package/dist/lib/schema/operation.js +7 -7
- package/dist/lib/schema/operation.js.map +1 -1
- package/dist/lib/taquito-local-forging.js +8 -6
- package/dist/lib/taquito-local-forging.js.map +1 -1
- package/dist/lib/uint8array-consumer.js +2 -2
- package/dist/lib/uint8array-consumer.js.map +1 -1
- package/dist/lib/version.js +2 -2
- package/dist/taquito-local-forging.es6.js +83 -87
- package/dist/taquito-local-forging.es6.js.map +1 -1
- package/dist/taquito-local-forging.umd.js +89 -94
- package/dist/taquito-local-forging.umd.js.map +1 -1
- package/dist/types/codec.d.ts +1 -1
- package/dist/types/errors.d.ts +97 -0
- package/package.json +5 -4
- package/dist/lib/error.js +0 -172
- package/dist/lib/error.js.map +0 -1
- package/dist/types/error.d.ts +0 -125
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/schema/operation.ts"],"names":[],"mappings":";;;AAEA,4CAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/schema/operation.ts"],"names":[],"mappings":";;;AAEA,4CAAsE;AACtE,wCAA0D;AAC1D,sCAImB;AAEN,QAAA,sBAAsB,GAAG;IACpC,MAAM,EAAE,iBAAK,CAAC,MAAM;IACpB,QAAQ,EAAE,CAAC,iBAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC9B,GAAG,EAAE,iBAAK,CAAC,GAAG;IACd,MAAM,EAAE,i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4C,EAAE,EAAE,CACjD,CAAC,KAAyB,EAAE,EAAE;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC/B,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YAE3C,MAAM,OAAO,GAAG,EAAE,CAAC;YACnB,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;gBACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;gBAE7B,IAAI,UAAU,KAAK,KAAK,CAAC,MAAM,EAAE,EAAE;oBACjC,MAAM,IAAI,+BAAsB,CAAC,wBAAwB,CAAC,CAAC;iBAC5D;aACF;YAED,uCACK,IAAI,KACP,CAAC,GAAG,CAAC,EAAE,OAAO,IACd;SACH;aAAM;YACL,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;YAExC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAE9B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;gBACjC,uCACK,IAAI,KACP,CAAC,GAAG,CAAC,EAAE,MAAM,IACb;aACH;iBAAM;gBACL,yBACK,IAAI,EACP;aACH;SACF;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AA1CS,QAAA,aAAa,iBA0CtB"}
|
|
@@ -20,9 +20,10 @@ const decoder_1 = require("./decoder");
|
|
|
20
20
|
const encoder_1 = require("./encoder");
|
|
21
21
|
const uint8array_consumer_1 = require("./uint8array-consumer");
|
|
22
22
|
const utils_1 = require("@taquito/utils");
|
|
23
|
-
const
|
|
23
|
+
const errors_1 = require("./errors");
|
|
24
24
|
const validator_1 = require("./validator");
|
|
25
25
|
const protocols_1 = require("./protocols");
|
|
26
|
+
const core_1 = require("@taquito/core");
|
|
26
27
|
var constants_2 = require("./constants");
|
|
27
28
|
Object.defineProperty(exports, "CODEC", { enumerable: true, get: function () { return constants_2.CODEC; } });
|
|
28
29
|
Object.defineProperty(exports, "opMapping", { enumerable: true, get: function () { return constants_2.opMapping; } });
|
|
@@ -52,12 +53,13 @@ class LocalForger {
|
|
|
52
53
|
this.codec = getCodec(constants_1.CODEC.MANAGER, this.protocolHash);
|
|
53
54
|
}
|
|
54
55
|
forge(params) {
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const branchValidation = utils_1.validateBlock(params.branch);
|
|
57
|
+
if (branchValidation !== utils_1.ValidationResult.VALID) {
|
|
58
|
+
throw new core_1.InvalidBlockHashError(params.branch, utils_1.invalidErrorDetail(branchValidation));
|
|
57
59
|
}
|
|
58
60
|
for (const content of params.contents) {
|
|
59
61
|
if (!validator_1.validateOperationKind(content.kind)) {
|
|
60
|
-
throw new
|
|
62
|
+
throw new core_1.InvalidOperationKindError(content.kind);
|
|
61
63
|
}
|
|
62
64
|
const diff = validator_1.validateMissingProperty(content);
|
|
63
65
|
if (diff.length === 1) {
|
|
@@ -78,11 +80,11 @@ class LocalForger {
|
|
|
78
80
|
continue;
|
|
79
81
|
}
|
|
80
82
|
else {
|
|
81
|
-
throw new
|
|
83
|
+
throw new errors_1.InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
else if (diff.length > 1) {
|
|
85
|
-
throw new
|
|
87
|
+
throw new errors_1.InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
const forged = this.codec.encoder(params).toLowerCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-local-forging.js","sourceRoot":"","sources":["../../src/taquito-local-forging.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;AAGH,2CAAoC;AACpC,uCAAqC;AACrC,uCAAqC;AACrC,+DAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"taquito-local-forging.js","sourceRoot":"","sources":["../../src/taquito-local-forging.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;AAGH,2CAAoC;AACpC,uCAAqC;AACrC,uCAAqC;AACrC,+DAA2D;AAC3D,0CAAqF;AACrF,qCAAuD;AACvD,2CAA6E;AAC7E,2CAA4C;AAC5C,wCAAiF;AAEjF,yCAAiE;AAAxD,kGAAA,KAAK,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC3C,4CAA0B;AAC1B,4CAA0B;AAC1B,wDAAsC;AACtC,8CAA4B;AAC5B,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAEtB,MAAM,gBAAgB,GAAG,yBAAa,CAAC,SAAS,CAAC;AAEjD,SAAgB,QAAQ,CAAC,KAAY,EAAE,MAAqB;IAC1D,OAAO;QACL,OAAO,EAAE,kBAAQ,CAAC,KAAK,CAAC;QACxB,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,wCAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YACvD,OAAO,kBAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAQ,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC;AARD,4BAQC;AAED,MAAa,WAAW;IACtB,YAA4B,eAAe,gBAAgB;QAA/B,iBAAY,GAAZ,YAAY,CAAmB;QAEnD,UAAK,GAAG,QAAQ,CAAC,iBAAK,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAFG,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aACF;iBAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,MAAM,IAAI,oCAA2B,CAAC,OAAO,EAAE,uBAAuB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAC3F;SACF;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QACxD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,GAAW;QACf,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAgB,CAAC,CAAC;IACjE,CAAC;CACF;AA7CD,kCA6CC;AAEY,QAAA,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Uint8ArrayConsumer = void 0;
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@taquito/core");
|
|
5
5
|
class Uint8ArrayConsumer {
|
|
6
6
|
constructor(arr, offset = 0) {
|
|
7
7
|
this.arr = arr;
|
|
@@ -14,7 +14,7 @@ class Uint8ArrayConsumer {
|
|
|
14
14
|
return new Uint8ArrayConsumer(arr);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
throw new
|
|
17
|
+
throw new core_1.InvalidHexStringError(lowHex);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
consume(count) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8array-consumer.js","sourceRoot":"","sources":["../../src/uint8array-consumer.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"uint8array-consumer.js","sourceRoot":"","sources":["../../src/uint8array-consumer.ts"],"names":[],"mappings":";;;AAAA,wCAAsD;AAE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}
|
package/dist/lib/version.js
CHANGED
|
@@ -3,7 +3,7 @@ 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": "
|
|
7
|
-
"version": "16.
|
|
6
|
+
"commitHash": "adc0f8c31492e8eb2f03b06ac36ba053e8ba6224",
|
|
7
|
+
"version": "16.2.0"
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Prefix, buf2hex, b58cdecode, prefix, prefixLength, b58cencode, InvalidKeyHashError,
|
|
1
|
+
import { Prefix, buf2hex, b58cdecode, prefix, prefixLength, b58cencode, InvalidKeyHashError, invalidErrorDetail, ValidationResult, InvalidPublicKeyError, validateBlock } from '@taquito/utils';
|
|
2
|
+
import { ParameterValidationError, InvalidHexStringError, InvalidAddressError, InvalidContractAddressError, InvalidOperationKindError, InvalidBlockHashError } from '@taquito/core';
|
|
2
3
|
import BigNumber$1, { BigNumber } from 'bignumber.js';
|
|
3
4
|
|
|
4
5
|
const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
|
|
@@ -284,155 +285,146 @@ const entrypointMappingReverse = (() => {
|
|
|
284
285
|
|
|
285
286
|
/**
|
|
286
287
|
* @category Error
|
|
287
|
-
* @description Error
|
|
288
|
-
*/
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this.message = message;
|
|
293
|
-
this.name = 'InvalidBlockHashError';
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* @category Error
|
|
298
|
-
* @description Error that indicates an invalid operation schema being passed or used
|
|
299
|
-
*/ class InvalidOperationSchemaError extends Error {
|
|
300
|
-
constructor(message) {
|
|
301
|
-
super(message);
|
|
302
|
-
this.message = message;
|
|
288
|
+
* @description Error indicates an invalid operation content being passed or used
|
|
289
|
+
*/ class InvalidOperationSchemaError extends ParameterValidationError {
|
|
290
|
+
constructor(operation, errorDetail) {
|
|
291
|
+
super();
|
|
292
|
+
this.operation = operation;
|
|
303
293
|
this.name = 'InvalidOperationSchemaError';
|
|
294
|
+
this.message = `Invalid operation content recevied`;
|
|
295
|
+
errorDetail ? (this.message += ` ${errorDetail}.`) : '';
|
|
304
296
|
}
|
|
305
297
|
}
|
|
306
298
|
/**
|
|
307
299
|
* @category Error
|
|
308
|
-
* @description Error
|
|
300
|
+
* @description Error indicates an entrypoint name exceeding maximum length
|
|
309
301
|
*/
|
|
310
|
-
class OversizedEntryPointError extends
|
|
302
|
+
class OversizedEntryPointError extends ParameterValidationError {
|
|
311
303
|
constructor(entrypoint) {
|
|
312
|
-
super(
|
|
304
|
+
super();
|
|
313
305
|
this.entrypoint = entrypoint;
|
|
314
306
|
this.name = 'OversizedEntryPointError';
|
|
307
|
+
this.message = `Invalid entrypoint length "${entrypoint.length}", maximum length is "${ENTRYPOINT_MAX_LENGTH}".`;
|
|
315
308
|
}
|
|
316
309
|
}
|
|
317
310
|
/**
|
|
318
311
|
* @category Error
|
|
319
|
-
* @description Error
|
|
312
|
+
* @description Error indicates an invalid ballot value being used
|
|
320
313
|
*/
|
|
321
|
-
class InvalidBallotValueError extends
|
|
314
|
+
class InvalidBallotValueError extends ParameterValidationError {
|
|
322
315
|
constructor(ballotValue) {
|
|
323
|
-
super(
|
|
316
|
+
super();
|
|
324
317
|
this.ballotValue = ballotValue;
|
|
325
318
|
this.name = 'InvalidBallotValueError';
|
|
319
|
+
this.message = `Invalid ballot value "${ballotValue}" expecting one of the following: "yay", "nay", "pass".`;
|
|
326
320
|
}
|
|
327
321
|
}
|
|
328
322
|
/**
|
|
329
323
|
* @category Error
|
|
330
|
-
* @description Error
|
|
324
|
+
* @description Error indicates a failure when trying to decode ballot value
|
|
331
325
|
*/
|
|
332
|
-
class DecodeBallotValueError extends
|
|
326
|
+
class DecodeBallotValueError extends ParameterValidationError {
|
|
333
327
|
constructor(ballotValue) {
|
|
334
|
-
super(
|
|
328
|
+
super();
|
|
335
329
|
this.ballotValue = ballotValue;
|
|
336
330
|
this.name = 'DecodeBallotValueError';
|
|
331
|
+
this.message = `Invalid ballot value "${ballotValue}", cannot be decoded.`;
|
|
337
332
|
}
|
|
338
333
|
}
|
|
339
334
|
/**
|
|
340
335
|
* @category Error
|
|
341
|
-
* @description Error
|
|
336
|
+
* @description Error indicates unexpected Michelson Value being passed or used
|
|
342
337
|
*/
|
|
343
|
-
class
|
|
344
|
-
constructor(hexString) {
|
|
345
|
-
super(`The hex string '${hexString}' is invalid`);
|
|
346
|
-
this.hexString = hexString;
|
|
347
|
-
this.name = 'InvalidHexStringError';
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* @category Error
|
|
352
|
-
* @description Error that indicates unexpected Michelson Value being passed or used
|
|
353
|
-
*/
|
|
354
|
-
class UnexpectedMichelsonValueError extends Error {
|
|
338
|
+
class UnexpectedMichelsonValueError extends ParameterValidationError {
|
|
355
339
|
constructor(value) {
|
|
356
|
-
super(
|
|
340
|
+
super();
|
|
357
341
|
this.value = value;
|
|
358
342
|
this.name = 'UnexpectedMichelsonValueError';
|
|
343
|
+
this.message = `Invalid Michelson value "${value}", unalbe to encode.`;
|
|
359
344
|
}
|
|
360
345
|
}
|
|
361
346
|
/**
|
|
362
347
|
* @category Error
|
|
363
|
-
* @description Error
|
|
348
|
+
* @description Error indicates a failure when trying to decode an operation
|
|
364
349
|
*/
|
|
365
|
-
class OperationDecodingError extends
|
|
350
|
+
class OperationDecodingError extends ParameterValidationError {
|
|
366
351
|
constructor(message) {
|
|
367
|
-
super(
|
|
352
|
+
super();
|
|
368
353
|
this.message = message;
|
|
369
354
|
this.name = 'OperationDecodingError';
|
|
370
355
|
}
|
|
371
356
|
}
|
|
372
357
|
/**
|
|
373
358
|
* @category Error
|
|
374
|
-
* @description Error
|
|
359
|
+
* @description Error indicates a failure when trying to encode an operation
|
|
375
360
|
*/
|
|
376
|
-
class OperationEncodingError extends
|
|
361
|
+
class OperationEncodingError extends ParameterValidationError {
|
|
377
362
|
constructor(message) {
|
|
378
|
-
super(
|
|
363
|
+
super();
|
|
379
364
|
this.message = message;
|
|
380
365
|
this.name = 'OperationEncodingError';
|
|
381
366
|
}
|
|
382
367
|
}
|
|
383
368
|
/**
|
|
384
369
|
* @category Error
|
|
385
|
-
* @description Error
|
|
370
|
+
* @description Error indicates an unsupported operation being passed or used
|
|
386
371
|
*/
|
|
387
|
-
class UnsupportedOperationError extends
|
|
372
|
+
class UnsupportedOperationError extends ParameterValidationError {
|
|
388
373
|
constructor(op) {
|
|
389
|
-
super(
|
|
374
|
+
super();
|
|
390
375
|
this.op = op;
|
|
391
376
|
this.name = 'UnsupportedOperationError';
|
|
377
|
+
this.message = `Unsupported operation "${op}", can submit an issue on our github for feature request.`;
|
|
392
378
|
}
|
|
393
379
|
}
|
|
394
380
|
/**
|
|
395
381
|
* @cateogry Error
|
|
396
|
-
* @description Error
|
|
382
|
+
* @description Error indicates an unsupported pvm being passed or used
|
|
397
383
|
*/
|
|
398
|
-
class UnsupportedPvmKindError extends
|
|
384
|
+
class UnsupportedPvmKindError extends ParameterValidationError {
|
|
399
385
|
constructor(pvm) {
|
|
400
|
-
super(
|
|
386
|
+
super();
|
|
401
387
|
this.pvm = pvm;
|
|
402
388
|
this.name = 'UnsupportedPvmKindError';
|
|
389
|
+
this.message = `Invalid Pvm kind "${pvm}" expecting either "arith" or "wasm_2_0_0".`;
|
|
403
390
|
}
|
|
404
391
|
}
|
|
405
392
|
/**
|
|
406
393
|
* @category Error
|
|
407
|
-
* @description Error
|
|
394
|
+
* @description Error indicates an unsupported pvm to decode
|
|
408
395
|
*/
|
|
409
|
-
class DecodePvmKindError extends
|
|
396
|
+
class DecodePvmKindError extends ParameterValidationError {
|
|
410
397
|
constructor(pvm) {
|
|
411
|
-
super(
|
|
398
|
+
super();
|
|
412
399
|
this.pvm = pvm;
|
|
413
400
|
this.name = 'DecodePvmKindError';
|
|
401
|
+
this.message = `Invalid Pvm kind "${pvm}", cannot be decoded.`;
|
|
414
402
|
}
|
|
415
403
|
}
|
|
416
404
|
/**
|
|
417
405
|
* @category Error
|
|
418
|
-
* @description Error
|
|
406
|
+
* @description Error indicates an invalid Smart Rollup Address (sr1)
|
|
419
407
|
*/
|
|
420
|
-
class InvalidSmartRollupAddressError extends
|
|
421
|
-
constructor(address) {
|
|
422
|
-
super(
|
|
408
|
+
class InvalidSmartRollupAddressError extends ParameterValidationError {
|
|
409
|
+
constructor(address, errorDetail) {
|
|
410
|
+
super();
|
|
423
411
|
this.address = address;
|
|
424
|
-
this.name = '
|
|
412
|
+
this.name = 'InvalidSmartRollupAddress';
|
|
413
|
+
this.message = `Invalid smart rollup address "${address}"`;
|
|
414
|
+
errorDetail ? (this.message += ` ${errorDetail}.`) : '';
|
|
425
415
|
}
|
|
426
416
|
}
|
|
427
417
|
/**
|
|
428
418
|
* @category Error
|
|
429
|
-
* @description Error
|
|
419
|
+
* @description Error indicates an invalid Smart Rollup commitment hash (src1)
|
|
430
420
|
*/
|
|
431
|
-
class
|
|
432
|
-
constructor(
|
|
433
|
-
super(
|
|
434
|
-
this.
|
|
435
|
-
this.name = '
|
|
421
|
+
class InvalidSmartRollupCommitmentHashError extends ParameterValidationError {
|
|
422
|
+
constructor(hash, errorDetail) {
|
|
423
|
+
super();
|
|
424
|
+
this.hash = hash;
|
|
425
|
+
this.name = 'InvalidSmartRollupCommitmentHashError';
|
|
426
|
+
this.message = `Invalid smart rollup commitment hash "${hash}"`;
|
|
427
|
+
errorDetail ? (this.message += ` ${errorDetail}.`) : '';
|
|
436
428
|
}
|
|
437
429
|
}
|
|
438
430
|
|
|
@@ -872,7 +864,8 @@ const pkhEncoder = (val) => {
|
|
|
872
864
|
case Prefix.TZ4:
|
|
873
865
|
return '03' + prefixEncoder(Prefix.TZ4)(val);
|
|
874
866
|
default:
|
|
875
|
-
throw new InvalidKeyHashError(val)
|
|
867
|
+
throw new InvalidKeyHashError(val, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) +
|
|
868
|
+
` expecting one for the following "${Prefix.TZ1}", "${Prefix.TZ2}", "${Prefix.TZ3}" or "${Prefix.TZ4}".`);
|
|
876
869
|
}
|
|
877
870
|
};
|
|
878
871
|
const publicKeyEncoder = (val) => {
|
|
@@ -885,7 +878,8 @@ const publicKeyEncoder = (val) => {
|
|
|
885
878
|
case Prefix.P2PK:
|
|
886
879
|
return '02' + prefixEncoder(Prefix.P2PK)(val);
|
|
887
880
|
default:
|
|
888
|
-
throw new InvalidPublicKeyError(val)
|
|
881
|
+
throw new InvalidPublicKeyError(val, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) +
|
|
882
|
+
` expecting one of the following '${Prefix.EDPK}', '${Prefix.SPPK}', '${Prefix.P2PK}' or '${Prefix.BLPK}'.`);
|
|
889
883
|
}
|
|
890
884
|
};
|
|
891
885
|
const addressEncoder = (val) => {
|
|
@@ -899,12 +893,13 @@ const addressEncoder = (val) => {
|
|
|
899
893
|
case Prefix.KT1:
|
|
900
894
|
return '01' + prefixEncoder(Prefix.KT1)(val) + '00';
|
|
901
895
|
default:
|
|
902
|
-
throw new InvalidAddressError(val)
|
|
896
|
+
throw new InvalidAddressError(val, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) +
|
|
897
|
+
` expecting one of the following prefix '${Prefix.TZ1}', ${Prefix.TZ2}', '${Prefix.TZ3}', '${Prefix.TZ4}' or '${Prefix.KT1}'.`);
|
|
903
898
|
}
|
|
904
899
|
};
|
|
905
900
|
const smartRollupAddressEncoder = (val) => {
|
|
906
901
|
if (val.substring(0, 3) !== Prefix.SR1) {
|
|
907
|
-
throw new InvalidSmartRollupAddressError(val);
|
|
902
|
+
throw new InvalidSmartRollupAddressError(val, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SR1}'.`);
|
|
908
903
|
}
|
|
909
904
|
return prefixEncoder(Prefix.SR1)(val);
|
|
910
905
|
};
|
|
@@ -913,7 +908,7 @@ const smartContractAddressEncoder = (val) => {
|
|
|
913
908
|
if (prefix === Prefix.KT1) {
|
|
914
909
|
return '01' + prefixEncoder(Prefix.KT1)(val) + '00';
|
|
915
910
|
}
|
|
916
|
-
throw new InvalidContractAddressError(val);
|
|
911
|
+
throw new InvalidContractAddressError(val, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.KT1}'.`);
|
|
917
912
|
};
|
|
918
913
|
const publicKeyDecoder = (val) => {
|
|
919
914
|
const preamble = val.consume(1);
|
|
@@ -925,15 +920,15 @@ const publicKeyDecoder = (val) => {
|
|
|
925
920
|
case 0x02:
|
|
926
921
|
return prefixDecoder(Prefix.P2PK)(val);
|
|
927
922
|
default:
|
|
928
|
-
throw new InvalidPublicKeyError(val.toString());
|
|
923
|
+
throw new InvalidPublicKeyError(val.toString(), invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED));
|
|
929
924
|
}
|
|
930
925
|
};
|
|
931
|
-
const
|
|
926
|
+
const smartRollupCommitmentHashEncoder = (val) => {
|
|
932
927
|
const prefix = val.substring(0, 4);
|
|
933
928
|
if (prefix === Prefix.SRC1) {
|
|
934
929
|
return prefixEncoder(Prefix.SRC1)(val);
|
|
935
930
|
}
|
|
936
|
-
throw new
|
|
931
|
+
throw new InvalidSmartRollupCommitmentHashError(val, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SRC1}'`);
|
|
937
932
|
};
|
|
938
933
|
const addressDecoder = (val) => {
|
|
939
934
|
const preamble = val.consume(1);
|
|
@@ -946,13 +941,13 @@ const addressDecoder = (val) => {
|
|
|
946
941
|
return address;
|
|
947
942
|
}
|
|
948
943
|
default:
|
|
949
|
-
throw new InvalidAddressError(val.toString());
|
|
944
|
+
throw new InvalidAddressError(val.toString(), ': Unable to decode.');
|
|
950
945
|
}
|
|
951
946
|
};
|
|
952
947
|
const smartRollupAddressDecoder = (val) => {
|
|
953
948
|
const address = prefixDecoder(Prefix.SR1)(val);
|
|
954
949
|
if (address.substring(0, 3) !== Prefix.SR1) {
|
|
955
|
-
throw new
|
|
950
|
+
throw new InvalidSmartRollupAddressError(address, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SR1}'.`);
|
|
956
951
|
}
|
|
957
952
|
return address;
|
|
958
953
|
};
|
|
@@ -963,12 +958,12 @@ const smartContractAddressDecoder = (val) => {
|
|
|
963
958
|
val.consume(1);
|
|
964
959
|
return scAddress;
|
|
965
960
|
}
|
|
966
|
-
throw new InvalidContractAddressError(val.toString());
|
|
961
|
+
throw new InvalidContractAddressError(val.toString(), invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED));
|
|
967
962
|
};
|
|
968
963
|
const smartRollupCommitmentHashDecoder = (val) => {
|
|
969
964
|
const address = prefixDecoder(Prefix.SRC1)(val);
|
|
970
965
|
if (address.substring(0, 4) !== Prefix.SRC1) {
|
|
971
|
-
throw new
|
|
966
|
+
throw new InvalidSmartRollupCommitmentHashError(address, invalidErrorDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SRC1}'`);
|
|
972
967
|
}
|
|
973
968
|
return address;
|
|
974
969
|
};
|
|
@@ -1307,7 +1302,7 @@ const operationDecoder = (decoders) => (value) => {
|
|
|
1307
1302
|
}
|
|
1308
1303
|
const decodedObj = decoders[operationName](value);
|
|
1309
1304
|
if (typeof decodedObj !== 'object') {
|
|
1310
|
-
throw new OperationDecodingError('
|
|
1305
|
+
throw new OperationDecodingError('Invalid operation, cannot be decoded.');
|
|
1311
1306
|
}
|
|
1312
1307
|
return Object.assign({ kind: operationName }, decodedObj);
|
|
1313
1308
|
};
|
|
@@ -1319,7 +1314,7 @@ const schemaEncoder = (encoders) => (schema) => (value) => {
|
|
|
1319
1314
|
const encoder = encoders[valueToEncode[0]];
|
|
1320
1315
|
const values = value[key];
|
|
1321
1316
|
if (!Array.isArray(values)) {
|
|
1322
|
-
throw new OperationEncodingError(`
|
|
1317
|
+
throw new OperationEncodingError(`Invalid operation value "${JSON.stringify(values)}" of key "${key}, expected value to be Array.`);
|
|
1323
1318
|
}
|
|
1324
1319
|
return prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), '');
|
|
1325
1320
|
}
|
|
@@ -1431,7 +1426,7 @@ const encoders = {
|
|
|
1431
1426
|
[CODEC.ADDRESS]: addressEncoder,
|
|
1432
1427
|
[CODEC.SMART_ROLLUP_ADDRESS]: smartRollupAddressEncoder,
|
|
1433
1428
|
[CODEC.SMART_CONTRACT_ADDRESS]: smartContractAddressEncoder,
|
|
1434
|
-
[CODEC.SMART_ROLLUP_COMMITMENT_HASH]:
|
|
1429
|
+
[CODEC.SMART_ROLLUP_COMMITMENT_HASH]: smartRollupCommitmentHashEncoder,
|
|
1435
1430
|
[CODEC.VALUE]: valueParameterEncoder,
|
|
1436
1431
|
[CODEC.INT16]: int16Encoder,
|
|
1437
1432
|
[CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder,
|
|
@@ -1540,8 +1535,8 @@ var ProtocolsHash;
|
|
|
1540
1535
|
|
|
1541
1536
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
1542
1537
|
const VERSION = {
|
|
1543
|
-
"commitHash": "
|
|
1544
|
-
"version": "16.
|
|
1538
|
+
"commitHash": "adc0f8c31492e8eb2f03b06ac36ba053e8ba6224",
|
|
1539
|
+
"version": "16.2.0"
|
|
1545
1540
|
};
|
|
1546
1541
|
|
|
1547
1542
|
/**
|
|
@@ -1564,8 +1559,9 @@ class LocalForger {
|
|
|
1564
1559
|
this.codec = getCodec(CODEC.MANAGER, this.protocolHash);
|
|
1565
1560
|
}
|
|
1566
1561
|
forge(params) {
|
|
1567
|
-
|
|
1568
|
-
|
|
1562
|
+
const branchValidation = validateBlock(params.branch);
|
|
1563
|
+
if (branchValidation !== ValidationResult.VALID) {
|
|
1564
|
+
throw new InvalidBlockHashError(params.branch, invalidErrorDetail(branchValidation));
|
|
1569
1565
|
}
|
|
1570
1566
|
for (const content of params.contents) {
|
|
1571
1567
|
if (!validateOperationKind(content.kind)) {
|
|
@@ -1590,11 +1586,11 @@ class LocalForger {
|
|
|
1590
1586
|
continue;
|
|
1591
1587
|
}
|
|
1592
1588
|
else {
|
|
1593
|
-
throw new InvalidOperationSchemaError(`
|
|
1589
|
+
throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
1594
1590
|
}
|
|
1595
1591
|
}
|
|
1596
1592
|
else if (diff.length > 1) {
|
|
1597
|
-
throw new InvalidOperationSchemaError(`
|
|
1593
|
+
throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
1598
1594
|
}
|
|
1599
1595
|
}
|
|
1600
1596
|
const forged = this.codec.encoder(params).toLowerCase();
|