@taquito/taquito 19.2.1-beta.2 → 20.0.0-beta.1

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.
@@ -21,9 +21,7 @@ class WalletOperationBatch {
21
21
  this.operations = [];
22
22
  }
23
23
  /**
24
- *
25
24
  * @description Add a transaction operation to the batch
26
- *
27
25
  * @param params Transfer operation parameter
28
26
  */
29
27
  withTransfer(params) {
@@ -35,9 +33,7 @@ class WalletOperationBatch {
35
33
  return this;
36
34
  }
37
35
  /**
38
- *
39
36
  * @description Add a contract call to the batch
40
- *
41
37
  * @param params Call a contract method
42
38
  * @param options Generic operation parameters
43
39
  */
@@ -45,9 +41,7 @@ class WalletOperationBatch {
45
41
  return this.withTransfer(params.toTransferParams(options));
46
42
  }
47
43
  /**
48
- *
49
44
  * @description Add a delegation operation to the batch
50
- *
51
45
  * @param params Delegation operation parameter
52
46
  */
53
47
  withDelegation(params) {
@@ -60,9 +54,7 @@ class WalletOperationBatch {
60
54
  return this;
61
55
  }
62
56
  /**
63
- *
64
57
  * @description Add an origination operation to the batch
65
- *
66
58
  * @param params Origination operation parameter
67
59
  */
68
60
  withOrigination(params) {
@@ -70,9 +62,7 @@ class WalletOperationBatch {
70
62
  return this;
71
63
  }
72
64
  /**
73
- *
74
65
  * @description Add an IncreasePaidStorage operation to the batch
75
- *
76
66
  * @param param IncreasePaidStorage operation parameter
77
67
  */
78
68
  withIncreasePaidStorage(params) {
@@ -102,9 +92,7 @@ class WalletOperationBatch {
102
92
  });
103
93
  }
104
94
  /**
105
- *
106
95
  * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array
107
- *
108
96
  * @param params Operations parameter
109
97
  * @throws {@link InvalidOperationKindError}
110
98
  */
@@ -130,9 +118,7 @@ class WalletOperationBatch {
130
118
  return this;
131
119
  }
132
120
  /**
133
- *
134
121
  * @description Submit batch operation to wallet
135
- *
136
122
  */
137
123
  send() {
138
124
  return __awaiter(this, void 0, void 0, function* () {
@@ -160,7 +146,6 @@ class Wallet {
160
146
  }
161
147
  /**
162
148
  * @description Retrieve the PKH of the account that is currently in use by the wallet
163
- *
164
149
  * @param option Option to use while fetching the PKH.
165
150
  * If forceRefetch is specified the wallet provider implementation will refetch the PKH from the wallet
166
151
  */
@@ -174,7 +159,6 @@ class Wallet {
174
159
  }
175
160
  /**
176
161
  * @description Retrieve the PK of the account that is currently in use by the wallet
177
- *
178
162
  * @param option Option to use while fetching the PK.
179
163
  * If forceRefetch is specified the wallet provider implementation will refetch the PK from the wallet
180
164
  */
@@ -187,11 +171,8 @@ class Wallet {
187
171
  });
188
172
  }
189
173
  /**
190
- *
191
174
  * @description Originate a new contract according to the script in parameters.
192
- *
193
- * @returns An operation handle with the result from the rpc node
194
- *
175
+ * @returns a OriginationWalletOperation promise object when followed by .send()
195
176
  * @param originateParams Originate operation parameter
196
177
  */
197
178
  originate(params) {
@@ -202,11 +183,8 @@ class Wallet {
202
183
  }));
203
184
  }
204
185
  /**
205
- *
206
186
  * @description Set the delegate for a contract.
207
- *
208
- * @returns An operation handle with the result from the rpc node
209
- *
187
+ * @returns a WalletDelegateParams promise object when followed by .send()
210
188
  * @param delegateParams operation parameter
211
189
  */
212
190
  setDelegate(params) {
@@ -222,11 +200,8 @@ class Wallet {
222
200
  }));
223
201
  }
224
202
  /**
225
- *
226
203
  * @description failing_noop operation that is guaranteed to fail. DISCLAIMER: Not all wallets support signing failing_noop operations.
227
- *
228
204
  * @returns Signature for a failing_noop
229
- *
230
205
  * @param params operation parameter
231
206
  */
232
207
  signFailingNoop(params) {
@@ -257,11 +232,8 @@ class Wallet {
257
232
  });
258
233
  }
259
234
  /**
260
- *
261
235
  * @description Register the current address as delegate.
262
- *
263
- * @returns An operation handle with the result from the rpc node
264
- *
236
+ * @returns a DelegationWalletOperation promise object when followed by .send()
265
237
  */
266
238
  registerDelegate() {
267
239
  return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
@@ -274,11 +246,8 @@ class Wallet {
274
246
  }));
