@taquito/local-forging 13.0.0 → 14.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.
Files changed (45) hide show
  1. package/dist/lib/codec.js +59 -1
  2. package/dist/lib/codec.js.map +1 -1
  3. package/dist/lib/constants.js +8 -1
  4. package/dist/lib/constants.js.map +1 -1
  5. package/dist/lib/decoder.js +10 -0
  6. package/dist/lib/decoder.js.map +1 -1
  7. package/dist/lib/encoder.js +10 -0
  8. package/dist/lib/encoder.js.map +1 -1
  9. package/dist/lib/protocols.js +3 -1
  10. package/dist/lib/protocols.js.map +1 -1
  11. package/dist/lib/schema/operation.js +41 -1
  12. package/dist/lib/schema/operation.js.map +1 -1
  13. package/dist/lib/taquito-local-forging.js +8 -21
  14. package/dist/lib/taquito-local-forging.js.map +1 -1
  15. package/dist/lib/validator.js +4 -4
  16. package/dist/lib/validator.js.map +1 -1
  17. package/dist/lib/version.js +2 -2
  18. package/dist/taquito-local-forging.es6.js +133 -330
  19. package/dist/taquito-local-forging.es6.js.map +1 -1
  20. package/dist/taquito-local-forging.umd.js +132 -329
  21. package/dist/taquito-local-forging.umd.js.map +1 -1
  22. package/dist/types/codec.d.ts +12 -0
  23. package/dist/types/constants.d.ts +3 -1
  24. package/dist/types/protocols.d.ts +1 -0
  25. package/dist/types/schema/operation.d.ts +40 -0
  26. package/dist/types/taquito-local-forging.d.ts +1 -1
  27. package/package.json +22 -16
  28. package/dist/lib/proto13-jakarta/codec-proto13.js +0 -101
  29. package/dist/lib/proto13-jakarta/codec-proto13.js.map +0 -1
  30. package/dist/lib/proto13-jakarta/constants-proto13.js +0 -13
  31. package/dist/lib/proto13-jakarta/constants-proto13.js.map +0 -1
  32. package/dist/lib/proto13-jakarta/decoder-proto13.js +0 -26
  33. package/dist/lib/proto13-jakarta/decoder-proto13.js.map +0 -1
  34. package/dist/lib/proto13-jakarta/encoder-proto13.js +0 -26
  35. package/dist/lib/proto13-jakarta/encoder-proto13.js.map +0 -1
  36. package/dist/lib/proto13-jakarta/michelson-proto13/codec-proto13.js +0 -150
  37. package/dist/lib/proto13-jakarta/michelson-proto13/codec-proto13.js.map +0 -1
  38. package/dist/lib/proto13-jakarta/schema/operation-proto13.js +0 -36
  39. package/dist/lib/proto13-jakarta/schema/operation-proto13.js.map +0 -1
  40. package/dist/types/proto13-jakarta/codec-proto13.d.ts +0 -23
  41. package/dist/types/proto13-jakarta/constants-proto13.d.ts +0 -6
  42. package/dist/types/proto13-jakarta/decoder-proto13.d.ts +0 -4
  43. package/dist/types/proto13-jakarta/encoder-proto13.d.ts +0 -4
  44. package/dist/types/proto13-jakarta/michelson-proto13/codec-proto13.d.ts +0 -15
  45. package/dist/types/proto13-jakarta/schema/operation-proto13.d.ts +0 -32
@@ -1,4 +1,4 @@
1
- import { Prefix, prefixLength, b58cencode, prefix, buf2hex, b58cdecode, InvalidKeyHashError, InvalidPublicKeyError, InvalidAddressError, InvalidOperationKindError, validateBlock, ValidationResult } from '@taquito/utils';
1
+ import { Prefix, prefixLength, b58cencode, prefix, buf2hex, b58cdecode, InvalidKeyHashError, InvalidPublicKeyError, InvalidAddressError, InvalidContractAddressError, InvalidOperationKindError, validateBlock, ValidationResult } from '@taquito/utils';
2
2
  import BigNumber$1, { BigNumber } from 'bignumber.js';
3
3
 
4
4
  const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
@@ -30,6 +30,7 @@ var CODEC;
30
30
  CODEC["INT16"] = "int16";
31
31
  CODEC["PARAMETERS"] = "parameters";
32
32
  CODEC["ADDRESS"] = "address";
33
+ CODEC["SMART_CONTRACT_ADDRESS"] = "smart_contract_address";
33
34
  CODEC["VALUE"] = "value";
34
35
  CODEC["MANAGER"] = "manager";
35
36
  CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash";
