@symmetry-hq/temp-v3-sdk 0.0.39 → 0.0.41

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/dist/src/index.js CHANGED
@@ -37,12 +37,21 @@ const fraction_1 = require("./layouts/fraction");
37
37
  const intent_1 = require("./layouts/intents/intent");
38
38
  Object.defineProperty(exports, "TaskType", { enumerable: true, get: function () { return intent_1.TaskType; } });
39
39
  const rebalanceIntent_2 = require("./layouts/intents/rebalanceIntent");
40
+ const oracle_1 = require("./layouts/oracle");
40
41
  const basket_1 = require("./states/basket");
41
42
  const config_1 = require("./states/config");
42
43
  const intent_2 = require("./states/intents/intent");
43
44
  const rebalanceIntent_3 = require("./states/intents/rebalanceIntent");
45
+ const pythOracle_1 = require("./states/oracles/pythOracle");
44
46
  const txUtils_1 = require("./txUtils");
45
47
  class SymmetryCore {
48
+ /**
49
+ * Initializes the SymmetryCore SDK.
50
+ * @param params {connection: Connection, network: "devnet" | "mainnet", priorityFee?: number} - The parameters for the SDK.
51
+ * @param params.connection - The connection to the Solana network.
52
+ * @param params.network - The network to use (devnet or mainnet).
53
+ * @param params.priorityFee - Optional. The priority fee to use for the transactions. Defaults to PRIORITY_FEE.
54
+ */
46
55
  constructor(params) {
47
56
  var _a;
48
57
  this.sdkParams = {
@@ -51,41 +60,82 @@ class SymmetryCore {
51
60
  priorityFee: (_a = params.priorityFee) !== null && _a !== void 0 ? _a : constants_1.PRIORITY_FEE,
52
61
  };
53
62
  }
63
+ /**
64
+ * Fetches the global config account.
65
+ * @returns {Promise<GlobalConfig>} The global config.
66
+ */
54
67
  fetchGlobalConfig() {
55
68
  return __awaiter(this, void 0, void 0, function* () {
56
69
  return yield (0, config_1.fetchGlobalConfig)(this.sdkParams.connection);
57
70
  });
58
71
  }
72
+ /**
73
+ * Fetches a basket by its public key.
74
+ * @param {string} basketPubkey - The public key of the basket.
75
+ * @returns {Promise<Basket>} The basket.
76
+ */
59
77
  fetchBasket(basketPubkey) {
60
78
  return __awaiter(this, void 0, void 0, function* () {
61
79
  return yield (0, basket_1.fetchBasket)(this.sdkParams.connection, new web3_js_1.PublicKey(basketPubkey));
62
80
  });
63
81
  }
82
+ /**
83
+ * Fetches multiple baskets by their public keys.
84
+ * @param {string[]} basketPubkeys - The public keys of the baskets.
85
+ * @returns {Promise<Map<string, Basket>>} A map of basket public keys to baskets.
86
+ */
64
87
  fetchMultipleBaskets(basketPubkeys) {
65
88
  return __awaiter(this, void 0, void 0, function* () {
66
89
  return yield (0, basket_1.fetchBaskektsMultiple)(this.sdkParams.connection, basketPubkeys.map(key => new web3_js_1.PublicKey(key)));
67
90
  });
68
91
  }
92
+ /**
93
+ * Fetches all baskets.
94
+ * @param {BasketFilter} basketFilter - Optional. The filter to apply to the baskets.
95
+ * @param {"creator" | "host" | "manager"} basketFilter.type - The type of the basket filter ("creator", "host", "manager").
96
+ * @param {string} basketFilter.pubkey - The public key of the basket filter.
97
+ * @returns {Promise<Basket[]>} The baskets.
98
+ */
69
99
  fetchAllBaskets(basketFilter) {
70
100
  return __awaiter(this, void 0, void 0, function* () {
71
101
  return yield (0, basket_1.fetchBaskets)(this.sdkParams.connection, basketFilter);
72
102
  });
73
103
  }
104
+ /**
105
+ * Fetches all baskets created by a given public key.
106
+ * @param {string} creatorPubkey - The public key of the creator.
107
+ * @returns {Promise<Basket[]>} The baskets.
108
+ */
74
109
  fetchCreatedBaskets(creatorPubkey) {
75
110
  return __awaiter(this, void 0, void 0, function* () {
76
111
  return yield (0, basket_1.fetchBaskets)(this.sdkParams.connection, { type: "creator", pubkey: creatorPubkey });
77
112
  });
78
113
  }
114
+ /**
115
+ * Fetches all baskets hosted by a given public key.
116
+ * @param {string} hostPubkey - The public key of the host.
117
+ * @returns {Promise<Basket[]>} The baskets.
118
+ */
79
119
  fetchHostedBaskets(hostPubkey) {
80
120
  return __awaiter(this, void 0, void 0, function* () {
81
121
  return yield (0, basket_1.fetchBaskets)(this.sdkParams.connection, { type: "host", pubkey: hostPubkey });
82
122
  });
83
123
  }
124
+ /**
125
+ * Fetches all baskets managed by a given public key.
126
+ * @param {string} managerPubkey - The public key of the manager.
127
+ * @returns {Promise<Basket[]>} The baskets.
128
+ */
84
129
  fetchManagedBaskets(managerPubkey) {
85
130
  return __awaiter(this, void 0, void 0, function* () {
86
131
  return yield (0, basket_1.fetchBaskets)(this.sdkParams.connection, { type: "manager", pubkey: managerPubkey });
87
132
  });
88
133
  }
134
+ /**
135
+ * Derives baskets by their mints.
136
+ * @param {string[]} mints - The mint public keys of the baskets.
137
+ * @returns {Promise<Map<string, string>>} A map of basket mint public keys to basket public keys.
138
+ */
89
139
  deriveBasketsByMints(mints) {
90
140
  return __awaiter(this, void 0, void 0, function* () {
91
141
  let result = new Map();
@@ -98,6 +148,11 @@ class SymmetryCore {
98
148
  return result;
99
149
  });
100
150
  }
151
+ /**
152
+ * Fetches baskets by their mint public keys.
153
+ * @param {string[]} mints - The mint public keys of the baskets.
154
+ * @returns {Promise<Map<string, Basket>>} A map of basket mint public keys to baskets.
155
+ */
101
156
  fetchBasketsFromMints(mints) {
102
157
  return __awaiter(this, void 0, void 0, function* () {
103
158
  let basketPubkeys = mints.map(mint => {
@@ -118,56 +173,115 @@ class SymmetryCore {
118
173
  return mintsMap;
119
174
  });
120
175
  }
176
+ /**
177
+ * Loads the price of a basket.
178
+ * @param {Basket} basket - The basket.
179
+ * @returns {Promise<Basket>} The basket with the price.
180
+ */
121
181
  loadBasketPrice(basket) {
122
182
  return __awaiter(this, void 0, void 0, function* () {
123
183
  return yield (0, basket_1.loadBasketPrice)(basket, this.sdkParams.connection);
124
184
  });
125
185
  }
186
+ /**
187
+ * Fetches an intent by its public key.
188
+ * @param {string} intentPubkey - The public key of the intent.
189
+ * @returns {Promise<Intent>} The intent.
190
+ */
126
191
  fetchIntent(intentPubkey) {
127
192
  return __awaiter(this, void 0, void 0, function* () {
128
193
  return yield (0, intent_2.fetchIntent)(this.sdkParams.connection, new web3_js_1.PublicKey(intentPubkey));
129
194
  });
130
195
  }
196
+ /**
197
+ * Fetches multiple intents by their public keys.
198
+ * @param {string[]} intentPubkeys - The public keys of the intents.
199
+ * @returns {Promise<Map<string, Intent>>} A map of intent public keys to intents.
200
+ */
131
201
  fetchMultipleIntents(intentPubkeys) {
132
202
  return __awaiter(this, void 0, void 0, function* () {
133
203
  return yield (0, intent_2.fetchIntentsMultiple)(this.sdkParams.connection, intentPubkeys.map(key => new web3_js_1.PublicKey(key)));
134
204
  });
135
205
  }
206
+ /**
207
+ * Fetches all intents.
208
+ * @param {IntentFilter} filter - Optional. The filter to apply to the intents.
209
+ * @param {"creator" | "host" | "manager" | "basket" | "owner"} filter.type - The type of the intent filter ("creator", "host", "manager", "basket", "owner").
210
+ * @param {string} filter.pubkey - The public key of the intent filter.
211
+ * @returns {Promise<Intent[]>} The intents.
212
+ */
136
213
  fetchAllIntents(filter) {
137
214
  return __awaiter(this, void 0, void 0, function* () {
138
215
  return yield (0, intent_2.fetchIntents)(this.sdkParams.connection, filter);
139
216
  });
140
217
  }
218
+ /**
219
+ * Fetches all intents created by a given public key.
220
+ * @param {string} creatorPubkey - The public key of the creator.
221
+ * @returns {Promise<Intent[]>} The intents.
222
+ */
141
223
  fetchCreatedIntents(creatorPubkey) {
142
224
  return __awaiter(this, void 0, void 0, function* () {
143
225
  return yield (0, intent_2.fetchIntents)(this.sdkParams.connection, { type: "manager", pubkey: creatorPubkey });
144
226
  });
145
227
  }
228
+ /**
229
+ * Fetches all intents for a given basket.
230
+ * @param {string} basketPubkey - The public key of the basket.
231
+ * @returns {Promise<Intent[]>} The intents.
232
+ */
146
233
  fetchBasketIntents(basketPubkey) {
147
234
  return __awaiter(this, void 0, void 0, function* () {
148
235
  return yield (0, intent_2.fetchIntents)(this.sdkParams.connection, { type: "basket", pubkey: basketPubkey });
149
236
  });
150
237
  }
238
+ /**
239
+ * Fetches a rebalance intent by its public key.
240
+ * @param {string} rebalanceIntentPubkey - The public key of the rebalance intent.
241
+ * @returns {Promise<RebalanceIntent>} The rebalance intent.
242
+ */
151
243
  fetchRebalanceIntent(rebalanceIntentPubkey) {
152
244
  return __awaiter(this, void 0, void 0, function* () {
153
245
  return yield (0, rebalanceIntent_3.fetchRebalanceIntent)(this.sdkParams.connection, new web3_js_1.PublicKey(rebalanceIntentPubkey));
154
246
  });
155
247
  }
248
+ /**
249
+ * Fetches multiple rebalance intents by their public keys.
250
+ * @param {string[]} rebalanceIntentPubkeys - The public keys of the rebalance intents.
251
+ * @returns {Promise<Map<string, RebalanceIntent>>} A map of rebalance intent public keys to rebalance intents.
252
+ */
156
253
  fetchMultipleRebalanceIntents(rebalanceIntentPubkeys) {
157
254
  return __awaiter(this, void 0, void 0, function* () {
158
255
  return yield (0, rebalanceIntent_3.fetchRebalanceIntentsMultiple)(this.sdkParams.connection, rebalanceIntentPubkeys.map(key => new web3_js_1.PublicKey(key)));
159
256
  });
160
257
  }
258
+ /**
259
+ * Fetches all rebalance intents.
260
+ * @param {RebalanceIntentFilter} filter - Optional. The filter to apply to the rebalance intents.
261
+ * @param {"owner" | "basket"} filter.type - The type of the rebalance intent filter ("owner", "basket").
262
+ * @param {string} filter.pubkey - The public key of the rebalance intent filter.
263
+ * @returns {Promise<RebalanceIntent[]>} The rebalance intents.
264
+ */
161
265
  fetchAllRebalanceIntents(filter) {
162
266
  return __awaiter(this, void 0, void 0, function* () {
163
267
  return yield (0, rebalanceIntent_3.fetchRebalanceIntents)(this.sdkParams.connection, filter);
164
268
  });
165
269
  }
270
+ /**
271
+ * Fetches all rebalance intents for a given owner.
272
+ * @param {string} ownerPubkey - The public key of the owner.
273
+ * @returns {Promise<RebalanceIntent[]>} The rebalance intents.
274
+ */
166
275
  fetchOwnerRebalanceIntents(ownerPubkey) {
167
276
  return __awaiter(this, void 0, void 0, function* () {
168
277
  return yield (0, rebalanceIntent_3.fetchRebalanceIntents)(this.sdkParams.connection, { type: "owner", pubkey: ownerPubkey });
169
278
  });
170
279
  }
280
+ /**
281
+ * Fetches all rebalance intents for a given basket.
282
+ * @param {string} basketPubkey - The public key of the basket.
283
+ * @returns {Promise<RebalanceIntent[]>} The rebalance intents.
284
+ */
171
285
  fetchBasketRebalanceIntents(basketPubkey) {
172
286
  return __awaiter(this, void 0, void 0, function* () {
173
287
  return yield (0, rebalanceIntent_3.fetchRebalanceIntents)(this.sdkParams.connection, { type: "basket", pubkey: basketPubkey });
@@ -207,6 +321,22 @@ class SymmetryCore {
207
321
  return txPayloadBatchSequence;
208
322
  });
209
323
  }
324
+ /**
325
+ * Creates a basket.
326
+ * @param {Object} params - The parameters for the basket creation.
327
+ * @param {string} params.creator - The public key of the creator.
328
+ * @param {string} params.start_price - The start price of the basket.
329
+ * @param {string} params.name - The name of the basket.
330
+ * @param {string} params.symbol - The symbol of the basket.
331
+ * @param {string} params.metadata_uri - The metadata URI of the basket.
332
+ * @param {Object} params.host_platform_params - Optional. The host platform parameters.
333
+ * @param {string} params.host_platform_params.host_pubkey - The public key of the host.
334
+ * @param {number} params.host_platform_params.host_deposit_fee_bps - The host deposit fee in basis points.
335
+ * @param {number} params.host_platform_params.host_withdraw_fee_bps - The host withdrawal fee in basis points.
336
+ * @param {number} params.host_platform_params.host_management_fee_bps - The host management fee in basis points.
337
+ * @param {number} params.host_platform_params.host_performance_fee_bps - The host performance fee in basis points.
338
+ * @returns {Promise<BasketCreationTx>} The basket creation transaction.
339
+ */
210
340
  createBasketTx(params) {
211
341
  return __awaiter(this, void 0, void 0, function* () {
212
342
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -266,86 +396,194 @@ class SymmetryCore {
266
396
  };
267
397
  });
268
398
  }
399
+ /**
400
+ * Changes the creator of a basket.
401
+ * @param {TaskContext} context - The context of the task.
402
+ * @param {EditCreatorSettings} settings - The settings for the creator edit.
403
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
404
+ */
269
405
  editCreatorTx(context, settings) {
270
406
  return __awaiter(this, void 0, void 0, function* () {
271
407
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditCreator, context, settings });
272
408
  });
273
409
  }
410
+ /**
411
+ * Creates an edit manager settings intent for a basket.
412
+ * @param {TaskContext} context - The context of the task.
413
+ * @param {EditManagerSettings} settings - The settings for the manager edit.
414
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
415
+ */
274
416
  editManagersTx(context, settings) {
275
417
  return __awaiter(this, void 0, void 0, function* () {
276
418
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditManagerSettings, context, settings });
277
419
  });
278
420
  }
421
+ /**
422
+ * Creates an edit schedule settings intent for a basket.
423
+ * @param {TaskContext} context - The context of the task.
424
+ * @param {EditScheduleSettings} settings - The settings for the schedule edit.
425
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
426
+ */
279
427
  editScheduleTx(context, settings) {
280
428
  return __awaiter(this, void 0, void 0, function* () {
281
429
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditScheduleSettings, context, settings });
282
430
  });
283
431
  }
432
+ /**
433
+ * Creates an edit fees settings intent for a basket.
434
+ * @param {TaskContext} context - The context of the task.
435
+ * @param {EditFeeSettings} settings - The settings for the fee edit.
436
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
437
+ */
284
438
  editFeesTx(context, settings) {
285
439
  return __awaiter(this, void 0, void 0, function* () {
286
440
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditFeeSettings, context, settings });
287
441
  });
