@taquito/local-forging 23.0.0-beta.0 → 23.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/codec.js CHANGED
@@ -12,29 +12,30 @@ const utils_2 = require("./utils");
12
12
  const core_1 = require("@taquito/core");
13
13
  // https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
14
14
  const prefixEncoder = (prefix) => (str) => {
15
- return (0, utils_1.buf2hex)(Buffer.from((0, utils_1.b58cdecode)(str, utils_1.prefix[prefix])));
15
+ const [pl] = (0, utils_1.b58DecodeAndCheckPrefix)(str, [prefix]);
16
+ return (0, utils_1.buf2hex)(pl);
16
17
  };
17
18
  exports.prefixEncoder = prefixEncoder;
18
19
  const prefixDecoder = (pre) => (str) => {
19
- const val = str.consume(utils_1.prefixLength[pre]);
20
- return (0, utils_1.b58cencode)(val, utils_1.prefix[pre]);
20
+ const val = str.consume(utils_1.payloadLength[pre]);
21
+ return (0, utils_1.b58Encode)(val, pre);
21
22
  };
22
23
  exports.prefixDecoder = prefixDecoder;
23
- exports.tz1Decoder = (0, exports.prefixDecoder)(utils_1.Prefix.TZ1);
24
- exports.branchDecoder = (0, exports.prefixDecoder)(utils_1.Prefix.B);
24
+ exports.tz1Decoder = (0, exports.prefixDecoder)(utils_1.PrefixV2.Ed25519PublicKeyHash);
25
+ exports.branchDecoder = (0, exports.prefixDecoder)(utils_1.PrefixV2.BlockHash);
25
26
  const publicKeyHashDecoder = (val) => {
26
27
  const prefix = val.consume(1);
27
28
  if (prefix[0] === 0x00) {
28
- return (0, exports.prefixDecoder)(utils_1.Prefix.TZ1)(val);
29
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.Ed25519PublicKeyHash)(val);
29
30
  }
30
31
  else if (prefix[0] === 0x01) {
31
- return (0, exports.prefixDecoder)(utils_1.Prefix.TZ2)(val);
32
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.Secp256k1PublicKeyHash)(val);
32
33
  }
33
34
  else if (prefix[0] === 0x02) {
34
- return (0, exports.prefixDecoder)(utils_1.Prefix.TZ3)(val);
35
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.P256PublicKeyHash)(val);
35
36
  }
36
37
  else if (prefix[0] === 0x03) {
37
- return (0, exports.prefixDecoder)(utils_1.Prefix.TZ4)(val);
38
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.BLS12_381PublicKeyHash)(val);
38
39
  }
39
40
  };
40
41
  exports.publicKeyHashDecoder = publicKeyHashDecoder;
@@ -50,16 +51,16 @@ const publicKeyHashesDecoder = (val) => {
50
51
  return publicKeyHashes;
51
52
  };
52
53
  exports.publicKeyHashesDecoder = publicKeyHashesDecoder;
53
- exports.branchEncoder = (0, exports.prefixEncoder)(utils_1.Prefix.B);
54
- exports.tz1Encoder = (0, exports.prefixEncoder)(utils_1.Prefix.TZ1);
54
+ exports.branchEncoder = (0, exports.prefixEncoder)(utils_1.PrefixV2.BlockHash);
55
+ exports.tz1Encoder = (0, exports.prefixEncoder)(utils_1.PrefixV2.Ed25519PublicKeyHash);
55
56
  const boolEncoder = (bool) => (bool ? 'ff' : '00');
56
57
  exports.boolEncoder = boolEncoder;
57
58
  const proposalEncoder = (proposal) => {
58
- return (0, exports.prefixEncoder)(utils_1.Prefix.P)(proposal);
59
+ return (0, exports.prefixEncoder)(utils_1.PrefixV2.ProtocolHash)(proposal);
59
60
  };
60
61
  exports.proposalEncoder = proposalEncoder;
61
62
  const proposalDecoder = (proposal) => {
62
- return (0, exports.prefixDecoder)(utils_1.Prefix.P)(proposal);
63
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.ProtocolHash)(proposal);
63
64
  };
64
65
  exports.proposalDecoder = proposalDecoder;
65
66
  const proposalsDecoder = (proposal) => {
@@ -189,19 +190,11 @@ const delegateDecoder = (val) => {
189
190
  };
190
191
  exports.delegateDecoder = delegateDecoder;
191
192
  const publicKeyHashEncoder = (val) => {
192
- const pubkeyPrefix = val.substring(0, 3);
193
- switch (pubkeyPrefix) {
194
- case utils_1.Prefix.TZ1:
195
- return '00' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ1)(val);
196
- case utils_1.Prefix.TZ2:
197
- return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ2)(val);
198
- case utils_1.Prefix.TZ3:
199
- return '02' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ3)(val);
200
- case utils_1.Prefix.TZ4:
201
- return '03' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ4)(val);
202
- default:
203
- throw new utils_1.InvalidKeyHashError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) +
204
- ` expecting one for the following "${utils_1.Prefix.TZ1}", "${utils_1.Prefix.TZ2}", "${utils_1.Prefix.TZ3}" or "${utils_1.Prefix.TZ4}".`);
193
+ try {
194
+ return (0, utils_1.b58DecodePublicKeyHash)(val);
195
+ }
196
+ catch (err) {
197
+ throw new core_1.InvalidKeyHashError(val, err instanceof core_1.ParameterValidationError ? err.result : undefined);
205
198
  }
206
199
  };
207
200
  exports.publicKeyHashEncoder = publicKeyHashEncoder;
@@ -219,75 +212,62 @@ const publicKeyHashesEncoder = (val) => {
219
212
  };
220
213
  exports.publicKeyHashesEncoder = publicKeyHashesEncoder;
221
214
  const publicKeyEncoder = (val) => {
222
- const pubkeyPrefix = val.substring(0, 4);
223
- switch (pubkeyPrefix) {
224
- case utils_1.Prefix.EDPK:
225
- return '00' + (0, exports.prefixEncoder)(utils_1.Prefix.EDPK)(val);
226
- case utils_1.Prefix.SPPK:
227
- return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.SPPK)(val);
228
- case utils_1.Prefix.P2PK:
229
- return '02' + (0, exports.prefixEncoder)(utils_1.Prefix.P2PK)(val);
230
- case utils_1.Prefix.BLPK:
231
- return '03' + (0, exports.prefixEncoder)(utils_1.Prefix.BLPK)(val);
232
- default:
233
- throw new utils_1.InvalidPublicKeyError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) +
234
- ` expecting one of the following '${utils_1.Prefix.EDPK}', '${utils_1.Prefix.SPPK}', '${utils_1.Prefix.P2PK}' or '${utils_1.Prefix.BLPK}'.`);
215
+ try {
216
+ return (0, utils_1.b58DecodePublicKey)(val);
217
+ }
218
+ catch (err) {
219
+ throw new utils_1.InvalidPublicKeyError(val, err instanceof core_1.ParameterValidationError ? err.result : undefined);
235
220
  }
236
221
  };
237
222
  exports.publicKeyEncoder = publicKeyEncoder;