275
247
  }
276
248
  /**
277
- *
278
249
  * @description Transfer tezos tokens from current address to a specific address or call a smart contract.
279
- *
280
- * @returns A wallet command from which we can send the operation to the wallet
281
- *
250
+ * @returns a TransactionWalletOperation promise object when followed by .send()
282
251
  * @param params operation parameter
283
252
  */
284
253
  transfer(params) {
@@ -293,12 +262,83 @@ class Wallet {
293
262
  }));
294
263
  }
295
264
  /**
296
- *
297
- * @description
298
- *
299
- * @returns
300
- *
301
- * @param params
265
+ * @description Stake a given amount for the source address
266
+ * @returns a TransactionWalletOperation promise object when followed by .send()
267
+ * @param Stake pseudo-operation parameter
268
+ */
269
+ stake(params) {
270
+ return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
271
+ const mappedParams = yield this.walletProvider.mapStakeParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () {
272
+ const source = yield this.pkh();
273
+ if (!params.to) {
274
+ params.to = source;
275
+ }
276
+ if (params.to !== source) {
277
+ throw new core_1.InvalidStakingAddressError(params.to);
278
+ }
279
+ params.parameter = { entrypoint: 'stake', value: { prim: 'Unit' } };
280
+ return params;
281
+ }));
282
+ const opHash = yield this.walletProvider.sendOperations([mappedParams]);
283
+ return this.context.operationFactory.createTransactionOperation(opHash);
284
+ }));
285
+ }
286
+ /**
287
+ * @description Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance.
288
+ * Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over,
289
+ * the operation "finalize unstake" must be called for the funds to appear in the liquid balance.
290
+ * @returns a TransactionWalletOperation promise object when followed by .send()
291
+ * @param Unstake pseudo-operation parameter
292
+ */
293
+ unstake(params) {
294
+ return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
295
+ const mappedParams = yield this.walletProvider.mapUnstakeParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () {
296
+ const source = yield this.pkh();
297
+ if (!params.to) {
298
+ params.to = source;
299
+ }
300
+ if (params.to !== source) {
301
+ throw new core_1.InvalidStakingAddressError(params.to);
302
+ }
303
+ params.parameter = { entrypoint: 'unstake', value: { prim: 'Unit' } };
304
+ return params;
305
+ }));
306
+ const opHash = yield this.walletProvider.sendOperations([mappedParams]);
307
+ return yield this.context.operationFactory.createTransactionOperation(opHash);
308
+ }));
309
+ }
310
+ /**
311
+ * @description Transfer all the finalizable unstaked funds of the source to their liquid balance
312
+ * @returns a TransactionWalletOperation promise object when followed by .send()
313
+ * @param Finalize_unstake pseudo-operation parameter
314
+ */
315
+ finalizeUnstake(params) {
316
+ return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
317
+ const mappedParams = yield this.walletProvider.mapFinalizeUnstakeParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () {
318
+ const source = yield this.pkh();
319
+ if (!params.to) {
320
+ params.to = source;
321
+ }
322
+ if (params.to !== source) {
323
+ throw new core_1.InvalidStakingAddressError(params.to);
324
+ }
325
+ if (!params.amount) {
326
+ params.amount = 0;
327
+ }
328
+ if (params.amount !== 0) {
329
+ throw new core_1.InvalidFinalizeUnstakeAmountError('Amount must be 0 to finalize unstake.');
330
+ }
331
+ params.parameter = { entrypoint: 'finalize_unstake', value: { prim: 'Unit' } };
332
+ return params;
333
+ }));
334
+ const opHash = yield this.walletProvider.sendOperations([mappedParams]);
335
+ return yield this.context.operationFactory.createTransactionOperation(opHash);
336
+ }));
337
+ }
338
+ /**
339
+ * @description Increase the paid storage of a smart contract.
340
+ * @returns a IncreasePaidStorageWalletOperation promise object when followed by .send()
341
+ * @param params operation parameter
302
342
  */
303
343
  increasePaidStorage(params) {
304
344
  const destinationValidation = (0, utils_1.validateAddress)(params.destination);
@@ -312,11 +352,8 @@ class Wallet {
312
352
  }));
313
353
  }
314
354
  /**
315
- *
316
355
  * @description Create a batch of operation
317
- *
318
356
  * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch
319
- *
320
357
  * @param params List of operation to initialize the batch with
321
358
  */
322
359
  batch(params) {
@@ -327,10 +364,8 @@ class Wallet {
327
364
  return batch;
328
365
  }
329
366
  /**
330
- *
331
367
  * @description Create an smart contract abstraction for the address specified. Calling entrypoints with the returned
332
368
  * smart contract abstraction will leverage the wallet provider to make smart contract calls
333
- *
334
369
  * @param address Smart contract address
335
370
  * @throws {@link InvalidContractAddressError} If the contract address is not valid
336
371
  */