288
442
  }
443
+ /**
444
+ * Creates an edit automation settings intent for a basket.
445
+ * @param {TaskContext} context - The context of the task.
446
+ * @param {EditAutomationSettings} settings - The settings for the automation edit.
447
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
448
+ */
289
449
  editAutomationTx(context, settings) {
290
450
  return __awaiter(this, void 0, void 0, function* () {
291
451
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditAutomationSettings, context, settings });
292
452
  });
293
453
  }
454
+ /**
455
+ * Creates an edit LP settings intent for a basket.
456
+ * @param {TaskContext} context - The context of the task.
457
+ * @param {EditLpSettings} settings - The settings for the LP edit.
458
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
459
+ */
294
460
  editLpTx(context, settings) {
295
461
  return __awaiter(this, void 0, void 0, function* () {
296
462
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditLpSettings, context, settings });
297
463
  });
298
464
  }
465
+ /**
466
+ * Creates an edit metadata settings intent for a basket.
467
+ * @param {TaskContext} context - The context of the task.
468
+ * @param {EditMetadataSettings} settings - The settings for the metadata edit.
469
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
470
+ */
299
471
  editMetadataTx(context, settings) {
300
472
  return __awaiter(this, void 0, void 0, function* () {
301
473
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditMetadataSettings, context, settings });
302
474
  });
