@taquito/taquito 24.2.0-beta.1 → 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
package/README.md CHANGED
@@ -7,7 +7,7 @@ The `@taquito/taquito` package contains higher-level functionality that builds u
7
7
  ## CDN Bundle
8
8
 
9
9
  ```html
10
- <script src="https://unpkg.com/@taquito/taquito@24.2.0-beta.1/dist/taquito.min.js"
10
+ <script src="https://unpkg.com/@taquito/taquito@24.3.0-beta.0/dist/taquito.min.js"
11
11
  crossorigin="anonymous" integrity="sha384-IxvP0ECHi5oqLyz94wF85pU9+ktcsL1HHtA42MITxZsGbsUMEu/g+0Vkjj5vqiMR"></script>
12
12
  ```
13
13
 
@@ -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.RPCBatchProvider = exports.OperationBatch = exports.BATCH_KINDS = void 0;
13
4
  const prepare_1 = require("../contract/prepare");
@@ -28,7 +19,7 @@ class OperationBatch extends provider_1.Provider {
28
19
  }
29
20
  /**
30
21
  *
31
- * @description Add a transaction operation to the batch
22
+ * Add a transaction operation to the batch
32
23
  *
33
24
  * @param params Transfer operation parameter
34
25
  */
@@ -40,12 +31,12 @@ class OperationBatch extends provider_1.Provider {
40
31
  if (toValidation !== utils_1.ValidationResult.VALID) {
41
32
  throw new core_1.InvalidAddressError(params.to, toValidation);
42
33
  }
43
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.TRANSACTION }, params));
34
+ this.operations.push({ kind: rpc_1.OpKind.TRANSACTION, ...params });
44
35
  return this;
45
36
  }
46
37
  /**
47
38
  *
48
- * @description Transfer tickets from a Tezos address (tz1,tz2 or tz3) to a smart contract address( KT1)
39
+ * Transfer tickets from a Tezos address (tz1,tz2 or tz3) to a smart contract address( KT1)
49
40
  *
50
41
  * @param params Transfer operation parameter
51
42
  */
@@ -54,12 +45,12 @@ class OperationBatch extends provider_1.Provider {
54
45
  if (destinationValidation !== utils_1.ValidationResult.VALID) {
55
46
  throw new core_1.InvalidAddressError(params.destination, destinationValidation);
56
47
  }
57
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.TRANSFER_TICKET }, params));
48
+ this.operations.push({ kind: rpc_1.OpKind.TRANSFER_TICKET, ...params });
58
49
  return this;
59
50
  }
60
51
  /**
61
52
  *
62
- * @description Add a contract call to the batch
53
+ * Add a contract call to the batch
63
54
  *
64
55
  * @param params Call a contract method
65
56
  * @param options Generic operation parameters
@@ -69,29 +60,28 @@ class OperationBatch extends provider_1.Provider {
69
60
  }
70
61
  /**
71
62
  *
72
- * @description Add a delegation operation to the batch
63
+ * Add a delegation operation to the batch
73
64
  *
74
65
  * @param params Delegation operation parameter
75
66
  */
76
67
  withDelegation(params) {
77
- var _a, _b;
78
- const sourceValidation = (0, utils_1.validateAddress)((_a = params.source) !== null && _a !== void 0 ? _a : '');
68
+ const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
79
69
  if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
80
70
  throw new core_1.InvalidAddressError(params.source, sourceValidation);
81
71
  }
82
- const delegateValidation = (0, utils_1.validateAddress)((_b = params.delegate) !== null && _b !== void 0 ? _b : '');
72
+ const delegateValidation = (0, utils_1.validateAddress)(params.delegate ?? '');
83
73
  if (params.delegate && delegateValidation !== utils_1.ValidationResult.VALID) {
84
74
  throw new core_1.InvalidAddressError(params.delegate, delegateValidation);
85
75
  }
86
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.DELEGATION }, params));
76
+ this.operations.push({ kind: rpc_1.OpKind.DELEGATION, ...params });
87
77
  return this;
