@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.Operation = void 0;
|
|
13
4
|
const rxjs_1 = require("rxjs");
|
|
@@ -17,8 +8,60 @@ const utils_1 = require("@taquito/utils");
|
|
|
17
8
|
const create_observable_from_subscription_1 = require("../subscribe/create-observable-from-subscription");
|
|
18
9
|
const errors_1 = require("../errors");
|
|
19
10
|
const core_1 = require("@taquito/core");
|
|
11
|
+
const opTraceEnabled = /^(1|true)$/i.test(process?.env?.TAQUITO_OP_TRACE ?? '');
|
|
12
|
+
const opTraceVerbose = /^(1|true)$/i.test(process?.env?.TAQUITO_OP_TRACE_VERBOSE ?? '');
|
|
13
|
+
const parsedOpTraceSlowMs = Number(process?.env?.TAQUITO_OP_TRACE_SLOW_MS ?? '60000');
|
|
14
|
+
const opTraceSlowMs = Number.isFinite(parsedOpTraceSlowMs) && parsedOpTraceSlowMs >= 0 ? parsedOpTraceSlowMs : 60000;
|
|
15
|
+
const asRecord = (value) => typeof value === 'object' && value !== null ? value : undefined;
|
|
16
|
+
const getErrors = (value) => (Array.isArray(value) ? value : []);
|
|
17
|
+
const summarizeOperationResults = (results) => results.map((result) => {
|
|
18
|
+
const resultRecord = asRecord(result) ?? {};
|
|
19
|
+
const metadata = asRecord(resultRecord.metadata);
|
|
20
|
+
const operationResult = asRecord(metadata?.operation_result);
|
|
21
|
+
const internalOperationResults = metadata?.internal_operation_results;
|
|
22
|
+
const internalFailures = Array.isArray(internalOperationResults)
|
|
23
|
+
? internalOperationResults.reduce((acc, internalResult) => {
|
|
24
|
+
const internalResultRecord = asRecord(internalResult);
|
|
25
|
+
const internalResultPayload = asRecord(internalResultRecord?.result);
|
|
26
|
+
const status = internalResultPayload?.status;
|
|
27
|
+
if (typeof status !== 'string' || status === 'applied') {
|
|
28
|
+
return acc;
|
|
29
|
+
}
|
|
30
|
+
acc.push({
|
|
31
|
+
kind: typeof internalResultRecord?.kind === 'string'
|
|
32
|
+
? internalResultRecord.kind
|
|
33
|
+
: 'unknown',
|
|
34
|
+
status,
|
|
35
|
+
errors: getErrors(internalResultPayload?.errors),
|
|
36
|
+
});
|
|
37
|
+
return acc;
|
|
38
|
+
}, [])
|
|
39
|
+
: [];
|
|
40
|
+
return {
|
|
41
|
+
kind: typeof resultRecord.kind === 'string' ? resultRecord.kind : 'unknown',
|
|
42
|
+
status: typeof operationResult?.status === 'string' ? operationResult.status : 'unknown',
|
|
43
|
+
errors: getErrors(operationResult?.errors),
|
|
44
|
+
consumed_milligas: typeof operationResult?.consumed_milligas === 'string'
|
|
45
|
+
? operationResult.consumed_milligas
|
|
46
|
+
: undefined,
|
|
47
|
+
internalFailures,
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const toErrorMessage = (error) => {
|
|
51
|
+
if (error instanceof Error) {
|
|
52
|
+
return `${error.name}: ${error.message}`;
|
|
53
|
+
}
|
|
54
|
+
return String(error);
|
|
55
|
+
};
|
|
56
|
+
const traceOperation = (payload) => {
|
|
57
|
+
if (!opTraceEnabled) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// JSON logs make post-run parsing for flaky tests straightforward.
|
|
61
|
+
console.log(`[taquito:op-trace] ${JSON.stringify(payload)}`);
|
|
62
|
+
};
|
|
20
63
|
/**
|
|
21
|
-
*
|
|
64
|
+
* Utility class to interact with Tezos operations
|
|
22
65
|
*/
|
|
23
66
|
class Operation {
|
|
24
67
|
get includedInBlock() {
|
|
@@ -29,7 +72,7 @@ class Operation {
|
|
|
29
72
|
* @param hash Operation hash
|
|
30
73
|
* @param raw Raw operation that was injected
|
|
31
74
|
* @param context Taquito context allowing access to rpc and signer
|
|
32
|
-
* @throws
|
|
75
|
+
* @throws InvalidOperationHashError
|
|
33
76
|
*/
|
|
34
77
|
constructor(hash, raw, results, context) {
|
|
35
78
|
this.hash = hash;
|
|
@@ -44,8 +87,7 @@ class Operation {
|
|
|
44
87
|
}));
|
|
45
88
|
}), (0, operators_1.switchMap)(() => {
|
|
46
89
|
return (0, rxjs_1.defer)(() => (0, create_observable_from_subscription_1.createObservableFromSubscription)(this.context.stream.subscribeBlock('head'))).pipe((0, operators_1.switchMap)((newHead) => {
|
|
47
|
-
|
|
48
|
-
const prevHead = (_b = (_a = this.lastHead) === null || _a === void 0 ? void 0 : _a.header.level) !== null && _b !== void 0 ? _b : newHead.header.level - 1;
|
|
90
|
+
const prevHead = this.lastHead?.header.level ?? newHead.header.level - 1;
|
|
49
91
|
return (0, rxjs_1.range)(prevHead + 1, newHead.header.level - prevHead - 1).pipe((0, operators_1.concatMap)((level) => this.context.readProvider.getBlock(level)), (0, operators_1.endWith)(newHead));
|
|
50
92
|
}), (0, operators_1.tap)((newHead) => (this.lastHead = newHead)));
|
|
51
93
|
}), (0, operators_1.shareReplay)({ refCount: true }));
|
|
@@ -99,23 +141,51 @@ class Operation {
|
|
|
99
141
|
* @param confirmations [0] Number of confirmation to wait for
|
|
100
142
|
* @param timeout [180] Timeout
|
|
101
143
|
*/
|
|
102
|
-
confirmation(confirmations, timeout) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
144
|
+
async confirmation(confirmations, timeout) {
|
|
145
|
+
if (typeof confirmations !== 'undefined' && confirmations < 1) {
|
|
146
|
+
throw new errors_1.InvalidConfirmationCountError(confirmations);
|
|
147
|
+
}
|
|
148
|
+
const { defaultConfirmationCount, confirmationPollingTimeoutSecond } = this.context.config;
|
|
149
|
+
const timeoutSeconds = timeout || confirmationPollingTimeoutSecond;
|
|
150
|
+
const startedAt = Date.now();
|
|
151
|
+
this._pollingConfig$.next({
|
|
152
|
+
timeout: timeoutSeconds,
|
|
153
|
+
});
|
|
154
|
+
const conf = confirmations !== undefined ? confirmations : defaultConfirmationCount;
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
this.confirmed$
|
|
157
|
+
.pipe((0, operators_1.switchMap)(() => this.currentHead$), (0, operators_1.filter)((head) => head.header.level - this._foundAt >= conf - 1), (0, operators_1.first)())
|
|
158
|
+
.subscribe({
|
|
159
|
+
error: (e) => {
|
|
160
|
+
traceOperation({
|
|
161
|
+
stage: 'confirmation-error',
|
|
162
|
+
hash: this.hash,
|
|
163
|
+
elapsedMs: Date.now() - startedAt,
|
|
164
|
+
expectedConfirmations: conf,
|
|
165
|
+
timeoutSec: timeoutSeconds,
|
|
166
|
+
includedInBlock: Number.isFinite(this._foundAt) ? this._foundAt : null,
|
|
167
|
+
status: this.status,
|
|
168
|
+
error: toErrorMessage(e),
|
|
169
|
+
results: summarizeOperationResults(this.results),
|
|
170
|
+
});
|
|
171
|
+
reject(e);
|
|
172
|
+
},
|
|
173
|
+
complete: () => {
|
|
174
|
+
const elapsedMs = Date.now() - startedAt;
|
|
175
|
+
if (opTraceVerbose || elapsedMs >= opTraceSlowMs || this.status !== 'applied') {
|
|
176
|
+
traceOperation({
|
|
177
|
+
stage: 'confirmation-complete',
|
|
178
|
+
hash: this.hash,
|
|
179
|
+
elapsedMs,
|
|
180
|
+
expectedConfirmations: conf,
|
|
181
|
+
timeoutSec: timeoutSeconds,
|
|
182
|
+
includedInBlock: Number.isFinite(this._foundAt) ? this._foundAt : null,
|
|
183
|
+
status: this.status,
|
|
184
|
+
results: summarizeOperationResults(this.results),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
resolve(this._foundAt + (conf - 1));
|
|
188
|
+
},
|
|
119
189
|
});
|
|
120
190
|
});
|
|
121
191
|
}
|
|
@@ -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.OriginationOperation = void 0;
|
|
13
4
|
const bignumber_js_1 = require("bignumber.js");
|
|
@@ -15,9 +6,9 @@ const errors_1 = require("./errors");
|
|
|
15
6
|
const operations_1 = require("./operations");
|
|
16
7
|
const types_1 = require("./types");
|
|
17
8
|
/**
|
|
18
|
-
*
|
|
9
|
+
* Origination operation provide utility function to fetch newly originated contract
|
|
19
10
|
*
|
|
20
|
-
* @
|
|
11
|
+
* @remarks Currently support only one origination per operation
|
|
21
12
|
*/
|
|
22
13
|
class OriginationOperation extends operations_1.Operation {
|
|
23
14
|
constructor(hash, params, raw, results, context, contractProvider) {
|
|
@@ -30,8 +21,7 @@ class OriginationOperation extends operations_1.Operation {
|
|
|
30
21
|
}
|
|
31
22
|
}
|
|
32
23
|
get status() {
|
|
33
|
-
|
|
34
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
24
|
+
return this.operationResults?.status ?? 'unknown';
|
|
35
25
|
}
|
|
36
26
|
get operationResults() {
|
|
37
27
|
const originationOp = Array.isArray(this.results) &&
|
|
@@ -57,8 +47,7 @@ class OriginationOperation extends operations_1.Operation {
|
|
|
57
47
|
: undefined;
|
|
58
48
|
}
|
|
59
49
|
get consumedMilliGas() {
|
|
60
|
-
|
|
61
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
50
|
+
return this.operationResults?.consumed_milligas;
|
|
62
51
|
}
|
|
63
52
|
get storageDiff() {
|
|
64
53
|
const storageDiff = this.operationResults && this.operationResults.paid_storage_size_diff;
|
|
@@ -69,21 +58,21 @@ class OriginationOperation extends operations_1.Operation {
|
|
|
69
58
|
return storageSize ? storageSize : undefined;
|
|
70
59
|
}
|
|
71
60
|
get errors() {
|
|
72
|
-
|
|
73
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
61
|
+
return this.operationResults?.errors;
|
|
74
62
|
}
|
|
75
63
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @throws
|
|
64
|
+
* Provide the contract abstract of the newly originated contract
|
|
65
|
+
* @throws OriginationOperationError
|
|
78
66
|
*/
|
|
79
|
-
contract(confirmations, timeout) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
67
|
+
async contract(confirmations, timeout) {
|
|
68
|
+
if (!this.contractAddress) {
|
|
69
|
+
throw new errors_1.OriginationOperationError('No contract was originated in this operation');
|
|
70
|
+
}
|
|
71
|
+
await this.confirmation(confirmations, timeout);
|
|
72
|
+
if (!Number.isFinite(this.includedInBlock)) {
|
|
73
|
+
throw new errors_1.OriginationOperationError('Confirmation completed but includedInBlock was not set');
|
|
74
|
+
}
|
|
75
|
+
return this.contractProvider.at(this.contractAddress, undefined, this.includedInBlock);
|
|
87
76
|
}
|
|
88
77
|
}
|
|
89
78
|
exports.OriginationOperation = OriginationOperation;
|
|
@@ -4,7 +4,7 @@ exports.ProposalsOperation = void 0;
|
|
|
4
4
|
const operations_1 = require("./operations");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* ProposalsOperation provides utility functions to fetch a new operation of kind proposals
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
class ProposalsOperation extends operations_1.Operation {
|
|
@@ -23,8 +23,7 @@ class ProposalsOperation extends operations_1.Operation {
|
|
|
23
23
|
return this.params.proposals;
|
|
24
24
|
}
|
|
25
25
|
get period() {
|
|
26
|
-
|
|
27
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.period;
|
|
26
|
+
return this.operationResults?.period;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
exports.ProposalsOperation = ProposalsOperation;
|
|
@@ -4,7 +4,7 @@ exports.RegisterGlobalConstantOperation = void 0;
|
|
|
4
4
|
const bignumber_js_1 = require("bignumber.js");
|
|
5
5
|
const operations_1 = require("./operations");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* RegisterGlobalConstantOperation provides utility functions to fetch a newly issued operation of kind register_global_constant
|
|
8
8
|
*/
|
|
9
9
|
class RegisterGlobalConstantOperation extends operations_1.Operation {
|
|
10
10
|
constructor(hash, params, source, raw, results, context) {
|
|
@@ -22,8 +22,7 @@ class RegisterGlobalConstantOperation extends operations_1.Operation {
|
|
|
22
22
|
return result ? result : undefined;
|
|
23
23
|
}
|
|
24
24
|
get status() {
|
|
25
|
-
|
|
26
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
25
|
+
return this.operationResults?.status ?? 'unknown';
|
|
27
26
|
}
|
|
28
27
|
get registeredExpression() {
|
|
29
28
|
return this.params.value;
|
|
@@ -38,8 +37,7 @@ class RegisterGlobalConstantOperation extends operations_1.Operation {
|
|
|
38
37
|
return Number(this.params.storage_limit);
|
|
39
38
|
}
|
|
40
39
|
get errors() {
|
|
41
|
-
|
|
42
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
40
|
+
return this.operationResults?.errors;
|
|
43
41
|
}
|
|
44
42
|
get consumedGas() {
|
|
45
43
|
bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
|
|
@@ -48,8 +46,7 @@ class RegisterGlobalConstantOperation extends operations_1.Operation {
|
|
|
48
46
|
: undefined;
|
|
49
47
|
}
|
|
50
48
|
get consumedMilliGas() {
|
|
51
|
-
|
|
52
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
49
|
+
return this.operationResults?.consumed_milligas;
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
exports.RegisterGlobalConstantOperation = RegisterGlobalConstantOperation;
|
|
@@ -6,7 +6,7 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
6
6
|
const errors_1 = require("./errors");
|
|
7
7
|
const operations_1 = require("./operations");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Reveal operation provides utility functions to fetch a newly issued revelation
|
|
10
10
|
*/
|
|
11
11
|
class RevealOperation extends operations_1.Operation {
|
|
12
12
|
constructor(hash, params, source, raw, results, context) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SmartRollupAddMessagesOperation = void 0;
|
|
4
4
|
const operations_1 = require("./operations");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* SmartRollupAddMessagesOperation provides utility to fetch properties of SmartRollupAddMessages
|
|
7
7
|
*/
|
|
8
8
|
class SmartRollupAddMessagesOperation extends operations_1.Operation {
|
|
9
9
|
constructor(hash, params, source, raw, results, context) {
|
|
@@ -20,8 +20,7 @@ class SmartRollupAddMessagesOperation extends operations_1.Operation {
|
|
|
20
20
|
return result ? result : undefined;
|
|
21
21
|
}
|
|
22
22
|
get status() {
|
|
23
|
-
|
|
24
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
23
|
+
return this.operationResults?.status ?? 'unknown';
|
|
25
24
|
}
|
|
26
25
|
get message() {
|
|
27
26
|
return this.params.message;
|
|
@@ -36,12 +35,10 @@ class SmartRollupAddMessagesOperation extends operations_1.Operation {
|
|
|
36
35
|
return Number(this.params.storage_limit);
|
|
37
36
|
}
|
|
38
37
|
get consumedMilliGas() {
|
|
39
|
-
|
|
40
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
38
|
+
return this.operationResults?.consumed_milligas;
|
|
41
39
|
}
|
|
42
40
|
get errors() {
|
|
43
|
-
|
|
44
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
41
|
+
return this.operationResults?.errors;
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
exports.SmartRollupAddMessagesOperation = SmartRollupAddMessagesOperation;
|
|
@@ -5,7 +5,7 @@ const rpc_1 = require("@taquito/rpc");
|
|
|
5
5
|
const operations_1 = require("./operations");
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* SmartRollupExecuteOutboxMessage Operation provides utility to fetch properties for Operation of kind SmartRollupExecuteOutboxMessage
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
class SmartRollupExecuteOutboxMessageOperation extends operations_1.Operation {
|
|
@@ -23,8 +23,7 @@ class SmartRollupExecuteOutboxMessageOperation extends operations_1.Operation {
|
|
|
23
23
|
return result ? result : undefined;
|
|
24
24
|
}
|
|
25
25
|
get status() {
|
|
26
|
-
|
|
27
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
26
|
+
return this.operationResults?.status ?? 'unknown';
|
|
28
27
|
}
|
|
29
28
|
get rollup() {
|
|
30
29
|
return this.params.rollup;
|
|
@@ -45,12 +44,10 @@ class SmartRollupExecuteOutboxMessageOperation extends operations_1.Operation {
|
|
|
45
44
|
return Number(this.params.storage_limit);
|
|
46
45
|
}
|
|
47
46
|
get consumedMilliGas() {
|
|
48
|
-
|
|
49
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
47
|
+
return this.operationResults?.consumed_milligas;
|
|
50
48
|
}
|
|
51
49
|
get errors() {
|
|
52
|
-
|
|
53
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
50
|
+
return this.operationResults?.errors;
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
exports.SmartRollupExecuteOutboxMessageOperation = SmartRollupExecuteOutboxMessageOperation;
|
|
@@ -5,7 +5,7 @@ const rpc_1 = require("@taquito/rpc");
|
|
|
5
5
|
const operations_1 = require("./operations");
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* SmartRollupOriginate Operation provides utility to fetch properties for Operation of kind SmartRollupOriginate
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
class SmartRollupOriginateOperation extends operations_1.Operation {
|
|
@@ -23,8 +23,7 @@ class SmartRollupOriginateOperation extends operations_1.Operation {
|
|
|
23
23
|
return result ? result : undefined;
|
|
24
24
|
}
|
|
25
25
|
get status() {
|
|
26
|
-
|
|
27
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
26
|
+
return this.operationResults?.status ?? 'unknown';
|
|
28
27
|
}
|
|
29
28
|
get fee() {
|
|
30
29
|
return Number(this.params.fee);
|
|
@@ -36,8 +35,7 @@ class SmartRollupOriginateOperation extends operations_1.Operation {
|
|
|
36
35
|
return Number(this.params.storage_limit);
|
|
37
36
|
}
|
|
38
37
|
get consumedMilliGas() {
|
|
39
|
-
|
|
40
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
38
|
+
return this.operationResults?.consumed_milligas;
|
|
41
39
|
}
|
|
42
40
|
get pvmKind() {
|
|
43
41
|
return this.params.pvm_kind;
|
|
@@ -46,8 +44,7 @@ class SmartRollupOriginateOperation extends operations_1.Operation {
|
|
|
46
44
|
return this.params.kernel;
|
|
47
45
|
}
|
|
48
46
|
get errors() {
|
|
49
|
-
|
|
50
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
47
|
+
return this.operationResults?.errors;
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
exports.SmartRollupOriginateOperation = SmartRollupOriginateOperation;
|
|
@@ -5,9 +5,9 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
5
5
|
const errors_1 = require("./errors");
|
|
6
6
|
const operations_1 = require("./operations");
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Transaction operation provides utility functions to fetch a newly issued transaction
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @remarks Currently supports one transaction per operation
|
|
11
11
|
*/
|
|
12
12
|
class TransactionOperation extends operations_1.Operation {
|
|
13
13
|
constructor(hash, params, source, raw, results, context) {
|
|
@@ -6,9 +6,9 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
6
6
|
const operations_1 = require("./operations");
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Transfer tickets from a Tezos address (tz1, tz2 or tz3) to a smart contract address (KT1) (everything on layer 1 at this step)
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @remarks Currently only supports one L2 ticket holder transfer at once. ie. one collection of tickets owned by tz1, tz2 or tz3 to a smart contract.
|
|
12
12
|
*/
|
|
13
13
|
class TransferTicketOperation extends operations_1.Operation {
|
|
14
14
|
constructor(hash, params, source, raw, results, context) {
|
|
@@ -23,8 +23,7 @@ class TransferTicketOperation extends operations_1.Operation {
|
|
|
23
23
|
return result ? result : undefined;
|
|
24
24
|
}
|
|
25
25
|
get status() {
|
|
26
|
-
|
|
27
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
26
|
+
return this.operationResults?.status ?? 'unknown';
|
|
28
27
|
}
|
|
29
28
|
get fee() {
|
|
30
29
|
return Number(this.params.fee);
|
|
@@ -42,8 +41,7 @@ class TransferTicketOperation extends operations_1.Operation {
|
|
|
42
41
|
: undefined;
|
|
43
42
|
}
|
|
44
43
|
get consumedMilliGas() {
|
|
45
|
-
|
|
46
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
44
|
+
return this.operationResults?.consumed_milligas;
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
exports.TransferTicketOperation = TransferTicketOperation;
|
|
@@ -5,7 +5,7 @@ const rpc_1 = require("@taquito/rpc");
|
|
|
5
5
|
var rpc_2 = require("@taquito/rpc");
|
|
6
6
|
Object.defineProperty(exports, "OpKind", { enumerable: true, get: function () { return rpc_2.OpKind; } });
|
|
7
7
|
const attachKind = (op, kind) => {
|
|
8
|
-
return
|
|
8
|
+
return { ...op, kind };
|
|
9
9
|
};
|
|
10
10
|
exports.attachKind = attachKind;
|
|
11
11
|
const findWithKind = (arr, kind) => {
|
|
@@ -21,9 +21,22 @@ const isKind = (op, kind) => {
|
|
|
21
21
|
return op.kind === kind;
|
|
22
22
|
};
|
|
23
23
|
exports.isKind = isKind;
|
|
24
|
+
const feeConsumingOpKinds = [
|
|
25
|
+
rpc_1.OpKind.TRANSACTION,
|
|
26
|
+
rpc_1.OpKind.DELEGATION,
|
|
27
|
+
rpc_1.OpKind.ORIGINATION,
|
|
28
|
+
rpc_1.OpKind.REVEAL,
|
|
29
|
+
rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT,
|
|
30
|
+
rpc_1.OpKind.INCREASE_PAID_STORAGE,
|
|
31
|
+
rpc_1.OpKind.TRANSFER_TICKET,
|
|
32
|
+
rpc_1.OpKind.UPDATE_CONSENSUS_KEY,
|
|
33
|
+
rpc_1.OpKind.UPDATE_COMPANION_KEY,
|
|
34
|
+
rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES,
|
|
35
|
+
rpc_1.OpKind.SMART_ROLLUP_ORIGINATE,
|
|
36
|
+
rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,
|
|
37
|
+
];
|
|
24
38
|
const isOpWithGasBuffer = (op) => {
|
|
25
|
-
|
|
26
|
-
if (op.kind === rpc_1.OpKind.TRANSACTION && ((_a = op.destination) === null || _a === void 0 ? void 0 : _a.startsWith('KT1'))) {
|
|
39
|
+
if (op.kind === rpc_1.OpKind.TRANSACTION && op.destination?.startsWith('KT1')) {
|
|
27
40
|
return true;
|
|
28
41
|
}
|
|
29
42
|
else {
|
|
@@ -39,22 +52,7 @@ const isOpWithGasBuffer = (op) => {
|
|
|
39
52
|
}
|
|
40
53
|
};
|
|
41
54
|
exports.isOpWithGasBuffer = isOpWithGasBuffer;
|
|
42
|
-
const isOpWithFee = (op) =>
|
|
43
|
-
return ([
|
|
44
|
-
'transaction',
|
|
45
|
-
'delegation',
|
|
46
|
-
'origination',
|
|
47
|
-
'reveal',
|
|
48
|
-
'register_global_constant',
|
|
49
|
-
'increase_paid_storage',
|
|
50
|
-
'transfer_ticket',
|
|
51
|
-
'update_consensus_key',
|
|
52
|
-
'update_companion_key',
|
|
53
|
-
'smart_rollup_add_messages',
|
|
54
|
-
'smart_rollup_originate',
|
|
55
|
-
'smart_rollup_execute_outbox_message',
|
|
56
|
-
].indexOf(op.kind) !== -1);
|
|
57
|
-
};
|
|
55
|
+
const isOpWithFee = (op) => feeConsumingOpKinds.includes(op.kind);
|
|
58
56
|
exports.isOpWithFee = isOpWithFee;
|
|
59
57
|
const isOpRequireReveal = (op) => {
|
|
60
58
|
return ([
|
|
@@ -5,7 +5,7 @@ const core_1 = require("@taquito/core");
|
|
|
5
5
|
const operations_1 = require("./operations");
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* UpdateCompanionKeyOperation provides utility to fetch properties for Operation of kind UpdateCompanionKey
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
class UpdateCompanionKeyOperation extends operations_1.Operation {
|
|
@@ -23,8 +23,7 @@ class UpdateCompanionKeyOperation extends operations_1.Operation {
|
|
|
23
23
|
return result ? result : undefined;
|
|
24
24
|
}
|
|
25
25
|
get status() {
|
|
26
|
-
|
|
27
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
26
|
+
return this.operationResults?.status ?? 'unknown';
|
|
28
27
|
}
|
|
29
28
|
get fee() {
|
|
30
29
|
return Number(this.params.fee);
|
|
@@ -47,12 +46,10 @@ class UpdateCompanionKeyOperation extends operations_1.Operation {
|
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
get consumedMilliGas() {
|
|
50
|
-
|
|
51
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
49
|
+
return this.operationResults?.consumed_milligas;
|
|
52
50
|
}
|
|
53
51
|
get errors() {
|
|
54
|
-
|
|
55
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
52
|
+
return this.operationResults?.errors;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
exports.UpdateCompanionKeyOperation = UpdateCompanionKeyOperation;
|
|
@@ -5,7 +5,7 @@ const core_1 = require("@taquito/core");
|
|
|
5
5
|
const operations_1 = require("./operations");
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* UpdateConsensusKeyOperation provides utility to fetch properties for Operation of kind UpdateConsensusKey
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
class UpdateConsensusKeyOperation extends operations_1.Operation {
|
|
@@ -23,8 +23,7 @@ class UpdateConsensusKeyOperation extends operations_1.Operation {
|
|
|
23
23
|
return result ? result : undefined;
|
|
24
24
|
}
|
|
25
25
|
get status() {
|
|
26
|
-
|
|
27
|
-
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
26
|
+
return this.operationResults?.status ?? 'unknown';
|
|
28
27
|
}
|
|
29
28
|
get fee() {
|
|
30
29
|
return Number(this.params.fee);
|
|
@@ -47,12 +46,10 @@ class UpdateConsensusKeyOperation extends operations_1.Operation {
|
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
get consumedMilliGas() {
|
|
50
|
-
|
|
51
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
49
|
+
return this.operationResults?.consumed_milligas;
|
|
52
50
|
}
|
|
53
51
|
get errors() {
|
|
54
|
-
|
|
55
|
-
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
52
|
+
return this.operationResults?.errors;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
exports.UpdateConsensusKeyOperation = UpdateConsensusKeyOperation;
|
|
@@ -1,22 +1,11 @@
|
|
|
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.MichelCodecPacker = void 0;
|
|
13
4
|
const michel_codec_1 = require("@taquito/michel-codec");
|
|
14
5
|
class MichelCodecPacker {
|
|
15
|
-
packData(data) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return { packed: bytes };
|
|
19
|
-
});
|
|
6
|
+
async packData(data) {
|
|
7
|
+
const { bytes } = (0, michel_codec_1.packDataBytes)(data.data, data.type);
|
|
8
|
+
return { packed: bytes };
|
|
20
9
|
}
|
|
21
10
|
}
|
|
22
11
|
exports.MichelCodecPacker = MichelCodecPacker;
|
|
@@ -1,23 +1,12 @@
|
|
|
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.RpcPacker = void 0;
|
|
13
4
|
class RpcPacker {
|
|
14
5
|
constructor(context) {
|
|
15
6
|
this.context = context;
|
|
16
7
|
}
|
|
17
|
-
packData(data) {
|
|
18
|
-
return
|
|
19
|
-
return this.context.rpc.packData(data);
|
|
20
|
-
});
|
|
8
|
+
async packData(data) {
|
|
9
|
+
return this.context.rpc.packData(data);
|
|
21
10
|
}
|
|
22
11
|
}
|
|
23
12
|
exports.RpcPacker = RpcPacker;
|