@taquito/local-forging 22.0.0-beta.0 → 23.0.0-RC.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-proto021.js → codec-proto022.js} +71 -23
- package/dist/lib/codec.js +87 -110
- package/dist/lib/{constants-proto021.js → constants-proto022.js} +1 -0
- package/dist/lib/constants.js +3 -0
- package/dist/lib/decoder-proto022.js +63 -0
- package/dist/lib/decoder.js +1 -0
- package/dist/lib/encoder-proto022.js +62 -0
- package/dist/lib/encoder.js +1 -0
- package/dist/lib/michelson/codec-proto022.js +283 -0
- package/dist/lib/protocols.js +2 -0
- package/dist/lib/schema/operation-proto022.js +238 -0
- package/dist/lib/schema/operation.js +11 -1
- package/dist/lib/taquito-local-forging.js +14 -8
- package/dist/lib/validator-proto022.js +56 -0
- package/dist/lib/validator.js +1 -0
- package/dist/lib/version.js +2 -2
- package/dist/taquito-local-forging.es6.js +606 -302
- package/dist/taquito-local-forging.es6.js.map +1 -1
- package/dist/taquito-local-forging.umd.js +604 -300
- package/dist/taquito-local-forging.umd.js.map +1 -1
- package/dist/types/{codec-proto021.d.ts → codec-proto022.d.ts} +3 -1
- package/dist/types/codec.d.ts +3 -3
- package/dist/types/{constants-proto021.d.ts → constants-proto022.d.ts} +1 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/{decoder-proto021.d.ts → decoder-proto022.d.ts} +1 -1
- package/dist/types/{encoder-proto021.d.ts → encoder-proto022.d.ts} +1 -1
- package/dist/types/michelson/codec-proto022.d.ts +49 -0
- package/dist/types/michelson/codec.d.ts +1 -1
- package/dist/types/protocols.d.ts +1 -0
- package/dist/types/schema/{operation-proto021.d.ts → operation-proto022.d.ts} +3 -2
- package/dist/types/schema/operation.d.ts +10 -0
- package/dist/types/taquito-local-forging.d.ts +3 -3
- package/dist/types/validator-proto022.d.ts +13 -0
- package/package.json +5 -5
- package/dist/lib/decoder-proto021.js +0 -62
- package/dist/lib/encoder-proto021.js +0 -61
- package/dist/lib/schema/operation-proto021.js +0 -237
|
@@ -22,9 +22,9 @@ exports.localForger = exports.LocalForger = exports.ProtocolsHash = exports.VERS
|
|
|
22
22
|
exports.getCodec = getCodec;
|
|
23
23
|
const constants_1 = require("./constants");
|
|
24
24
|
const decoder_1 = require("./decoder");
|
|
25
|
-
const
|
|
25
|
+
const decoder_proto022_1 = require("./decoder-proto022");
|
|
26
26
|
const encoder_1 = require("./encoder");
|
|
27
|
-
const
|
|
27
|
+
const encoder_proto022_1 = require("./encoder-proto022");
|
|
28
28
|
const uint8array_consumer_1 = require("./uint8array-consumer");
|
|
29
29
|
const utils_1 = require("@taquito/utils");
|
|
30
30
|
const errors_1 = require("./errors");
|
|
@@ -43,15 +43,15 @@ var version_1 = require("./version");
|
|
|
43
43
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
44
44
|
var protocols_2 = require("./protocols");
|
|
45
45
|
Object.defineProperty(exports, "ProtocolsHash", { enumerable: true, get: function () { return protocols_2.ProtocolsHash; } });
|
|
46
|
-
const PROTOCOL_CURRENT = protocols_1.ProtocolsHash.
|
|
46
|
+
const PROTOCOL_CURRENT = protocols_1.ProtocolsHash.PtSeouLou;
|
|
47
47
|
function getCodec(codec, _proto) {
|
|
48
|
-
// use
|
|
49
|
-
if (_proto === protocols_1.ProtocolsHash.
|
|
48
|
+
// use encodersProto022 & decodersProto022 if it's rio or prior
|
|
49
|
+
if (_proto === protocols_1.ProtocolsHash.PsRiotuma || (0, protocols_1.ProtoInferiorTo)(_proto, protocols_1.ProtocolsHash.PsRiotuma)) {
|
|
50
50
|
return {
|
|
51
|
-
encoder:
|
|
51
|
+
encoder: encoder_proto022_1.encoders[codec],
|
|
52
52
|
decoder: (hex) => {
|
|
53
53
|
const consumer = uint8array_consumer_1.Uint8ArrayConsumer.fromHexString(hex);
|
|
54
|
-
return
|
|
54
|
+
return decoder_proto022_1.decoders[codec](consumer);
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
}
|
|
@@ -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,
|
|
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)) {
|
|
@@ -107,6 +107,12 @@ class LocalForger {
|
|
|
107
107
|
else if (content.kind === 'update_consensus_key' && diff[0] === 'proof') {
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
|
+
else if (content.kind === 'update_companion_key' && diff[0] === 'proof') {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
else if (content.kind === 'reveal' && diff[0] === 'proof') {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
110
116
|
else {
|
|
111
117
|
throw new errors_1.InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`);
|
|
112
118
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateMissingProperty = exports.validateOperationKind = void 0;
|
|
4
|
+
const operation_proto022_1 = require("./schema/operation-proto022");
|
|
5
|
+
const OperationKindMapping = {
|
|
6
|
+
activate_account: operation_proto022_1.ActivationSchema,
|
|
7
|
+
reveal: operation_proto022_1.RevealSchema,
|
|
8
|
+
delegation: operation_proto022_1.DelegationSchema,
|
|
9
|
+
transaction: operation_proto022_1.TransactionSchema,
|
|
10
|
+
origination: operation_proto022_1.OriginationSchema,
|
|
11
|
+
ballot: operation_proto022_1.BallotSchema,
|
|
12
|
+
attestation: operation_proto022_1.AttestationSchema,
|
|
13
|
+
attestation_with_dal: operation_proto022_1.AttestationWithDalSchema,
|
|
14
|
+
seed_nonce_revelation: operation_proto022_1.SeedNonceRevelationSchema,
|
|
15
|
+
proposals: operation_proto022_1.ProposalsSchema,
|
|
16
|
+
register_global_constant: operation_proto022_1.RegisterGlobalConstantSchema,
|
|
17
|
+
transfer_ticket: operation_proto022_1.TransferTicketSchema,
|
|
18
|
+
increase_paid_storage: operation_proto022_1.IncreasePaidStorageSchema,
|
|
19
|
+
update_consensus_key: operation_proto022_1.UpdateConsensusKeySchema,
|
|
20
|
+
drain_delegate: operation_proto022_1.DrainDelegateSchema,
|
|
21
|
+
set_deposits_limit: operation_proto022_1.SetDepositsLimitSchema,
|
|
22
|
+
smart_rollup_originate: operation_proto022_1.SmartRollupOriginateSchema,
|
|
23
|
+
smart_rollup_add_messages: operation_proto022_1.SmartRollupAddMessagesSchema,
|
|
24
|
+
smart_rollup_execute_outbox_message: operation_proto022_1.SmartRollupExecuteOutboxMessageSchema,
|
|
25
|
+
dal_publish_commitment: operation_proto022_1.DalPublishCommitmentSchema,
|
|
26
|
+
failing_noop: operation_proto022_1.FailingNoopSchema,
|
|
27
|
+
};
|
|
28
|
+
// Asymmetric difference: only account for things in arr2 that are not present in arr1, not vice versa
|
|
29
|
+
const getArrayDifference = (arr1, arr2) => {
|
|
30
|
+
return arr2.filter((x) => !arr1.includes(x));
|
|
31
|
+
};
|
|
32
|
+
const deleteArrayElementByValue = (array, item) => {
|
|
33
|
+
return array.filter((e) => e !== item);
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @returns A boolean value to indicate whether the operation kind is valid or not
|
|
37
|
+
*/
|
|
38
|
+
const validateOperationKind = (opKind) => {
|
|
39
|
+
const opKindList = Object.keys(OperationKindMapping);
|
|
40
|
+
return opKindList.includes(opKind);
|
|
41
|
+
};
|
|
42
|
+
exports.validateOperationKind = validateOperationKind;
|
|
43
|
+
/**
|
|
44
|
+
* returns 0 when the two array of properties are identical or the passed property
|
|
45
|
+
* does not have any missing parameters from the corresponding schema
|
|
46
|
+
*
|
|
47
|
+
* @returns array element differences if there are missing required property keys
|
|
48
|
+
*/
|
|
49
|
+
const validateMissingProperty = (operationContent) => {
|
|
50
|
+
const kind = operationContent.kind;
|
|
51
|
+
const keys = Object.keys(operationContent);
|
|
52
|
+
const cleanKeys = deleteArrayElementByValue(keys, 'kind');
|
|
53
|
+
const schemaKeys = Object.keys(OperationKindMapping[kind]);
|
|
54
|
+
return getArrayDifference(cleanKeys, schemaKeys);
|
|
55
|
+
};
|
|
56
|
+
exports.validateMissingProperty = validateMissingProperty;
|
package/dist/lib/validator.js
CHANGED
|
@@ -17,6 +17,7 @@ const OperationKindMapping = {
|
|
|
17
17
|
transfer_ticket: operation_1.TransferTicketSchema,
|
|
18
18
|
increase_paid_storage: operation_1.IncreasePaidStorageSchema,
|
|
19
19
|
update_consensus_key: operation_1.UpdateConsensusKeySchema,
|
|
20
|
+
update_companion_key: operation_1.UpdateCompanionKeySchema,
|
|
20
21
|
drain_delegate: operation_1.DrainDelegateSchema,
|
|
21
22
|
set_deposits_limit: operation_1.SetDepositsLimitSchema,
|
|
22
23
|
smart_rollup_originate: operation_1.SmartRollupOriginateSchema,
|
package/dist/lib/version.js
CHANGED
|
@@ -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": "
|
|
7
|
-
"version": "
|
|
6
|
+
"commitHash": "13639ef56845fbb7e93bcbd37d3f6d0457b0872b",
|
|
7
|
+
"version": "23.0.0-RC.0"
|
|
8
8
|
};
|