@taquito/taquito 24.2.0 → 24.3.0-beta.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/README.md +1 -1
- package/dist/lib/batch/rpc-batch-provider.js +91 -83
- package/dist/lib/context.js +22 -26
- package/dist/lib/contract/big-map.js +16 -29
- package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
- package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
- package/dist/lib/contract/contract.js +21 -32
- package/dist/lib/contract/errors.js +9 -9
- package/dist/lib/contract/prepare.js +36 -45
- package/dist/lib/contract/rpc-contract-provider.js +426 -475
- package/dist/lib/contract/sapling-state-abstraction.js +3 -14
- package/dist/lib/contract/semantic.js +2 -2
- package/dist/lib/errors.js +3 -3
- package/dist/lib/estimate/errors.js +1 -1
- package/dist/lib/estimate/estimate.js +66 -20
- package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
- package/dist/lib/forger/composite-forger.js +16 -27
- package/dist/lib/forger/errors.js +2 -2
- package/dist/lib/forger/taquito-local-forger.js +9 -22
- package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
- package/dist/lib/global-constants/errors.js +2 -2
- package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
- package/dist/lib/import-key.js +23 -34
- package/dist/lib/injector/rpc-injector.js +13 -24
- package/dist/lib/operations/ballot-operation.js +2 -3
- package/dist/lib/operations/delegate-operation.js +5 -8
- package/dist/lib/operations/drain-delegate-operation.js +1 -1
- package/dist/lib/operations/errors.js +9 -6
- package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
- package/dist/lib/operations/operations.js +100 -30
- package/dist/lib/operations/origination-operation.js +16 -27
- package/dist/lib/operations/proposals-operation.js +2 -3
- package/dist/lib/operations/register-global-constant-operation.js +4 -7
- package/dist/lib/operations/reveal-operation.js +1 -1
- package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
- package/dist/lib/operations/transaction-operation.js +2 -2
- package/dist/lib/operations/transfer-ticket-operation.js +4 -6
- package/dist/lib/operations/types.js +17 -19
- package/dist/lib/operations/update-companion-key-operation.js +4 -7
- package/dist/lib/operations/update-consensus-key-operation.js +4 -7
- package/dist/lib/packer/michel-codec-packer.js +3 -14
- package/dist/lib/packer/rpc-packer.js +2 -13
- package/dist/lib/parser/michel-codec-parser.js +82 -107
- package/dist/lib/parser/noop-parser.js +2 -13
- package/dist/lib/prepare/prepare-provider.js +780 -744
- package/dist/lib/provider.js +322 -128
- package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
- package/dist/lib/signer/errors.js +1 -1
- package/dist/lib/signer/noop.js +9 -26
- package/dist/lib/subscribe/errors.js +2 -2
- package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
- package/dist/lib/taquito.js +33 -33
- package/dist/lib/tz/rpc-tz-provider.js +27 -44
- package/dist/lib/version.js +2 -2
- package/dist/lib/wallet/batch-operation.js +32 -45
- package/dist/lib/wallet/delegation-operation.js +25 -40
- package/dist/lib/wallet/errors.js +15 -3
- package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
- package/dist/lib/wallet/legacy.js +28 -63
- package/dist/lib/wallet/operation-factory.js +27 -56
- package/dist/lib/wallet/operation.js +123 -59
- package/dist/lib/wallet/origination-operation.js +34 -46
- package/dist/lib/wallet/register-global-constant-operation.js +26 -43
- package/dist/lib/wallet/transaction-operation.js +21 -36
- package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
- package/dist/lib/wallet/wallet.js +187 -184
- package/dist/taquito.es6.js +3424 -3197
- package/dist/taquito.es6.js.map +1 -1
- package/dist/taquito.min.js +1 -1
- package/dist/taquito.umd.js +7930 -7701
- package/dist/taquito.umd.js.map +1 -1
- package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
- package/dist/types/context.d.ts +4 -4
- package/dist/types/contract/big-map.d.ts +3 -3
- package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
- package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
- package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
- package/dist/types/contract/contract.d.ts +6 -6
- package/dist/types/contract/errors.d.ts +11 -11
- package/dist/types/contract/interface.d.ts +42 -42
- package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
- package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
- package/dist/types/contract/semantic.d.ts +2 -2
- package/dist/types/errors.d.ts +5 -5
- package/dist/types/estimate/errors.d.ts +1 -1
- package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
- package/dist/types/estimate/estimate.d.ts +28 -11
- package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
- package/dist/types/forger/errors.d.ts +2 -2
- package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
- package/dist/types/global-constants/errors.d.ts +2 -2
- package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
- package/dist/types/import-key.d.ts +2 -2
- package/dist/types/operations/ballot-operation.d.ts +1 -1
- package/dist/types/operations/delegate-operation.d.ts +2 -2
- package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
- package/dist/types/operations/errors.d.ts +5 -5
- package/dist/types/operations/failing-noop-operation.d.ts +1 -1
- package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
- package/dist/types/operations/operations.d.ts +2 -2
- package/dist/types/operations/origination-operation.d.ts +5 -5
- package/dist/types/operations/proposals-operation.d.ts +1 -1
- package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
- package/dist/types/operations/reveal-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
- package/dist/types/operations/transaction-operation.d.ts +2 -2
- package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
- package/dist/types/operations/types.d.ts +387 -25
- package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
- package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
- package/dist/types/prepare/interface.d.ts +32 -33
- package/dist/types/prepare/prepare-provider.d.ts +34 -60
- package/dist/types/provider.d.ts +7 -1
- package/dist/types/read-provider/interface.d.ts +21 -21
- package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
- package/dist/types/signer/errors.d.ts +1 -1
- package/dist/types/signer/noop.d.ts +1 -1
- package/dist/types/subscribe/errors.d.ts +2 -2
- package/dist/types/taquito.d.ts +33 -33
- package/dist/types/wallet/errors.d.ts +10 -2
- package/dist/types/wallet/interface.d.ts +13 -13
- package/dist/types/wallet/operation.d.ts +4 -3
- package/dist/types/wallet/wallet.d.ts +36 -35
- package/package.json +27 -15
- package/LICENSE +0 -202
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.MichelCodecParser = void 0;
|
|
13
4
|
const michel_codec_1 = require("@taquito/michel-codec");
|
|
@@ -17,119 +8,103 @@ class MichelCodecParser {
|
|
|
17
8
|
constructor(context) {
|
|
18
9
|
this.context = context;
|
|
19
10
|
}
|
|
20
|
-
getNextProto() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return this.context.proto;
|
|
27
|
-
});
|
|
11
|
+
async getNextProto() {
|
|
12
|
+
if (!this.context.proto) {
|
|
13
|
+
const nextProto = await this.context.readProvider.getNextProtocol('head');
|
|
14
|
+
this.context.proto = nextProto;
|
|
15
|
+
}
|
|
16
|
+
return this.context.proto;
|
|
28
17
|
}
|
|
29
|
-
parseScript(src) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return parser.parseScript(src);
|
|
33
|
-
});
|
|
18
|
+
async parseScript(src) {
|
|
19
|
+
const parser = new michel_codec_1.Parser({ protocol: await this.getNextProto() });
|
|
20
|
+
return parser.parseScript(src);
|
|
34
21
|
}
|
|
35
|
-
parseMichelineExpression(src) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return parser.parseMichelineExpression(src);
|
|
39
|
-
});
|
|
22
|
+
async parseMichelineExpression(src) {
|
|
23
|
+
const parser = new michel_codec_1.Parser({ protocol: await this.getNextProto() });
|
|
24
|
+
return parser.parseMichelineExpression(src);
|
|
40
25
|
}
|
|
41
|
-
parseJSON(src) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return parser.parseJSON(src);
|
|
45
|
-
});
|
|
26
|
+
async parseJSON(src) {
|
|
27
|
+
const parser = new michel_codec_1.Parser({ protocol: await this.getNextProto() });
|
|
28
|
+
return parser.parseJSON(src);
|
|
46
29
|
}
|
|
47
|
-
prepareCodeOrigination(params) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
throw new errors_1.InvalidCodeParameter('The storage section is missing from the script', params.code);
|
|
58
|
-
}
|
|
59
|
-
const schema = new michelson_encoder_1.Schema(storageType.args[0]);
|
|
60
|
-
const globalconstantsHashAndValue = yield this.findGlobalConstantsHashAndValue(schema);
|
|
61
|
-
if (Object.keys(globalconstantsHashAndValue).length !== 0) {
|
|
62
|
-
// If there are global constants in the storage part of the contract code,
|
|
63
|
-
// they need to be locally expanded in order to encode the storage arguments
|
|
64
|
-
const p = new michel_codec_1.Parser({ expandGlobalConstant: globalconstantsHashAndValue });
|
|
65
|
-
const storageTypeNoGlobalConst = p.parseJSON(storageType.args[0]);
|
|
66
|
-
const schemaNoGlobalConst = new michelson_encoder_1.Schema(storageTypeNoGlobalConst);
|
|
67
|
-
parsedParams.init = schemaNoGlobalConst.Encode(params.storage);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
parsedParams.init = schema.Encode(params.storage);
|
|
71
|
-
}
|
|
72
|
-
delete parsedParams.storage;
|
|
30
|
+
async prepareCodeOrigination(params) {
|
|
31
|
+
const parsedParams = params;
|
|
32
|
+
parsedParams.code = await this.formatCodeParam(params.code);
|
|
33
|
+
if (params.init) {
|
|
34
|
+
parsedParams.init = await this.formatInitParam(params.init);
|
|
35
|
+
}
|
|
36
|
+
else if (params.storage) {
|
|
37
|
+
const storageType = parsedParams.code.find((p) => 'prim' in p && p.prim === 'storage');
|
|
38
|
+
if (!storageType?.args) {
|
|
39
|
+
throw new errors_1.InvalidCodeParameter('The storage section is missing from the script', params.code);
|
|
73
40
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
throw new errors_1.InvalidCodeParameter('Unable to parse', code);
|
|
84
|
-
}
|
|
85
|
-
parsedCode = c;
|
|
41
|
+
const schema = new michelson_encoder_1.Schema(storageType.args[0]);
|
|
42
|
+
const globalconstantsHashAndValue = await this.findGlobalConstantsHashAndValue(schema);
|
|
43
|
+
if (Object.keys(globalconstantsHashAndValue).length !== 0) {
|
|
44
|
+
// If there are global constants in the storage part of the contract code,
|
|
45
|
+
// they need to be locally expanded in order to encode the storage arguments
|
|
46
|
+
const p = new michel_codec_1.Parser({ expandGlobalConstant: globalconstantsHashAndValue });
|
|
47
|
+
const storageTypeNoGlobalConst = p.parseJSON(storageType.args[0]);
|
|
48
|
+
const schemaNoGlobalConst = new michelson_encoder_1.Schema(storageTypeNoGlobalConst);
|
|
49
|
+
parsedParams.init = schemaNoGlobalConst.Encode(params.storage);
|
|
86
50
|
}
|
|
87
51
|
else {
|
|
88
|
-
|
|
89
|
-
const order = ['parameter', 'storage', 'code'];
|
|
90
|
-
// Ensure correct ordering for RPC
|
|
91
|
-
parsedCode = c.sort((a, b) => order.indexOf(a.prim) - order.indexOf(b.prim));
|
|
52
|
+
parsedParams.init = schema.Encode(params.storage);
|
|
92
53
|
}
|
|
93
|
-
|
|
94
|
-
}
|
|
54
|
+
delete parsedParams.storage;
|
|
55
|
+
}
|
|
56
|
+
return parsedParams;
|
|
95
57
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
throw new errors_1.InvalidInitParameter('Invalid init parameter', init);
|
|
103
|
-
}
|
|
104
|
-
parsedInit = c;
|
|
58
|
+
async formatCodeParam(code) {
|
|
59
|
+
let parsedCode;
|
|
60
|
+
if (typeof code === 'string') {
|
|
61
|
+
const c = await this.parseScript(code);
|
|
62
|
+
if (c === null) {
|
|
63
|
+
throw new errors_1.InvalidCodeParameter('Unable to parse', code);
|
|
105
64
|
}
|
|
106
|
-
|
|
107
|
-
|
|
65
|
+
parsedCode = c;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const c = await this.parseJSON(code);
|
|
69
|
+
const order = ['parameter', 'storage', 'code'];
|
|
70
|
+
// Ensure correct ordering for RPC
|
|
71
|
+
parsedCode = c.sort((a, b) => order.indexOf(a.prim) - order.indexOf(b.prim));
|
|
72
|
+
}
|
|
73
|
+
return parsedCode;
|
|
74
|
+
}
|
|
75
|
+
async formatInitParam(init) {
|
|
76
|
+
let parsedInit;
|
|
77
|
+
if (typeof init === 'string') {
|
|
78
|
+
const c = await this.parseMichelineExpression(init);
|
|
79
|
+
if (c === null) {
|
|
80
|
+
throw new errors_1.InvalidInitParameter('Invalid init parameter', init);
|
|
108
81
|
}
|
|
109
|
-
|
|
110
|
-
}
|
|
82
|
+
parsedInit = c;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
parsedInit = await this.parseJSON(init);
|
|
86
|
+
}
|
|
87
|
+
return parsedInit;
|
|
111
88
|
}
|
|
112
|
-
findGlobalConstantsHashAndValue(schema) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
127
|
-
}
|
|
89
|
+
async findGlobalConstantsHashAndValue(schema) {
|
|
90
|
+
const globalConstantTokens = schema.findToken('constant');
|
|
91
|
+
const globalConstantsHashAndValue = {};
|
|
92
|
+
if (globalConstantTokens.length !== 0) {
|
|
93
|
+
for (const token of globalConstantTokens) {
|
|
94
|
+
const tokenArgs = token.tokenVal.args;
|
|
95
|
+
if (tokenArgs) {
|
|
96
|
+
const expression = tokenArgs[0];
|
|
97
|
+
if (expression.string) {
|
|
98
|
+
const hash = expression.string;
|
|
99
|
+
const michelineValue = await this.context.globalConstantsProvider.getGlobalConstantByHash(hash);
|
|
100
|
+
Object.assign(globalConstantsHashAndValue, {
|
|
101
|
+
[hash]: michelineValue,
|
|
102
|
+
});
|
|
128
103
|
}
|
|
129
104
|
}
|
|
130
105
|
}
|
|
131
|
-
|
|
132
|
-
|
|
106
|
+
}
|
|
107
|
+
return globalConstantsHashAndValue;
|
|
133
108
|
}
|
|
134
109
|
}
|
|
135
110
|
exports.MichelCodecParser = MichelCodecParser;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.NoopParser = void 0;
|
|
13
4
|
class NoopParser {
|
|
14
|
-
prepareCodeOrigination(params) {
|
|
15
|
-
return
|
|
16
|
-
return params;
|
|
17
|
-
});
|
|
5
|
+
async prepareCodeOrigination(params) {
|
|
6
|
+
return params;
|
|
18
7
|
}
|
|
19
8
|
}
|
|
20
9
|
exports.NoopParser = NoopParser;
|