@symmetry-hq/temp-v3-sdk 0.0.41 → 0.0.42
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.d.ts +90 -4
- package/dist/src/index.js +185 -39
- package/dist/src/instructions/management/claimFees.d.ts +10 -2
- package/dist/src/instructions/management/claimFees.js +70 -21
- package/dist/src/instructions/pda.d.ts +2 -0
- package/dist/src/instructions/pda.js +10 -1
- package/dist/src/layouts/basket.d.ts +20 -0
- package/dist/src/layouts/basket.js +9 -1
- package/dist/src/states/intents/rebalanceIntent.js +1 -1
- package/dist/src/states/withdrawBasketFees.d.ts +10 -0
- package/dist/src/states/withdrawBasketFees.js +134 -0
- package/dist/test.js +19 -0
- package/package.json +1 -1
- package/src/index.ts +198 -41
- package/src/instructions/management/claimFees.ts +97 -24
- package/src/instructions/pda.ts +9 -0
- package/src/layouts/basket.ts +30 -1
- package/src/states/intents/rebalanceIntent.ts +1 -1
- package/src/states/withdrawBasketFees.ts +134 -0
- package/test.ts +23 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, PublicKey, TransactionInstruction, TransactionSignature } from '@solana/web3.js';
|
|
2
2
|
import { getJupTokenLedgerAndSwapInstructions } from './jup';
|
|
3
|
-
import { Basket, FormattedAccumulatedFees, FormattedAddTokenSettings, FormattedAsset, FormattedAutomationSettings, FormattedBasket, FormattedCreatorSettings, FormattedCustomRebalanceSettings, FormattedDepositsSettings, FormattedFeeSettings, FormattedForceRebalanceSettings, FormattedLookupTables, FormattedLpSettings, FormattedMakeDirectSwapSettings, FormattedManagersSettings, FormattedMetadataSettings, FormattedOracle, FormattedOracleAggregator, FormattedOracleSettings, FormattedScheduleSettings, FormattedUpdateWeightsSettings } from './layouts/basket';
|
|
3
|
+
import { Basket, FormattedAccumulatedFees, FormattedAddTokenSettings, FormattedAsset, FormattedAutomationSettings, FormattedBasket, FormattedCreatorSettings, FormattedCustomRebalanceSettings, FormattedDepositsSettings, FormattedFeeSettings, FormattedForceRebalanceSettings, FormattedLookupTables, FormattedLpSettings, FormattedMakeDirectSwapSettings, FormattedManagersSettings, FormattedMetadataSettings, FormattedOracle, FormattedOracleAggregator, FormattedOracleSettings, FormattedScheduleSettings, FormattedUpdateWeightsSettings, WithdrawBasketFees } from './layouts/basket';
|
|
4
4
|
import { FormattedGlobalConfig, GlobalConfig } from './layouts/config';
|
|
5
5
|
import { AddOrEditTokenInput, EditAddTokenSettings, EditAutomationSettings, EditCreatorSettings, EditCustomRebalanceSettings, EditDepositsSettings, EditFeeSettings, EditForceRebalanceSettings, EditLpSettings, EditMakeDirectSwapSettings, EditManagerSettings, EditMetadataSettings, EditScheduleSettings, EditUpdateWeightsSettings, FormattedBounty, FormattedBountySchedule, FormattedIntent, FormattedIntentStatus, FormattedTaskType, Intent, MakeDirectSwapInput, OracleInput, Settings, TaskContext, TaskType, UpdateWeightsInput } from './layouts/intents/intent';
|
|
6
6
|
import { FormattedOraclePrice, FormattedRebalanceAction, FormattedRebalanceIntent, FormattedRebalanceType, FormattedTaskCompletion, FormattedTokenAuction, RebalanceIntent } from './layouts/intents/rebalanceIntent';
|
|
@@ -8,6 +8,7 @@ import { FormattedOracleType } from './layouts/oracle';
|
|
|
8
8
|
import { BasketFilter } from './states/basket';
|
|
9
9
|
import { IntentFilter } from './states/intents/intent';
|
|
10
10
|
import { RebalanceIntentFilter } from './states/intents/rebalanceIntent';
|
|
11
|
+
import { WithdrawBasketFeesFilter } from './states/withdrawBasketFees';
|
|
11
12
|
import { BasketCreationTx, TxPayloadBatchSequence, VersionedTxs, Wallet } from './txUtils';
|
|
12
13
|
export declare class SymmetryCore {
|
|
13
14
|
private sdkParams;
|
|
@@ -148,6 +149,56 @@ export declare class SymmetryCore {
|
|
|
148
149
|
* @returns {Promise<RebalanceIntent[]>} The rebalance intents.
|
|
149
150
|
*/
|
|
150
151
|
fetchBasketRebalanceIntents(basketPubkey: string): Promise<RebalanceIntent[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetches a WithdrawBasketFees account by its public key.
|
|
154
|
+
* @param {string} withdrawBasketFeesPubkey - The public key of the WithdrawBasketFees account.
|
|
155
|
+
* @returns {Promise<WithdrawBasketFees>} The WithdrawBasketFees account.
|
|
156
|
+
*/
|
|
157
|
+
fetchWithdrawBasketFees(withdrawBasketFeesPubkey: string): Promise<WithdrawBasketFees>;
|
|
158
|
+
/**
|
|
159
|
+
* Fetches multiple WithdrawBasketFees accounts by their public keys.
|
|
160
|
+
* @param {string[]} withdrawBasketFeesPubkeys - The public keys of the WithdrawBasketFees accounts.
|
|
161
|
+
* @returns {Promise<Map<string, WithdrawBasketFees>>} A map of WithdrawBasketFees public keys to WithdrawBasketFees accounts.
|
|
162
|
+
*/
|
|
163
|
+
fetchMultipleWithdrawBasketFees(withdrawBasketFeesPubkeys: string[]): Promise<Map<string, WithdrawBasketFees>>;
|
|
164
|
+
/**
|
|
165
|
+
* Fetches all WithdrawBasketFees accounts with optional filter.
|
|
166
|
+
* @param {WithdrawBasketFeesFilter} filter - Optional. The filter to apply to the WithdrawBasketFees accounts.
|
|
167
|
+
* @param {"basket" | "manager" | "creator" | "host" | "symmetry"} filter.type - The type of the filter.
|
|
168
|
+
* @param {string} filter.pubkey - The public key to filter by.
|
|
169
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
170
|
+
*/
|
|
171
|
+
fetchAllWithdrawBasketFees(filter?: WithdrawBasketFeesFilter): Promise<WithdrawBasketFees[]>;
|
|
172
|
+
/**
|
|
173
|
+
* Fetches all WithdrawBasketFees accounts for a given basket.
|
|
174
|
+
* @param {string} basketPubkey - The public key of the basket.
|
|
175
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
176
|
+
*/
|
|
177
|
+
fetchBasketWithdrawBasketFees(basketPubkey: string): Promise<WithdrawBasketFees[]>;
|
|
178
|
+
/**
|
|
179
|
+
* Fetches all WithdrawBasketFees accounts for a given manager.
|
|
180
|
+
* @param {string} managerPubkey - The public key of the manager.
|
|
181
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
182
|
+
*/
|
|
183
|
+
fetchManagerWithdrawBasketFees(managerPubkey: string): Promise<WithdrawBasketFees[]>;
|
|
184
|
+
/**
|
|
185
|
+
* Fetches all WithdrawBasketFees accounts for a given creator.
|
|
186
|
+
* @param {string} creatorPubkey - The public key of the creator.
|
|
187
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
188
|
+
*/
|
|
189
|
+
fetchCreatorWithdrawBasketFees(creatorPubkey: string): Promise<WithdrawBasketFees[]>;
|
|
190
|
+
/**
|
|
191
|
+
* Fetches all WithdrawBasketFees accounts for a given host.
|
|
192
|
+
* @param {string} hostPubkey - The public key of the host.
|
|
193
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
194
|
+
*/
|
|
195
|
+
fetchHostWithdrawBasketFees(hostPubkey: string): Promise<WithdrawBasketFees[]>;
|
|
196
|
+
/**
|
|
197
|
+
* Fetches all WithdrawBasketFees accounts for a given symmetry fee collector.
|
|
198
|
+
* @param {string} symmetryPubkey - The public key of the symmetry fee collector.
|
|
199
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
200
|
+
*/
|
|
201
|
+
fetchSymmetryWithdrawBasketFees(symmetryPubkey: string): Promise<WithdrawBasketFees[]>;
|
|
151
202
|
createGlobalConfigTx(params: {
|
|
152
203
|
signer: PublicKey;
|
|
153
204
|
}): Promise<TxPayloadBatchSequence>;
|
|
@@ -637,18 +688,53 @@ export declare class SymmetryCore {
|
|
|
637
688
|
amount: number;
|
|
638
689
|
}): Promise<TxPayloadBatchSequence>;
|
|
639
690
|
/**
|
|
640
|
-
*
|
|
691
|
+
* Withdraws fees from the basket, initializes WithdrawBasketFees accounts, and claims the fee tokens
|
|
692
|
+
* for all fee types that the claimer is authorized to claim (symmetry, creator, host, or manager fees).
|
|
693
|
+
*
|
|
694
|
+
* This function automatically determines which fee types the claimer can claim based on:
|
|
695
|
+
* - Symmetry fees: if claimer equals globalConfig.symmetryFeeCollector
|
|
696
|
+
* - Creator fees: if claimer equals basket.settings.creator
|
|
697
|
+
* - Host fees: if claimer equals basket.settings.host
|
|
698
|
+
* - Manager fees: if claimer is in basket.settings.managers.managers
|
|
699
|
+
*
|
|
641
700
|
* Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
|
|
642
701
|
*
|
|
643
|
-
*
|
|
702
|
+
* Batch layout:
|
|
703
|
+
* - batch 0: One transaction per claimable fee type, each containing a withdrawFeesIx instruction.
|
|
704
|
+
* All transactions in this batch can run in parallel. These create and populate the WithdrawBasketFees accounts.
|
|
705
|
+
* - batch 1: Multiple transactions for claiming fee tokens, automatically batched based on account limits.
|
|
706
|
+
* All transactions in this batch can run in parallel. These transfer tokens from WithdrawBasketFees accounts to claimers.
|
|
707
|
+
*
|
|
708
|
+
* Note: If not all tokens are claimed in batch 1 (e.g., due to account limits or errors),
|
|
709
|
+
* use claimTokenFeesFromBasketTx to claim the remaining tokens.
|
|
710
|
+
*
|
|
711
|
+
* @param {Object} params - The parameters for withdrawing and claiming basket fees.
|
|
644
712
|
* @param {string} params.claimer - The public key of the claimer.
|
|
645
713
|
* @param {string} params.basket - The public key of the basket.
|
|
646
714
|
* @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
|
|
647
715
|
*/
|
|
648
|
-
|
|
716
|
+
withdrawBasketFeesTx(params: {
|
|
649
717
|
claimer: string;
|
|
650
718
|
basket: string;
|
|
651
719
|
}): Promise<TxPayloadBatchSequence>;
|
|
720
|
+
/**
|
|
721
|
+
* Claims fee tokens from a WithdrawBasketFees account.
|
|
722
|
+
*
|
|
723
|
+
* This function transfers accumulated fee tokens from the WithdrawBasketFees account
|
|
724
|
+
* to the claimers (owners) based on their weights. The tokens are automatically batched
|
|
725
|
+
* into multiple transactions if needed to respect Solana's account limit (30 accounts per transaction).
|
|
726
|
+
*
|
|
727
|
+
* Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
|
|
728
|
+
*
|
|
729
|
+
* @param {Object} params - The parameters for claiming basket fees.
|
|
730
|
+
* @param {string} params.claimer - The public key of the claimer.
|
|
731
|
+
* @param {string} params.basket - The public key of the basket.
|
|
732
|
+
* @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
|
|
733
|
+
*/
|
|
734
|
+
claimTokenFeesFromBasketTx(params: {
|
|
735
|
+
claimer: string;
|
|
736
|
+
withdrawBasketFees: string;
|
|
737
|
+
}): Promise<TxPayloadBatchSequence>;
|
|
652
738
|
/**
|
|
653
739
|
* Rewrites lookup tables for the basket. (Used when the basket lookup tables are full)
|
|
654
740
|
*
|
package/dist/src/index.js
CHANGED
|
@@ -42,6 +42,7 @@ const basket_1 = require("./states/basket");
|
|
|
42
42
|
const config_1 = require("./states/config");
|
|
43
43
|
const intent_2 = require("./states/intents/intent");
|
|
44
44
|
const rebalanceIntent_3 = require("./states/intents/rebalanceIntent");
|
|
45
|
+
const withdrawBasketFees_1 = require("./states/withdrawBasketFees");
|
|
45
46
|
const pythOracle_1 = require("./states/oracles/pythOracle");
|
|
46
47
|
const txUtils_1 = require("./txUtils");
|
|
47
48
|
class SymmetryCore {
|
|
@@ -287,6 +288,88 @@ class SymmetryCore {
|
|
|
287
288
|
return yield (0, rebalanceIntent_3.fetchRebalanceIntents)(this.sdkParams.connection, { type: "basket", pubkey: basketPubkey });
|
|
288
289
|
});
|
|
289
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Fetches a WithdrawBasketFees account by its public key.
|
|
293
|
+
* @param {string} withdrawBasketFeesPubkey - The public key of the WithdrawBasketFees account.
|
|
294
|
+
* @returns {Promise<WithdrawBasketFees>} The WithdrawBasketFees account.
|
|
295
|
+
*/
|
|
296
|
+
fetchWithdrawBasketFees(withdrawBasketFeesPubkey) {
|
|
297
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFees)(this.sdkParams.connection, new web3_js_1.PublicKey(withdrawBasketFeesPubkey));
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Fetches multiple WithdrawBasketFees accounts by their public keys.
|
|
303
|
+
* @param {string[]} withdrawBasketFeesPubkeys - The public keys of the WithdrawBasketFees accounts.
|
|
304
|
+
* @returns {Promise<Map<string, WithdrawBasketFees>>} A map of WithdrawBasketFees public keys to WithdrawBasketFees accounts.
|
|
305
|
+
*/
|
|
306
|
+
fetchMultipleWithdrawBasketFees(withdrawBasketFeesPubkeys) {
|
|
307
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesMultiple)(this.sdkParams.connection, withdrawBasketFeesPubkeys.map(key => new web3_js_1.PublicKey(key)));
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Fetches all WithdrawBasketFees accounts with optional filter.
|
|
313
|
+
* @param {WithdrawBasketFeesFilter} filter - Optional. The filter to apply to the WithdrawBasketFees accounts.
|
|
314
|
+
* @param {"basket" | "manager" | "creator" | "host" | "symmetry"} filter.type - The type of the filter.
|
|
315
|
+
* @param {string} filter.pubkey - The public key to filter by.
|
|
316
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
317
|
+
*/
|
|
318
|
+
fetchAllWithdrawBasketFees(filter) {
|
|
319
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
320
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesList)(this.sdkParams.connection, filter);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Fetches all WithdrawBasketFees accounts for a given basket.
|
|
325
|
+
* @param {string} basketPubkey - The public key of the basket.
|
|
326
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
327
|
+
*/
|
|
328
|
+
fetchBasketWithdrawBasketFees(basketPubkey) {
|
|
329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesList)(this.sdkParams.connection, { type: "basket", pubkey: basketPubkey });
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Fetches all WithdrawBasketFees accounts for a given manager.
|
|
335
|
+
* @param {string} managerPubkey - The public key of the manager.
|
|
336
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
337
|
+
*/
|
|
338
|
+
fetchManagerWithdrawBasketFees(managerPubkey) {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
340
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesList)(this.sdkParams.connection, { type: "manager", pubkey: managerPubkey });
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Fetches all WithdrawBasketFees accounts for a given creator.
|
|
345
|
+
* @param {string} creatorPubkey - The public key of the creator.
|
|
346
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
347
|
+
*/
|
|
348
|
+
fetchCreatorWithdrawBasketFees(creatorPubkey) {
|
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesList)(this.sdkParams.connection, { type: "creator", pubkey: creatorPubkey });
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Fetches all WithdrawBasketFees accounts for a given host.
|
|
355
|
+
* @param {string} hostPubkey - The public key of the host.
|
|
356
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
357
|
+
*/
|
|
358
|
+
fetchHostWithdrawBasketFees(hostPubkey) {
|
|
359
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
360
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesList)(this.sdkParams.connection, { type: "host", pubkey: hostPubkey });
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Fetches all WithdrawBasketFees accounts for a given symmetry fee collector.
|
|
365
|
+
* @param {string} symmetryPubkey - The public key of the symmetry fee collector.
|
|
366
|
+
* @returns {Promise<WithdrawBasketFees[]>} The WithdrawBasketFees accounts.
|
|
367
|
+
*/
|
|
368
|
+
fetchSymmetryWithdrawBasketFees(symmetryPubkey) {
|
|
369
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
370
|
+
return yield (0, withdrawBasketFees_1.fetchWithdrawBasketFeesList)(this.sdkParams.connection, { type: "symmetry", pubkey: symmetryPubkey });
|
|
371
|
+
});
|
|
372
|
+
}
|
|
290
373
|
createGlobalConfigTx(params) {
|
|
291
374
|
return __awaiter(this, void 0, void 0, function* () {
|
|
292
375
|
let ix = (0, admin_1.createGlobalConfigIx)({ admin: params.signer });
|
|
@@ -1690,57 +1773,120 @@ class SymmetryCore {
|
|
|
1690
1773
|
});
|
|
1691
1774
|
}
|
|
1692
1775
|
/**
|
|
1693
|
-
*
|
|
1776
|
+
* Withdraws fees from the basket, initializes WithdrawBasketFees accounts, and claims the fee tokens
|
|
1777
|
+
* for all fee types that the claimer is authorized to claim (symmetry, creator, host, or manager fees).
|
|
1778
|
+
*
|
|
1779
|
+
* This function automatically determines which fee types the claimer can claim based on:
|
|
1780
|
+
* - Symmetry fees: if claimer equals globalConfig.symmetryFeeCollector
|
|
1781
|
+
* - Creator fees: if claimer equals basket.settings.creator
|
|
1782
|
+
* - Host fees: if claimer equals basket.settings.host
|
|
1783
|
+
* - Manager fees: if claimer is in basket.settings.managers.managers
|
|
1784
|
+
*
|
|
1694
1785
|
* Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
|
|
1695
1786
|
*
|
|
1696
|
-
*
|
|
1787
|
+
* Batch layout:
|
|
1788
|
+
* - batch 0: One transaction per claimable fee type, each containing a withdrawFeesIx instruction.
|
|
1789
|
+
* All transactions in this batch can run in parallel. These create and populate the WithdrawBasketFees accounts.
|
|
1790
|
+
* - batch 1: Multiple transactions for claiming fee tokens, automatically batched based on account limits.
|
|
1791
|
+
* All transactions in this batch can run in parallel. These transfer tokens from WithdrawBasketFees accounts to claimers.
|
|
1792
|
+
*
|
|
1793
|
+
* Note: If not all tokens are claimed in batch 1 (e.g., due to account limits or errors),
|
|
1794
|
+
* use claimTokenFeesFromBasketTx to claim the remaining tokens.
|
|
1795
|
+
*
|
|
1796
|
+
* @param {Object} params - The parameters for withdrawing and claiming basket fees.
|
|
1697
1797
|
* @param {string} params.claimer - The public key of the claimer.
|
|
1698
1798
|
* @param {string} params.basket - The public key of the basket.
|
|
1699
1799
|
* @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
|
|
1700
1800
|
*/
|
|
1701
|
-
|
|
1801
|
+
withdrawBasketFeesTx(params) {
|
|
1702
1802
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1703
1803
|
let claimer = new web3_js_1.PublicKey(params.claimer);
|
|
1704
1804
|
let basket = yield this.fetchBasket(params.basket);
|
|
1705
1805
|
let globalConfig = yield this.fetchGlobalConfig();
|
|
1706
|
-
let
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
ixs.push((0, claimFees_1.claimFeesIx)({
|
|
1730
|
-
claimer: claimer,
|
|
1806
|
+
let claimableFeeTypes = [];
|
|
1807
|
+
let owners = [];
|
|
1808
|
+
if (claimer.equals(globalConfig.symmetryFeeCollector)) {
|
|
1809
|
+
claimableFeeTypes.push(0);
|
|
1810
|
+
owners.push([globalConfig.symmetryFeeCollector]);
|
|
1811
|
+
}
|
|
1812
|
+
if (claimer.equals(basket.settings.creator)) {
|
|
1813
|
+
claimableFeeTypes.push(1);
|
|
1814
|
+
owners.push([basket.settings.creator]);
|
|
1815
|
+
}
|
|
1816
|
+
if (claimer.equals(basket.settings.host)) {
|
|
1817
|
+
claimableFeeTypes.push(2);
|
|
1818
|
+
owners.push([basket.settings.host]);
|
|
1819
|
+
}
|
|
1820
|
+
if (basket.settings.managers.managers.find(manager => manager.equals(claimer))) {
|
|
1821
|
+
claimableFeeTypes.push(3);
|
|
1822
|
+
owners.push(basket.settings.managers.managers);
|
|
1823
|
+
}
|
|
1824
|
+
let withdrawFeesIxs = [];
|
|
1825
|
+
let claimTokenFeesFromBasketIxs = [];
|
|
1826
|
+
claimableFeeTypes.forEach((feeType, index) => {
|
|
1827
|
+
withdrawFeesIxs.push((0, claimFees_1.withdrawFeesIx)({
|
|
1828
|
+
claimer,
|
|
1731
1829
|
basketTokenMint: basket.mint,
|
|
1732
|
-
feeType:
|
|
1733
|
-
managers: basket.settings.managers.managers,
|
|
1830
|
+
feeType: feeType,
|
|
1734
1831
|
}));
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1832
|
+
claimTokenFeesFromBasketIxs.push(...(0, claimFees_1.claimFeeTokensFromBasketIxs)(claimer, basket.ownAddress, (0, pda_1.getWithdrawBasketFeesPda)(basket.ownAddress, feeType), claimer, owners[index], basket.composition.map(composition => composition.mint)));
|
|
1833
|
+
});
|
|
1834
|
+
let txBatchData = { batches: [
|
|
1835
|
+
withdrawFeesIxs.map(ix => ({
|
|
1836
|
+
payer: claimer,
|
|
1837
|
+
instructions: [
|
|
1838
|
+
ix,
|
|
1839
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
|
|
1840
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
|
|
1841
|
+
],
|
|
1842
|
+
lookupTables: [],
|
|
1843
|
+
})),
|
|
1844
|
+
claimTokenFeesFromBasketIxs.map(ix => ({
|
|
1845
|
+
payer: claimer,
|
|
1846
|
+
instructions: [
|
|
1847
|
+
ix,
|
|
1848
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
|
|
1849
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
|
|
1850
|
+
],
|
|
1851
|
+
lookupTables: [],
|
|
1852
|
+
})),
|
|
1853
|
+
] };
|
|
1854
|
+
let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
|
|
1855
|
+
let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
|
|
1856
|
+
return txPayloadBatchSequence;
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Claims fee tokens from a WithdrawBasketFees account.
|
|
1861
|
+
*
|
|
1862
|
+
* This function transfers accumulated fee tokens from the WithdrawBasketFees account
|
|
1863
|
+
* to the claimers (owners) based on their weights. The tokens are automatically batched
|
|
1864
|
+
* into multiple transactions if needed to respect Solana's account limit (30 accounts per transaction).
|
|
1865
|
+
*
|
|
1866
|
+
* Returns TxPayloadBatchSequence ready for signAndSendTxPayloadBatchSequence.
|
|
1867
|
+
*
|
|
1868
|
+
* @param {Object} params - The parameters for claiming basket fees.
|
|
1869
|
+
* @param {string} params.claimer - The public key of the claimer.
|
|
1870
|
+
* @param {string} params.basket - The public key of the basket.
|
|
1871
|
+
* @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
|
|
1872
|
+
*/
|
|
1873
|
+
claimTokenFeesFromBasketTx(params) {
|
|
1874
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1875
|
+
let claimer = new web3_js_1.PublicKey(params.claimer);
|
|
1876
|
+
let withdrawBasketFees = yield this.fetchWithdrawBasketFees(params.withdrawBasketFees);
|
|
1877
|
+
let claimTokenFeesFromBasketIxs = (0, claimFees_1.claimFeeTokensFromBasketIxs)(claimer, withdrawBasketFees.basket, withdrawBasketFees.ownAddress, withdrawBasketFees.rentPayer, withdrawBasketFees.owners, withdrawBasketFees.accumulatedTokens);
|
|
1878
|
+
// Create batches: all claim instructions can run in parallel
|
|
1879
|
+
let txBatchData = { batches: [
|
|
1880
|
+
claimTokenFeesFromBasketIxs.map(ix => ({
|
|
1881
|
+
payer: claimer,
|
|
1882
|
+
instructions: [
|
|
1883
|
+
ix,
|
|
1884
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
|
|
1885
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
|
|
1886
|
+
],
|
|
1887
|
+
lookupTables: [],
|
|
1888
|
+
}))
|
|
1889
|
+
] };
|
|
1744
1890
|
let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
|
|
1745
1891
|
let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
|
|
1746
1892
|
return txPayloadBatchSequence;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function withdrawFeesIx(params: {
|
|
3
3
|
claimer: PublicKey;
|
|
4
4
|
basketTokenMint: PublicKey;
|
|
5
5
|
feeType: number;
|
|
6
|
-
managers: PublicKey[];
|
|
7
6
|
}): TransactionInstruction;
|
|
7
|
+
export declare function claimFeeTokensFromBasketIx(params: {
|
|
8
|
+
signer: PublicKey;
|
|
9
|
+
basket: PublicKey;
|
|
10
|
+
withdrawBasketFees: PublicKey;
|
|
11
|
+
rentPayer: PublicKey;
|
|
12
|
+
owners: PublicKey[];
|
|
13
|
+
tokenMints: PublicKey[];
|
|
14
|
+
}): TransactionInstruction;
|
|
15
|
+
export declare function claimFeeTokensFromBasketIxs(signer: PublicKey, basket: PublicKey, withdrawBasketFees: PublicKey, rentPayer: PublicKey, owners: PublicKey[], tokenMints: PublicKey[]): TransactionInstruction[];
|
|
@@ -1,44 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.withdrawFeesIx = withdrawFeesIx;
|
|
4
|
+
exports.claimFeeTokensFromBasketIx = claimFeeTokensFromBasketIx;
|
|
5
|
+
exports.claimFeeTokensFromBasketIxs = claimFeeTokensFromBasketIxs;
|
|
4
6
|
const spl_token_1 = require("@solana/spl-token");
|
|
5
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
8
|
const constants_1 = require("../../constants");
|
|
7
9
|
const pda_1 = require("../pda");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const WITHDRAW_FEES_DISCRIMINATOR = Buffer.from([97, 50, 216, 3, 144, 118, 13, 164]);
|
|
11
|
+
// TODO: Get the actual discriminator from the program
|
|
12
|
+
// This is typically the first 8 bytes of sha256("global:claim_fee_tokens_from_basket")
|
|
13
|
+
const CLAIM_FEE_TOKENS_FROM_BASKET_DISCRIMINATOR = Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]);
|
|
14
|
+
function withdrawFeesIx(params) {
|
|
15
|
+
let { claimer, basketTokenMint, feeType } = params;
|
|
12
16
|
let basket = (0, pda_1.getBasketState)(basketTokenMint);
|
|
17
|
+
let withdrawBasketFees = (0, pda_1.getWithdrawBasketFeesPda)(basket, feeType);
|
|
13
18
|
let basketFeesWallet = (0, pda_1.getBasketFeesPda)(basket);
|
|
14
19
|
let basketFeesTokenAccount = (0, pda_1.getAta)(basketFeesWallet, basketTokenMint);
|
|
15
20
|
let globalConfig = (0, pda_1.getGlobalConfigPda)();
|
|
16
|
-
const discriminator =
|
|
17
|
-
const args = Buffer.from([
|
|
21
|
+
const discriminator = WITHDRAW_FEES_DISCRIMINATOR;
|
|
22
|
+
const args = Buffer.from([feeType]);
|
|
18
23
|
const data = Buffer.concat([discriminator, args]);
|
|
19
24
|
const keys = [
|
|
20
25
|
{ pubkey: claimer, isWritable: true, isSigner: true },
|
|
21
26
|
{ pubkey: basket, isWritable: true, isSigner: false },
|
|
22
|
-
{ pubkey:
|
|
27
|
+
{ pubkey: withdrawBasketFees, isWritable: true, isSigner: false },
|
|
28
|
+
{ pubkey: basketTokenMint, isWritable: true, isSigner: false },
|
|
23
29
|
{ pubkey: basketFeesWallet, isWritable: true, isSigner: false },
|
|
24
30
|
{ pubkey: basketFeesTokenAccount, isWritable: true, isSigner: false },
|
|
25
|
-
{ pubkey: globalConfig, isWritable:
|
|
31
|
+
{ pubkey: globalConfig, isWritable: false, isSigner: false },
|
|
32
|
+
{ pubkey: web3_js_1.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
33
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
34
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
35
|
+
];
|
|
36
|
+
return new web3_js_1.TransactionInstruction({
|
|
37
|
+
keys,
|
|
38
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
39
|
+
data,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function claimFeeTokensFromBasketIx(params) {
|
|
43
|
+
let { signer, basket, withdrawBasketFees, rentPayer, owners, tokenMints } = params;
|
|
44
|
+
let numOwners = owners.length;
|
|
45
|
+
const discriminator = CLAIM_FEE_TOKENS_FROM_BASKET_DISCRIMINATOR;
|
|
46
|
+
const args = Buffer.from([numOwners]);
|
|
47
|
+
const data = Buffer.concat([discriminator, args]);
|
|
48
|
+
const keys = [
|
|
49
|
+
{ pubkey: signer, isWritable: true, isSigner: true },
|
|
50
|
+
{ pubkey: basket, isWritable: true, isSigner: false },
|
|
51
|
+
{ pubkey: withdrawBasketFees, isWritable: true, isSigner: false },
|
|
52
|
+
{ pubkey: rentPayer, isWritable: true, isSigner: false },
|
|
26
53
|
{ pubkey: web3_js_1.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
27
54
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
28
55
|
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
29
|
-
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false }
|
|
56
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
30
57
|
];
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
keys.push({ pubkey:
|
|
40
|
-
|
|
41
|
-
});
|
|
58
|
+
// Remaining accounts: for each token: (mint, basketAta, claimer1Ata, claimer2Ata, ...)
|
|
59
|
+
for (let i = 0; i < tokenMints.length; i++) {
|
|
60
|
+
const mint = tokenMints[i];
|
|
61
|
+
const basketAta = (0, pda_1.getAta)(basket, mint);
|
|
62
|
+
const claimerATAs = owners.map(owner => (0, pda_1.getAta)(owner, mint));
|
|
63
|
+
keys.push({ pubkey: mint, isWritable: false, isSigner: false });
|
|
64
|
+
keys.push({ pubkey: basketAta, isWritable: true, isSigner: false });
|
|
65
|
+
for (let j = 0; j < numOwners; j++) {
|
|
66
|
+
keys.push({ pubkey: claimerATAs[j], isWritable: true, isSigner: false });
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
69
|
return new web3_js_1.TransactionInstruction({
|
|
44
70
|
keys,
|
|
@@ -46,3 +72,26 @@ function claimFeesIx(params) {
|
|
|
46
72
|
data,
|
|
47
73
|
});
|
|
48
74
|
}
|
|
75
|
+
function claimFeeTokensFromBasketIxs(signer, basket, withdrawBasketFees, rentPayer, owners, tokenMints) {
|
|
76
|
+
if (owners.length === 0 || tokenMints.length === 0)
|
|
77
|
+
return [];
|
|
78
|
+
// Account limit: 8 fixed accounts + (owners + 2) * number_of_mints <= 30
|
|
79
|
+
// So: (owners + 2) * number_of_mints <= 24
|
|
80
|
+
// Max tokens per tx: Math.floor(24 / (owners.length + 2))
|
|
81
|
+
const accountsPerToken = owners.length + 2; // mint, basketAta, and one account per owner
|
|
82
|
+
const maxRemainingAccounts = 24; // 30 - 8 fixed accounts
|
|
83
|
+
const maxTokensPerTx = Math.floor(maxRemainingAccounts / accountsPerToken);
|
|
84
|
+
let ixs = [];
|
|
85
|
+
for (let i = 0; i < tokenMints.length; i += maxTokensPerTx) {
|
|
86
|
+
const batchTokenMints = tokenMints.slice(i, i + maxTokensPerTx);
|
|
87
|
+
ixs.push(claimFeeTokensFromBasketIx({
|
|
88
|
+
signer: signer,
|
|
89
|
+
basket: basket,
|
|
90
|
+
withdrawBasketFees: withdrawBasketFees,
|
|
91
|
+
rentPayer: rentPayer,
|
|
92
|
+
owners: owners,
|
|
93
|
+
tokenMints: batchTokenMints,
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
return ixs;
|
|
97
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
export declare const GLOBAL_CONFIG_SEED: Buffer;
|
|
3
3
|
export declare const BASKET_FEES_SEED: Buffer;
|
|
4
|
+
export declare const WITHDRAW_BASKET_FEES_SEED: Buffer;
|
|
4
5
|
export declare const BASKET_SEED: Buffer;
|
|
5
6
|
export declare const MINT_SEED: Buffer;
|
|
6
7
|
export declare const RENT_PAYER_SEED: Buffer;
|
|
@@ -12,6 +13,7 @@ export declare function getBasketTokenMintPda(basketId: number): PublicKey;
|
|
|
12
13
|
export declare function getBasketState(mint: PublicKey): PublicKey;
|
|
13
14
|
export declare function getBountyVaultPda(): PublicKey;
|
|
14
15
|
export declare function getBasketFeesPda(basket: PublicKey): PublicKey;
|
|
16
|
+
export declare function getWithdrawBasketFeesPda(basket: PublicKey, feeType: number): PublicKey;
|
|
15
17
|
export declare function getGlobalConfigPda(): PublicKey;
|
|
16
18
|
export declare function getRentPayerPda(): PublicKey;
|
|
17
19
|
export declare function getIntentPda(basket: PublicKey, intentSeedArray: Uint8Array, editType: number): PublicKey;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REBALANCE_INTENT_SEED = exports.BOUNTY_VAULT_SEED = exports.RENT_PAYER_SEED = exports.MINT_SEED = exports.BASKET_SEED = exports.BASKET_FEES_SEED = exports.GLOBAL_CONFIG_SEED = void 0;
|
|
3
|
+
exports.REBALANCE_INTENT_SEED = exports.BOUNTY_VAULT_SEED = exports.RENT_PAYER_SEED = exports.MINT_SEED = exports.BASKET_SEED = exports.WITHDRAW_BASKET_FEES_SEED = exports.BASKET_FEES_SEED = exports.GLOBAL_CONFIG_SEED = void 0;
|
|
4
4
|
exports.serializeString = serializeString;
|
|
5
5
|
exports.getRandomSeed = getRandomSeed;
|
|
6
6
|
exports.getBasketTokenMintPda = getBasketTokenMintPda;
|
|
7
7
|
exports.getBasketState = getBasketState;
|
|
8
8
|
exports.getBountyVaultPda = getBountyVaultPda;
|
|
9
9
|
exports.getBasketFeesPda = getBasketFeesPda;
|
|
10
|
+
exports.getWithdrawBasketFeesPda = getWithdrawBasketFeesPda;
|
|
10
11
|
exports.getGlobalConfigPda = getGlobalConfigPda;
|
|
11
12
|
exports.getRentPayerPda = getRentPayerPda;
|
|
12
13
|
exports.getIntentPda = getIntentPda;
|
|
@@ -23,6 +24,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
23
24
|
const constants_1 = require("../constants");
|
|
24
25
|
exports.GLOBAL_CONFIG_SEED = Buffer.from("global_config");
|
|
25
26
|
exports.BASKET_FEES_SEED = Buffer.from("basket_fees");
|
|
27
|
+
exports.WITHDRAW_BASKET_FEES_SEED = Buffer.from("withdraw_basket_fees");
|
|
26
28
|
exports.BASKET_SEED = Buffer.from("basket");
|
|
27
29
|
exports.MINT_SEED = Buffer.from("mint");
|
|
28
30
|
exports.RENT_PAYER_SEED = Buffer.from("rent_payer");
|
|
@@ -67,6 +69,13 @@ function getBasketFeesPda(basket) {
|
|
|
67
69
|
basket.toBuffer()
|
|
68
70
|
], constants_1.BASKETS_V3_PROGRAM_ID)[0];
|
|
69
71
|
}
|
|
72
|
+
function getWithdrawBasketFeesPda(basket, feeType) {
|
|
73
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
74
|
+
exports.WITHDRAW_BASKET_FEES_SEED,
|
|
75
|
+
basket.toBuffer(),
|
|
76
|
+
Buffer.from([feeType]) // u8, not u64
|
|
77
|
+
], constants_1.BASKETS_V3_PROGRAM_ID)[0];
|
|
78
|
+
}
|
|
70
79
|
function getGlobalConfigPda() {
|
|
71
80
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
72
81
|
exports.GLOBAL_CONFIG_SEED
|
|
@@ -132,6 +132,26 @@ export interface BasketFees {
|
|
|
132
132
|
managersFees: BN;
|
|
133
133
|
}
|
|
134
134
|
export declare const BasketFeesLayout: any;
|
|
135
|
+
export interface FormattedWithdrawBasketFees {
|
|
136
|
+
pubkey: string;
|
|
137
|
+
basket: string;
|
|
138
|
+
rent_payer: string;
|
|
139
|
+
owners: string[];
|
|
140
|
+
owners_weights: number[];
|
|
141
|
+
accumulated_tokens: string[];
|
|
142
|
+
accumulated_fees: number[];
|
|
143
|
+
}
|
|
144
|
+
export interface WithdrawBasketFees {
|
|
145
|
+
basket: PublicKey;
|
|
146
|
+
rentPayer: PublicKey;
|
|
147
|
+
owners: PublicKey[];
|
|
148
|
+
ownersWeights: number[];
|
|
149
|
+
accumulatedTokens: PublicKey[];
|
|
150
|
+
accumulatedFees: BN[];
|
|
151
|
+
ownAddress?: PublicKey;
|
|
152
|
+
formatted?: FormattedWithdrawBasketFees;
|
|
153
|
+
}
|
|
154
|
+
export declare const WithdrawBasketFeesLayout: any;
|
|
135
155
|
export interface LookupTables {
|
|
136
156
|
active: PublicKey[];
|
|
137
157
|
temp: PublicKey[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BasketLayout = exports.AssetLayout = exports.LookupTablesLayout = exports.BasketFeesLayout = exports.BASKET_TYPES_STRINGS = void 0;
|
|
3
|
+
exports.BasketLayout = exports.AssetLayout = exports.LookupTablesLayout = exports.WithdrawBasketFeesLayout = exports.BasketFeesLayout = exports.BASKET_TYPES_STRINGS = void 0;
|
|
4
4
|
const borsh_1 = require("@coral-xyz/borsh");
|
|
5
5
|
const oracle_1 = require("./oracle");
|
|
6
6
|
const config_1 = require("./config");
|
|
@@ -16,6 +16,14 @@ exports.BasketFeesLayout = (0, borsh_1.struct)([
|
|
|
16
16
|
(0, borsh_1.u64)("hostFees"),
|
|
17
17
|
(0, borsh_1.u64)("managersFees"),
|
|
18
18
|
]);
|
|
19
|
+
exports.WithdrawBasketFeesLayout = (0, borsh_1.struct)([
|
|
20
|
+
(0, borsh_1.publicKey)('basket'),
|
|
21
|
+
(0, borsh_1.publicKey)('rentPayer'),
|
|
22
|
+
(0, borsh_1.array)((0, borsh_1.publicKey)(), constants_1.MAX_MANAGERS_PER_BASKET, 'owners'),
|
|
23
|
+
(0, borsh_1.array)((0, borsh_1.u16)(), constants_1.MAX_MANAGERS_PER_BASKET, 'ownersWeights'),
|
|
24
|
+
(0, borsh_1.array)((0, borsh_1.publicKey)(), constants_1.MAX_SUPPORTED_TOKENS_PER_BASKET, 'accumulatedTokens'),
|
|
25
|
+
(0, borsh_1.array)((0, borsh_1.u64)(), constants_1.MAX_SUPPORTED_TOKENS_PER_BASKET, 'accumulatedFees'),
|
|
26
|
+
]);
|
|
19
27
|
;
|
|
20
28
|
exports.LookupTablesLayout = (0, borsh_1.struct)([
|
|
21
29
|
(0, borsh_1.array)((0, borsh_1.publicKey)(), 2, "active"),
|
|
@@ -212,9 +212,9 @@ function fetchRebalanceIntents(connection, filter) {
|
|
|
212
212
|
let rebalanceIntents = accounts.map(account => {
|
|
213
213
|
let rebalanceIntent = rebalanceIntent_1.RebalanceIntentLayout.decode(account.account.data.slice(8));
|
|
214
214
|
rebalanceIntent.ownAddress = account.pubkey;
|
|
215
|
+
rebalanceIntent = addFieldsToRebalanceIntent(rebalanceIntent);
|
|
215
216
|
return rebalanceIntent;
|
|
216
217
|
});
|
|
217
|
-
rebalanceIntents = rebalanceIntents.map(rebalanceIntent => addFieldsToRebalanceIntent(rebalanceIntent));
|
|
218
218
|
return rebalanceIntents;
|
|
219
219
|
});
|
|
220
220
|
}
|