88
78
  }
89
79
  /**
90
80
  *
91
- * @description Add an activation operation to the batch
81
+ * Add an activation operation to the batch
92
82
  *
93
83
  * @param params Activation operation parameter
94
- * @throws {@link InvalidKeyHashError}
84
+ * @throws InvalidKeyHashError
95
85
  */
96
86
  withActivation({ pkh, secret }) {
97
87
  const pkhValidation = (0, utils_1.validateKeyHash)(pkh);
@@ -103,37 +93,37 @@ class OperationBatch extends provider_1.Provider {
103
93
  }
104
94
  /**
105
95
  *
106
- * @description Add an origination operation to the batch
96
+ * Add an origination operation to the batch
107
97
  *
108
98
  * @param params Origination operation parameter
109
99
  */
110
100
  withOrigination(params) {
111
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.ORIGINATION }, params));
101
+ this.operations.push({ kind: rpc_1.OpKind.ORIGINATION, ...params });
112
102
  return this;
113
103
  }
114
104
  /**
115
105
  *
116
- * @description Add a register a global constant operation to the batch
106
+ * Add a register a global constant operation to the batch
117
107
  *
118
108
  * @param params RegisterGlobalConstant operation parameter
119
109
  */
120
110
  withRegisterGlobalConstant(params) {
121
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT }, params));
111
+ this.operations.push({ kind: rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT, ...params });
122
112
  return this;
123
113
  }
124
114
  /**
125
115
  *
126
- * @description Add an increase paid storage operation to the batch
116
+ * Add an increase paid storage operation to the batch
127
117
  *
128
118
  * @param params IncreasePaidStorage operation parameter
129
119
  */
130
120
  withIncreasePaidStorage(params) {
131
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.INCREASE_PAID_STORAGE }, params));
121
+ this.operations.push({ kind: rpc_1.OpKind.INCREASE_PAID_STORAGE, ...params });
132
122
  return this;
133
123
  }
134
124
  /**
135
125
  *
136
- * @description Add a update consensus key operation to the batch
126
+ * Add a update consensus key operation to the batch
137
127
  *
138
128
  * @param params UpdateConsensusKey operation parameter
139
129
  */
@@ -149,12 +139,12 @@ class OperationBatch extends provider_1.Provider {
149
139
  throw new core_1.ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
150
140
  }
151
141
  }
152
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.UPDATE_CONSENSUS_KEY }, params));
142
+ this.operations.push({ kind: rpc_1.OpKind.UPDATE_CONSENSUS_KEY, ...params });
153
143
  return this;
154
144
  }
155
145
  /**
156
146
  *
157
- * @description Add a update companion key operation to the batch
147
+ * Add a update companion key operation to the batch
158
148
  *
159
149
  * @param params UpdateCompanionKey operation parameter
160
150
  */
@@ -166,75 +156,95 @@ class OperationBatch extends provider_1.Provider {
166
156
  if (!params.proof) {
167
157
  throw new core_1.InvalidProofError('Proof is required to set a bls account as companion key ');
168
158
  }
169
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.UPDATE_COMPANION_KEY }, params));
159
+ this.operations.push({ kind: rpc_1.OpKind.UPDATE_COMPANION_KEY, ...params });
170
160
  return this;
171
161
  }
172
162
  /**
173
163
  *
174
- * @description Add a smart rollup add messages operation to the batch
164
+ * Add a smart rollup add messages operation to the batch
175
165
  *
176
166
  * @param params Rollup origination operation parameter
177
167
  */
178
168
  withSmartRollupAddMessages(params) {
179
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES }, params));
169
+ this.operations.push({ kind: rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES, ...params });
180
170
  return this;
181
171
  }
182
172
  /**
183
173
  *
184
- * @description Add a smart rollup originate operation to the batch
174
+ * Add a smart rollup originate operation to the batch
185
175
  *
186
176
  * @param params Smart Rollup Originate operation parameter
187
177
  */