238
223
  const addressEncoder = (val) => {
239
- const pubkeyPrefix = val.substring(0, 3);
240
- switch (pubkeyPrefix) {
241
- case utils_1.Prefix.TZ1:
242
- case utils_1.Prefix.TZ2:
243
- case utils_1.Prefix.TZ3:
244
- case utils_1.Prefix.TZ4:
245
- return '00' + (0, exports.publicKeyHashEncoder)(val);
246
- case utils_1.Prefix.KT1:
247
- return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.KT1)(val) + '00';
248
- default:
249
- throw new core_1.InvalidAddressError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) +
250
- ` expecting one of the following prefix '${utils_1.Prefix.TZ1}', ${utils_1.Prefix.TZ2}', '${utils_1.Prefix.TZ3}', '${utils_1.Prefix.TZ4}' or '${utils_1.Prefix.KT1}'.`);
251
- }
224
+ return (0, utils_1.b58DecodeAddress)(val);
252
225
  };
253
226
  exports.addressEncoder = addressEncoder;
254
227
  const smartRollupAddressEncoder = (val) => {
255
- if (val.substring(0, 3) !== utils_1.Prefix.SR1) {
256
- throw new errors_1.InvalidSmartRollupAddressError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SR1}'.`);
228
+ try {
229
+ return (0, exports.prefixEncoder)(utils_1.PrefixV2.SmartRollupHash)(val);
257
230
  }
258
- return (0, exports.prefixEncoder)(utils_1.Prefix.SR1)(val);
259
- };
260
- exports.smartRollupAddressEncoder = smartRollupAddressEncoder;
261
- const smartContractAddressEncoder = (val) => {
262
- const prefix = val.substring(0, 3);
263
- if (prefix === utils_1.Prefix.KT1) {
264
- return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.KT1)(val) + '00';
231
+ catch (err) {
232
+ if (err instanceof core_1.ParameterValidationError) {
233
+ throw new errors_1.InvalidSmartRollupAddressError(val);
234
+ }
235
+ else {
236
+ throw err;
237
+ }
265
238
  }
266
- throw new core_1.InvalidContractAddressError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.KT1}'.`);
267
239
  };
240
+ exports.smartRollupAddressEncoder = smartRollupAddressEncoder;
241
+ const smartContractAddressEncoder = (val) => (0, utils_1.b58DecodeAddress)(val);
268
242
  exports.smartContractAddressEncoder = smartContractAddressEncoder;
269
243
  const publicKeyDecoder = (val) => {
270
244
  const preamble = val.consume(1);
271
245
  switch (preamble[0]) {
272
246
  case 0x00:
273
- return (0, exports.prefixDecoder)(utils_1.Prefix.EDPK)(val);
247
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.Ed25519PublicKey)(val);
274
248
  case 0x01:
275
- return (0, exports.prefixDecoder)(utils_1.Prefix.SPPK)(val);
249
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.Secp256k1PublicKey)(val);
276
250
  case 0x02:
277
- return (0, exports.prefixDecoder)(utils_1.Prefix.P2PK)(val);
251
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.P256PublicKey)(val);
278
252
  case 0x03:
279
- return (0, exports.prefixDecoder)(utils_1.Prefix.BLPK)(val);
253
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.BLS12_381PublicKey)(val);
280
254
  default:
281
- throw new utils_1.InvalidPublicKeyError(val.toString(), (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED));
255
+ throw new utils_1.InvalidPublicKeyError(undefined, utils_1.ValidationResult.NO_PREFIX_MATCHED);
282
256
  }
283
257
  };
284
258
  exports.publicKeyDecoder = publicKeyDecoder;
285
259
  const smartRollupCommitmentHashEncoder = (val) => {
286
- const prefix = val.substring(0, 4);
287
- if (prefix === utils_1.Prefix.SRC1) {
288
- return (0, exports.prefixEncoder)(utils_1.Prefix.SRC1)(val);
260
+ try {
261
+ return (0, exports.prefixEncoder)(utils_1.PrefixV2.SmartRollupCommitmentHash)(val);
262
+ }
263
+ catch (err) {
264
+ if (err instanceof core_1.ParameterValidationError) {
265
+ throw new errors_1.InvalidSmartRollupCommitmentHashError(val);
266
+ }
267
+ else {
268
+ throw err;
269
+ }
289
270
  }
290
- throw new errors_1.InvalidSmartRollupCommitmentHashError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SRC1}'`);
291
271
  };
292
272
  exports.smartRollupCommitmentHashEncoder = smartRollupCommitmentHashEncoder;
293
273
  const addressDecoder = (val) => {
@@ -296,7 +276,7 @@ const addressDecoder = (val) => {
296
276
  case 0x00:
297
277
  return (0, exports.publicKeyHashDecoder)(val);
298
278
  case 0x01: {
299
- const address = (0, exports.prefixDecoder)(utils_1.Prefix.KT1)(val);
279
+ const address = (0, exports.prefixDecoder)(utils_1.PrefixV2.ContractHash)(val);
300
280
  val.consume(1);
301
281
  return address;
302
282
  }
@@ -306,29 +286,21 @@ const addressDecoder = (val) => {
306
286
  };
307
287
  exports.addressDecoder = addressDecoder;
308
288
  const smartRollupAddressDecoder = (val) => {
309
- const address = (0, exports.prefixDecoder)(utils_1.Prefix.SR1)(val);
310
- if (address.substring(0, 3) !== utils_1.Prefix.SR1) {
311
- throw new errors_1.InvalidSmartRollupAddressError(address, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SR1}'.`);
312
- }
313
- return address;
289
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.SmartRollupHash)(val);
314
290
  };
315
291
  exports.smartRollupAddressDecoder = smartRollupAddressDecoder;
316
292
  const smartContractAddressDecoder = (val) => {
317
293
  const preamble = val.consume(1);
318
294
  if (preamble[0] === 0x01) {
319
- const scAddress = (0, exports.prefixDecoder)(utils_1.Prefix.KT1)(val);
295
+ const scAddress = (0, exports.prefixDecoder)(utils_1.PrefixV2.ContractHash)(val);
320
296
  val.consume(1);
321
297
  return scAddress;
322
298
  }
323
- throw new core_1.InvalidContractAddressError(val.toString(), (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED));
299
+ throw new core_1.InvalidContractAddressError(val.toString(), utils_1.ValidationResult.NO_PREFIX_MATCHED);
324
300
  };
325
301
  exports.smartContractAddressDecoder = smartContractAddressDecoder;
326
302
  const smartRollupCommitmentHashDecoder = (val) => {
327
- const address = (0, exports.prefixDecoder)(utils_1.Prefix.SRC1)(val);
328
- if (address.substring(0, 4) !== utils_1.Prefix.SRC1) {
329
- throw new errors_1.InvalidSmartRollupCommitmentHashError(address, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SRC1}'`);
330
- }
331
- return address;
303
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.SmartRollupCommitmentHash)(val);
332
304
  };
333
305
  exports.smartRollupCommitmentHashDecoder = smartRollupCommitmentHashDecoder;
