@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.
Files changed (129) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/batch/rpc-batch-provider.js +91 -83
  3. package/dist/lib/context.js +22 -26
  4. package/dist/lib/contract/big-map.js +16 -29
  5. package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
  6. package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
  7. package/dist/lib/contract/contract.js +21 -32
  8. package/dist/lib/contract/errors.js +9 -9
  9. package/dist/lib/contract/prepare.js +36 -45
  10. package/dist/lib/contract/rpc-contract-provider.js +426 -475
  11. package/dist/lib/contract/sapling-state-abstraction.js +3 -14
  12. package/dist/lib/contract/semantic.js +2 -2
  13. package/dist/lib/errors.js +3 -3
  14. package/dist/lib/estimate/errors.js +1 -1
  15. package/dist/lib/estimate/estimate.js +66 -20
  16. package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
  17. package/dist/lib/forger/composite-forger.js +16 -27
  18. package/dist/lib/forger/errors.js +2 -2
  19. package/dist/lib/forger/taquito-local-forger.js +9 -22
  20. package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
  21. package/dist/lib/global-constants/errors.js +2 -2
  22. package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
  23. package/dist/lib/import-key.js +23 -34
  24. package/dist/lib/injector/rpc-injector.js +13 -24
  25. package/dist/lib/operations/ballot-operation.js +2 -3
  26. package/dist/lib/operations/delegate-operation.js +5 -8
  27. package/dist/lib/operations/drain-delegate-operation.js +1 -1
  28. package/dist/lib/operations/errors.js +9 -6
  29. package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
  30. package/dist/lib/operations/operations.js +100 -30
  31. package/dist/lib/operations/origination-operation.js +16 -27
  32. package/dist/lib/operations/proposals-operation.js +2 -3
  33. package/dist/lib/operations/register-global-constant-operation.js +4 -7
  34. package/dist/lib/operations/reveal-operation.js +1 -1
  35. package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
  36. package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
  37. package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
  38. package/dist/lib/operations/transaction-operation.js +2 -2
  39. package/dist/lib/operations/transfer-ticket-operation.js +4 -6
  40. package/dist/lib/operations/types.js +17 -19
  41. package/dist/lib/operations/update-companion-key-operation.js +4 -7
  42. package/dist/lib/operations/update-consensus-key-operation.js +4 -7
  43. package/dist/lib/packer/michel-codec-packer.js +3 -14
  44. package/dist/lib/packer/rpc-packer.js +2 -13
  45. package/dist/lib/parser/michel-codec-parser.js +82 -107
  46. package/dist/lib/parser/noop-parser.js +2 -13
  47. package/dist/lib/prepare/prepare-provider.js +780 -744
  48. package/dist/lib/provider.js +322 -128
  49. package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
  50. package/dist/lib/signer/errors.js +1 -1
  51. package/dist/lib/signer/noop.js +9 -26
  52. package/dist/lib/subscribe/errors.js +2 -2
  53. package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
  54. package/dist/lib/taquito.js +33 -33
  55. package/dist/lib/tz/rpc-tz-provider.js +27 -44
  56. package/dist/lib/version.js +2 -2
  57. package/dist/lib/wallet/batch-operation.js +32 -45
  58. package/dist/lib/wallet/delegation-operation.js +25 -40
  59. package/dist/lib/wallet/errors.js +15 -3
  60. package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
  61. package/dist/lib/wallet/legacy.js +28 -63
  62. package/dist/lib/wallet/operation-factory.js +27 -56
  63. package/dist/lib/wallet/operation.js +123 -59
  64. package/dist/lib/wallet/origination-operation.js +34 -46
  65. package/dist/lib/wallet/register-global-constant-operation.js +26 -43
  66. package/dist/lib/wallet/transaction-operation.js +21 -36
  67. package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
  68. package/dist/lib/wallet/wallet.js +187 -184
  69. package/dist/taquito.es6.js +3424 -3197
  70. package/dist/taquito.es6.js.map +1 -1
  71. package/dist/taquito.min.js +1 -1
  72. package/dist/taquito.umd.js +7930 -7701
  73. package/dist/taquito.umd.js.map +1 -1
  74. package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
  75. package/dist/types/context.d.ts +4 -4
  76. package/dist/types/contract/big-map.d.ts +3 -3
  77. package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
  78. package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
  79. package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
  80. package/dist/types/contract/contract.d.ts +6 -6
  81. package/dist/types/contract/errors.d.ts +11 -11
  82. package/dist/types/contract/interface.d.ts +42 -42
  83. package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
  84. package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
  85. package/dist/types/contract/semantic.d.ts +2 -2
  86. package/dist/types/errors.d.ts +5 -5
  87. package/dist/types/estimate/errors.d.ts +1 -1
  88. package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
  89. package/dist/types/estimate/estimate.d.ts +28 -11
  90. package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
  91. package/dist/types/forger/errors.d.ts +2 -2
  92. package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
  93. package/dist/types/global-constants/errors.d.ts +2 -2
  94. package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
  95. package/dist/types/import-key.d.ts +2 -2
  96. package/dist/types/operations/ballot-operation.d.ts +1 -1
  97. package/dist/types/operations/delegate-operation.d.ts +2 -2
  98. package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
  99. package/dist/types/operations/errors.d.ts +5 -5
  100. package/dist/types/operations/failing-noop-operation.d.ts +1 -1
  101. package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
  102. package/dist/types/operations/operations.d.ts +2 -2
  103. package/dist/types/operations/origination-operation.d.ts +5 -5
  104. package/dist/types/operations/proposals-operation.d.ts +1 -1
  105. package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
  106. package/dist/types/operations/reveal-operation.d.ts +1 -1
  107. package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
  108. package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
  109. package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
  110. package/dist/types/operations/transaction-operation.d.ts +2 -2
  111. package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
  112. package/dist/types/operations/types.d.ts +387 -25
  113. package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
  114. package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
  115. package/dist/types/prepare/interface.d.ts +32 -33
  116. package/dist/types/prepare/prepare-provider.d.ts +34 -60
  117. package/dist/types/provider.d.ts +7 -1
  118. package/dist/types/read-provider/interface.d.ts +21 -21
  119. package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
  120. package/dist/types/signer/errors.d.ts +1 -1
  121. package/dist/types/signer/noop.d.ts +1 -1
  122. package/dist/types/subscribe/errors.d.ts +2 -2
  123. package/dist/types/taquito.d.ts +33 -33
  124. package/dist/types/wallet/errors.d.ts +10 -2
  125. package/dist/types/wallet/interface.d.ts +13 -13
  126. package/dist/types/wallet/operation.d.ts +4 -3
  127. package/dist/types/wallet/wallet.d.ts +36 -35
  128. package/package.json +27 -15
  129. 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