303
475
  }
476
+ /**
477
+ * Creates an edit deposits settings intent for a basket.
478
+ * @param {TaskContext} context - The context of the task.
479
+ * @param {EditDepositsSettings} settings - The settings for the deposits edit.
480
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
481
+ */
304
482
  editDepositsTx(context, settings) {
305
483
  return __awaiter(this, void 0, void 0, function* () {
306
484
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditDepositsSettings, context, settings });
307
485
  });
308
486
  }
487
+ /**
488
+ * Creates an edit force rebalance settings intent for a basket.
489
+ * @param {TaskContext} context - The context of the task.
490
+ * @param {EditForceRebalanceSettings} settings - The settings for the force rebalance edit.
491
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
492
+ */
309
493
  editForceRebalanceTx(context, settings) {
310
494
  return __awaiter(this, void 0, void 0, function* () {
311
495
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditForceRebalanceSettings, context, settings });
312
496
  });
313
497
  }
498
+ /**
499
+ * Creates an edit custom rebalance settings intent for a basket.
500
+ * @param {TaskContext} context - The context of the task.
501
+ * @param {EditCustomRebalanceSettings} settings - The settings for the custom rebalance edit.
502
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
503
+ */
314
504
  editCustomRebalanceTx(context, settings) {
315
505
  return __awaiter(this, void 0, void 0, function* () {
316
506
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditCustomRebalanceSettings, context, settings });
317
507
  });