188
178
  withSmartRollupOriginate(params) {
189
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.SMART_ROLLUP_ORIGINATE }, params));
179
+ this.operations.push({ kind: rpc_1.OpKind.SMART_ROLLUP_ORIGINATE, ...params });
190
180
  return this;
191
181
  }
192
182
  /**
193
183
  *
194
- * @description Add a smart rollup execute outbox message to the batch
184
+ * Add a smart rollup execute outbox message to the batch
195
185
  *
196
186
  * @param params Smart Rollup Execute Outbox Message operation parameter
197
187
  */
198
188
  withSmartRollupExecuteOutboxMessage(params) {
199
- this.operations.push(Object.assign({ kind: rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE }, params));
189
+ this.operations.push({ kind: rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE, ...params });
200
190
  return this;
201
191
  }
202
- getRPCOp(param) {
203
- return __awaiter(this, void 0, void 0, function* () {
204
- switch (param.kind) {
205
- case rpc_1.OpKind.TRANSACTION:
206
- return (0, prepare_1.createTransferOperation)(Object.assign({}, param));
207
- case rpc_1.OpKind.ORIGINATION:
208
- return (0, prepare_1.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign({}, param)));
209
- case rpc_1.OpKind.DELEGATION:
210
- return (0, prepare_1.createSetDelegateOperation)(Object.assign({}, param));
211
- case rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT:
212
- return (0, prepare_1.createRegisterGlobalConstantOperation)(Object.assign({}, param));
213
- case rpc_1.OpKind.INCREASE_PAID_STORAGE:
214
- return (0, prepare_1.createIncreasePaidStorageOperation)(Object.assign({}, param));
215
- case rpc_1.OpKind.UPDATE_CONSENSUS_KEY:
216
- return (0, prepare_1.createUpdateConsensusKeyOperation)(Object.assign({}, param));
217
- case rpc_1.OpKind.UPDATE_COMPANION_KEY:
218
- return (0, prepare_1.createUpdateCompanionKeyOperation)(Object.assign({}, param));
219
- case rpc_1.OpKind.TRANSFER_TICKET:
220
- return (0, prepare_1.createTransferTicketOperation)(Object.assign({}, param));
221
- case rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES:
222
- return (0, prepare_1.createSmartRollupAddMessagesOperation)(Object.assign({}, param));
223
- case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE:
224
- return (0, prepare_1.createSmartRollupOriginateOperation)(Object.assign({}, param));
225
- case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:
226
- return (0, prepare_1.createSmartRollupExecuteOutboxMessageOperation)(Object.assign({}, param));
227
- default:
228
- throw new core_1.InvalidOperationKindError(JSON.stringify(param.kind));
229
- }
230
- });
192
+ async getRPCOp(param) {
193
+ switch (param.kind) {
194
+ case rpc_1.OpKind.TRANSACTION:
195
+ return (0, prepare_1.createTransferOperation)({
196
+ ...param,
197
+ });
198
+ case rpc_1.OpKind.ORIGINATION:
199
+ return (0, prepare_1.createOriginationOperation)(await this.context.parser.prepareCodeOrigination({
200
+ ...param,
201
+ }));
202
+ case rpc_1.OpKind.DELEGATION:
203
+ return (0, prepare_1.createSetDelegateOperation)({
204
+ ...param,
205
+ });
206
+ case rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT:
207
+ return (0, prepare_1.createRegisterGlobalConstantOperation)({
208
+ ...param,
209
+ });
210
+ case rpc_1.OpKind.INCREASE_PAID_STORAGE:
211
+ return (0, prepare_1.createIncreasePaidStorageOperation)({
212
+ ...param,
213
+ });
214
+ case rpc_1.OpKind.UPDATE_CONSENSUS_KEY:
215
+ return (0, prepare_1.createUpdateConsensusKeyOperation)({
216
+ ...param,
217
+ });
218
+ case rpc_1.OpKind.UPDATE_COMPANION_KEY:
219
+ return (0, prepare_1.createUpdateCompanionKeyOperation)({
220
+ ...param,
221
+ });
222
+ case rpc_1.OpKind.TRANSFER_TICKET:
223
+ return (0, prepare_1.createTransferTicketOperation)({
224
+ ...param,
225
+ });
226
+ case rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES:
227
+ return (0, prepare_1.createSmartRollupAddMessagesOperation)({
228
+ ...param,
229
+ });
230
+ case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE:
231
+ return (0, prepare_1.createSmartRollupOriginateOperation)({
232
+ ...param,
233
+ });
234
+ case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:
235
+ return (0, prepare_1.createSmartRollupExecuteOutboxMessageOperation)({
236
+ ...param,
237
+ });
238
+ default:
239
+ throw new core_1.InvalidOperationKindError(JSON.stringify(param.kind));
240
+ }
231
241
  }