- * @description Utility class to interact with Tezos operations
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 {@link InvalidOperationHashError}
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
- var _a, _b;
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
- return __awaiter(this, void 0, void 0, function* () {
104
- if (typeof confirmations !== 'undefined' && confirmations < 1) {
105
- throw new errors_1.InvalidConfirmationCountError(confirmations);
106
- }
107
- const { defaultConfirmationCount, confirmationPollingTimeoutSecond } = this.context.config;
108
- this._pollingConfig$.next({
109
- timeout: timeout || confirmationPollingTimeoutSecond,
110
- });
111
- const conf = confirmations !== undefined ? confirmations : defaultConfirmationCount;
112
- return new Promise((resolve, reject) => {
113
- this.confirmed$
114
- .pipe((0, operators_1.switchMap)(() => this.currentHead$), (0, operators_1.filter)((head) => head.header.level - this._foundAt >= conf - 1), (0, operators_1.first)())
115
- .subscribe({
116
- error: (e) => reject(e),
117
- complete: () => resolve(this._foundAt + (conf - 1)),
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
- * @description Origination operation provide utility function to fetch newly originated contract
9
+ * Origination operation provide utility function to fetch newly originated contract
19
10
  *
20
- * @warn Currently support only one origination per operation
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
- var _a, _b;
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
- var _a;
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
- var _a;
73
- return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
61
+ return this.operationResults?.errors;
74
62
  }
75
63
  /**
76
- * @description Provide the contract abstract of the newly originated contract
77
- * @throws {@link OriginationOperationError}
64
+ * Provide the contract abstract of the newly originated contract
65
+ * @throws OriginationOperationError
78
66
  */
79
- contract(confirmations, timeout) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- if (!this.contractAddress) {
82
- throw new errors_1.OriginationOperationError('No contract was originated in this operation');
83
- }
84
- yield this.confirmation(confirmations, timeout);
85
- return this.contractProvider.at(this.contractAddress);
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
- * @description ProposalsOperation provides utility functions to fetch a new operation of kind proposals
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
- var _a;
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
- * @description RegisterGlobalConstantOperation provides utility functions to fetch a newly issued operation of kind register_global_constant
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
- var _a, _b;
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
- var _a;
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
- var _a;
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
- * @description Reveal operation provides utility functions to fetch a newly issued revelation
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
- * @description SmartRollupAddMessagesOperation provides utility to fetch properties of SmartRollupAddMessages
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
- var _a, _b;
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
- var _a;
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
- var _a;
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
- * @description SmartRollupExecuteOutboxMessage Operation provides utility to fetch properties for Operation of kind SmartRollupExecuteOutboxMessage
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
- var _a, _b;
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
- var _a;
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
- var _a;
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
- * @description SmartRollupOriginate Operation provides utility to fetch properties for Operation of kind SmartRollupOriginate
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
- var _a, _b;
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
- var _a;
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
- var _a;
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
- * @description Transaction operation provides utility functions to fetch a newly issued transaction
8
+ * Transaction operation provides utility functions to fetch a newly issued transaction
9
9
  *
10
- * @warn Currently supports one transaction per operation
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
- * @description Transfer tickets from a Tezos address (tz1, tz2 or tz3) to a smart contract address (KT1) (everything on layer 1 at this step)
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
- * @warn 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.
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
- var _a, _b;
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
- var _a;
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 Object.assign(Object.assign({}, op), { kind });
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
- var _a;
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
- * @description UpdateCompanionKeyOperation provides utility to fetch properties for Operation of kind UpdateCompanionKey
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
- var _a, _b;
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
- var _a;
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
- var _a;
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
- * @description UpdateConsensusKeyOperation provides utility to fetch properties for Operation of kind UpdateConsensusKey
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
- var _a, _b;
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
- var _a;
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
- var _a;
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
- return __awaiter(this, void 0, void 0, function* () {
17
- const { bytes } = (0, michel_codec_1.packDataBytes)(data.data, data.type);
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 __awaiter(this, void 0, void 0, function* () {
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;