318
508
  }
509
+ /**
510
+ * Creates an edit add token delay intent for a basket.
511
+ * @param {TaskContext} context - The context of the task.
512
+ * @param {EditAddTokenSettings} settings - The settings for the add token delay edit.
513
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
514
+ */
319
515
  editAddTokenDelayTx(context, settings) {
320
516
  return __awaiter(this, void 0, void 0, function* () {
321
517
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditAddTokenDelay, context, settings });
322
518
  });
323
519
  }
520
+ /**
521
+ * Creates an edit update weights delay intent for a basket.
522
+ * @param {TaskContext} context - The context of the task.
523
+ * @param {EditUpdateWeightsSettings} settings - The settings for the update weights delay edit.
524
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
525
+ */
324
526
  editUpdateWeightsDelayTx(context, settings) {
325
527
  return __awaiter(this, void 0, void 0, function* () {
326
528
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditUpdateWeightsDelay, context, settings });
327
529
  });
328
530
  }
531
+ /**
532
+ * Creates an edit swap delay intent for a basket.
533
+ * @param {TaskContext} context - The context of the task.
534
+ * @param {EditMakeDirectSwapSettings} settings - The settings for the make direct swap delay edit.
535
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
536
+ */
329
537
  editSwapDelayTx(context, settings) {
330
538
  return __awaiter(this, void 0, void 0, function* () {
331
539
  return this.openBasketIntentTx({ type: intent_1.TaskType.EditMakeDirectSwapDelay, context, settings });
332
540
  });
333
541
  }
542
+ /**
543
+ * Creates an add or edit token intent for a basket.
544
+ * @param {TaskContext} context - The context of the task.
545
+ * @param {AddOrEditTokenInput} settings - The settings for the add or edit token.
546
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
547
+ */
334
548
  addOrEditTokenTx(context, settings) {
335
549
  return __awaiter(this, void 0, void 0, function* () {
336
550
  return this.openBasketIntentTx({ type: intent_1.TaskType.AddToken, context, settings });
337
551
  });
338
552
  }
553
+ /**
554
+ * Creates a update weights intent for a basket.
555
+ * @param {TaskContext} context - The context of the task.
556
+ * @param {UpdateWeightsInput} settings - The settings for the update weights.
557
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
558
+ */
339
559
  updateWeightsTx(context, settings) {
340
560
  return __awaiter(this, void 0, void 0, function* () {
341
561
  return this.openBasketIntentTx({ type: intent_1.TaskType.UpdateWeights, context, settings });
342
562
  });
343
563
  }
564
+ /**
565
+ * Creates a direct swap intent for a basket.
566
+ * @param {TaskContext} context - The context of the task.
567
+ * @param {MakeDirectSwapInput} settings - The settings for the make direct swap.
568
+ * @param {TransactionInstruction} jup_swap_ix - Optional. The JUP swap instruction.
569
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
570
+ */
344
571
  makeDirectSwapTx(context, settings, jup_swap_ix) {
345
572
  return __awaiter(this, void 0, void 0, function* () {
346
573
  return this.openBasketIntentTx({ type: intent_1.TaskType.MakeDirectSwap, context, settings, jup_swap_ix: jup_swap_ix });
347
574
  });
348
575
  }