334
306
  const zarithEncoder = (n) => {
@@ -435,8 +407,8 @@ const valueParameterDecoder = (val) => {
435
407
  return (0, codec_1.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(value));
436
408
  };
437
409
  exports.valueParameterDecoder = valueParameterDecoder;
438
- exports.blockPayloadHashEncoder = (0, exports.prefixEncoder)(utils_1.Prefix.VH);
439
- exports.blockPayloadHashDecoder = (0, exports.prefixDecoder)(utils_1.Prefix.VH);
410
+ exports.blockPayloadHashEncoder = (0, exports.prefixEncoder)(utils_1.PrefixV2.ValueHash);
411
+ exports.blockPayloadHashDecoder = (0, exports.prefixDecoder)(utils_1.PrefixV2.ValueHash);
440
412
  const entrypointNameEncoder = (entrypoint) => {
441
413
  const value = { string: entrypoint };
442
414
  return `${(0, codec_1.valueEncoder)(value).slice(2)}`;
@@ -470,21 +442,31 @@ const depositsLimitDecoder = (value) => {
470
442
  };
471
443
  exports.depositsLimitDecoder = depositsLimitDecoder;
472
444
  const signatureV1Encoder = (val) => {
473
- const signaturePrefix = val.substring(0, 5);
474
- if (signaturePrefix === utils_1.Prefix.BLSIG) {
475
- return (0, exports.paddedBytesEncoder)((0, exports.prefixEncoder)(utils_1.Prefix.BLSIG)(val));
445
+ try {
446
+ const [data, pre] = (0, utils_1.b58DecodeAndCheckPrefix)(val, utils_1.signaturePrefixes);
447
+ if (pre === utils_1.PrefixV2.BLS12_381Signature) {
448
+ return (0, exports.paddedBytesEncoder)((0, utils_1.buf2hex)(data));
449
+ }
450
+ else {
451
+ throw new core_1.ProhibitedActionError('we only support encoding of BLSIG signatures from protocol Seoul');
452
+ }
476
453
  }
477
- else {
478
- throw new core_1.ProhibitedActionError('currently we only support encoding of BLSIG signatures');
454
+ catch (err) {
455
+ if (err instanceof core_1.ParameterValidationError) {
456
+ throw new core_1.InvalidSignatureError(val, err.result);
457
+ }
458
+ else {
459
+ throw err;
460
+ }
479
461
  }
480
462
  };
481
463
  const signatureV1Decoder = (val) => {
482
464
  val.consume(4);
483
465
  if (val.length().toString() === '96') {
484
- return (0, exports.prefixDecoder)(utils_1.Prefix.BLSIG)(val);
466
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.BLS12_381Signature)(val);
485
467
  }
486
468
  else {
487
- throw new core_1.ProhibitedActionError('currently we only support decoding of BLSIG signatures');
469
+ throw new core_1.ProhibitedActionError('we only support decoding of BLSIG signatures');
488
470
  }
489
471
  };
490
472
  const signatureProofEncoder = (val) => {
@@ -526,19 +508,21 @@ const smartRollupMessageDecoder = (val) => {
526
508
  };
527
509
  exports.smartRollupMessageDecoder = smartRollupMessageDecoder;
528
510
  const dalCommitmentEncoder = (val) => {
529
- const prefix = val.substring(0, 2);
530
- if (prefix === utils_1.Prefix.SH) {
531
- return (0, exports.prefixEncoder)(utils_1.Prefix.SH)(val);
511
+ try {
512
+ return (0, exports.prefixEncoder)(utils_1.PrefixV2.SlotHeader)(val);
513
+ }
514
+ catch (err) {
515
+ if (err instanceof core_1.ParameterValidationError) {
516
+ throw new errors_1.InvalidDalCommitmentError(val);
517
+ }
518
+ else {
519
+ throw err;
520
+ }
532
521
  }
533
- throw new errors_1.InvalidDalCommitmentError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SH}'`);
534
522
  };
535
523
  exports.dalCommitmentEncoder = dalCommitmentEncoder;
536
524
  const dalCommitmentDecoder = (val) => {
537
- const commitment = (0, exports.prefixDecoder)(utils_1.Prefix.SH)(val);
538
- if (commitment.substring(0, 2) !== utils_1.Prefix.SH) {
539
- throw new errors_1.InvalidDalCommitmentError(commitment, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SH}'`);
540
- }
541
- return commitment;
525
+ return (0, exports.prefixDecoder)(utils_1.PrefixV2.SlotHeader)(val);
542
526
  };
543
527
  exports.dalCommitmentDecoder = dalCommitmentDecoder;
544
528
  const slotHeaderEncoder = (val) => {
@@ -81,7 +81,7 @@ class LocalForger {
81
81
  forge(params) {
82
82
  const branchValidation = (0, utils_1.validateBlock)(params.branch);
83
83
  if (branchValidation !== utils_1.ValidationResult.VALID) {
84
- throw new core_1.InvalidBlockHashError(params.branch, (0, utils_1.invalidDetail)(branchValidation));
84
+ throw new core_1.InvalidBlockHashError(params.branch, branchValidation);
85
85
  }
86
86
  for (const content of params.contents) {
87
87
  if (!(0, validator_1.validateOperationKind)(content.kind)) {
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
5
5
  exports.VERSION = {
6
- "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
7
- "version": "23.0.0-beta.0"
6
+ "commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
7
+ "version": "23.0.0-beta.1"
8
8
  };
@@ -1,5 +1,5 @@
1
- import { Prefix, buf2hex, b58cdecode, prefix, prefixLength, b58cencode, InvalidKeyHashError, invalidDetail, ValidationResult, InvalidPublicKeyError, validateBlock } from '@taquito/utils';
2
- import { ParameterValidationError, InvalidHexStringError, InvalidAddressError, InvalidContractAddressError, ProhibitedActionError, InvalidOperationKindError, InvalidSignatureError, InvalidBlockHashError } from '@taquito/core';
1
+ import { PrefixV2, b58DecodeAndCheckPrefix, buf2hex, payloadLength, b58Encode, b58DecodePublicKeyHash, b58DecodePublicKey, InvalidPublicKeyError, b58DecodeAddress, ValidationResult, signaturePrefixes, Prefix, b58cdecode, prefix, prefixLength, b58cencode, InvalidKeyHashError as InvalidKeyHashError$1, invalidDetail, validateBlock } from '@taquito/utils';
2
+ import { ParameterValidationError, InvalidHexStringError, InvalidKeyHashError, InvalidAddressError, InvalidContractAddressError, ProhibitedActionError, InvalidSignatureError, InvalidOperationKindError, InvalidBlockHashError } from '@taquito/core';
3
3
  import BigNumber$1, { BigNumber } from 'bignumber.js';
4
4
 
5
5
  const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
@@ -740,28 +740,29 @@ const decodeAnnots$1 = (val) => {
740
740
  };
741
741
 
742
742
  // https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
743
- const prefixEncoder$1 = (prefix$1) => (str) => {
744
- return buf2hex(Buffer.from(b58cdecode(str, prefix[prefix$1])));
743
+ const prefixEncoder$1 = (prefix) => (str) => {
744
+ const [pl] = b58DecodeAndCheckPrefix(str, [prefix]);
745
+ return buf2hex(pl);
745
746
  };
746
747
  const prefixDecoder$1 = (pre) => (str) => {
747
- const val = str.consume(prefixLength[pre]);
748
- return b58cencode(val, prefix[pre]);
748
+ const val = str.consume(payloadLength[pre]);
749
+ return b58Encode(val, pre);
749
750
  };
750
- const tz1Decoder$1 = prefixDecoder$1(Prefix.TZ1);
751
- const branchDecoder$1 = prefixDecoder$1(Prefix.B);
751
+ const tz1Decoder$1 = prefixDecoder$1(PrefixV2.Ed25519PublicKeyHash);
752
+ const branchDecoder$1 = prefixDecoder$1(PrefixV2.BlockHash);
752
753
  const publicKeyHashDecoder$1 = (val) => {
753
754
  const prefix = val.consume(1);
754
755
  if (prefix[0] === 0x00) {
755
- return prefixDecoder$1(Prefix.TZ1)(val);
756
+ return prefixDecoder$1(PrefixV2.Ed25519PublicKeyHash)(val);
756
757
  }
757
758
  else if (prefix[0] === 0x01) {
758
- return prefixDecoder$1(Prefix.TZ2)(val);
759
+ return prefixDecoder$1(PrefixV2.Secp256k1PublicKeyHash)(val);
759
760
  }
760
761
  else if (prefix[0] === 0x02) {
761
- return prefixDecoder$1(Prefix.TZ3)(val);
762
+ return prefixDecoder$1(PrefixV2.P256PublicKeyHash)(val);
762
763
  }
763
764
  else if (prefix[0] === 0x03) {
764
- return prefixDecoder$1(Prefix.TZ4)(val);
765
+ return prefixDecoder$1(PrefixV2.BLS12_381PublicKeyHash)(val);
765
766
  }
766
767
  };
767
768
  const publicKeyHashesDecoder$1 = (val) => {
@@ -775,14 +776,14 @@ const publicKeyHashesDecoder$1 = (val) => {
775
776
  }
776
777
  return publicKeyHashes;
777
778
  };
778
- const branchEncoder$1 = prefixEncoder$1(Prefix.B);
779
- const tz1Encoder$1 = prefixEncoder$1(Prefix.TZ1);
779
+ const branchEncoder$1 = prefixEncoder$1(PrefixV2.BlockHash);
780
+ const tz1Encoder$1 = prefixEncoder$1(PrefixV2.Ed25519PublicKeyHash);
780
781
  const boolEncoder$1 = (bool) => (bool ? 'ff' : '00');
781
782
  const proposalEncoder$1 = (proposal) => {
782
- return prefixEncoder$1(Prefix.P)(proposal);
783
+ return prefixEncoder$1(PrefixV2.ProtocolHash)(proposal);
783
784
  };
784
785
  const proposalDecoder$1 = (proposal) => {
785
- return prefixDecoder$1(Prefix.P)(proposal);
786
+ return prefixDecoder$1(PrefixV2.ProtocolHash)(proposal);
786
787
  };
787
788
  const proposalsDecoder$1 = (proposal) => {
788
789
  const proposals = [];
@@ -898,19 +899,11 @@ const delegateDecoder$1 = (val) => {
898
899
  }
899
900
  };
900
901
  const publicKeyHashEncoder$1 = (val) => {
901
- const pubkeyPrefix = val.substring(0, 3);
902
- switch (pubkeyPrefix) {
903
- case Prefix.TZ1:
904
- return '00' + prefixEncoder$1(Prefix.TZ1)(val);
905
- case Prefix.TZ2:
906
- return '01' + prefixEncoder$1(Prefix.TZ2)(val);
907
- case Prefix.TZ3:
908
- return '02' + prefixEncoder$1(Prefix.TZ3)(val);
909
- case Prefix.TZ4:
910
- return '03' + prefixEncoder$1(Prefix.TZ4)(val);
911
- default:
912
- throw new InvalidKeyHashError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
913
- ` expecting one for the following "${Prefix.TZ1}", "${Prefix.TZ2}", "${Prefix.TZ3}" or "${Prefix.TZ4}".`);
902
+ try {
903
+ return b58DecodePublicKeyHash(val);
904
+ }
905
+ catch (err) {
906
+ throw new InvalidKeyHashError(val, err instanceof ParameterValidationError ? err.result : undefined);
914
907
  }
915
908
  };
916
909
  const publicKeyHashesEncoder$1 = (val) => {
@@ -926,70 +919,57 @@ const publicKeyHashesEncoder$1 = (val) => {
926
919
  return boolEncoder$1(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes;
927
920
  };
928
921
  const publicKeyEncoder$1 = (val) => {
929
- const pubkeyPrefix = val.substring(0, 4);
930
- switch (pubkeyPrefix) {
931
- case Prefix.EDPK:
932
- return '00' + prefixEncoder$1(Prefix.EDPK)(val);
933
- case Prefix.SPPK:
934
- return '01' + prefixEncoder$1(Prefix.SPPK)(val);
935
- case Prefix.P2PK:
936
- return '02' + prefixEncoder$1(Prefix.P2PK)(val);
937
- case Prefix.BLPK:
938
- return '03' + prefixEncoder$1(Prefix.BLPK)(val);
939
- default:
940
- throw new InvalidPublicKeyError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
941
- ` expecting one of the following '${Prefix.EDPK}', '${Prefix.SPPK}', '${Prefix.P2PK}' or '${Prefix.BLPK}'.`);
922
+ try {
923
+ return b58DecodePublicKey(val);
924
+ }
925
+ catch (err) {
926
+ throw new InvalidPublicKeyError(val, err instanceof ParameterValidationError ? err.result : undefined);
942
927
  }
943
928
  };
944
929
  const addressEncoder$1 = (val) => {
945
- const pubkeyPrefix = val.substring(0, 3);
946
- switch (pubkeyPrefix) {
947
- case Prefix.TZ1:
948
- case Prefix.TZ2:
949
- case Prefix.TZ3:
950
- case Prefix.TZ4:
951
- return '00' + publicKeyHashEncoder$1(val);
952
- case Prefix.KT1:
953
- return '01' + prefixEncoder$1(Prefix.KT1)(val) + '00';
954
- default:
955
- throw new InvalidAddressError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
956
- ` expecting one of the following prefix '${Prefix.TZ1}', ${Prefix.TZ2}', '${Prefix.TZ3}', '${Prefix.TZ4}' or '${Prefix.KT1}'.`);
957
- }
930
+ return b58DecodeAddress(val);
958
931
  };
959
932
  const smartRollupAddressEncoder$1 = (val) => {
960
- if (val.substring(0, 3) !== Prefix.SR1) {
961
- throw new InvalidSmartRollupAddressError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SR1}'.`);
933
+ try {
934
+ return prefixEncoder$1(PrefixV2.SmartRollupHash)(val);
962
935
  }
963
- return prefixEncoder$1(Prefix.SR1)(val);
964
- };
965
- const smartContractAddressEncoder$1 = (val) => {
966
- const prefix = val.substring(0, 3);
967
- if (prefix === Prefix.KT1) {
968
- return '01' + prefixEncoder$1(Prefix.KT1)(val) + '00';
936
+ catch (err) {
937
+ if (err instanceof ParameterValidationError) {
938
+ throw new InvalidSmartRollupAddressError(val);
939
+ }
940
+ else {
941
+ throw err;
942
+ }
969
943
  }
970
- throw new InvalidContractAddressError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.KT1}'.`);
971
944
  };
945
+ const smartContractAddressEncoder$1 = (val) => b58DecodeAddress(val);
972
946
  const publicKeyDecoder$1 = (val) => {
973
947
  const preamble = val.consume(1);
974
948
  switch (preamble[0]) {
975
949
  case 0x00:
976
- return prefixDecoder$1(Prefix.EDPK)(val);
950
+ return prefixDecoder$1(PrefixV2.Ed25519PublicKey)(val);
977
951
  case 0x01:
978
- return prefixDecoder$1(Prefix.SPPK)(val);
952
+ return prefixDecoder$1(PrefixV2.Secp256k1PublicKey)(val);
979
953
  case 0x02:
980
- return prefixDecoder$1(Prefix.P2PK)(val);
954
+ return prefixDecoder$1(PrefixV2.P256PublicKey)(val);
981
955
  case 0x03:
982
- return prefixDecoder$1(Prefix.BLPK)(val);
956
+ return prefixDecoder$1(PrefixV2.BLS12_381PublicKey)(val);
983
957
  default:
984
- throw new InvalidPublicKeyError(val.toString(), invalidDetail(ValidationResult.NO_PREFIX_MATCHED));
958
+ throw new InvalidPublicKeyError(undefined, ValidationResult.NO_PREFIX_MATCHED);
985
959
  }
986
960
  };
987
961
  const smartRollupCommitmentHashEncoder$1 = (val) => {
988
- const prefix = val.substring(0, 4);
989
- if (prefix === Prefix.SRC1) {
990
- return prefixEncoder$1(Prefix.SRC1)(val);
962
+ try {
963
+ return prefixEncoder$1(PrefixV2.SmartRollupCommitmentHash)(val);
964
+ }
965
+ catch (err) {
966
+ if (err instanceof ParameterValidationError) {
967
+ throw new InvalidSmartRollupCommitmentHashError(val);
968
+ }
969
+ else {
970
+ throw err;
971
+ }
991
972
  }
992
- throw new InvalidSmartRollupCommitmentHashError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SRC1}'`);
993
973
  };
994
974
  const addressDecoder$1 = (val) => {
995
975
  const preamble = val.consume(1);
@@ -997,7 +977,7 @@ const addressDecoder$1 = (val) => {
997
977
  case 0x00:
998
978
  return publicKeyHashDecoder$1(val);
999
979
  case 0x01: {
1000
- const address = prefixDecoder$1(Prefix.KT1)(val);
980
+ const address = prefixDecoder$1(PrefixV2.ContractHash)(val);
1001
981
  val.consume(1);
1002
982
  return address;
1003
983
  }
@@ -1006,27 +986,19 @@ const addressDecoder$1 = (val) => {
1006
986
  }
1007
987
  };
1008
988
  const smartRollupAddressDecoder$1 = (val) => {
1009
- const address = prefixDecoder$1(Prefix.SR1)(val);
1010
- if (address.substring(0, 3) !== Prefix.SR1) {
1011
- throw new InvalidSmartRollupAddressError(address, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SR1}'.`);
1012
- }
1013
- return address;
989
+ return prefixDecoder$1(PrefixV2.SmartRollupHash)(val);
1014
990
  };
1015
991
  const smartContractAddressDecoder$1 = (val) => {
1016
992
  const preamble = val.consume(1);
1017
993
  if (preamble[0] === 0x01) {
1018
- const scAddress = prefixDecoder$1(Prefix.KT1)(val);
994
+ const scAddress = prefixDecoder$1(PrefixV2.ContractHash)(val);
1019
995
  val.consume(1);
1020
996
  return scAddress;
1021
997
  }
1022
- throw new InvalidContractAddressError(val.toString(), invalidDetail(ValidationResult.NO_PREFIX_MATCHED));
998
+ throw new InvalidContractAddressError(val.toString(), ValidationResult.NO_PREFIX_MATCHED);
1023
999
  };
1024
1000
  const smartRollupCommitmentHashDecoder$1 = (val) => {
1025
- const address = prefixDecoder$1(Prefix.SRC1)(val);
1026
- if (address.substring(0, 4) !== Prefix.SRC1) {
1027
- throw new InvalidSmartRollupCommitmentHashError(address, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SRC1}'`);
1028
- }
1029
- return address;
1001
+ return prefixDecoder$1(PrefixV2.SmartRollupCommitmentHash)(val);
1030
1002
  };
1031
1003
  const zarithEncoder$1 = (n) => {
1032
1004
  const fn = [];
@@ -1124,8 +1096,8 @@ const valueParameterDecoder$1 = (val) => {
1124
1096
  const value = extractRequiredLen$1(val);
1125
1097
  return valueDecoder$1(new Uint8ArrayConsumer(value));
1126
1098
  };
1127
- const blockPayloadHashEncoder$1 = prefixEncoder$1(Prefix.VH);
1128
- const blockPayloadHashDecoder$1 = prefixDecoder$1(Prefix.VH);
1099
+ const blockPayloadHashEncoder$1 = prefixEncoder$1(PrefixV2.ValueHash);
1100
+ const blockPayloadHashDecoder$1 = prefixDecoder$1(PrefixV2.ValueHash);
1129
1101
  const entrypointNameEncoder$1 = (entrypoint) => {
1130
1102
  const value = { string: entrypoint };
1131
1103
  return `${valueEncoder$1(value).slice(2)}`;
@@ -1153,21 +1125,31 @@ const depositsLimitDecoder$1 = (value) => {
1153
1125
  }
1154
1126
  };
1155
1127
  const signatureV1Encoder$1 = (val) => {
1156
- const signaturePrefix = val.substring(0, 5);
1157
- if (signaturePrefix === Prefix.BLSIG) {
1158
- return paddedBytesEncoder$1(prefixEncoder$1(Prefix.BLSIG)(val));
1128
+ try {
1129
+ const [data, pre] = b58DecodeAndCheckPrefix(val, signaturePrefixes);
1130
+ if (pre === PrefixV2.BLS12_381Signature) {
1131
+ return paddedBytesEncoder$1(buf2hex(data));
1132
+ }
1133
+ else {
1134
+ throw new ProhibitedActionError('we only support encoding of BLSIG signatures from protocol Seoul');
1135
+ }
1159
1136
  }
1160
- else {
1161
- throw new ProhibitedActionError('currently we only support encoding of BLSIG signatures');
1137
+ catch (err) {
1138
+ if (err instanceof ParameterValidationError) {
1139
+ throw new InvalidSignatureError(val, err.result);
1140
+ }
1141
+ else {
1142
+ throw err;
1143
+ }
1162
1144
  }
1163
1145
  };
1164
1146
  const signatureV1Decoder$1 = (val) => {
1165
1147
  val.consume(4);
1166
1148
  if (val.length().toString() === '96') {
1167
- return prefixDecoder$1(Prefix.BLSIG)(val);
1149
+ return prefixDecoder$1(PrefixV2.BLS12_381Signature)(val);
1168
1150
  }
1169
1151
  else {
1170
- throw new ProhibitedActionError('currently we only support decoding of BLSIG signatures');
1152
+ throw new ProhibitedActionError('we only support decoding of BLSIG signatures');
1171
1153
  }
1172
1154
  };
1173
1155
  const signatureProofEncoder$1 = (val) => {
@@ -1203,18 +1185,20 @@ const smartRollupMessageDecoder$1 = (val) => {
1203
1185
  return ret.map((value) => Buffer.from(value).toString('hex'));
1204
1186
  };
1205
1187
  const dalCommitmentEncoder$1 = (val) => {
1206
- const prefix = val.substring(0, 2);
1207
- if (prefix === Prefix.SH) {
1208
- return prefixEncoder$1(Prefix.SH)(val);
1188
+ try {
1189
+ return prefixEncoder$1(PrefixV2.SlotHeader)(val);
1190
+ }
1191
+ catch (err) {
1192
+ if (err instanceof ParameterValidationError) {
1193
+ throw new InvalidDalCommitmentError(val);
1194
+ }
1195
+ else {
1196
+ throw err;
1197
+ }
1209
1198
  }
1210
- throw new InvalidDalCommitmentError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SH}'`);
1211
1199
  };
1212
1200
  const dalCommitmentDecoder$1 = (val) => {
1213
- const commitment = prefixDecoder$1(Prefix.SH)(val);
1214
- if (commitment.substring(0, 2) !== Prefix.SH) {
1215
- throw new InvalidDalCommitmentError(commitment, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${Prefix.SH}'`);
1216
- }
1217
- return commitment;
1201
+ return prefixDecoder$1(PrefixV2.SlotHeader)(val);
1218
1202
  };
1219
1203
  const slotHeaderEncoder$1 = (val) => {
1220
1204
  return pad(val.slot_index, 2) + dalCommitmentEncoder$1(val.commitment) + val.commitment_proof;
@@ -2230,7 +2214,7 @@ const publicKeyHashEncoder = (val) => {
2230
2214
  case Prefix.TZ4:
2231
2215
  return '03' + prefixEncoder(Prefix.TZ4)(val);
2232
2216
  default:
2233
- throw new InvalidKeyHashError(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
2217
+ throw new InvalidKeyHashError$1(val, invalidDetail(ValidationResult.NO_PREFIX_MATCHED) +
2234
2218
  ` expecting one for the following "${Prefix.TZ1}", "${Prefix.TZ2}", "${Prefix.TZ3}" or "${Prefix.TZ4}".`);
2235
2219
  }
2236
2220
  };
@@ -3063,8 +3047,8 @@ function ProtoInferiorTo(a, b) {
3063
3047
 
3064
3048
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
3065
3049
  const VERSION = {
3066
- "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
3067
- "version": "23.0.0-beta.0"
3050
+ "commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
3051
+ "version": "23.0.0-beta.1"
3068
3052
  };
3069
3053
 
3070
3054
  /**
@@ -3109,7 +3093,7 @@ class LocalForger {
3109
3093
  forge(params) {
3110
3094
  const branchValidation = validateBlock(params.branch);
3111
3095
  if (branchValidation !== ValidationResult.VALID) {
3112
- throw new InvalidBlockHashError(params.branch, invalidDetail(branchValidation));
3096
+ throw new InvalidBlockHashError(params.branch, branchValidation);
3113
3097
  }
3114
3098
  for (const content of params.contents) {
3115
3099
  if (!validateOperationKind(content.kind)) {
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-local-forging.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -743,27 +743,28 @@
743
743
 
744
744
  // https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
745
745
  const prefixEncoder$1 = (prefix) => (str) => {
746
- return utils.buf2hex(Buffer.from(utils.b58cdecode(str, utils.prefix[prefix])));
746
+ const [pl] = utils.b58DecodeAndCheckPrefix(str, [prefix]);
747
+ return utils.buf2hex(pl);
747
748
  };
748
749
  const prefixDecoder$1 = (pre) => (str) => {
749
- const val = str.consume(utils.prefixLength[pre]);
750
- return utils.b58cencode(val, utils.prefix[pre]);
750
+ const val = str.consume(utils.payloadLength[pre]);
751
+ return utils.b58Encode(val, pre);
751
752
  };
752
- const tz1Decoder$1 = prefixDecoder$1(utils.Prefix.TZ1);
753
- const branchDecoder$1 = prefixDecoder$1(utils.Prefix.B);
753
+ const tz1Decoder$1 = prefixDecoder$1(utils.PrefixV2.Ed25519PublicKeyHash);
754
+ const branchDecoder$1 = prefixDecoder$1(utils.PrefixV2.BlockHash);
754
755
  const publicKeyHashDecoder$1 = (val) => {
755
756
  const prefix = val.consume(1);
756
757
  if (prefix[0] === 0x00) {
757
- return prefixDecoder$1(utils.Prefix.TZ1)(val);
758
+ return prefixDecoder$1(utils.PrefixV2.Ed25519PublicKeyHash)(val);
758
759
  }
759
760
  else if (prefix[0] === 0x01) {
760
- return prefixDecoder$1(utils.Prefix.TZ2)(val);
761
+ return prefixDecoder$1(utils.PrefixV2.Secp256k1PublicKeyHash)(val);
761
762
  }
762
763
  else if (prefix[0] === 0x02) {
763
- return prefixDecoder$1(utils.Prefix.TZ3)(val);
764
+ return prefixDecoder$1(utils.PrefixV2.P256PublicKeyHash)(val);
764
765
  }
765
766
  else if (prefix[0] === 0x03) {
766
- return prefixDecoder$1(utils.Prefix.TZ4)(val);
767
+ return prefixDecoder$1(utils.PrefixV2.BLS12_381PublicKeyHash)(val);
767
768
  }
768
769
  };
769
770
  const publicKeyHashesDecoder$1 = (val) => {
@@ -777,14 +778,14 @@
777
778
  }
778
779
  return publicKeyHashes;
779
780
  };
780
- const branchEncoder$1 = prefixEncoder$1(utils.Prefix.B);
781
- const tz1Encoder$1 = prefixEncoder$1(utils.Prefix.TZ1);
781
+ const branchEncoder$1 = prefixEncoder$1(utils.PrefixV2.BlockHash);
782
+ const tz1Encoder$1 = prefixEncoder$1(utils.PrefixV2.Ed25519PublicKeyHash);
782
783
  const boolEncoder$1 = (bool) => (bool ? 'ff' : '00');
783
784
  const proposalEncoder$1 = (proposal) => {
784
- return prefixEncoder$1(utils.Prefix.P)(proposal);
785
+ return prefixEncoder$1(utils.PrefixV2.ProtocolHash)(proposal);
785
786
  };
786
787
  const proposalDecoder$1 = (proposal) => {
787
- return prefixDecoder$1(utils.Prefix.P)(proposal);
788
+ return prefixDecoder$1(utils.PrefixV2.ProtocolHash)(proposal);
788
789
  };
789
790
  const proposalsDecoder$1 = (proposal) => {
790
791
  const proposals = [];
@@ -900,19 +901,11 @@
900
901
  }
901
902
  };
902
903
  const publicKeyHashEncoder$1 = (val) => {
903
- const pubkeyPrefix = val.substring(0, 3);
904
- switch (pubkeyPrefix) {
905
- case utils.Prefix.TZ1:
906
- return '00' + prefixEncoder$1(utils.Prefix.TZ1)(val);
907
- case utils.Prefix.TZ2:
908
- return '01' + prefixEncoder$1(utils.Prefix.TZ2)(val);
909
- case utils.Prefix.TZ3:
910
- return '02' + prefixEncoder$1(utils.Prefix.TZ3)(val);
911
- case utils.Prefix.TZ4:
912
- return '03' + prefixEncoder$1(utils.Prefix.TZ4)(val);
913
- default:
914
- throw new utils.InvalidKeyHashError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
915
- ` expecting one for the following "${utils.Prefix.TZ1}", "${utils.Prefix.TZ2}", "${utils.Prefix.TZ3}" or "${utils.Prefix.TZ4}".`);
904
+ try {
905
+ return utils.b58DecodePublicKeyHash(val);
906
+ }
907
+ catch (err) {
908
+ throw new core.InvalidKeyHashError(val, err instanceof core.ParameterValidationError ? err.result : undefined);
916
909
  }
917
910
  };
918
911
  const publicKeyHashesEncoder$1 = (val) => {
@@ -928,70 +921,57 @@
928
921
  return boolEncoder$1(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes;
929
922
  };
930
923
  const publicKeyEncoder$1 = (val) => {
931
- const pubkeyPrefix = val.substring(0, 4);
932
- switch (pubkeyPrefix) {
933
- case utils.Prefix.EDPK:
934
- return '00' + prefixEncoder$1(utils.Prefix.EDPK)(val);
935
- case utils.Prefix.SPPK:
936
- return '01' + prefixEncoder$1(utils.Prefix.SPPK)(val);
937
- case utils.Prefix.P2PK:
938
- return '02' + prefixEncoder$1(utils.Prefix.P2PK)(val);
939
- case utils.Prefix.BLPK:
940
- return '03' + prefixEncoder$1(utils.Prefix.BLPK)(val);
941
- default:
942
- throw new utils.InvalidPublicKeyError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
943
- ` expecting one of the following '${utils.Prefix.EDPK}', '${utils.Prefix.SPPK}', '${utils.Prefix.P2PK}' or '${utils.Prefix.BLPK}'.`);
924
+ try {
925
+ return utils.b58DecodePublicKey(val);
926
+ }
927
+ catch (err) {
928
+ throw new utils.InvalidPublicKeyError(val, err instanceof core.ParameterValidationError ? err.result : undefined);
944
929
  }
945
930
  };
946
931
  const addressEncoder$1 = (val) => {
947
- const pubkeyPrefix = val.substring(0, 3);
948
- switch (pubkeyPrefix) {
949
- case utils.Prefix.TZ1:
950
- case utils.Prefix.TZ2:
951
- case utils.Prefix.TZ3:
952
- case utils.Prefix.TZ4:
953
- return '00' + publicKeyHashEncoder$1(val);
954
- case utils.Prefix.KT1:
955
- return '01' + prefixEncoder$1(utils.Prefix.KT1)(val) + '00';
956
- default:
957
- throw new core.InvalidAddressError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) +
958
- ` expecting one of the following prefix '${utils.Prefix.TZ1}', ${utils.Prefix.TZ2}', '${utils.Prefix.TZ3}', '${utils.Prefix.TZ4}' or '${utils.Prefix.KT1}'.`);
959
- }
932
+ return utils.b58DecodeAddress(val);
960
933
  };
961
934
  const smartRollupAddressEncoder$1 = (val) => {
962
- if (val.substring(0, 3) !== utils.Prefix.SR1) {
963
- throw new InvalidSmartRollupAddressError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SR1}'.`);
935
+ try {
936
+ return prefixEncoder$1(utils.PrefixV2.SmartRollupHash)(val);
964
937
  }
965
- return prefixEncoder$1(utils.Prefix.SR1)(val);
966
- };
967
- const smartContractAddressEncoder$1 = (val) => {
968
- const prefix = val.substring(0, 3);
969
- if (prefix === utils.Prefix.KT1) {
970
- return '01' + prefixEncoder$1(utils.Prefix.KT1)(val) + '00';
938
+ catch (err) {
939
+ if (err instanceof core.ParameterValidationError) {
940
+ throw new InvalidSmartRollupAddressError(val);
941
+ }
942
+ else {
943
+ throw err;
944
+ }
971
945
  }
972
- throw new core.InvalidContractAddressError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.KT1}'.`);
973
946
  };
947
+ const smartContractAddressEncoder$1 = (val) => utils.b58DecodeAddress(val);
974
948
  const publicKeyDecoder$1 = (val) => {
975
949
  const preamble = val.consume(1);
976
950
  switch (preamble[0]) {
977
951
  case 0x00:
978
- return prefixDecoder$1(utils.Prefix.EDPK)(val);
952
+ return prefixDecoder$1(utils.PrefixV2.Ed25519PublicKey)(val);
979
953
  case 0x01:
980
- return prefixDecoder$1(utils.Prefix.SPPK)(val);
954
+ return prefixDecoder$1(utils.PrefixV2.Secp256k1PublicKey)(val);
981
955
  case 0x02:
982
- return prefixDecoder$1(utils.Prefix.P2PK)(val);
956
+ return prefixDecoder$1(utils.PrefixV2.P256PublicKey)(val);
983
957
  case 0x03:
984
- return prefixDecoder$1(utils.Prefix.BLPK)(val);
958
+ return prefixDecoder$1(utils.PrefixV2.BLS12_381PublicKey)(val);
985
959
  default:
986
- throw new utils.InvalidPublicKeyError(val.toString(), utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED));
960
+ throw new utils.InvalidPublicKeyError(undefined, utils.ValidationResult.NO_PREFIX_MATCHED);
987
961
  }
988
962
  };
989
963
  const smartRollupCommitmentHashEncoder$1 = (val) => {
990
- const prefix = val.substring(0, 4);
991
- if (prefix === utils.Prefix.SRC1) {
992
- return prefixEncoder$1(utils.Prefix.SRC1)(val);
964
+ try {
965
+ return prefixEncoder$1(utils.PrefixV2.SmartRollupCommitmentHash)(val);
966
+ }
967
+ catch (err) {
968
+ if (err instanceof core.ParameterValidationError) {
969
+ throw new InvalidSmartRollupCommitmentHashError(val);
970
+ }
971
+ else {
972
+ throw err;
973
+ }
993
974
  }
994
- throw new InvalidSmartRollupCommitmentHashError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SRC1}'`);
995
975
  };
996
976
  const addressDecoder$1 = (val) => {
997
977
  const preamble = val.consume(1);
@@ -999,7 +979,7 @@
999
979
  case 0x00:
1000
980
  return publicKeyHashDecoder$1(val);
1001
981
  case 0x01: {
1002
- const address = prefixDecoder$1(utils.Prefix.KT1)(val);
982
+ const address = prefixDecoder$1(utils.PrefixV2.ContractHash)(val);
1003
983
  val.consume(1);
1004
984
  return address;
1005
985
  }
@@ -1008,27 +988,19 @@
1008
988
  }
1009
989
  };
1010
990
  const smartRollupAddressDecoder$1 = (val) => {
1011
- const address = prefixDecoder$1(utils.Prefix.SR1)(val);
1012
- if (address.substring(0, 3) !== utils.Prefix.SR1) {
1013
- throw new InvalidSmartRollupAddressError(address, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SR1}'.`);
1014
- }
1015
- return address;
991
+ return prefixDecoder$1(utils.PrefixV2.SmartRollupHash)(val);
1016
992
  };
1017
993
  const smartContractAddressDecoder$1 = (val) => {
1018
994
  const preamble = val.consume(1);
1019
995
  if (preamble[0] === 0x01) {
1020
- const scAddress = prefixDecoder$1(utils.Prefix.KT1)(val);
996
+ const scAddress = prefixDecoder$1(utils.PrefixV2.ContractHash)(val);
1021
997
  val.consume(1);
1022
998
  return scAddress;
1023
999
  }
1024
- throw new core.InvalidContractAddressError(val.toString(), utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED));
1000
+ throw new core.InvalidContractAddressError(val.toString(), utils.ValidationResult.NO_PREFIX_MATCHED);
1025
1001
  };
1026
1002
  const smartRollupCommitmentHashDecoder$1 = (val) => {
1027
- const address = prefixDecoder$1(utils.Prefix.SRC1)(val);
1028
- if (address.substring(0, 4) !== utils.Prefix.SRC1) {
1029
- throw new InvalidSmartRollupCommitmentHashError(address, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SRC1}'`);
1030
- }
1031
- return address;
1003
+ return prefixDecoder$1(utils.PrefixV2.SmartRollupCommitmentHash)(val);
1032
1004
  };
1033
1005
  const zarithEncoder$1 = (n) => {
1034
1006
  const fn = [];
@@ -1126,8 +1098,8 @@
1126
1098
  const value = extractRequiredLen$1(val);
1127
1099
  return valueDecoder$1(new Uint8ArrayConsumer(value));
1128
1100
  };
1129
- const blockPayloadHashEncoder$1 = prefixEncoder$1(utils.Prefix.VH);
1130
- const blockPayloadHashDecoder$1 = prefixDecoder$1(utils.Prefix.VH);
1101
+ const blockPayloadHashEncoder$1 = prefixEncoder$1(utils.PrefixV2.ValueHash);
1102
+ const blockPayloadHashDecoder$1 = prefixDecoder$1(utils.PrefixV2.ValueHash);
1131
1103
  const entrypointNameEncoder$1 = (entrypoint) => {
1132
1104
  const value = { string: entrypoint };
1133
1105
  return `${valueEncoder$1(value).slice(2)}`;
@@ -1155,21 +1127,31 @@
1155
1127
  }
1156
1128
  };
1157
1129
  const signatureV1Encoder$1 = (val) => {
1158
- const signaturePrefix = val.substring(0, 5);
1159
- if (signaturePrefix === utils.Prefix.BLSIG) {
1160
- return paddedBytesEncoder$1(prefixEncoder$1(utils.Prefix.BLSIG)(val));
1130
+ try {
1131
+ const [data, pre] = utils.b58DecodeAndCheckPrefix(val, utils.signaturePrefixes);
1132
+ if (pre === utils.PrefixV2.BLS12_381Signature) {
1133
+ return paddedBytesEncoder$1(utils.buf2hex(data));
1134
+ }
1135
+ else {
1136
+ throw new core.ProhibitedActionError('we only support encoding of BLSIG signatures from protocol Seoul');
1137
+ }
1161
1138
  }
1162
- else {
1163
- throw new core.ProhibitedActionError('currently we only support encoding of BLSIG signatures');
1139
+ catch (err) {
1140
+ if (err instanceof core.ParameterValidationError) {
1141
+ throw new core.InvalidSignatureError(val, err.result);
1142
+ }
1143
+ else {
1144
+ throw err;
1145
+ }
1164
1146
  }
1165
1147
  };
1166
1148
  const signatureV1Decoder$1 = (val) => {
1167
1149
  val.consume(4);
1168
1150
  if (val.length().toString() === '96') {
1169
- return prefixDecoder$1(utils.Prefix.BLSIG)(val);
1151
+ return prefixDecoder$1(utils.PrefixV2.BLS12_381Signature)(val);
1170
1152
  }
1171
1153
  else {
1172
- throw new core.ProhibitedActionError('currently we only support decoding of BLSIG signatures');
1154
+ throw new core.ProhibitedActionError('we only support decoding of BLSIG signatures');
1173
1155
  }
1174
1156
  };
1175
1157
  const signatureProofEncoder$1 = (val) => {
@@ -1205,18 +1187,20 @@
1205
1187
  return ret.map((value) => Buffer.from(value).toString('hex'));
1206
1188
  };
1207
1189
  const dalCommitmentEncoder$1 = (val) => {
1208
- const prefix = val.substring(0, 2);
1209
- if (prefix === utils.Prefix.SH) {
1210
- return prefixEncoder$1(utils.Prefix.SH)(val);
1190
+ try {
1191
+ return prefixEncoder$1(utils.PrefixV2.SlotHeader)(val);
1192
+ }
1193
+ catch (err) {
1194
+ if (err instanceof core.ParameterValidationError) {
1195
+ throw new InvalidDalCommitmentError(val);
1196
+ }
1197
+ else {
1198
+ throw err;
1199
+ }
1211
1200
  }
1212
- throw new InvalidDalCommitmentError(val, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SH}'`);
1213
1201
  };
1214
1202
  const dalCommitmentDecoder$1 = (val) => {
1215
- const commitment = prefixDecoder$1(utils.Prefix.SH)(val);
1216
- if (commitment.substring(0, 2) !== utils.Prefix.SH) {
1217
- throw new InvalidDalCommitmentError(commitment, utils.invalidDetail(utils.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils.Prefix.SH}'`);
1218
- }
1219
- return commitment;
1203
+ return prefixDecoder$1(utils.PrefixV2.SlotHeader)(val);
1220
1204
  };
1221
1205
  const slotHeaderEncoder$1 = (val) => {
1222
1206
  return pad(val.slot_index, 2) + dalCommitmentEncoder$1(val.commitment) + val.commitment_proof;
@@ -3065,8 +3049,8 @@
3065
3049
 
3066
3050
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
3067
3051
  const VERSION = {
3068
- "commitHash": "7af2138a9e5c5b230c4b4c726f35c2f2e67b721c",
3069
- "version": "23.0.0-beta.0"
3052
+ "commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
3053
+ "version": "23.0.0-beta.1"
3070
3054
  };
3071
3055
 
3072
3056
  /**
@@ -3111,7 +3095,7 @@
3111
3095
  forge(params) {
3112
3096
  const branchValidation = utils.validateBlock(params.branch);
3113
3097
  if (branchValidation !== utils.ValidationResult.VALID) {
3114
- throw new core.InvalidBlockHashError(params.branch, utils.invalidDetail(branchValidation));
3098
+ throw new core.InvalidBlockHashError(params.branch, branchValidation);
3115
3099
  }
3116
3100
  for (const content of params.contents) {
3117
3101
  if (!validateOperationKind(content.kind)) {
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-local-forging.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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2
  import { MichelsonValue } from './michelson/codec';
3
3
  import { Uint8ArrayConsumer } from './uint8array-consumer';
4
- export declare const prefixEncoder: (prefix: Prefix) => (str: string) => string;
5
- export declare const prefixDecoder: (pre: Prefix) => (str: Uint8ArrayConsumer) => string;
4
+ export declare const prefixEncoder: (prefix: PrefixV2) => (str: string) => string;
5
+ export declare const prefixDecoder: (pre: PrefixV2) => (str: Uint8ArrayConsumer) => string;
6
6
  export declare const tz1Decoder: (str: Uint8ArrayConsumer) => string;
7
7
  export declare const branchDecoder: (str: Uint8ArrayConsumer) => string;
8
8
  export declare const publicKeyHashDecoder: (val: Uint8ArrayConsumer) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/local-forging",
3
- "version": "23.0.0-beta.0",
3
+ "version": "23.0.0-beta.1",
4
4
  "description": "Provide local forging functionality to be with taquito",
5
5
  "keywords": [
6
6
  "tezos",
@@ -67,12 +67,12 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@taquito/core": "^23.0.0-beta.0",
71
- "@taquito/utils": "^23.0.0-beta.0",
70
+ "@taquito/core": "^23.0.0-beta.1",
71
+ "@taquito/utils": "^23.0.0-beta.1",
72
72
  "bignumber.js": "^9.1.2"
73
73
  },
74
74
  "devDependencies": {
75
- "@taquito/rpc": "^23.0.0-beta.0",
75
+ "@taquito/rpc": "^23.0.0-beta.1",
76
76
  "@types/bluebird": "^3.5.42",
77
77
  "@types/estree": "^1.0.5",
78
78
  "@types/jest": "^29.5.12",
@@ -104,5 +104,5 @@
104
104
  "webpack": "^5.94.0",
105
105
  "webpack-cli": "^5.1.4"
106
106
  },
107
- "gitHead": "37cc766d60407d7909fbd2d841d9dd946243d04a"
107
+ "gitHead": "1469d6f0d55134a4b853598a2eec48e6f71b3da3"
108
108
  }