232
242
  /**
233
243
  *
234
- * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array
244
+ * Add a group operation to the batch. Operation will be applied in the order they are in the params array
235
245
  *
236
246
  * @param params Operations parameter
237
- * @throws {@link InvalidOperationKindError}
247
+ * @throws InvalidOperationKindError
238
248
  */
239
249
  with(params) {
240
250
  for (const param of params) {
@@ -277,23 +287,21 @@ class OperationBatch extends provider_1.Provider {
277
287
  }
278
288
  /**
279
289
  *
280
- * @description Forge and Inject the operation batch
290
+ * Forge and Inject the operation batch
281
291
  *
282
292
  * @param params Optionally specify the source of the operation
283
293
  */
284
- send(params) {
285
- return __awaiter(this, void 0, void 0, function* () {
286
- const publicKeyHash = yield this.signer.publicKeyHash();
287
- const source = (params && params.source) || publicKeyHash;
288
- const estimates = yield this.estimator.batch(this.operations);
289
- if (estimates.length !== this.operations.length) {
290
- estimates.shift();
291
- }
292
- const preparedOp = yield this.prepare.batch(this.operations, estimates);
293
- const opBytes = yield this.forge(preparedOp);
294
- const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes);
295
- return new batch_operation_1.BatchOperation(hash, preparedOp.opOb.contents, source, forgedBytes, opResponse, context);
296
- });
294
+ async send(params) {
295
+ const publicKeyHash = await this.signer.publicKeyHash();
296
+ const source = (params && params.source) || publicKeyHash;
297
+ const estimates = await this.estimator.batch(this.operations);
298
+ if (estimates.length !== this.operations.length) {
299
+ estimates.shift();
300
+ }
301
+ const preparedOp = await this.prepare.batch(this.operations, estimates);
302
+ const opBytes = await this.forge(preparedOp);
303
+ const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
304
+ return new batch_operation_1.BatchOperation(hash, preparedOp.opOb.contents, source, forgedBytes, opResponse, context);
297
305
  }
298
306
  }
299
307
  exports.OperationBatch = OperationBatch;
@@ -304,7 +312,7 @@ class RPCBatchProvider {
304
312
  }
305
313
  /***
306
314
  *
307
- * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch
315
+ * Batch a group of operation together. Operations will be applied in the order in which they are added to the batch
308
316
  *
309
317
  * @param params List of operation to batch together
310
318
  */
@@ -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.Context = exports.defaultConfigConfirmation = void 0;
13
4
  const rpc_1 = require("@taquito/rpc");
@@ -32,10 +23,12 @@ exports.defaultConfigConfirmation = {
32
23
  confirmationPollingTimeoutSecond: 180,
33
24
  };
34
25
  /**
35
- * @description Encapsulate common service used throughout different part of the library
26
+ * Encapsulate common service used throughout different part of the library
36
27
  */
37
28
  class Context {
38
- constructor(_rpc, _signer = new noop_1.NoopSigner(), _proto, _config = new rxjs_1.BehaviorSubject(Object.assign({}, exports.defaultConfigConfirmation)), forger, injector, packer, wallet, parser, globalConstantsProvider, readProvider, stream) {
29
+ constructor(_rpc, _signer = new noop_1.NoopSigner(), _proto, _config = new rxjs_1.BehaviorSubject({
30
+ ...exports.defaultConfigConfirmation,
31
+ }), forger, injector, packer, wallet, parser, globalConstantsProvider, readProvider, stream) {
39
32
  this._rpc = _rpc;
40
33
  this._signer = _signer;
41
34
  this._proto = _proto;
@@ -48,7 +41,7 @@ class Context {
48
41
  this.batch = new rpc_batch_provider_1.RPCBatchProvider(this, this.estimate);
49
42
  this.wallet = new wallet_1.Wallet(this);
50
43
  /**
51
- * @description Applies the decorators on a cloned instance of the context and returned this cloned instance.
44
+ * Applies the decorators on a cloned instance of the context and returned this cloned instance.
52
45
  * The decorators are functions that inject logic into the context.
53
46
  * They are provided by the extensions set on the TezosToolkit by calling the registerProviderDecorator method.
54
47
  */
@@ -81,10 +74,15 @@ class Context {
81
74
  return this._config.getValue();
82
75
  }
83
76
  set config(value) {
84
- this._config.next(Object.assign({}, value));
77
+ this._config.next({
78
+ ...value,
79
+ });
85
80
  }
86
81
  setPartialConfig(value) {
87
- this._config.next(Object.assign(Object.assign({}, this._config.getValue()), value));
82
+ this._config.next({
83
+ ...this._config.getValue(),
84
+ ...value,
85
+ });
88
86
  }
89
87
  get rpc() {
90
88
  return this._rpcClient;
@@ -152,28 +150,26 @@ class Context {
152
150
  set stream(value) {
153
151
  this._stream = value;
154
152
  }
155
- isAnyProtocolActive() {
156
- return __awaiter(this, arguments, void 0, function* (protocol = []) {
157
- if (this._proto) {
158
- return protocol.includes(this._proto);
159
- }
160
- else {
161
- const next_protocol = yield this.readProvider.getNextProtocol('head');
162
- return protocol.includes(next_protocol);
163
- }
164
- });
153
+ async isAnyProtocolActive(protocol = []) {
154
+ if (this._proto) {
155
+ return protocol.includes(this._proto);
156
+ }
157
+ else {
158
+ const next_protocol = await this.readProvider.getNextProtocol('head');
159
+ return protocol.includes(next_protocol);
160
+ }
165
161
  }
166
162
  isAnySignerConfigured() {
167
163
  return !(this.signer instanceof noop_1.NoopSigner);
168
164
  }
169
165
  /**
170
- * @description Create a copy of the current context. Useful when you have long running operation and you do not want a context change to affect the operation
166
+ * Create a copy of the current context. Useful when you have long running operation and you do not want a context change to affect the operation
171
167
  */
172
168
  clone() {
173
169
  return new Context(this.rpc, this.signer, this.proto, this._config, this.forger, this._injector, this.packer, this._walletProvider, this._parser, this._globalConstantsProvider, this._readProvider, this._stream);
174
170
  }
175
171
  /**
176
- * @description Allows extensions set on the TezosToolkit to inject logic into the context
172
+ * Allows extensions set on the TezosToolkit to inject logic into the context
177
173
  */
178
174
  registerProviderDecorator(fx) {
179
175
  this.providerDecorator.push(fx);
@@ -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.BigMapAbstraction = void 0;
13
4
  const http_utils_1 = require("@taquito/http-utils");
@@ -19,32 +10,30 @@ class BigMapAbstraction {
19
10
  }
20
11
  /**
21
12
  *
22
- * @description Fetch one value in a big map
13
+ * Fetch one value in a big map
23
14
  *
24
- * @param keysToEncode Key to query (will be encoded properly according to the schema)
15
+ * @param keyToEncode Key to query (will be encoded properly according to the schema)
25
16
  * @param block optional block level to fetch the values from (head will be use by default)
26
17
  * @returns Return a well formatted json object of a big map value or undefined if the key is not found in the big map
27
18
  *
28
19
  */
29
- get(keyToEncode, block) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- try {
32
- const id = yield this.provider.getBigMapKeyByID(this.id.toString(), keyToEncode, this.schema, block);
33
- return id;
20
+ async get(keyToEncode, block) {
21
+ try {
22
+ const id = await this.provider.getBigMapKeyByID(this.id.toString(), keyToEncode, this.schema, block);
23
+ return id;
24
+ }
25
+ catch (e) {
26
+ if (e instanceof http_utils_1.HttpResponseError && e.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
27
+ return undefined;
34
28
  }
35
- catch (e) {
36
- if (e instanceof http_utils_1.HttpResponseError && e.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
37
- return undefined;
38
- }
39
- else {
40
- throw e;
41
- }
29
+ else {
30
+ throw e;
42
31
  }
43
- });
32
+ }
44
33
  }
45
34
  /**
46
35
  *
47
- * @description Fetch multiple values in a big map
36
+ * Fetch multiple values in a big map
48
37
  * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it.
49
38
  * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level.
50
39
  * If one of the keys does not exist in the big map, its value will be set to undefined.
@@ -55,10 +44,8 @@ class BigMapAbstraction {
55
44
  * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format
56
45
  *
57
46
  */
58
- getMultipleValues(keysToEncode_1, block_1) {
59
- return __awaiter(this, arguments, void 0, function* (keysToEncode, block, batchSize = 5) {
60
- return this.provider.getBigMapKeysByID(this.id.toString(), keysToEncode, this.schema, block, batchSize);
61
- });
47
+ async getMultipleValues(keysToEncode, block, batchSize = 5) {
48
+ return this.provider.getBigMapKeysByID(this.id.toString(), keysToEncode, this.schema, block, batchSize);
62
49
  }
63
50
  toJSON() {
64
51
  return this.id.toString();
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContractMethodObject = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  /**
6
- * @description Utility class to send smart contract operation
6
+ * Utility class to send smart contract operation
7
7
  * The format for the arguments is the object representation
8
8
  */
9
9
  class ContractMethodObject {
@@ -17,21 +17,21 @@ class ContractMethodObject {
17
17
  this.isAnonymous = isAnonymous;
18
18
  }
19
19
  /**
20
- * @description Get the signature of the smart contract method
20
+ * Get the signature of the smart contract method
21
21
  */
22
22
  getSignature() {
23
23
  const generatedSchema = this.parameterSchema.generateSchema();
24
24
  if (this.isAnonymous) {
25
25
  const schemaObj = generatedSchema.schema;
26
- return schemaObj === null || schemaObj === void 0 ? void 0 : schemaObj[this.name];
26
+ return schemaObj?.[this.name];
27
27
  }
28
28
  return generatedSchema;
29
29
  }
30
30
  /**
31
31
  *
32
- * @description Send the smart contract operation
32
+ * Send the smart contract operation
33
33
  *
34
- * @param Options generic operation parameter
34
+ * @param params generic operation parameter
35
35
  */
36
36
  send(params = {}) {
37
37
  // provider is either ContractProvider | Wallet but pkh method is unique to Wallet
@@ -46,9 +46,9 @@ class ContractMethodObject {
46
46
  }
47
47
  /**
48
48
  *
49
- * @description Create transfer params to be used with TezosToolkit.contract.transfer methods
49
+ * Create transfer params to be used with TezosToolkit.contract.transfer methods
50
50
  *
51
- * @param Options generic transfer operation parameters
51
+ * @param params generic transfer operation parameters
52
52
  */
53
53
  toTransferParams({ fee, gasLimit, storageLimit, source, amount = 0, mutez = false, } = {}) {
54
54
  const fullTransferParams = {