576
+ /**
577
+ * Creates basket intent account.
578
+ * @param {Object} params - The parameters for the basket intent.
579
+ * @param {TaskContext} params.context - The context of the task.
580
+ * @param {TaskType} params.type - The type of the task.
581
+ * @param {Settings} params.settings - The settings for the task.
582
+ * @param {number} params.min_bounty_per_task - Optional. The minimum bounty per task.
583
+ * @param {number} params.max_bounty_per_task - Optional. The maximum bounty per task.
584
+ * @param {TransactionInstruction} params.jup_swap_ix - Optional. The JUP swap instruction (for MakeDirectSwap task).
585
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
586
+ */
349
587
  openBasketIntentTx(params) {
350
588
  return __awaiter(this, void 0, void 0, function* () {
351
589
  var _a, _b, _c;
@@ -475,6 +713,13 @@ class SymmetryCore {
475
713
  return txPayloadBatchSequence;
476
714
  });
477
715
  }
716
+ /**
717
+ * Executes a basket intent. Basket intent will be executed immediately.
718
+ * @param {Object} params - The parameters for the basket intent.
719
+ * @param {string} params.keeper - The public key of the keeper.
720
+ * @param {string} params.intent - The public key of the intent.
721
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
722
+ */
478
723
  executeBasketIntentTx(params) {
479
724
  return __awaiter(this, void 0, void 0, function* () {
480
725
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -507,6 +752,13 @@ class SymmetryCore {
507
752
  return txPayloadBatchSequence;
508
753
  });
509
754
  }
755
+ /**
756
+ * Cancels a basket intent. Basket intent account will get closed.
757
+ * @param {Object} params - The parameters for the basket intent.
758
+ * @param {string} params.keeper - The public key of the keeper.
759
+ * @param {string} params.intent - The public key of the intent.
760
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
761
+ */
510
762
  cancelBasketIntentTx(params) {
511
763
  return __awaiter(this, void 0, void 0, function* () {
512
764
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -533,6 +785,13 @@ class SymmetryCore {
533
785
  return txPayloadBatchSequence;
534
786
  });
535
787
  }
788
+ /**
789
+ * Cancels a rebalance intent. Rebalance intent status will be set to AuctionFinished.
790
+ * @param {Object} params - The parameters for the rebalance intent.
791
+ * @param {string} params.keeper - The public key of the keeper.
792
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent.
793
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
794
+ */
536
795
  cancelRebalanceIntentTx(params) {
537
796
  return __awaiter(this, void 0, void 0, function* () {
538
797
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -556,6 +815,35 @@ class SymmetryCore {
556
815
  return txPayloadBatchSequence;
557
816
  });
558
817
  }
818
+ /**
819
+ * Creates a rebalance intent for a user to deposit tokens into a basket.
820
+ *
821
+ * Batch layout:
822
+ *
823
+ * batch 0:
824
+ * * tx0: [create, resize, init rebalance intent],
825
+ *
826
+ * batch 1:
827
+ * * tx0: [deposit tokens ix],
828
+ * * tx1: [deposit tokens ix],
829
+ * * ...
830
+ *
831
+ * batch 2:
832
+ * * tx0: [lock deposits ix, start price updates ix],
833
+ *
834
+ * @param {Object} params - The parameters for the basket purchase.
835
+ * @param {string} params.buyer - The public key of the buyer.
836
+ * @param {string} params.basket_mint - The mint public key of the basket.
837
+ * @param {{mint: string, amount: number}[]} params.contributions - The contributions to the basket.
838
+ * @param {string} params.contributions[].mint - The mint public key of the contribution.
839
+ * @param {number} params.contributions[].amount - The amount of the contribution.
840
+ * @param {number} params.rebalance_slippage_bps - Optional. The rebalance slippage in basis points.
841
+ * @param {number} params.per_trade_rebalance_slippage_bps - Optional. The per trade rebalance slippage in basis points.
842
+ * @param {number} params.execution_start_time - Optional. The execution start time.
843
+ * @param {number} params.min_bounty_amount - Optional. The minimum bounty amount.
844
+ * @param {number} params.max_bounty_amount - Optional. The maximum bounty amount.
845
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
846
+ */
559
847
  buyBasketTx(params) {
560
848
  return __awaiter(this, void 0, void 0, function* () {
561
849
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -659,6 +947,20 @@ class SymmetryCore {
659
947
  return txPayloadBatchSequence;
660
948
  });
661
949
  }
950
+ /**
951
+ * Creates a rebalance intent for a user to withdraw tokens from a basket.
952
+ * @param {{Object}} params - The parameters for the basket sale.
953
+ * @param {string} params.seller - The public key of the seller.
954
+ * @param {string} params.basket_mint - The mint public key of the basket.
955
+ * @param {number} params.withdraw_amount - The amount of the withdrawal.
956
+ * @param {string[]} params.keep_tokens - The token mints to skip rebalancing (will directly be sent to the user without being rebalanced).
957
+ * @param {number} params.rebalance_slippage_bps - Optional. The rebalance slippage in basis points.
958
+ * @param {number} params.per_trade_rebalance_slippage_bps - Optional. The per trade rebalance slippage in basis points.
959
+ * @param {number} params.execution_start_time - Optional. The execution start time.
960
+ * @param {number} params.min_bounty_amount - Optional. The minimum bounty amount.
961
+ * @param {number} params.max_bounty_amount - Optional. The maximum bounty amount.
962
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
963
+ */
662
964
  sellBasketTx(params) {
663
965
  return __awaiter(this, void 0, void 0, function* () {
664
966
  var _a, _b, _c, _d, _e, _f;
@@ -773,6 +1075,18 @@ class SymmetryCore {
773
1075
  return txPayloadBatchSequence;
774
1076
  });
775
1077
  }
1078
+ /**
1079
+ * Creates a rebalance intent for a basket rebalance.
1080
+ * @param {Object} params - The parameters for the basket rebalance.
1081
+ * @param {string} params.keeper - The public key of the keeper.
1082
+ * @param {string} params.basket_mint - The basket token mint public key.
1083
+ * @param {number} params.rebalance_slippage_bps - Optional. The rebalance slippage in basis points.
1084
+ * @param {number} params.per_trade_rebalance_slippage_bps - Optional. The per trade rebalance slippage in basis points.
1085
+ * @param {number} params.execution_start_time - Optional. The execution start time.
1086
+ * @param {number} params.min_bounty_amount - Optional. The minimum bounty amount.
1087
+ * @param {number} params.max_bounty_amount - Optional. The maximum bounty amount.
1088
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1089
+ */
776
1090
  rebalanceBasketTx(params) {
777
1091
  return __awaiter(this, void 0, void 0, function* () {
778
1092
  var _a, _b, _c, _d, _e, _f;
@@ -837,6 +1151,17 @@ class SymmetryCore {
837
1151
  return txPayloadBatchSequence;
838
1152
  });
839
1153
  }
1154
+ /**
1155
+ * Marks the start of price updates for a rebalance intent. Keepers will be able to
1156
+ *
1157
+ * update token prices for the rebalance intent after priceUpdateDelayAfterCreation seconds.
1158
+ *
1159
+ * @param {Object} params - The parameters for the start price updates.
1160
+ * @param {string} params.keeper - The public key of the keeper.
1161
+ * @param {string} params.basket - The public key of the basket.
1162
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1163
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1164
+ */
840
1165
  startPriceUpdatesTx(params) {
841
1166
  return __awaiter(this, void 0, void 0, function* () {
842
1167
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -860,30 +1185,74 @@ class SymmetryCore {
860
1185
  return txPayloadBatchSequence;
861
1186
  });
862
1187
  }
1188
+ /**
1189
+ * Build update token prices transactions.
1190
+ *
1191
+ * For pyth oracle accounts, fetches feed IDs, builds vaa [create init encode], [write verify],
1192
+ *
1193
+ * [update feed], [close vaa] instructions. For all tokens, builds [update token prices] instructions.
1194
+ *
1195
+ * returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1196
+ *
1197
+ * Batch layout:
1198
+ *
1199
+ * batch 0:
1200
+ * * tx0: [vaa0CreateIx, vaa0InitIx, vaa0WriteIx],
1201
+ * * tx1: [vaa1CreateIx, vaa1InitIx, vaa1WriteIx],
1202
+ * * ...
1203
+ *
1204
+ * batch 1:
1205
+ * * tx0: [vaa0WriteVerifyIx, vaa0VerifyIx],
1206
+ * * tx1: [vaa1WriteVerifyIx, vaa1VerifyIx],
1207
+ * * ...
1208
+ *
1209
+ * batch 2:
1210
+ * * tx0: [updateFeed0Ix],
1211
+ * * tx1: [updateFeed1Ix],
1212
+ * * ...
1213
+ *
1214
+ * batch 3:
1215
+ * * tx0: [updateTokenPricesIx(max 10 tokens)],
1216
+ * * tx1: [updateTokenPricesIx(max 10 tokens)],
1217
+ * * ...
1218
+ * * txLast: [closeVaa0Ix, closeVaa1Ix, ...]
1219
+ *
1220
+ * @param {Object} params - The parameters for the update token prices.
1221
+ * @param {string} params.keeper - The public key of the keeper.
1222
+ * @param {string} params.basket - The public key of the basket.
1223
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1224
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1225
+ */
863
1226
  updateTokenPricesTx(params) {
864
1227
  return __awaiter(this, void 0, void 0, function* () {
865
1228
  let keeper = new web3_js_1.PublicKey(params.keeper);
866
1229
  let rebalanceIntent = new web3_js_1.PublicKey(params.rebalance_intent);
867
1230
  let basketRebalanceIntent = (0, pda_1.getRebalanceIntentPda)(new web3_js_1.PublicKey(params.basket), new web3_js_1.PublicKey(params.basket));
868
1231
  let basket = yield this.fetchBasket(params.basket);
869
- let ixs = [];
870
- let batchSize = 7;
871
- for (let batchStart = 0; batchStart < basket.numTokens; batchStart += batchSize) {
1232
+ let pythPriceFeeds = [];
1233
+ let updateTokenPricesIxs = [];
1234
+ for (let startIndex = 0; startIndex < basket.numTokens; startIndex++) {
872
1235
  let allKeys = [];
873
1236
  let tokenIndices = [];
874
- for (let i = batchStart; i < basket.numTokens && i < batchStart + batchSize; i++) {
875
- tokenIndices.push(i);
876
- let agg = basket.composition[i].oracleAggregator;
1237
+ for (let endIndex = startIndex; endIndex < basket.numTokens; endIndex++) {
1238
+ let numAccounts = basket.composition[endIndex].oracleAggregator.oracles
1239
+ .slice(0, basket.composition[endIndex].oracleAggregator.numOracles)
1240
+ .reduce((acc, oracle) => acc + oracle.oracleSettings.numRequiredAccounts, 0);
1241
+ if (allKeys.length + numAccounts > constants_1.UPDATE_TOKEN_PRICES_MAX_ACCOUNTS)
1242
+ break;
1243
+ if (tokenIndices.length == 20)
1244
+ break;
1245
+ startIndex = endIndex;
1246
+ tokenIndices.push(endIndex);
1247
+ let agg = basket.composition[endIndex].oracleAggregator;
877
1248
  for (let i = 0; i < agg.numOracles; i++) {
878
- const oracleData = agg.oracles[i];
1249
+ const oracleData = agg.oracles[endIndex];
879
1250
  for (let j = 0; j < oracleData.oracleSettings.numRequiredAccounts; j++) {
880
1251
  const lutId = oracleData.accountsToLoadLutIds[j];
881
1252
  const lutIdx = oracleData.accountsToLoadLutIndices[j];
882
- if (lutId === 0 && lutIdx === 0)
883
- continue;
884
- if (!basket.lutPubkeys)
885
- continue;
886
1253
  allKeys.push(basket.lutPubkeys[lutId].state.addresses[lutIdx]);
1254
+ if (oracleData.oracleSettings.oracleType === oracle_1.OracleType.Pyth)
1255
+ pythPriceFeeds.push(basket.lutPubkeys[lutId].state.addresses[lutIdx]);
887
1256
  }
888
1257
  }
889
1258
  }
@@ -891,7 +1260,7 @@ class SymmetryCore {
891
1260
  tokenIndices.push(0);
892
1261
  // TODO: in last instruction we should include performance fee accounts
893
1262
  let performanceFees = basket.settings.fees.hostPerformanceFeeBps + basket.settings.fees.creatorPerformanceFeeBps + basket.settings.fees.managersPerformanceFeeBps;
894
- ixs.push((0, priceUpdate_1.updateTokenPricesIx)({
1263
+ updateTokenPricesIxs.push((0, priceUpdate_1.updateTokenPricesIx)({
895
1264
  keeper: keeper,
896
1265
  basket: basket.ownAddress,
897
1266
  rebalanceIntent: rebalanceIntent,
@@ -903,20 +1272,191 @@ class SymmetryCore {
903
1272
  basketMint: performanceFees > 0 ? basket.mint : undefined,
904
1273
  }));
905
1274
  }
906
- let txBatchData = { batches: [ixs.map(ix => ({
907
- payer: keeper,
908
- instructions: [
909
- ix,
910
- web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
911
- web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
912
- ],
913
- lookupTables: [basket.lookupTables.active[0], basket.lookupTables.active[1]],
914
- }))] };
1275
+ const { feedIds } = yield (0, pythOracle_1.fetchFeedIdsFromAccounts)(this.sdkParams.connection, pythPriceFeeds);
1276
+ const { vaaCreateInitEncodeIxs, vaaWriteVerifyIxs, updateFeedIxs, closeVaaIxs, } = yield (0, pythOracle_1.buildPythPriceFeedUpdateIxs)(keeper, feedIds);
1277
+ let txBatchData = { batches: [
1278
+ [
1279
+ ...vaaCreateInitEncodeIxs.map(ixs => ({
1280
+ payer: keeper,
1281
+ instructions: [
1282
+ ...ixs.ixs,
1283
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1284
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1285
+ ],
1286
+ lookupTables: [],
1287
+ })),
1288
+ ],
1289
+ [
1290
+ ...vaaWriteVerifyIxs.map(ixs => ({
1291
+ payer: keeper,
1292
+ instructions: [
1293
+ ...ixs,
1294
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1295
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1296
+ ],
1297
+ lookupTables: [],
1298
+ })),
1299
+ ],
1300
+ [
1301
+ ...updateFeedIxs.map(ix => ({
1302
+ payer: keeper,
1303
+ instructions: [
1304
+ ix,
1305
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1306
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1307
+ ],
1308
+ lookupTables: [],
1309
+ })),
1310
+ ],
1311
+ [
1312
+ ...updateTokenPricesIxs.map(ix => ({
1313
+ payer: keeper,
1314
+ instructions: [
1315
+ ix,
1316
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1317
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1318
+ ],
1319
+ lookupTables: [basket.lookupTables.active[0], basket.lookupTables.active[1]],
1320
+ })),
1321
+ {
1322
+ payer: keeper,
1323
+ instructions: [
1324
+ ...closeVaaIxs,
1325
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1326
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1327
+ ],
1328
+ lookupTables: [],
1329
+ }
1330
+ ],
1331
+ ] };
915
1332
  let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1333
+ for (let [txId, vaaCreateInitEncodeIx] of vaaCreateInitEncodeIxs.entries()) {
1334
+ versionedTxs.batches[0][txId].sign([vaaCreateInitEncodeIx.signer]);
1335
+ }
1336
+ let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
1337
+ return txPayloadBatchSequence;
1338
+ });
1339
+ }
1340
+ /**
1341
+ * Build Pyth price feed update transactions from on-chain price account pubkeys.
1342
+ * Fetches feed IDs from accounts, builds update instructions, and returns
1343
+ * TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1344
+ *
1345
+ * Batch layout:
1346
+ *
1347
+ * batch 0:
1348
+ * * tx0: [vaa0CreateIx, vaa0InitIx, vaa0WriteIx],
1349
+ * * tx1: [vaa1CreateIx, vaa1InitIx, vaa1WriteIx],
1350
+ * * ...
1351
+ *
1352
+ * batch 1:
1353
+ * * tx0: [vaa0WriteVerifyIx, vaa0VerifyIx],
1354
+ * * tx1: [vaa1WriteVerifyIx, vaa1VerifyIx],
1355
+ * * ...
1356
+ *
1357
+ * batch 2:
1358
+ * * tx0: [updateFeed0Ix],
1359
+ * * tx1: [updateFeed1Ix],
1360
+ * * ...
1361
+ *
1362
+ * batch 3:
1363
+ * * txLast: [closeVaa0Ix, closeVaa1Ix, ...]
1364
+ *
1365
+ */
1366
+ updatePythPriceFeedsTx(params) {
1367
+ return __awaiter(this, void 0, void 0, function* () {
1368
+ const payer = new web3_js_1.PublicKey(params.keeper);
1369
+ const priceAccounts = params.accounts.map(a => new web3_js_1.PublicKey(a));
1370
+ const { feedIds } = yield (0, pythOracle_1.fetchFeedIdsFromAccounts)(this.sdkParams.connection, priceAccounts);
1371
+ const { vaaCreateInitEncodeIxs, vaaWriteVerifyIxs, updateFeedIxs, closeVaaIxs, } = yield (0, pythOracle_1.buildPythPriceFeedUpdateIxs)(payer, feedIds);
1372
+ let txBatchData = { batches: [
1373
+ [
1374
+ ...vaaCreateInitEncodeIxs.map(ixs => ({
1375
+ payer: payer,
1376
+ instructions: [
1377
+ ...ixs.ixs,
1378
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1379
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1380
+ ],
1381
+ lookupTables: [],
1382
+ })),
1383
+ ],
1384
+ [
1385
+ ...vaaWriteVerifyIxs.map(ixs => ({
1386
+ payer: payer,
1387
+ instructions: [
1388
+ ...ixs,
1389
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1390
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1391
+ ],
1392
+ lookupTables: [],
1393
+ })),
1394
+ ],
1395
+ [
1396
+ ...updateFeedIxs.map(ix => ({
1397
+ payer: payer,
1398
+ instructions: [
1399
+ ix,
1400
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1401
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1402
+ ],
1403
+ lookupTables: [],
1404
+ })),
1405
+ ],
1406
+ [
1407
+ {
1408
+ payer: payer,
1409
+ instructions: [
1410
+ ...closeVaaIxs,
1411
+ web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1412
+ web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1413
+ ],
1414
+ lookupTables: [],
1415
+ }
1416
+ ],
1417
+ ] };
1418
+ let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1419
+ for (let [txId, vaaCreateInitEncodeIx] of vaaCreateInitEncodeIxs.entries()) {
1420
+ versionedTxs.batches[0][txId].sign([vaaCreateInitEncodeIx.signer]);
1421
+ }
916
1422
  let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
917
1423
  return txPayloadBatchSequence;
918
1424
  });
919
1425
  }
1426
+ /**
1427
+ * Build flash swap transactions (Rebalance or MakeDirectSwap).
1428
+ *
1429
+ * Withdraws amount_out tokens(mint_out) from basket, deposits amount_in tokens(mint_in) to basket.
1430
+ *
1431
+ * If jup_swap_ix is provided, uses it to swap amount_out tokens(mint_out) for amount_in tokens(mint_in).
1432
+ *
1433
+ * returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1434
+ *
1435
+ * Batch layout: batch 0: tx: 0:
1436
+ * * create associated token account_mint_out
1437
+ * * create associated token account_mint_in
1438
+ * * jup_token_ledger_ix
1439
+ * * flash withdraw
1440
+ * * jup_swap_ix
1441
+ * * flash deposit
1442
+ * * set compute unit limit
1443
+ * * set compute unit price
1444
+ *
1445
+ * @param {Object} params - The parameters for the flash swap.
1446
+ * @param {string} params.keeper - The public key of the keeper.
1447
+ * @param {string} params.basket - The public key of the basket.
1448
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent (for Rebalance).
1449
+ * @param {string} params.intent - The public key of the intent (for MakeDirectSwap).
1450
+ * @param {string} params.mint_in - The mint of the input token (deposited to basket).
1451
+ * @param {string} params.mint_out - The mint of the output token (withdrawn from basket).
1452
+ * @param {number} params.amount_in - The amount of the input token (deposited to basket).
1453
+ * @param {number} params.amount_out - The amount of the output token (withdrawn from basket).
1454
+ * @param {"exact_in" | "exact_out" | "ioc"} params.mode - The mode of the flash swap.
1455
+ * @param {TransactionInstruction} params.jup_token_ledger_ix - The jup token ledger ix.
1456
+ * @param {TransactionInstruction} params.jup_swap_ix - The jup swap ix.
1457
+ * @param {PublicKey[]} params.jup_address_lookup_table_addresses - The jup address lookup table addresses.
1458
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1459
+ */
920
1460
  flashSwapTx(params) {
921
1461
  return __awaiter(this, void 0, void 0, function* () {
922
1462
  var _a;
@@ -969,6 +1509,16 @@ class SymmetryCore {
969
1509
  return txPayloadBatchSequence;
970
1510
  });
971
1511
  }
1512
+ /**
1513
+ * Mints basket tokens for a user. Executable when the rebalance intent has finished its auctions.
1514
+ *
1515
+ * Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1516
+ *
1517
+ * @param {Object} params - The parameters for the mint.
1518
+ * @param {string} params.keeper - The public key of the keeper.
1519
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1520
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1521
+ */
972
1522
  mintTx(params) {
973
1523
  return __awaiter(this, void 0, void 0, function* () {
974
1524
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -996,6 +1546,16 @@ class SymmetryCore {
996
1546
  return txPayloadBatchSequence;
997
1547
  });
998
1548
  }
1549
+ /**
1550
+ * Redeems tokens from the rebalance intent with Withdraw status.
1551
+ *
1552
+ * Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1553
+ *
1554
+ * @param {Object} params - The parameters for the redeem tokens.
1555
+ * @param {string} params.keeper - The public key of the keeper.
1556
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1557
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1558
+ */
999
1559
  redeemTokensTx(params) {
1000
1560
  return __awaiter(this, void 0, void 0, function* () {
1001
1561
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -1030,6 +1590,20 @@ class SymmetryCore {
1030
1590
  return txPayloadBatchSequence;
1031
1591
  });
1032
1592
  }
1593
+ /**
1594
+ * Claims the bounty to keepers who have completed tasks for rebalance intent.
1595
+ *
1596
+ * Executebale when the rebalance intent has finished its auctions.
1597
+ *
1598
+ * For Withdraw status rebalance intent, tokens have to be redeemed first.
1599
+ *
1600
+ * Closes the rebalance intent if all keepers have claimed the bounty.
1601
+ *
1602
+ * @param {Object} params - The parameters for the claim bounty.
1603
+ * @param {string} params.keeper - The public key of the keeper.
1604
+ * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1605
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1606
+ */
1033
1607
  claimBountyTx(params) {
1034
1608
  return __awaiter(this, void 0, void 0, function* () {
1035
1609
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -1074,6 +1648,16 @@ class SymmetryCore {
1074
1648
  return txPayloadBatchSequence;
1075
1649
  });
1076
1650
  }
1651
+ /**
1652
+ * Adds bounty for automation to basket.
1653
+ * Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1654
+ *
1655
+ * @param {Object} params - The parameters for the add bounty.
1656
+ * @param {string} params.keeper - The public key of the keeper.
1657
+ * @param {string} params.basket - The public key of the basket.
1658
+ * @param {number} params.amount - The amount of the bounty.
1659
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1660
+ */
1077
1661
  addBountyTx(params) {
1078
1662
  return __awaiter(this, void 0, void 0, function* () {
1079
1663
  let keeper = new web3_js_1.PublicKey(params.keeper);
@@ -1105,6 +1689,15 @@ class SymmetryCore {
1105
1689
  return txPayloadBatchSequence;
1106
1690
  });
1107
1691
  }
1692
+ /**
1693
+ * Claims fees from the basket for host, creator, managers or symmetry fees collector.
1694
+ * Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1695
+ *
1696
+ * @param {Object} params - The parameters for the claim basket fees.
1697
+ * @param {string} params.claimer - The public key of the claimer.
1698
+ * @param {string} params.basket - The public key of the basket.
1699
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1700
+ */
1108
1701
  claimBasketFeesTx(params) {
1109
1702
  return __awaiter(this, void 0, void 0, function* () {
1110
1703
  let claimer = new web3_js_1.PublicKey(params.claimer);
@@ -1153,6 +1746,30 @@ class SymmetryCore {
1153
1746
  return txPayloadBatchSequence;
1154
1747
  });
1155
1748
  }
1749
+ /**
1750
+ * Rewrites lookup tables for the basket. (Used when the basket lookup tables are full)
1751
+ *
1752
+ * Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
1753
+ *
1754
+ * Batch layout:
1755
+ *
1756
+ * batch 0:
1757
+ * * tx0: [create temp lookup tables],
1758
+ *
1759
+ * batch 1:
1760
+ * * tx0: [extend temp lookup tables (with oracles of active tokens)],
1761
+ * * tx1: [extend temp lookup tables (with oracles of active tokens)],
1762
+ * * ...
1763
+ *
1764
+ * batch 2:
1765
+ * * tx0: [overwrite lookup tables with temp, deactivate old lookup tables],
1766
+ *
1767
+ * @param {Object} params - The parameters for the rewrite lookup tables.
1768
+ * @param {string} params.signer - The public key of the signer.
1769
+ * @param {string} params.basket_mint - The mint of the basket.
1770
+ * @param {string[]} params.additional_accounts - The additional accounts.
1771
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1772
+ */
1156
1773
  rewriteLookupTablesTx(params) {
1157
1774
  return __awaiter(this, void 0, void 0, function* () {
1158
1775
  const signer = new web3_js_1.PublicKey(params.signer);