@@ -52,6 +53,7 @@ var CODEC;
52
53
  CODEC["TX_ROLLUP_ORIGINATION_PARAM"] = "tx_rollup_origination_param";
53
54
  CODEC["TX_ROLLUP_ID"] = "tx_rollup_id";
54
55
  CODEC["TX_ROLLUP_BATCH_CONTENT"] = "tx_rollup_batch_content";
56
+ CODEC["OP_INCREASE_PAID_STORAGE"] = "increase_paid_storage";
55
57
  })(CODEC || (CODEC = {}));
56
58
  // See https://tezos.gitlab.io/whitedoc/michelson.html#full-grammar
57
59
  const opMapping = {
@@ -187,7 +189,7 @@ const opMapping = {
187
189
  '81': 'bls12_381_g2',
188
190
  '82': 'bls12_381_fr',
189
191
  '83': 'sapling_state',
190
- '84': 'sapling_transaction',
192
+ '84': 'sapling_transaction_deprecated',
191
193
  '85': 'SAPLING_EMPTY_STATE',
192
194
  '86': 'SAPLING_VERIFY_UPDATE',
193
195
  '87': 'ticket',
@@ -203,6 +205,10 @@ const opMapping = {
203
205
  '91': 'view',
204
206
  '92': 'constant',
205
207
  '93': 'SUB_MUTEZ',
208
+ '94': 'tx_rollup_l2_address',
209
+ '95': 'MIN_BLOCK_TIME',
210
+ '96': 'sapling_transaction',
211
+ '97': 'EMIT',
206
212
  };
207
213
  const opMappingReverse = (() => {
208
214
  const result = {};
@@ -226,6 +232,7 @@ const kindMapping = {
226
232
  0x96: 'tx_rollup_origination',
227
233
  0x97: 'tx_rollup_submit_batch',
228
234
  0x9e: 'transfer_ticket',
235
+ 0x71: 'increase_paid_storage',
229
236
  };
230
237
  const kindMappingReverse = (() => {
231
238
  const result = {};
@@ -572,7 +579,7 @@ const primDecoder = (value, preamble) => {
572
579
  let combPairArgs;
573
580
  let combPairAnnots;
574
581
  if ((opMapping[op] === 'pair' || opMapping[op] === 'Pair') && argsCount > 2) {
575
- combPairArgs = decodeCombPair$1(value);
582
+ combPairArgs = decodeCombPair(value);
576
583
  argsCount = 0;
577
584
  combPairAnnots = decodeAnnots(value);
578
585
  }
@@ -600,7 +607,7 @@ const primViewDecoder = (value, result) => {
600
607
  value.consume(4);
601
608
  return result;
602
609
  };
603
- const decodeCombPair$1 = (val) => {
610
+ const decodeCombPair = (val) => {
604
611
  const array = new Uint8ArrayConsumer(extractRequiredLen(val));
605
612
  const args = [];
606
613
  while (array.length() > 0) {
@@ -782,6 +789,13 @@ const addressEncoder = (val) => {
782
789
  throw new InvalidAddressError(val);
783
790
  }
784
791
  };
792
+ const smartContractAddressEncoder = (val) => {
793
+ const prefix = val.substring(0, 3);
794
+ if (prefix === Prefix.KT1) {
795
+ return '01' + prefixEncoder(Prefix.KT1)(val) + '00';
796
+ }
797
+ throw new InvalidContractAddressError(val);
798
+ };
785
799
  const publicKeyDecoder = (val) => {
786
800
  const preamble = val.consume(1);
787
801
  switch (preamble[0]) {
@@ -809,6 +823,15 @@ const addressDecoder = (val) => {
809
823
  throw new InvalidAddressError(val.toString());
810
824
  }
811
825
  };
826
+ const smartContractAddressDecoder = (val) => {
827
+ const preamble = val.consume(1);
828
+ if (preamble[0] === 0x01) {
829
+ const scAddress = prefixDecoder(Prefix.KT1)(val);
830
+ val.consume(1);
831
+ return scAddress;
832
+ }
833
+ throw new InvalidContractAddressError(val.toString());
834
+ };
812
835
  const zarithEncoder = (n) => {
813
836
  const fn = [];
814
837
  let nn = new BigNumber$1(n, 10);
@@ -906,7 +929,39 @@ const valueParameterDecoder = (val) => {
906
929
  return valueDecoder(new Uint8ArrayConsumer(value));
907
930
  };
908
931
  const blockPayloadHashEncoder = prefixEncoder(Prefix.VH);
909
- const blockPayloadHashDecoder = prefixDecoder(Prefix.VH);
932
+ const blockPayloadHashDecoder = prefixDecoder(Prefix.VH);
933
+ const entrypointNameEncoder = (entrypoint) => {
934
+ const value = { string: entrypoint };
935
+ return `${valueEncoder(value).slice(2)}`;
936
+ };
937
+ const entrypointNameDecoder = (val) => {
938
+ const entry = extractRequiredLen(val);
939
+ return Buffer.from(entry).toString('utf8');
940
+ };
941
+ const txRollupOriginationParamEncoder = (_value) => {
942
+ return '';
943
+ };
944
+ const txRollupOriginationParamDecoder = (_val) => {
945
+ return {};
946
+ };
947
+ const txRollupIdEncoder = prefixEncoder(Prefix.TXR1);
948
+ const txRollupIdDecoder = prefixDecoder(Prefix.TXR1);
949
+ const txRollupBatchContentEncoder = (value) => {
950
+ return `${pad(value.length / 2)}${value}`;
951
+ };
952
+ const txRollupBatchContentDecoder = (val) => {
953
+ const value = extractRequiredLen(val);
954
+ return Buffer.from(value).toString('hex');
955
+ };
956
+ const burnLimitEncoder = (val) => {
957
+ return !val ? '00' : `ff${zarithEncoder(val)}`;
958
+ };
959
+ const burnLimitDecoder = (value) => {
960
+ const prefix = value.consume(1);
961
+ if (Buffer.from(prefix).toString('hex') !== '00') {
962
+ return zarithDecoder(value);
963
+ }
964
+ };
910
965
 
911
966
  const ManagerOperationSchema = {
912
967
  branch: CODEC.BRANCH,
@@ -981,6 +1036,46 @@ const RegisterGlobalConstantSchema = {
981
1036
  storage_limit: CODEC.ZARITH,
982
1037
  value: CODEC.VALUE,
983
1038
  };
1039
+ const TransferTicketSchema = {
1040
+ source: CODEC.PKH,
1041
+ fee: CODEC.ZARITH,
1042
+ counter: CODEC.ZARITH,
1043
+ gas_limit: CODEC.ZARITH,
1044
+ storage_limit: CODEC.ZARITH,
1045
+ ticket_contents: CODEC.VALUE,
1046
+ ticket_ty: CODEC.VALUE,
1047
+ ticket_ticketer: CODEC.ADDRESS,
1048
+ ticket_amount: CODEC.ZARITH,
1049
+ destination: CODEC.ADDRESS,
1050
+ entrypoint: CODEC.ENTRYPOINT,
1051
+ };
1052
+ const TxRollupOriginationSchema = {
1053
+ source: CODEC.PKH,
1054
+ fee: CODEC.ZARITH,
1055
+ counter: CODEC.ZARITH,
1056
+ gas_limit: CODEC.ZARITH,
1057
+ storage_limit: CODEC.ZARITH,
1058
+ tx_rollup_origination: CODEC.TX_ROLLUP_ORIGINATION_PARAM,
1059
+ };
1060
+ const TxRollupSubmitBatchSchema = {
1061
+ source: CODEC.PKH,
1062
+ fee: CODEC.ZARITH,
1063
+ counter: CODEC.ZARITH,
1064
+ gas_limit: CODEC.ZARITH,
1065
+ storage_limit: CODEC.ZARITH,
1066
+ rollup: CODEC.TX_ROLLUP_ID,
1067
+ content: CODEC.TX_ROLLUP_BATCH_CONTENT,
1068
+ burn_limit: CODEC.BURN_LIMIT,
1069
+ };
1070
+ const IncreasePaidStorageSchema = {
1071
+ source: CODEC.PKH,
1072
+ fee: CODEC.ZARITH,
1073
+ counter: CODEC.ZARITH,
1074
+ gas_limit: CODEC.ZARITH,
1075
+ storage_limit: CODEC.ZARITH,
1076
+ amount: CODEC.ZARITH,
1077
+ destination: CODEC.SMART_CONTRACT_ADDRESS,
1078
+ };
984
1079
  const operationEncoder = (encoders) => (operation) => {
985
1080
  if (!(operation.kind in encoders) || !(operation.kind in kindMappingReverse)) {
986
1081
  throw new InvalidOperationKindError(operation.kind);
@@ -1062,9 +1157,15 @@ const decoders = {
1062
1157
  [CODEC.PROPOSAL_ARR]: proposalsDecoder,
1063
1158
  [CODEC.PARAMETERS]: parametersDecoder,
1064
1159
  [CODEC.ADDRESS]: addressDecoder,
1160
+ [CODEC.SMART_CONTRACT_ADDRESS]: smartContractAddressDecoder,
1065
1161
  [CODEC.VALUE]: valueParameterDecoder,
1066
1162
  [CODEC.INT16]: int16Decoder,
1067
1163
  [CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashDecoder,
1164
+ [CODEC.ENTRYPOINT]: entrypointNameDecoder,
1165
+ [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamDecoder,
1166
+ [CODEC.TX_ROLLUP_ID]: txRollupIdDecoder,
1167
+ [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentDecoder,
1168
+ [CODEC.BURN_LIMIT]: burnLimitDecoder,
1068
1169
  };
1069
1170
  decoders[CODEC.OPERATION] = operationDecoder(decoders);
1070
1171
  decoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decoders)(ActivationSchema)(val);
@@ -1077,6 +1178,10 @@ decoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decoders)(Seed
1077
1178
  decoders[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decoders)(ProposalsSchema)(val);
1078
1179
  decoders[CODEC.OP_REVEAL] = (val) => schemaDecoder(decoders)(RevealSchema)(val);
1079
1180
  decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decoders)(RegisterGlobalConstantSchema)(val);
1181
+ decoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decoders)(TransferTicketSchema)(val);
1182
+ decoders[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaDecoder(decoders)(TxRollupOriginationSchema)(val);
1183
+ decoders[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaDecoder(decoders)(TxRollupSubmitBatchSchema)(val);
1184
+ decoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaDecoder(decoders)(IncreasePaidStorageSchema)(val);
1080
1185
  decoders[CODEC.MANAGER] = schemaDecoder(decoders)(ManagerOperationSchema);
1081
1186
 
1082
1187
  const encoders = {
@@ -1095,9 +1200,15 @@ const encoders = {
1095
1200
  [CODEC.INT32]: int32Encoder,
1096
1201
  [CODEC.PARAMETERS]: parametersEncoder,
1097
1202
  [CODEC.ADDRESS]: addressEncoder,
1203
+ [CODEC.SMART_CONTRACT_ADDRESS]: smartContractAddressEncoder,
1098
1204
  [CODEC.VALUE]: valueParameterEncoder,
1099
1205
  [CODEC.INT16]: int16Encoder,
1100
1206
  [CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder,
1207
+ [CODEC.ENTRYPOINT]: entrypointNameEncoder,
1208
+ [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamEncoder,
1209
+ [CODEC.TX_ROLLUP_ID]: txRollupIdEncoder,
1210
+ [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentEncoder,
1211
+ [CODEC.BURN_LIMIT]: burnLimitEncoder,
1101
1212
  };
1102
1213
  encoders[CODEC.OPERATION] = operationEncoder(encoders);
1103
1214
  encoders[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encoders)(ActivationSchema)(val);
@@ -1110,40 +1221,12 @@ encoders[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encoders)(Seed
1110
1221
  encoders[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encoders)(ProposalsSchema)(val);
1111
1222
  encoders[CODEC.OP_REVEAL] = (val) => schemaEncoder(encoders)(RevealSchema)(val);
1112
1223
  encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encoders)(RegisterGlobalConstantSchema)(val);
1224
+ encoders[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encoders)(TransferTicketSchema)(val);
1225
+ encoders[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaEncoder(encoders)(TxRollupOriginationSchema)(val);
1226
+ encoders[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaEncoder(encoders)(TxRollupSubmitBatchSchema)(val);
1227
+ encoders[CODEC.OP_INCREASE_PAID_STORAGE] = (val) => schemaEncoder(encoders)(IncreasePaidStorageSchema)(val);
1113
1228
  encoders[CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema);
1114
1229
 
1115
- const TransferTicketSchema = {
1116
- source: CODEC.PKH,
1117
- fee: CODEC.ZARITH,
1118
- counter: CODEC.ZARITH,
1119
- gas_limit: CODEC.ZARITH,
1120
- storage_limit: CODEC.ZARITH,
1121
- ticket_contents: CODEC.VALUE,
1122
- ticket_ty: CODEC.VALUE,
1123
- ticket_ticketer: CODEC.ADDRESS,
1124
- ticket_amount: CODEC.ZARITH,
1125
- destination: CODEC.ADDRESS,
1126
- entrypoint: CODEC.ENTRYPOINT,
1127
- };
1128
- const TxRollupOriginationSchema = {
1129
- source: CODEC.PKH,
1130
- fee: CODEC.ZARITH,
1131
- counter: CODEC.ZARITH,
1132
- gas_limit: CODEC.ZARITH,
1133
- storage_limit: CODEC.ZARITH,
1134
- tx_rollup_origination: CODEC.TX_ROLLUP_ORIGINATION_PARAM,
1135
- };
1136
- const TxRollupSubmitBatchSchema = {
1137
- source: CODEC.PKH,
1138
- fee: CODEC.ZARITH,
1139
- counter: CODEC.ZARITH,
1140
- gas_limit: CODEC.ZARITH,
1141
- storage_limit: CODEC.ZARITH,
1142
- rollup: CODEC.TX_ROLLUP_ID,
1143
- content: CODEC.TX_ROLLUP_BATCH_CONTENT,
1144
- burn_limit: CODEC.BURN_LIMIT,
1145
- };
1146
-
1147
1230
  const OperationKindMapping = {
1148
1231
  activate_account: ActivationSchema,
1149
1232
  reveal: RevealSchema,
@@ -1158,6 +1241,7 @@ const OperationKindMapping = {
1158
1241
  transfer_ticket: TransferTicketSchema,
1159
1242
  tx_rollup_origination: TxRollupOriginationSchema,
1160
1243
  tx_rollup_submit_batch: TxRollupSubmitBatchSchema,
1244
+ increase_paid_storage: IncreasePaidStorageSchema,
1161
1245
  };
1162
1246
  // Asymmetric difference: only account for things in arr2 that are not present in arr1, not vice versa
1163
1247
  const getArrayDifference = (arr1, arr2) => {
@@ -1200,284 +1284,14 @@ var ProtocolsHash;
1200
1284
  ProtocolsHash["PtHangz2"] = "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx";
1201
1285
  ProtocolsHash["Psithaca2"] = "Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A";
1202
1286
  ProtocolsHash["PtJakart2"] = "PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY";
1287
+ ProtocolsHash["PtKathman"] = "PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg";
1203
1288
  ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";
1204
- })(ProtocolsHash || (ProtocolsHash = {}));
1205
- const protoLevel = {
1206
- Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd: 4,
1207
- PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU: 5,
1208
- PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS: 5,
1209
- PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb: 6,
1210
- PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo: 7,
1211
- PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA: 8,
1212
- PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i: 9,
1213
- PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV: 10,
1214
- PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx: 11,
1215
- Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A: 12,
1216
- PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY: 13,
1217
- ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 14,
1218
- };
1219
- function ProtoInferiorTo(a, b) {
1220
- return protoLevel[a] < protoLevel[b];
1221
- }
1222
-
1223
- const opMappingProto13 = Object.assign(Object.assign({}, opMapping), { '84': 'sapling_transaction_deprecated', '94': 'tx_rollup_l2_address', '95': 'MIN_BLOCK_TIME', '96': 'sapling_transaction' });
1224
- const opMappingReverseProto13 = (() => {
1225
- const result = {};
1226
- Object.keys(opMappingProto13).forEach((key) => {
1227
- result[opMappingProto13[key]] = key;
1228
- });
1229
- return result;
1230
- })();
1231
-
1232
- const scriptEncoderProto13 = (script) => {
1233
- const code = valueEncoderProto13(script.code);
1234
- const storage = valueEncoderProto13(script.storage);
1235
- return `${pad(code.length / 2, 8)}${code}${pad(storage.length / 2, 8)}${storage}`;
1236
- };
1237
- const scriptDecoderProto13 = (value) => {
1238
- const code = extractRequiredLen(value);
1239
- const storage = extractRequiredLen(value);
1240
- return {
1241
- code: valueDecoderProto13(new Uint8ArrayConsumer(code)),
1242
- storage: valueDecoderProto13(new Uint8ArrayConsumer(storage)),
1243
- };
1244
- };
1245
- const valueEncoderProto13 = (value) => {
1246
- if (Array.isArray(value)) {
1247
- const encoded = value.map((x) => valueEncoderProto13(x)).join('');
1248
- const len = encoded.length / 2;
1249
- return `02${pad(len)}${encoded}`;
1250
- }
1251
- else if (isPrim(value)) {
1252
- return primEncoderProto13(value);
1253
- }
1254
- else if (isBytes(value)) {
1255
- return bytesEncoder(value);
1256
- }
1257
- else if (isString(value)) {
1258
- return stringEncoder(value);
1259
- }
1260
- else if (isInt(value)) {
1261
- return intEncoder(value);
1262
- }
1263
- throw new UnexpectedMichelsonValueError('Unexpected value');
1264
- };
1265
- const valueDecoderProto13 = (value) => {
1266
- const preamble = value.consume(1);
1267
- switch (preamble[0]) {
1268
- case 0x0a:
1269
- return bytesDecoder(value);
1270
- case 0x01:
1271
- return stringDecoder(value);
1272
- case 0x00:
1273
- return intDecoder(value);
1274
- case 0x02: {
1275
- const val = new Uint8ArrayConsumer(extractRequiredLen(value));
1276
- const results = [];
1277
- while (val.length() > 0) {
1278
- results.push(valueDecoderProto13(val));
1279
- }
1280
- return results;
1281
- }
1282
- default:
1283
- return primDecoderProto13(value, preamble);
1284
- }
1285
- };
1286
- const primEncoderProto13 = (value) => {
1287
- const hasAnnot = +Array.isArray(value.annots);
1288
- const argsCount = Array.isArray(value.args) ? value.args.length : 0;
1289
- // Specify the number of args max is 3 without annotation
1290
- const preamble = pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2);
1291
- const op = opMappingReverseProto13[value.prim];
1292
- let encodedArgs = (value.args || []).map((arg) => valueEncoderProto13(arg)).join('');
1293
- const encodedAnnots = Array.isArray(value.annots) ? encodeAnnots(value.annots) : '';
1294
- if (value.prim === 'LAMBDA' && argsCount) {
1295
- encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
1296
- }
1297
- if ((value.prim === 'pair' || value.prim === 'Pair') && argsCount > 2) {
1298
- encodedArgs =
1299
- encodedAnnots === ''
1300
- ? pad(encodedArgs.length / 2) + encodedArgs + pad(0)
1301
- : pad(encodedArgs.length / 2) + encodedArgs;
1302
- }
1303
- if (value.prim === 'view' && value.args) {
1304
- encodedArgs = pad(encodedArgs.length / 2) + encodedArgs + pad(0);
1305
- }
1306
- return `${preamble}${op}${encodedArgs}${encodedAnnots}`;
1307
- };
1308
- const primDecoderProto13 = (value, preamble) => {
1309
- const hasAnnot = (preamble[0] - 0x03) % 2 === 1;
1310
- let argsCount = Math.floor((preamble[0] - 0x03) / 2);
1311
- const op = value.consume(1)[0].toString(16).padStart(2, '0');
1312
- const result = {
1313
- prim: opMappingProto13[op],
1314
- };
1315
- if (opMappingProto13[op] === 'LAMBDA') {
1316
- value.consume(4);
1317
- }
1318
- if (opMappingProto13[op] === 'view') {
1319
- if (argsCount != 0) {
1320
- return primViewDecoderProto13(value, result);
1321
- }
1322
- else {
1323
- return result;
1324
- }
1325
- }
1326
- let combPairArgs;
1327
- let combPairAnnots;
1328
- if ((opMappingProto13[op] === 'pair' || opMappingProto13[op] === 'Pair') && argsCount > 2) {
1329
- combPairArgs = decodeCombPair(value);
1330
- argsCount = 0;
1331
- combPairAnnots = decodeAnnots(value);
1332
- }
1333
- const args = new Array(argsCount).fill(0).map(() => valueDecoderProto13(value));
1334
- if (opMappingProto13[op] === 'LAMBDA') {
1335
- value.consume(4);
1336
- }
1337
- if (combPairArgs) {
1338
- result['args'] = combPairArgs;
1339
- }
1340
- else if (args.length) {
1341
- result['args'] = args;
1342
- }
1343
- if (combPairAnnots && combPairAnnots[0] !== '') {
1344
- result['annots'] = combPairAnnots;
1345
- }
1346
- else if (hasAnnot) {
1347
- result['annots'] = decodeAnnots(value);
1348
- }
1349
- return result;
1350
- };
1351
- const primViewDecoderProto13 = (value, result) => {
1352
- value.consume(4);
1353
- result['args'] = new Array(4).fill(0).map(() => valueDecoderProto13(value));
1354
- value.consume(4);
1355
- return result;
1356
- };
1357
- const decodeCombPair = (val) => {
1358
- const array = new Uint8ArrayConsumer(extractRequiredLen(val));
1359
- const args = [];
1360
- while (array.length() > 0) {
1361
- args.push(valueDecoderProto13(array));
1362
- }
1363
- return args;
1364
- };
1365
-
1366
- const parametersDecoderProto13 = (val) => {
1367
- const preamble = val.consume(1);
1368
- if (preamble[0] === 0x00) {
1369
- return;
1370
- }
1371
- else {
1372
- const encodedEntrypoint = entrypointDecoder(val);
1373
- const params = extractRequiredLen(val);
1374
- const parameters = valueDecoderProto13(new Uint8ArrayConsumer(params));
1375
- return {
1376
- entrypoint: encodedEntrypoint,
1377
- value: parameters,
1378
- };
1379
- }
1380
- };
1381
- const valueParameterDecoderProto13 = (val) => {
1382
- const value = extractRequiredLen(val);
1383
- return valueDecoderProto13(new Uint8ArrayConsumer(value));
1384
- };
1385
- const entrypointEncoderProto13 = (entrypoint) => {
1386
- if (entrypoint in entrypointMappingReverse) {
1387
- return `${entrypointMappingReverse[entrypoint]}`;
1388
- }
1389
- else {
1390
- if (entrypoint.length > ENTRYPOINT_MAX_LENGTH) {
1391
- throw new OversizedEntryPointError(entrypoint);
1392
- }
1393
- const value = { string: entrypoint };
1394
- return `ff${valueEncoderProto13(value).slice(8)}`;
1395
- }
1396
- };
1397
- const entrypointNameEncoderProto13 = (entrypoint) => {
1398
- const value = { string: entrypoint };
1399
- return `${valueEncoderProto13(value).slice(2)}`;
1400
- };
1401
- const entrypointNameDecoderProto13 = (val) => {
1402
- const entry = extractRequiredLen(val);
1403
- return Buffer.from(entry).toString('utf8');
1404
- };
1405
- const parametersEncoderProto13 = (val) => {
1406
- if (!val || (val.entrypoint === 'default' && 'prim' in val.value && val.value.prim === 'Unit')) {
1407
- return '00';
1408
- }
1409
- const encodedEntrypoint = entrypointEncoderProto13(val.entrypoint);
1410
- const parameters = valueEncoderProto13(val.value);
1411
- const length = (parameters.length / 2).toString(16).padStart(8, '0');
1412
- return `ff${encodedEntrypoint}${length}${parameters}`;
1413
- };
1414
- const valueParameterEncoderProto13 = (value) => {
1415
- const valueEncoded = valueEncoderProto13(value);
1416
- return `${pad(valueEncoded.length / 2)}${valueEncoded}`;
1417
- };
1418
- const txRollupOriginationParamEncoderProto13 = (_value) => {
1419
- return '';
1420
- };
1421
- const txRollupOriginationParamDecoderProto13 = (_val) => {
1422
- return {};
1423
- };
1424
- const txRollupIdEncoderProto13 = prefixEncoder(Prefix.TXR1);
1425
- const txRollupIdDecoderProto13 = prefixDecoder(Prefix.TXR1);
1426
- const txRollupBatchContentEncoderProto13 = (value) => {
1427
- return `${pad(value.length / 2)}${value}`;
1428
- };
1429
- const txRollupBatchContentDecoderProto13 = (val) => {
1430
- const value = extractRequiredLen(val);
1431
- return Buffer.from(value).toString('hex');
1432
- };
1433
- const burnLimitEncoder = (val) => {
1434
- return !val ? '00' : `ff${zarithEncoder(val)}`;
1435
- };
1436
- const burnLimitDecoder = (value) => {
1437
- const prefix = value.consume(1);
1438
- if (Buffer.from(prefix).toString('hex') !== '00') {
1439
- return zarithDecoder(value);
1440
- }
1441
- };
1442
-
1443
- const encodersProto13 = Object.assign(Object.assign({}, encoders), { [CODEC.SCRIPT]: scriptEncoderProto13, [CODEC.PARAMETERS]: parametersEncoderProto13, [CODEC.VALUE]: valueParameterEncoderProto13, [CODEC.ENTRYPOINT]: entrypointNameEncoderProto13, [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamEncoderProto13, [CODEC.TX_ROLLUP_ID]: txRollupIdEncoderProto13, [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentEncoderProto13, [CODEC.BURN_LIMIT]: burnLimitEncoder });
1444
- encodersProto13[CODEC.OPERATION] = operationEncoder(encodersProto13);
1445
- encodersProto13[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encodersProto13)(ActivationSchema)(val);
1446
- encodersProto13[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encodersProto13)(DelegationSchema)(val);
1447
- encodersProto13[CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encodersProto13)(TransactionSchema)(val);
1448
- encodersProto13[CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encodersProto13)(OriginationSchema)(val);
1449
- encodersProto13[CODEC.OP_BALLOT] = (val) => schemaEncoder(encodersProto13)(BallotSchema)(val);
1450
- encodersProto13[CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto13)(EndorsementSchema)(val);
1451
- encodersProto13[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encodersProto13)(SeedNonceRevelationSchema)(val);
1452
- encodersProto13[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encodersProto13)(ProposalsSchema)(val);
1453
- encodersProto13[CODEC.OP_REVEAL] = (val) => schemaEncoder(encodersProto13)(RevealSchema)(val);
1454
- encodersProto13[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encodersProto13)(RegisterGlobalConstantSchema)(val);
1455
- encodersProto13[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encodersProto13)(TransferTicketSchema)(val);
1456
- encodersProto13[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaEncoder(encodersProto13)(TxRollupOriginationSchema)(val);
1457
- encodersProto13[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaEncoder(encodersProto13)(TxRollupSubmitBatchSchema)(val);
1458
- encodersProto13[CODEC.MANAGER] = schemaEncoder(encodersProto13)(ManagerOperationSchema);
1459
-
1460
- const decodersProto13 = Object.assign(Object.assign({}, decoders), { [CODEC.SCRIPT]: scriptDecoderProto13, [CODEC.PARAMETERS]: parametersDecoderProto13, [CODEC.VALUE]: valueParameterDecoderProto13, [CODEC.ENTRYPOINT]: entrypointNameDecoderProto13, [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamDecoderProto13, [CODEC.TX_ROLLUP_ID]: txRollupIdDecoderProto13, [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentDecoderProto13, [CODEC.BURN_LIMIT]: burnLimitDecoder });
1461
- decodersProto13[CODEC.OPERATION] = operationDecoder(decodersProto13);
1462
- decodersProto13[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decodersProto13)(ActivationSchema)(val);
1463
- decodersProto13[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decodersProto13)(DelegationSchema)(val);
1464
- decodersProto13[CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decodersProto13)(TransactionSchema)(val);
1465
- decodersProto13[CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decodersProto13)(OriginationSchema)(val);
1466
- decodersProto13[CODEC.OP_BALLOT] = (val) => schemaDecoder(decodersProto13)(BallotSchema)(val);
1467
- decodersProto13[CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto13)(EndorsementSchema)(val);
1468
- decodersProto13[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decodersProto13)(SeedNonceRevelationSchema)(val);
1469
- decodersProto13[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decodersProto13)(ProposalsSchema)(val);
1470
- decodersProto13[CODEC.OP_REVEAL] = (val) => schemaDecoder(decodersProto13)(RevealSchema)(val);
1471
- decodersProto13[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decodersProto13)(RegisterGlobalConstantSchema)(val);
1472
- decodersProto13[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decodersProto13)(TransferTicketSchema)(val);
1473
- decodersProto13[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaDecoder(decodersProto13)(TxRollupOriginationSchema)(val);
1474
- decodersProto13[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaDecoder(decodersProto13)(TxRollupSubmitBatchSchema)(val);
1475
- decodersProto13[CODEC.MANAGER] = schemaDecoder(decodersProto13)(ManagerOperationSchema);
1289
+ })(ProtocolsHash || (ProtocolsHash = {}));
1476
1290
 
1477
1291
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
1478
1292
  const VERSION = {
1479
- "commitHash": "01d3579d51bb8d70038a304cd4dbb7c6366a244b",
1480
- "version": "13.0.0"
1293
+ "commitHash": "b1a433145402043facaec3519daceb21a305deef",
1294
+ "version": "14.0.0"
1481
1295
  };
1482
1296
 
1483
1297
  /**
@@ -1485,25 +1299,14 @@ const VERSION = {
1485
1299
  * @module @taquito/local-forging
1486
1300
  */
1487
1301
  const PROTOCOL_CURRENT = ProtocolsHash.Psithaca2;
1488
- function getCodec(codec, proto) {
1489
- if (proto === ProtocolsHash.Psithaca2 || ProtoInferiorTo(proto, ProtocolsHash.Psithaca2)) {
1490
- return {
1491
- encoder: encoders[codec],
1492
- decoder: (hex) => {
1493
- const consumer = Uint8ArrayConsumer.fromHexString(hex);
1494
- return decoders[codec](consumer);
1495
- },
1496
- };
1497
- }
1498
- else {
1499
- return {
1500
- encoder: encodersProto13[codec],
1501
- decoder: (hex) => {
1502
- const consumer = Uint8ArrayConsumer.fromHexString(hex);
1503
- return decodersProto13[codec](consumer);
1504
- },
1505
- };
1506
- }
1302
+ function getCodec(codec, _proto) {
1303
+ return {
1304
+ encoder: encoders[codec],
1305
+ decoder: (hex) => {
1306
+ const consumer = Uint8ArrayConsumer.fromHexString(hex);
1307
+ return decoders[codec](consumer);
1308
+ },
1309
+ };
1507
1310
  }
1508
1311
  class LocalForger {
1509
1312
  constructor(protocolHash = PROTOCOL_CURRENT) {