@symmetry-hq/temp-v3-sdk 0.0.10 → 0.0.12
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 +28 -24
- package/dist/src/index.js +78 -45
- package/dist/src/instructions/management/edit.d.ts +2 -2
- package/dist/src/instructions/management/edit.js +19 -20
- package/dist/src/layouts/intents/intent.d.ts +116 -194
- package/dist/src/states/basket.d.ts +3 -3
- package/dist/src/states/basket.js +198 -178
- package/dist/test.js +172 -253
- package/package.json +1 -1
- package/src/index.ts +110 -79
- package/src/instructions/management/edit.ts +21 -23
- package/src/layouts/intents/intent.ts +117 -197
- package/src/states/basket.ts +199 -181
- package/test.ts +174 -254
package/dist/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BN } from '@coral-xyz/anchor';
|
|
|
2
2
|
import { Connection, PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
3
3
|
import { Basket } from './layouts/basket';
|
|
4
4
|
import { GlobalConfig } from './layouts/config';
|
|
5
|
-
import {
|
|
5
|
+
import { FormattedCreatorSettings, FormattedManagersSettings, FormattedFeeSettings, FormattedScheduleSettings, FormattedAutomationSettings, FormattedLpSettings, FormattedMetadataSettings, FormattedDepositsSettings, FormattedForceRebalanceSettings, FormattedCustomRebalanceSettings, FormattedAddTokenSettings, FormattedUpdateWeightsSettings, FormattedMakeDirectSwapSettings, TaskContext, Settings, AddTokenInput, UpdateWeightsInput, MakeDirectSwapInput, TaskType, Intent } from './layouts/intents/intent';
|
|
6
6
|
import { RebalanceIntent } from './layouts/intents/rebalanceIntent';
|
|
7
7
|
import { BasketFilter } from './states/basket';
|
|
8
8
|
import { IntentFilter } from './states/intents/intent';
|
|
@@ -21,10 +21,13 @@ export declare class SymmetryCore {
|
|
|
21
21
|
jupiterApiKey?: string;
|
|
22
22
|
maxAllowedAccounts?: number;
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
fetchBasket(basketPubkey: string): Promise<Basket>;
|
|
25
|
+
fetchMultipleBaskets(basketPubkeys: string[]): Promise<Map<string, Basket>>;
|
|
26
|
+
fetchAllBaskets(basketFilter?: BasketFilter): Promise<Basket[]>;
|
|
27
|
+
fetchCreatedBaskets(creatorPubkey: string): Promise<Basket[]>;
|
|
28
|
+
fetchHostedBaskets(hostPubkey: string): Promise<Basket[]>;
|
|
29
|
+
fetchManagedBaskets(managerPubkey: string): Promise<Basket[]>;
|
|
30
|
+
deriveBasketsByMints(mints: string[]): Promise<Map<string, string>>;
|
|
28
31
|
fetchBasketsFromMints(mints: string[]): Promise<Map<string, Basket>>;
|
|
29
32
|
loadBasketPrice(basket: Basket): Promise<Basket>;
|
|
30
33
|
fetchAllIntents(filters: IntentFilter[]): Promise<Intent[]>;
|
|
@@ -49,25 +52,26 @@ export declare class SymmetryCore {
|
|
|
49
52
|
host_performance_fee_bps: number;
|
|
50
53
|
priority_fee_lamports: number;
|
|
51
54
|
}): Promise<TxPayloadBatchSequence>;
|
|
52
|
-
editCreatorTx(
|
|
53
|
-
editManagersTx(
|
|
54
|
-
editScheduleTx(
|
|
55
|
-
editFeesTx(
|
|
56
|
-
editAutomationTx(
|
|
57
|
-
editLpTx(
|
|
58
|
-
editMetadataTx(
|
|
59
|
-
editDepositsTx(
|
|
60
|
-
editForceRebalanceTx(
|
|
61
|
-
editCustomRebalanceTx(
|
|
62
|
-
editAddTokenDelayTx(
|
|
63
|
-
editUpdateWeightsDelayTx(
|
|
64
|
-
editSwapDelayTx(
|
|
65
|
-
addTokenTx(
|
|
66
|
-
updateWeightsTx(
|
|
67
|
-
makeDirectSwapTx(
|
|
55
|
+
editCreatorTx(context: TaskContext, settings: FormattedCreatorSettings): Promise<TxPayloadBatchSequence>;
|
|
56
|
+
editManagersTx(context: TaskContext, settings: FormattedManagersSettings): Promise<TxPayloadBatchSequence>;
|
|
57
|
+
editScheduleTx(context: TaskContext, settings: FormattedScheduleSettings): Promise<TxPayloadBatchSequence>;
|
|
58
|
+
editFeesTx(context: TaskContext, settings: FormattedFeeSettings): Promise<TxPayloadBatchSequence>;
|
|
59
|
+
editAutomationTx(context: TaskContext, settings: FormattedAutomationSettings): Promise<TxPayloadBatchSequence>;
|
|
60
|
+
editLpTx(context: TaskContext, settings: FormattedLpSettings): Promise<TxPayloadBatchSequence>;
|
|
61
|
+
editMetadataTx(context: TaskContext, settings: FormattedMetadataSettings): Promise<TxPayloadBatchSequence>;
|
|
62
|
+
editDepositsTx(context: TaskContext, settings: FormattedDepositsSettings): Promise<TxPayloadBatchSequence>;
|
|
63
|
+
editForceRebalanceTx(context: TaskContext, settings: FormattedForceRebalanceSettings): Promise<TxPayloadBatchSequence>;
|
|
64
|
+
editCustomRebalanceTx(context: TaskContext, settings: FormattedCustomRebalanceSettings): Promise<TxPayloadBatchSequence>;
|
|
65
|
+
editAddTokenDelayTx(context: TaskContext, settings: FormattedAddTokenSettings): Promise<TxPayloadBatchSequence>;
|
|
66
|
+
editUpdateWeightsDelayTx(context: TaskContext, settings: FormattedUpdateWeightsSettings): Promise<TxPayloadBatchSequence>;
|
|
67
|
+
editSwapDelayTx(context: TaskContext, settings: FormattedMakeDirectSwapSettings): Promise<TxPayloadBatchSequence>;
|
|
68
|
+
addTokenTx(context: TaskContext, settings: AddTokenInput): Promise<TxPayloadBatchSequence>;
|
|
69
|
+
updateWeightsTx(context: TaskContext, settings: UpdateWeightsInput): Promise<TxPayloadBatchSequence>;
|
|
70
|
+
makeDirectSwapTx(context: TaskContext, settings: MakeDirectSwapInput): Promise<TxPayloadBatchSequence>;
|
|
68
71
|
openBasketIntentTx(params: {
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
context: TaskContext;
|
|
73
|
+
type: TaskType;
|
|
74
|
+
settings: Settings;
|
|
71
75
|
}): Promise<TxPayloadBatchSequence>;
|
|
72
76
|
executeBasketIntentTx(params: {
|
|
73
77
|
intent: Intent;
|
|
@@ -124,4 +128,4 @@ export declare class SymmetryCore {
|
|
|
124
128
|
}): Promise<TransactionSignature[][]>;
|
|
125
129
|
}
|
|
126
130
|
export { Basket, BasketFilter, Intent, IntentFilter, RebalanceIntent, RebalanceIntentFilter };
|
|
127
|
-
export {
|
|
131
|
+
export { FormattedCreatorSettings, FormattedManagersSettings, FormattedFeeSettings, FormattedScheduleSettings, FormattedAutomationSettings, FormattedLpSettings, FormattedMetadataSettings, FormattedDepositsSettings, FormattedForceRebalanceSettings, FormattedCustomRebalanceSettings, FormattedAddTokenSettings, FormattedUpdateWeightsSettings, FormattedMakeDirectSwapSettings, AddTokenInput, UpdateWeightsInput, MakeDirectSwapInput, Settings, TaskContext, TaskType, };
|
package/dist/src/index.js
CHANGED
|
@@ -56,16 +56,49 @@ class SymmetryCore {
|
|
|
56
56
|
// async setPayer(payer: PublicKey) {
|
|
57
57
|
// this.sdkParams.payer = payer;
|
|
58
58
|
// }
|
|
59
|
-
|
|
59
|
+
fetchBasket(basketPubkey) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const basketState = yield (0, basket_2.fetchBasket)(this.sdkParams.connection,
|
|
61
|
+
const basketState = yield (0, basket_2.fetchBasket)(this.sdkParams.connection, new web3_js_1.PublicKey(basketPubkey));
|
|
62
62
|
return basketState;
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
fetchMultipleBaskets(basketPubkeys) {
|
|
66
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
let basketPubkeysArray = basketPubkeys.map(pubkey => new web3_js_1.PublicKey(pubkey));
|
|
68
|
+
const basketsMap = yield (0, basket_2.fetchBaskektsMultiple)(this.sdkParams.connection, basketPubkeysArray);
|
|
69
|
+
return basketsMap;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
fetchAllBaskets(basketFilter) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return yield (0, basket_2.fetchBaskets)(this.sdkParams.connection, basketFilter);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
fetchCreatedBaskets(creatorPubkey) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
return yield (0, basket_2.fetchBaskets)(this.sdkParams.connection, { type: "creator", pubkey: creatorPubkey });
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
fetchHostedBaskets(hostPubkey) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
return yield (0, basket_2.fetchBaskets)(this.sdkParams.connection, { type: "host", pubkey: hostPubkey });
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
fetchManagedBaskets(managerPubkey) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
return yield (0, basket_2.fetchBaskets)(this.sdkParams.connection, { type: "manager", pubkey: managerPubkey });
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
deriveBasketsByMints(mints) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
let result = new Map();
|
|
95
|
+
for (let basketId = 0; basketId < 50000; basketId++) {
|
|
96
|
+
let mint = (0, pda_1.getBasketTokenMintPda)(basketId).toBase58();
|
|
97
|
+
if (mints.includes(mint)) {
|
|
98
|
+
result.set(mint, (0, pda_1.getBasketState)(new web3_js_1.PublicKey(mint)).toBase58());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
69
102
|
});
|
|
70
103
|
}
|
|
71
104
|
fetchBasketsFromMints(mints) {
|
|
@@ -195,95 +228,95 @@ class SymmetryCore {
|
|
|
195
228
|
return txPayloadBatchSequence;
|
|
196
229
|
});
|
|
197
230
|
}
|
|
198
|
-
editCreatorTx(
|
|
231
|
+
editCreatorTx(context, settings) {
|
|
199
232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
return this.openBasketIntentTx({
|
|
233
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditCreator, context, settings });
|
|
201
234
|
});
|
|
202
235
|
}
|
|
203
|
-
editManagersTx(
|
|
236
|
+
editManagersTx(context, settings) {
|
|
204
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
-
return this.openBasketIntentTx({
|
|
238
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditManagerSettings, context, settings });
|
|
206
239
|
});
|
|
207
240
|
}
|
|
208
|
-
editScheduleTx(
|
|
241
|
+
editScheduleTx(context, settings) {
|
|
209
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
-
return this.openBasketIntentTx({
|
|
243
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditScheduleSettings, context, settings });
|
|
211
244
|
});
|
|
212
245
|
}
|
|
213
|
-
editFeesTx(
|
|
246
|
+
editFeesTx(context, settings) {
|
|
214
247
|
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
-
return this.openBasketIntentTx({
|
|
248
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditFeeSettings, context, settings });
|
|
216
249
|
});
|
|
217
250
|
}
|
|
218
|
-
editAutomationTx(
|
|
251
|
+
editAutomationTx(context, settings) {
|
|
219
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
-
return this.openBasketIntentTx({
|
|
253
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditAutomationSettings, context, settings });
|
|
221
254
|
});
|
|
222
255
|
}
|
|
223
|
-
editLpTx(
|
|
256
|
+
editLpTx(context, settings) {
|
|
224
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
return this.openBasketIntentTx({
|
|
258
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditLpSettings, context, settings });
|
|
226
259
|
});
|
|
227
260
|
}
|
|
228
|
-
editMetadataTx(
|
|
261
|
+
editMetadataTx(context, settings) {
|
|
229
262
|
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
-
return this.openBasketIntentTx({
|
|
263
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditMetadataSettings, context, settings });
|
|
231
264
|
});
|
|
232
265
|
}
|
|
233
|
-
editDepositsTx(
|
|
266
|
+
editDepositsTx(context, settings) {
|
|
234
267
|
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
-
return this.openBasketIntentTx({
|
|
268
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditDepositsSettings, context, settings });
|
|
236
269
|
});
|
|
237
270
|
}
|
|
238
|
-
editForceRebalanceTx(
|
|
271
|
+
editForceRebalanceTx(context, settings) {
|
|
239
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
return this.openBasketIntentTx({
|
|
273
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditForceRebalanceSettings, context, settings });
|
|
241
274
|
});
|
|
242
275
|
}
|
|
243
|
-
editCustomRebalanceTx(
|
|
276
|
+
editCustomRebalanceTx(context, settings) {
|
|
244
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
-
return this.openBasketIntentTx({
|
|
278
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditCustomRebalanceSettings, context, settings });
|
|
246
279
|
});
|
|
247
280
|
}
|
|
248
|
-
editAddTokenDelayTx(
|
|
281
|
+
editAddTokenDelayTx(context, settings) {
|
|
249
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
return this.openBasketIntentTx({
|
|
283
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditAddTokenDelay, context, settings });
|
|
251
284
|
});
|
|
252
285
|
}
|
|
253
|
-
editUpdateWeightsDelayTx(
|
|
286
|
+
editUpdateWeightsDelayTx(context, settings) {
|
|
254
287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
255
|
-
return this.openBasketIntentTx({
|
|
288
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditUpdateWeightsDelay, context, settings });
|
|
256
289
|
});
|
|
257
290
|
}
|
|
258
|
-
editSwapDelayTx(
|
|
291
|
+
editSwapDelayTx(context, settings) {
|
|
259
292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
-
return this.openBasketIntentTx({
|
|
293
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.EditMakeDirectSwapDelay, context, settings });
|
|
261
294
|
});
|
|
262
295
|
}
|
|
263
|
-
addTokenTx(
|
|
296
|
+
addTokenTx(context, settings) {
|
|
264
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
-
return this.openBasketIntentTx({
|
|
298
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.AddToken, context, settings });
|
|
266
299
|
});
|
|
267
300
|
}
|
|
268
|
-
updateWeightsTx(
|
|
301
|
+
updateWeightsTx(context, settings) {
|
|
269
302
|
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
-
return this.openBasketIntentTx({
|
|
303
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.UpdateWeights, context, settings });
|
|
271
304
|
});
|
|
272
305
|
}
|
|
273
|
-
makeDirectSwapTx(
|
|
306
|
+
makeDirectSwapTx(context, settings) {
|
|
274
307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
return this.openBasketIntentTx({
|
|
308
|
+
return this.openBasketIntentTx({ type: intent_1.TaskType.MakeDirectSwap, context, settings });
|
|
276
309
|
});
|
|
277
310
|
}
|
|
278
311
|
openBasketIntentTx(params) {
|
|
279
312
|
return __awaiter(this, void 0, void 0, function* () {
|
|
280
313
|
var _a;
|
|
281
|
-
let basket = yield this.
|
|
282
|
-
let manager = new web3_js_1.PublicKey(params.
|
|
283
|
-
let useBounty = params.
|
|
284
|
-
let activationTimestamp = new anchor_1.BN((_a = params.
|
|
285
|
-
let editType = params.
|
|
286
|
-
let editData = params.
|
|
314
|
+
let basket = yield this.fetchBasket(params.context.basket);
|
|
315
|
+
let manager = new web3_js_1.PublicKey(params.context.manager);
|
|
316
|
+
let useBounty = params.context.use_bounty == false ? false : true;
|
|
317
|
+
let activationTimestamp = new anchor_1.BN((_a = params.context.activation_timestamp) !== null && _a !== void 0 ? _a : 0);
|
|
318
|
+
let editType = params.type;
|
|
319
|
+
let editData = params.settings;
|
|
287
320
|
let modificationDelay = (() => {
|
|
288
321
|
switch (editType) {
|
|
289
322
|
case intent_1.TaskType.EditCreator: return new anchor_1.BN(0);
|
|
@@ -307,7 +340,7 @@ class SymmetryCore {
|
|
|
307
340
|
})();
|
|
308
341
|
let intentSeedArray = web3_js_1.Keypair.generate().publicKey.toBytes();
|
|
309
342
|
if (editType === intent_1.TaskType.AddToken) {
|
|
310
|
-
let tokenMint = new web3_js_1.PublicKey(editData.
|
|
343
|
+
let tokenMint = new web3_js_1.PublicKey(editData.token_mint);
|
|
311
344
|
intentSeedArray = tokenMint.toBytes();
|
|
312
345
|
}
|
|
313
346
|
let intent = (0, pda_1.getIntentPda)(basket.ownAddress, intentSeedArray, editType);
|
|
@@ -354,7 +387,7 @@ class SymmetryCore {
|
|
|
354
387
|
let { keeper, intent } = params;
|
|
355
388
|
let basketMint;
|
|
356
389
|
if (intent.taskType === intent_1.TaskType.EditMetadataSettings) {
|
|
357
|
-
let basket = yield this.
|
|
390
|
+
let basket = yield this.fetchBasket(intent.basket.toBase58());
|
|
358
391
|
basketMint = basket.mint;
|
|
359
392
|
}
|
|
360
393
|
let ix = (0, edit_1.executeEditBasketIntentIx)({
|
|
@@ -2,7 +2,7 @@ import { BN } from '@coral-xyz/anchor';
|
|
|
2
2
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
3
|
import { Basket } from '../../layouts/basket';
|
|
4
4
|
import { AuthorityBitmasks, AutomationSettings, FeeSettings, LpSettings, ManagerSettings, MetadataParams, ScheduleSettings } from '../../layouts/config';
|
|
5
|
-
import {
|
|
5
|
+
import { Settings, TaskType } from '../../layouts/intents/intent';
|
|
6
6
|
export declare function editPrivateBasketSettingsIx(params: {
|
|
7
7
|
creator: PublicKey;
|
|
8
8
|
basket: PublicKey;
|
|
@@ -27,7 +27,7 @@ export declare function createEditBasketIntentIx(params: {
|
|
|
27
27
|
useBounty: boolean;
|
|
28
28
|
activationTimestamp: BN;
|
|
29
29
|
editType: TaskType;
|
|
30
|
-
editData:
|
|
30
|
+
editData: Settings;
|
|
31
31
|
}): TransactionInstruction;
|
|
32
32
|
export declare function executeEditBasketIntentIx(params: {
|
|
33
33
|
keeper: PublicKey;
|
|
@@ -21,7 +21,6 @@ const EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR = Buffer.from([202, 54, 138, 17
|
|
|
21
21
|
const CREATE_EDIT_BASKET_INTENT_DISCRIMINATOR = Buffer.from([82, 150, 58, 227, 153, 129, 20, 30]);
|
|
22
22
|
const EDIT_BASKET_DISCRIMINATOR = Buffer.from([156, 31, 4, 39, 248, 29, 55, 220]);
|
|
23
23
|
const CANCEL_INTENT_DISCRIMINATOR = Buffer.from([181, 103, 27, 100, 84, 89, 70, 236]);
|
|
24
|
-
const ZERO_INTENT_SEED = new Uint8Array(32).fill(0);
|
|
25
24
|
function editPrivateBasketSettingsIx(params) {
|
|
26
25
|
let metadataAccount = (0, pda_1.getMetadataAccount)(params.mint);
|
|
27
26
|
let globalConfig = (0, pda_1.getGlobalConfigPda)();
|
|
@@ -80,14 +79,14 @@ function createEditBasketIntentIx(params) {
|
|
|
80
79
|
let additionalAccounts = [];
|
|
81
80
|
switch (editType) {
|
|
82
81
|
case intent_1.TaskType.EditCreator: // 1
|
|
83
|
-
let creatorSettings = editData
|
|
82
|
+
let creatorSettings = editData;
|
|
84
83
|
let editCreator = {
|
|
85
84
|
creator: new web3_js_1.PublicKey(creatorSettings.creator),
|
|
86
85
|
};
|
|
87
86
|
config_1.EditCreatorLayout.encode(editCreator, editDataBuf);
|
|
88
87
|
break;
|
|
89
88
|
case intent_1.TaskType.EditManagerSettings: // 2
|
|
90
|
-
let managerSettings = editData
|
|
89
|
+
let managerSettings = editData;
|
|
91
90
|
let managersWeights = managerSettings.managers.map((manager) => manager.fee_split_weight_bps);
|
|
92
91
|
let managers = managerSettings.managers.map((manager) => new web3_js_1.PublicKey(manager.pubkey));
|
|
93
92
|
while (managers.length < config_1.MAX_MANAGERS_PER_BASKET) {
|
|
@@ -147,7 +146,7 @@ function createEditBasketIntentIx(params) {
|
|
|
147
146
|
startIndex += 8;
|
|
148
147
|
break;
|
|
149
148
|
case intent_1.TaskType.EditFeeSettings: // 3
|
|
150
|
-
let feeSettings = editData
|
|
149
|
+
let feeSettings = editData;
|
|
151
150
|
let editFeeSettings = {
|
|
152
151
|
hostDepositFeeBps: 0,
|
|
153
152
|
hostWithdrawFeeBps: 0,
|
|
@@ -169,7 +168,7 @@ function createEditBasketIntentIx(params) {
|
|
|
169
168
|
config_1.FeeSettingsLayout.encode(editFeeSettings, editDataBuf);
|
|
170
169
|
break;
|
|
171
170
|
case intent_1.TaskType.EditScheduleSettings: // 4
|
|
172
|
-
let scheduleSettings = editData
|
|
171
|
+
let scheduleSettings = editData;
|
|
173
172
|
let editScheduleSettings = {
|
|
174
173
|
cycleStartTime: new anchor_1.BN(scheduleSettings.cycle_start_time),
|
|
175
174
|
cycleDuration: new anchor_1.BN(scheduleSettings.cycle_duration),
|
|
@@ -184,9 +183,9 @@ function createEditBasketIntentIx(params) {
|
|
|
184
183
|
config_1.ScheduleSettingsLayout.encode(editScheduleSettings, editDataBuf);
|
|
185
184
|
break;
|
|
186
185
|
case intent_1.TaskType.EditAutomationSettings: // 5
|
|
187
|
-
let automationSettings = editData
|
|
186
|
+
let automationSettings = editData;
|
|
188
187
|
let editAutomationSettings = {
|
|
189
|
-
allowAutomation: automationSettings.
|
|
188
|
+
allowAutomation: automationSettings.allow ? 1 : 0,
|
|
190
189
|
rebalanceSlippageThresholdBps: automationSettings.rebalance_slippage_threshold_bps,
|
|
191
190
|
perTradeRebalanceSlippageThresholdBps: automationSettings.per_trade_rebalance_slippage_threshold_bps,
|
|
192
191
|
rebalanceActivationThresholdAbsBps: automationSettings.rebalance_activation_threshold_abs_bps,
|
|
@@ -198,9 +197,9 @@ function createEditBasketIntentIx(params) {
|
|
|
198
197
|
config_1.AutomationSettingsLayout.encode(editAutomationSettings, editDataBuf);
|
|
199
198
|
break;
|
|
200
199
|
case intent_1.TaskType.EditLpSettings: // 6
|
|
201
|
-
let lpSettings = editData
|
|
200
|
+
let lpSettings = editData;
|
|
202
201
|
let editLpSettings = {
|
|
203
|
-
allowLp: lpSettings.
|
|
202
|
+
allowLp: lpSettings.allow ? 1 : 0,
|
|
204
203
|
lpThresholdBps: lpSettings.lp_threshold_bps,
|
|
205
204
|
extraData: new Array(32).fill(0),
|
|
206
205
|
modificationDelay: new anchor_1.BN(lpSettings.modification_delay),
|
|
@@ -208,7 +207,7 @@ function createEditBasketIntentIx(params) {
|
|
|
208
207
|
config_1.LpSettingsLayout.encode(editLpSettings, editDataBuf);
|
|
209
208
|
break;
|
|
210
209
|
case intent_1.TaskType.EditMetadataSettings: // 7
|
|
211
|
-
let metadataSettings = editData
|
|
210
|
+
let metadataSettings = editData;
|
|
212
211
|
let editMetadataSettings = {
|
|
213
212
|
symbolLength: metadataSettings.symbol.length,
|
|
214
213
|
symbol: metadataSettings.symbol.split('').map((char) => char.charCodeAt(0)),
|
|
@@ -221,47 +220,47 @@ function createEditBasketIntentIx(params) {
|
|
|
221
220
|
config_1.MetadataSettingsLayout.encode(editMetadataSettings, editDataBuf);
|
|
222
221
|
break;
|
|
223
222
|
case intent_1.TaskType.EditDepositsSettings: // 8
|
|
224
|
-
let depositsSettings = editData
|
|
225
|
-
let editDepositsSettings = depositsSettings.
|
|
223
|
+
let depositsSettings = editData;
|
|
224
|
+
let editDepositsSettings = depositsSettings.allow ? 1 : 0;
|
|
226
225
|
editDataBuf[0] = editDepositsSettings;
|
|
227
226
|
break;
|
|
228
227
|
case intent_1.TaskType.EditForceRebalanceSettings: // 9
|
|
229
|
-
let forceRebalanceSettings = editData
|
|
230
|
-
let editForceRebalanceSettings = forceRebalanceSettings.
|
|
228
|
+
let forceRebalanceSettings = editData;
|
|
229
|
+
let editForceRebalanceSettings = forceRebalanceSettings.allow ? 1 : 0;
|
|
231
230
|
let editForceRebalanceModificationDelayBN = new anchor_1.BN(forceRebalanceSettings.modification_delay);
|
|
232
231
|
editDataBuf[0] = editForceRebalanceSettings;
|
|
233
232
|
editDataBuf.writeBigUint64LE(BigInt(editForceRebalanceModificationDelayBN.toString()), 1);
|
|
234
233
|
break;
|
|
235
234
|
case intent_1.TaskType.EditCustomRebalanceSettings: // 10
|
|
236
|
-
let customRebalanceSettings = editData
|
|
237
|
-
let editCustomRebalanceSettings = customRebalanceSettings.
|
|
235
|
+
let customRebalanceSettings = editData;
|
|
236
|
+
let editCustomRebalanceSettings = customRebalanceSettings.allow ? 1 : 0;
|
|
238
237
|
let editCustomRebalanceModificationDelayBN = new anchor_1.BN(customRebalanceSettings.modification_delay);
|
|
239
238
|
editDataBuf[0] = editCustomRebalanceSettings;
|
|
240
239
|
editDataBuf.writeBigUint64LE(BigInt(editCustomRebalanceModificationDelayBN.toString()), 1);
|
|
241
240
|
break;
|
|
242
241
|
case intent_1.TaskType.EditAddTokenDelay: // 11 - 101
|
|
243
|
-
let addTokenDelay = editData
|
|
242
|
+
let addTokenDelay = editData;
|
|
244
243
|
let editAddTokenDelay = {
|
|
245
244
|
modificationDelay: new anchor_1.BN(addTokenDelay.modification_delay),
|
|
246
245
|
};
|
|
247
246
|
config_1.EditAddTokenDelayLayout.encode(editAddTokenDelay, editDataBuf);
|
|
248
247
|
break;
|
|
249
248
|
case intent_1.TaskType.EditUpdateWeightsDelay: // 12 - 102
|
|
250
|
-
let updateWeightsDelay = editData
|
|
249
|
+
let updateWeightsDelay = editData;
|
|
251
250
|
let editUpdateWeightsDelay = {
|
|
252
251
|
modificationDelay: new anchor_1.BN(updateWeightsDelay.modification_delay),
|
|
253
252
|
};
|
|
254
253
|
config_1.EditUpdateWeightsDelayLayout.encode(editUpdateWeightsDelay, editDataBuf);
|
|
255
254
|
break;
|
|
256
255
|
case intent_1.TaskType.EditMakeDirectSwapDelay: // 13 - 103
|
|
257
|
-
let makeDirectSwapDelay = editData
|
|
256
|
+
let makeDirectSwapDelay = editData;
|
|
258
257
|
let editMakeDirectSwapDelay = {
|
|
259
258
|
modificationDelay: new anchor_1.BN(makeDirectSwapDelay.modification_delay),
|
|
260
259
|
};
|
|
261
260
|
config_1.EditMakeDirectSwapDelayLayout.encode(editMakeDirectSwapDelay, editDataBuf);
|
|
262
261
|
break;
|
|
263
262
|
case intent_1.TaskType.AddToken: // 14 - 201
|
|
264
|
-
let addTokenData = editData
|
|
263
|
+
let addTokenData = editData;
|
|
265
264
|
let oracleDatas = [];
|
|
266
265
|
while (oracleDatas.length < constants_1.MAX_ORACLES_PER_TOKEN) {
|
|
267
266
|
oracleDatas.push({
|