@symmetry-hq/sdk 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/constants.d.ts +23 -0
- package/dist/src/constants.js +38 -0
- package/dist/src/index.d.ts +804 -0
- package/dist/src/index.js +2097 -0
- package/dist/src/instructions/automation/auction.d.ts +6 -0
- package/dist/src/instructions/automation/auction.js +40 -0
- package/dist/src/instructions/automation/claimBounty.d.ts +12 -0
- package/dist/src/instructions/automation/claimBounty.js +44 -0
- package/dist/src/instructions/automation/flashSwap.d.ts +21 -0
- package/dist/src/instructions/automation/flashSwap.js +74 -0
- package/dist/src/instructions/automation/priceUpdate.d.ts +19 -0
- package/dist/src/instructions/automation/priceUpdate.js +89 -0
- package/dist/src/instructions/automation/rebalanceIntent.d.ts +32 -0
- package/dist/src/instructions/automation/rebalanceIntent.js +117 -0
- package/dist/src/instructions/automation/rebalanceSwap.d.ts +11 -0
- package/dist/src/instructions/automation/rebalanceSwap.js +42 -0
- package/dist/src/instructions/management/addBounty.d.ts +7 -0
- package/dist/src/instructions/management/addBounty.js +41 -0
- package/dist/src/instructions/management/admin.d.ts +9 -0
- package/dist/src/instructions/management/admin.js +53 -0
- package/dist/src/instructions/management/claimFees.d.ts +15 -0
- package/dist/src/instructions/management/claimFees.js +95 -0
- package/dist/src/instructions/management/createBasket.d.ts +21 -0
- package/dist/src/instructions/management/createBasket.js +98 -0
- package/dist/src/instructions/management/edit.d.ts +51 -0
- package/dist/src/instructions/management/edit.js +477 -0
- package/dist/src/instructions/management/luts.d.ts +30 -0
- package/dist/src/instructions/management/luts.js +99 -0
- package/dist/src/instructions/pda.d.ts +25 -0
- package/dist/src/instructions/pda.js +128 -0
- package/dist/src/instructions/user/deposit.d.ts +20 -0
- package/dist/src/instructions/user/deposit.js +100 -0
- package/dist/src/instructions/user/withdraw.d.ts +8 -0
- package/dist/src/instructions/user/withdraw.js +36 -0
- package/dist/src/jup.d.ts +49 -0
- package/dist/src/jup.js +80 -0
- package/dist/src/keeperMonitor.d.ts +52 -0
- package/dist/src/keeperMonitor.js +624 -0
- package/dist/src/layouts/basket.d.ts +191 -0
- package/dist/src/layouts/basket.js +51 -0
- package/dist/src/layouts/config.d.ts +281 -0
- package/dist/src/layouts/config.js +237 -0
- package/dist/src/layouts/fraction.d.ts +20 -0
- package/dist/src/layouts/fraction.js +164 -0
- package/dist/src/layouts/intents/bounty.d.ts +18 -0
- package/dist/src/layouts/intents/bounty.js +19 -0
- package/dist/src/layouts/intents/intent.d.ts +209 -0
- package/dist/src/layouts/intents/intent.js +97 -0
- package/dist/src/layouts/intents/rebalanceIntent.d.ts +212 -0
- package/dist/src/layouts/intents/rebalanceIntent.js +94 -0
- package/dist/src/layouts/lookupTable.d.ts +7 -0
- package/dist/src/layouts/lookupTable.js +10 -0
- package/dist/src/layouts/oracle.d.ts +63 -0
- package/dist/src/layouts/oracle.js +96 -0
- package/dist/src/states/basket.d.ts +14 -0
- package/dist/src/states/basket.js +479 -0
- package/dist/src/states/config.d.ts +3 -0
- package/dist/src/states/config.js +71 -0
- package/dist/src/states/intents/intent.d.ts +10 -0
- package/dist/src/states/intents/intent.js +316 -0
- package/dist/src/states/intents/rebalanceIntent.d.ts +42 -0
- package/dist/src/states/intents/rebalanceIntent.js +680 -0
- package/dist/src/states/oracles/constants.d.ts +9 -0
- package/dist/src/states/oracles/constants.js +15 -0
- package/dist/src/states/oracles/oracle.d.ts +24 -0
- package/dist/src/states/oracles/oracle.js +168 -0
- package/dist/src/states/oracles/pythOracle.d.ts +132 -0
- package/dist/src/states/oracles/pythOracle.js +609 -0
- package/dist/src/states/oracles/raydiumClmmOracle.d.ts +184 -0
- package/dist/src/states/oracles/raydiumClmmOracle.js +843 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.d.ts +120 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.js +540 -0
- package/dist/src/states/oracles/switchboardOracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboardOracle.js +1 -0
- package/dist/src/states/withdrawBasketFees.d.ts +10 -0
- package/dist/src/states/withdrawBasketFees.js +154 -0
- package/dist/src/txUtils.d.ts +65 -0
- package/dist/src/txUtils.js +306 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +561 -0
- package/package.json +31 -0
- package/src/constants.ts +40 -0
- package/src/index.ts +2431 -0
- package/src/instructions/automation/auction.ts +55 -0
- package/src/instructions/automation/claimBounty.ts +69 -0
- package/src/instructions/automation/flashSwap.ts +104 -0
- package/src/instructions/automation/priceUpdate.ts +117 -0
- package/src/instructions/automation/rebalanceIntent.ts +181 -0
- package/src/instructions/management/addBounty.ts +55 -0
- package/src/instructions/management/admin.ts +72 -0
- package/src/instructions/management/claimFees.ts +129 -0
- package/src/instructions/management/createBasket.ts +138 -0
- package/src/instructions/management/edit.ts +602 -0
- package/src/instructions/management/luts.ts +157 -0
- package/src/instructions/pda.ts +151 -0
- package/src/instructions/user/deposit.ts +143 -0
- package/src/instructions/user/withdraw.ts +53 -0
- package/src/jup.ts +113 -0
- package/src/keeperMonitor.ts +585 -0
- package/src/layouts/basket.ts +233 -0
- package/src/layouts/config.ts +576 -0
- package/src/layouts/fraction.ts +164 -0
- package/src/layouts/intents/bounty.ts +35 -0
- package/src/layouts/intents/intent.ts +324 -0
- package/src/layouts/intents/rebalanceIntent.ts +306 -0
- package/src/layouts/lookupTable.ts +14 -0
- package/src/layouts/oracle.ts +157 -0
- package/src/states/basket.ts +527 -0
- package/src/states/config.ts +62 -0
- package/src/states/intents/intent.ts +311 -0
- package/src/states/intents/rebalanceIntent.ts +751 -0
- package/src/states/oracles/constants.ts +13 -0
- package/src/states/oracles/oracle.ts +212 -0
- package/src/states/oracles/pythOracle.ts +874 -0
- package/src/states/oracles/raydiumClmmOracle.ts +1193 -0
- package/src/states/oracles/raydiumCpmmOracle.ts +784 -0
- package/src/states/oracles/switchboardOracle.ts +0 -0
- package/src/states/withdrawBasketFees.ts +160 -0
- package/src/txUtils.ts +424 -0
- package/test.ts +609 -0
- package/tsconfig.json +101 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import BN from 'bn.js';
|
|
2
|
+
import {
|
|
3
|
+
ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID,
|
|
4
|
+
TOKEN_PROGRAM_ID
|
|
5
|
+
} from '@solana/spl-token';
|
|
6
|
+
import { AccountMeta, PublicKey, SystemProgram, TransactionInstruction } from '@solana/web3.js';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ADDRESS_LOOKUP_TABLE_PROGRAM_ID,
|
|
10
|
+
BASKETS_V3_PROGRAM_ID, MAX_ORACLES_PER_TOKEN, MAX_SUPPORTED_TOKENS_PER_BASKET,
|
|
11
|
+
METADATA_PROGRAM_ID
|
|
12
|
+
} from '../../constants';
|
|
13
|
+
import { Basket } from '../../layouts/basket';
|
|
14
|
+
import {
|
|
15
|
+
AuthorityBitmasks,
|
|
16
|
+
AuthorityBitmasksLayout,
|
|
17
|
+
AutomationSettings, AutomationSettingsLayout, EditAddTokenDelay, EditAddTokenDelayLayout, EditCreator, EditCreatorLayout, EditMakeDirectSwapDelay, EditMakeDirectSwapDelayLayout, EditUpdateWeightsDelay, EditUpdateWeightsDelayLayout, FeeSettings, FeeSettingsLayout, LpSettings,
|
|
18
|
+
LpSettingsLayout, MakeDirectSwap, MakeDirectSwapLayout, ManagerSettings, ManagerSettingsLayout, MAX_MANAGERS_PER_BASKET,
|
|
19
|
+
MetadataParams,
|
|
20
|
+
MetadataSettings, MetadataSettingsLayout, ScheduleSettings, ScheduleSettingsLayout,
|
|
21
|
+
UpdateWeights,
|
|
22
|
+
UpdateWeightsLayout
|
|
23
|
+
} from '../../layouts/config';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
DEFAULT_ORACLE_SETTINGS, MAX_ACCOUNTS_PER_ORACLE, ORACLE_TYPES_STRINGS, OracleAggregator, OracleAggregatorLayout,
|
|
27
|
+
OracleData,
|
|
28
|
+
Quote,
|
|
29
|
+
Side
|
|
30
|
+
} from '../../layouts/oracle';
|
|
31
|
+
import {
|
|
32
|
+
getAta, getBountyVaultPda, getGlobalConfigPda, getIntentPda, getMetadataAccount, serializeString
|
|
33
|
+
} from '../pda';
|
|
34
|
+
import { AddOrEditTokenInput, EditAddTokenSettings, EditAutomationSettings, EditCreatorSettings, EditCustomRebalanceSettings, EditDepositsSettings, EditFeeSettings, EditForceRebalanceSettings, EditLpSettings, EditMakeDirectSwapSettings, EditManagerSettings, EditMetadataSettings, EditScheduleSettings, EditUpdateWeightsSettings, MakeDirectSwapInput, Settings, TaskType, UpdateWeightsInput } from '../../layouts/intents/intent';
|
|
35
|
+
import Decimal from 'decimal.js';
|
|
36
|
+
import { decimalToFraction } from '../../layouts/fraction';
|
|
37
|
+
import { computeTokenMintsHash } from '../../states/basket';
|
|
38
|
+
|
|
39
|
+
const EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR = Buffer.from([202,54,138,17,3,104,128,229]);
|
|
40
|
+
const CREATE_EDIT_BASKET_INTENT_DISCRIMINATOR = Buffer.from([82, 150, 58, 227, 153, 129, 20, 30]);
|
|
41
|
+
const EDIT_BASKET_DISCRIMINATOR = Buffer.from([156, 31, 4, 39, 248, 29, 55, 220]);
|
|
42
|
+
const CANCEL_INTENT_DISCRIMINATOR = Buffer.from([181, 103, 27, 100, 84, 89, 70, 236]);
|
|
43
|
+
|
|
44
|
+
export function editPrivateBasketSettingsIx(
|
|
45
|
+
params: {
|
|
46
|
+
creator: PublicKey,
|
|
47
|
+
basket: PublicKey,
|
|
48
|
+
mint: PublicKey,
|
|
49
|
+
basketType: number,
|
|
50
|
+
scheduleBytes: ScheduleSettings,
|
|
51
|
+
feeSettingsBytes: FeeSettings,
|
|
52
|
+
managerSettingsBytes: ManagerSettings,
|
|
53
|
+
automationSettingsBytes: AutomationSettings,
|
|
54
|
+
lpSettingsBytes: LpSettings,
|
|
55
|
+
authorityBitmasks: AuthorityBitmasks,
|
|
56
|
+
metadataParams: MetadataParams,
|
|
57
|
+
depositsAreAllowed: number,
|
|
58
|
+
forceRebalanceIsAllowed: number,
|
|
59
|
+
customRebalanceIsAllowed: number,
|
|
60
|
+
}): TransactionInstruction {
|
|
61
|
+
|
|
62
|
+
let metadataAccount = getMetadataAccount(params.mint);
|
|
63
|
+
let globalConfig = getGlobalConfigPda();
|
|
64
|
+
let managerSettingsBuffer = Buffer.alloc(ManagerSettingsLayout.span);
|
|
65
|
+
ManagerSettingsLayout.encode(params.managerSettingsBytes, managerSettingsBuffer);
|
|
66
|
+
let authorityBitmasksBuffer = Buffer.alloc(AuthorityBitmasksLayout.span);
|
|
67
|
+
AuthorityBitmasksLayout.encode(params.authorityBitmasks, authorityBitmasksBuffer);
|
|
68
|
+
let feeSettingsBuffer = Buffer.alloc(FeeSettingsLayout.span);
|
|
69
|
+
FeeSettingsLayout.encode(params.feeSettingsBytes, feeSettingsBuffer);
|
|
70
|
+
let scheduleSettingsBuffer = Buffer.alloc(ScheduleSettingsLayout.span);
|
|
71
|
+
ScheduleSettingsLayout.encode(params.scheduleBytes, scheduleSettingsBuffer);
|
|
72
|
+
let automationSettingsBuffer = Buffer.alloc(AutomationSettingsLayout.span);
|
|
73
|
+
AutomationSettingsLayout.encode(params.automationSettingsBytes, automationSettingsBuffer);
|
|
74
|
+
let lpSettingsBuffer = Buffer.alloc(LpSettingsLayout.span);
|
|
75
|
+
LpSettingsLayout.encode(params.lpSettingsBytes, lpSettingsBuffer);
|
|
76
|
+
const data = Buffer.concat([
|
|
77
|
+
EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR,
|
|
78
|
+
Buffer.from([params.basketType]),
|
|
79
|
+
managerSettingsBuffer,
|
|
80
|
+
authorityBitmasksBuffer,
|
|
81
|
+
feeSettingsBuffer,
|
|
82
|
+
scheduleSettingsBuffer,
|
|
83
|
+
automationSettingsBuffer,
|
|
84
|
+
lpSettingsBuffer,
|
|
85
|
+
serializeString(params.metadataParams.name),
|
|
86
|
+
serializeString(params.metadataParams.symbol),
|
|
87
|
+
serializeString(params.metadataParams.uri),
|
|
88
|
+
Buffer.from([params.depositsAreAllowed]),
|
|
89
|
+
Buffer.from([params.forceRebalanceIsAllowed]),
|
|
90
|
+
Buffer.from([params.customRebalanceIsAllowed]),
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
const keys = [
|
|
94
|
+
{ pubkey: params.creator, isSigner: true, isWritable: true },
|
|
95
|
+
{ pubkey: params.basket, isSigner: false, isWritable: true },
|
|
96
|
+
{ pubkey: metadataAccount, isSigner: false, isWritable: true },
|
|
97
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
98
|
+
{ pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
return new TransactionInstruction({
|
|
102
|
+
keys,
|
|
103
|
+
programId: BASKETS_V3_PROGRAM_ID,
|
|
104
|
+
data
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
export function createEditBasketIntentIx(params: {
|
|
110
|
+
manager: PublicKey;
|
|
111
|
+
basket: Basket;
|
|
112
|
+
intent: PublicKey;
|
|
113
|
+
intentSeedArray: Uint8Array;
|
|
114
|
+
editType: TaskType;
|
|
115
|
+
editData: Settings;
|
|
116
|
+
activationTimestamp: BN;
|
|
117
|
+
expirationTimestamp: BN;
|
|
118
|
+
minBounty: BN;
|
|
119
|
+
maxBounty: BN;
|
|
120
|
+
tokenProgram? : PublicKey;
|
|
121
|
+
}): TransactionInstruction {
|
|
122
|
+
const {
|
|
123
|
+
manager,
|
|
124
|
+
basket,
|
|
125
|
+
intent,
|
|
126
|
+
intentSeedArray,
|
|
127
|
+
editType,
|
|
128
|
+
editData,
|
|
129
|
+
activationTimestamp,
|
|
130
|
+
expirationTimestamp,
|
|
131
|
+
minBounty,
|
|
132
|
+
maxBounty,
|
|
133
|
+
tokenProgram,
|
|
134
|
+
} = params;
|
|
135
|
+
|
|
136
|
+
let globalConfig = getGlobalConfigPda();
|
|
137
|
+
let bountyVault = getBountyVaultPda();
|
|
138
|
+
|
|
139
|
+
let bountyMint = basket.settings.bountyMint;
|
|
140
|
+
let managerBountyATA = getAta(manager, bountyMint);
|
|
141
|
+
let bountyVaultATA = getAta(bountyVault, bountyMint);
|
|
142
|
+
|
|
143
|
+
const intentSeedArrayBuf = Buffer.from(intentSeedArray);
|
|
144
|
+
const editTypeBuf = Buffer.from([editType]);
|
|
145
|
+
|
|
146
|
+
let editDataBuf = Buffer.alloc(260);
|
|
147
|
+
let additionalAccounts: AccountMeta[] = [];
|
|
148
|
+
|
|
149
|
+
switch (editType) {
|
|
150
|
+
case TaskType.EditCreator: // 1
|
|
151
|
+
let creatorSettings = (editData as EditCreatorSettings);
|
|
152
|
+
let editCreator: EditCreator = {
|
|
153
|
+
creator: new PublicKey(creatorSettings.creator),
|
|
154
|
+
}
|
|
155
|
+
EditCreatorLayout.encode(editCreator, editDataBuf);
|
|
156
|
+
break;
|
|
157
|
+
|
|
158
|
+
case TaskType.EditManagerSettings: // 2
|
|
159
|
+
let managerSettings = (editData as EditManagerSettings);
|
|
160
|
+
let managersWeights = managerSettings.managers.map((manager) => manager.fee_split_weight_bps);
|
|
161
|
+
let managers = managerSettings.managers.map((manager) => new PublicKey(manager.pubkey));
|
|
162
|
+
while (managers.length < MAX_MANAGERS_PER_BASKET) {
|
|
163
|
+
managers.push(PublicKey.default);
|
|
164
|
+
managersWeights.push(0);
|
|
165
|
+
}
|
|
166
|
+
let startIndex = 0;
|
|
167
|
+
for (let i = 0; i < MAX_MANAGERS_PER_BASKET; i++) {
|
|
168
|
+
editDataBuf.writeUInt16LE(managersWeights[i], startIndex);
|
|
169
|
+
if (!managers[i].equals(PublicKey.default)) {
|
|
170
|
+
additionalAccounts.push({
|
|
171
|
+
pubkey: managers[i],
|
|
172
|
+
isWritable: true,
|
|
173
|
+
isSigner: false
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
startIndex += 2;
|
|
177
|
+
}
|
|
178
|
+
let authorityBitmasks: AuthorityBitmasks = {
|
|
179
|
+
scheduleAuthorityBitmask: 0,
|
|
180
|
+
feesAuthorityBitmask: 0,
|
|
181
|
+
managersAuthorityBitmask: 0,
|
|
182
|
+
automationAuthorityBitmask: 0,
|
|
183
|
+
lpAuthorityBitmask: 0,
|
|
184
|
+
metadataAuthorityBitmask: 0,
|
|
185
|
+
depositsAuthorityBitmask: 0,
|
|
186
|
+
forceRebalanceAuthorityBitmask: 0,
|
|
187
|
+
customRebalanceAuthorityBitmask: 0,
|
|
188
|
+
addTokenIntentAuthorityBitmask: 0,
|
|
189
|
+
updateWeightsIntentAuthorityBitmask: 0,
|
|
190
|
+
makeDirectSwapIntentAuthorityBitmask: 0,
|
|
191
|
+
extraData: 0,
|
|
192
|
+
extraData1: 0,
|
|
193
|
+
extraData2: 0,
|
|
194
|
+
}
|
|
195
|
+
for (let i = 0; i < managerSettings.managers.length; i++) {
|
|
196
|
+
let bitPow = (2 ** i);
|
|
197
|
+
authorityBitmasks.managersAuthorityBitmask |= managerSettings.managers[i].authorities.managers ? bitPow : 0;
|
|
198
|
+
authorityBitmasks.feesAuthorityBitmask |= managerSettings.managers[i].authorities.fees ? bitPow : 0;
|
|
199
|
+
authorityBitmasks.scheduleAuthorityBitmask |= managerSettings.managers[i].authorities.schedule ? bitPow : 0;
|
|
200
|
+
authorityBitmasks.automationAuthorityBitmask |= managerSettings.managers[i].authorities.automation ? bitPow : 0;
|
|
201
|
+
authorityBitmasks.lpAuthorityBitmask |= managerSettings.managers[i].authorities.lp ? bitPow : 0;
|
|
202
|
+
authorityBitmasks.metadataAuthorityBitmask |= managerSettings.managers[i].authorities.metadata ? bitPow : 0;
|
|
203
|
+
authorityBitmasks.depositsAuthorityBitmask |= managerSettings.managers[i].authorities.deposits ? bitPow : 0;
|
|
204
|
+
authorityBitmasks.forceRebalanceAuthorityBitmask |= managerSettings.managers[i].authorities.force_rebalance ? bitPow : 0;
|
|
205
|
+
authorityBitmasks.customRebalanceAuthorityBitmask |= managerSettings.managers[i].authorities.custom_rebalance ? bitPow : 0;
|
|
206
|
+
authorityBitmasks.addTokenIntentAuthorityBitmask |= managerSettings.managers[i].authorities.add_token ? bitPow : 0;
|
|
207
|
+
authorityBitmasks.updateWeightsIntentAuthorityBitmask |= managerSettings.managers[i].authorities.update_weights ? bitPow : 0;
|
|
208
|
+
authorityBitmasks.makeDirectSwapIntentAuthorityBitmask |= managerSettings.managers[i].authorities.make_direct_swap ? bitPow : 0;
|
|
209
|
+
}
|
|
210
|
+
let authorityBitmasksBuffer = Buffer.alloc(AuthorityBitmasksLayout.span);
|
|
211
|
+
AuthorityBitmasksLayout.encode(authorityBitmasks, authorityBitmasksBuffer);
|
|
212
|
+
editDataBuf.set(authorityBitmasksBuffer, startIndex);
|
|
213
|
+
startIndex += AuthorityBitmasksLayout.span;
|
|
214
|
+
let modificationDelayBN = new BN(managerSettings.modification_delay);
|
|
215
|
+
editDataBuf.writeBigUint64LE(BigInt(modificationDelayBN.toString()), startIndex);
|
|
216
|
+
startIndex += 8;
|
|
217
|
+
break;
|
|
218
|
+
|
|
219
|
+
case TaskType.EditFeeSettings: // 3
|
|
220
|
+
let feeSettings = (editData as EditFeeSettings);
|
|
221
|
+
let editFeeSettings: FeeSettings = {
|
|
222
|
+
hostDepositFeeBps: 0,
|
|
223
|
+
hostWithdrawFeeBps: 0,
|
|
224
|
+
hostManagementFeeBps: 0,
|
|
225
|
+
hostPerformanceFeeBps:0,
|
|
226
|
+
creatorDepositFeeBps: feeSettings.creator_deposit_fee_bps,
|
|
227
|
+
creatorWithdrawFeeBps: feeSettings.creator_withdraw_fee_bps,
|
|
228
|
+
creatorManagementFeeBps: feeSettings.creator_management_fee_bps,
|
|
229
|
+
creatorPerformanceFeeBps: feeSettings.creator_performance_fee_bps,
|
|
230
|
+
managersDepositFeeBps: feeSettings.managers_deposit_fee_bps,
|
|
231
|
+
managersWithdrawFeeBps: feeSettings.managers_withdraw_fee_bps,
|
|
232
|
+
managersManagementFeeBps: feeSettings.managers_management_fee_bps,
|
|
233
|
+
managersPerformanceFeeBps: feeSettings.managers_performance_fee_bps,
|
|
234
|
+
basketDepositFeeBps: feeSettings.basket_deposit_fee_bps,
|
|
235
|
+
basketWithdrawFeeBps: feeSettings.basket_withdraw_fee_bps,
|
|
236
|
+
extraData: new Array(32).fill(0),
|
|
237
|
+
modificationDelay: new BN(feeSettings.modification_delay),
|
|
238
|
+
}
|
|
239
|
+
FeeSettingsLayout.encode(editFeeSettings, editDataBuf);
|
|
240
|
+
break;
|
|
241
|
+
|
|
242
|
+
case TaskType.EditScheduleSettings: // 4
|
|
243
|
+
let scheduleSettings = (editData as EditScheduleSettings);
|
|
244
|
+
let editScheduleSettings: ScheduleSettings = {
|
|
245
|
+
cycleStartTime: new BN(scheduleSettings.cycle_start_time),
|
|
246
|
+
cycleDuration: new BN(scheduleSettings.cycle_duration),
|
|
247
|
+
depositsStart: new BN(scheduleSettings.deposits_start),
|
|
248
|
+
depositsEnd: new BN(scheduleSettings.deposits_end),
|
|
249
|
+
automationStart: new BN(scheduleSettings.automation_start),
|
|
250
|
+
automationEnd: new BN(scheduleSettings.automation_end),
|
|
251
|
+
managementStart: new BN(scheduleSettings.management_start),
|
|
252
|
+
managementEnd: new BN(scheduleSettings.management_end),
|
|
253
|
+
modificationDelay: new BN(scheduleSettings.modification_delay),
|
|
254
|
+
}
|
|
255
|
+
ScheduleSettingsLayout.encode(editScheduleSettings, editDataBuf);
|
|
256
|
+
break;
|
|
257
|
+
|
|
258
|
+
case TaskType.EditAutomationSettings: // 5
|
|
259
|
+
let automationSettings = (editData as EditAutomationSettings);
|
|
260
|
+
let editAutomationSettings: AutomationSettings = {
|
|
261
|
+
allowAutomation: automationSettings.enabled ? 1 : 0,
|
|
262
|
+
rebalanceSlippageThresholdBps: automationSettings.rebalance_slippage_threshold_bps,
|
|
263
|
+
perTradeRebalanceSlippageThresholdBps: automationSettings.per_trade_rebalance_slippage_threshold_bps,
|
|
264
|
+
rebalanceActivationThresholdAbsBps: automationSettings.rebalance_activation_threshold_abs_bps,
|
|
265
|
+
rebalanceActivationThresholdRelBps: automationSettings.rebalance_activation_threshold_rel_bps,
|
|
266
|
+
rebalanceActivationCooldown: new BN(automationSettings.rebalance_activation_cooldown),
|
|
267
|
+
extraData: new Array(4).fill(PublicKey.default),
|
|
268
|
+
modificationDelay: new BN(automationSettings.modification_delay),
|
|
269
|
+
}
|
|
270
|
+
AutomationSettingsLayout.encode(editAutomationSettings, editDataBuf);
|
|
271
|
+
break;
|
|
272
|
+
|
|
273
|
+
case TaskType.EditLpSettings: // 6
|
|
274
|
+
let lpSettings = (editData as EditLpSettings);
|
|
275
|
+
let editLpSettings: LpSettings = {
|
|
276
|
+
allowLp: lpSettings.enabled ? 1 : 0,
|
|
277
|
+
lpThresholdBps: lpSettings.lp_threshold_bps,
|
|
278
|
+
extraData: new Array(32).fill(0),
|
|
279
|
+
modificationDelay: new BN(lpSettings.modification_delay),
|
|
280
|
+
}
|
|
281
|
+
LpSettingsLayout.encode(editLpSettings, editDataBuf);
|
|
282
|
+
break;
|
|
283
|
+
|
|
284
|
+
case TaskType.EditMetadataSettings: // 7
|
|
285
|
+
let metadataSettings = (editData as EditMetadataSettings);
|
|
286
|
+
let editMetadataSettings: MetadataSettings = {
|
|
287
|
+
symbolLength: metadataSettings.symbol.length,
|
|
288
|
+
symbol: metadataSettings.symbol.split('').map((char) => char.charCodeAt(0)),
|
|
289
|
+
nameLength: metadataSettings.name.length,
|
|
290
|
+
name: metadataSettings.name.split('').map((char) => char.charCodeAt(0)),
|
|
291
|
+
uriLength: metadataSettings.uri.length,
|
|
292
|
+
uri: metadataSettings.uri.split('').map((char) => char.charCodeAt(0)),
|
|
293
|
+
modificationDelay: new BN(metadataSettings.modification_delay),
|
|
294
|
+
}
|
|
295
|
+
MetadataSettingsLayout.encode(editMetadataSettings, editDataBuf);
|
|
296
|
+
break;
|
|
297
|
+
|
|
298
|
+
case TaskType.EditDepositsSettings: // 8
|
|
299
|
+
let depositsSettings = (editData as EditDepositsSettings);
|
|
300
|
+
let editDepositsSettings = depositsSettings.enabled ? 1 : 0
|
|
301
|
+
editDataBuf[0] = editDepositsSettings;
|
|
302
|
+
break;
|
|
303
|
+
|
|
304
|
+
case TaskType.EditForceRebalanceSettings: // 9
|
|
305
|
+
let forceRebalanceSettings = (editData as EditForceRebalanceSettings);
|
|
306
|
+
let editForceRebalanceSettings = forceRebalanceSettings.enabled ? 1 : 0
|
|
307
|
+
let editForceRebalanceModificationDelayBN = new BN(forceRebalanceSettings.modification_delay);
|
|
308
|
+
editDataBuf[0] = editForceRebalanceSettings;
|
|
309
|
+
editDataBuf.writeBigUint64LE(BigInt(editForceRebalanceModificationDelayBN.toString()), 1);
|
|
310
|
+
break;
|
|
311
|
+
|
|
312
|
+
case TaskType.EditCustomRebalanceSettings: // 10
|
|
313
|
+
let customRebalanceSettings = (editData as EditCustomRebalanceSettings);
|
|
314
|
+
let editCustomRebalanceSettings = customRebalanceSettings.enabled ? 1 : 0
|
|
315
|
+
let editCustomRebalanceModificationDelayBN = new BN(customRebalanceSettings.modification_delay);
|
|
316
|
+
editDataBuf[0] = editCustomRebalanceSettings;
|
|
317
|
+
editDataBuf.writeBigUint64LE(BigInt(editCustomRebalanceModificationDelayBN.toString()), 1);
|
|
318
|
+
break;
|
|
319
|
+
|
|
320
|
+
case TaskType.EditAddTokenDelay: // 11 - 101
|
|
321
|
+
let addTokenDelay = (editData as EditAddTokenSettings);
|
|
322
|
+
let editAddTokenDelay: EditAddTokenDelay = {
|
|
323
|
+
modificationDelay: new BN(addTokenDelay.modification_delay),
|
|
324
|
+
}
|
|
325
|
+
EditAddTokenDelayLayout.encode(editAddTokenDelay, editDataBuf);
|
|
326
|
+
break;
|
|
327
|
+
|
|
328
|
+
case TaskType.EditUpdateWeightsDelay: // 12 - 102
|
|
329
|
+
let updateWeightsDelay = (editData as EditUpdateWeightsSettings);
|
|
330
|
+
let editUpdateWeightsDelay: EditUpdateWeightsDelay = {
|
|
331
|
+
modificationDelay: new BN(updateWeightsDelay.modification_delay),
|
|
332
|
+
}
|
|
333
|
+
EditUpdateWeightsDelayLayout.encode(editUpdateWeightsDelay, editDataBuf);
|
|
334
|
+
break;
|
|
335
|
+
|
|
336
|
+
case TaskType.EditMakeDirectSwapDelay: // 13 - 103
|
|
337
|
+
let makeDirectSwapDelay = (editData as EditMakeDirectSwapSettings);
|
|
338
|
+
let editMakeDirectSwapDelay: EditMakeDirectSwapDelay = {
|
|
339
|
+
modificationDelay: new BN(makeDirectSwapDelay.modification_delay),
|
|
340
|
+
}
|
|
341
|
+
EditMakeDirectSwapDelayLayout.encode(editMakeDirectSwapDelay, editDataBuf);
|
|
342
|
+
break;
|
|
343
|
+
|
|
344
|
+
case TaskType.AddToken: // 14 - 201
|
|
345
|
+
let addTokenData = (editData as AddOrEditTokenInput);
|
|
346
|
+
let oracleDatas: OracleData[] = [];
|
|
347
|
+
for (let i = 0; i < addTokenData.oracles.length; i++) {
|
|
348
|
+
let oracleData: OracleData = {
|
|
349
|
+
oracleSettings: {
|
|
350
|
+
oracleType: [...ORACLE_TYPES_STRINGS.entries()].find(([, name]) => name === addTokenData.oracles[i].oracle_type)?.[0] ?? 255,
|
|
351
|
+
numRequiredAccounts: 0,
|
|
352
|
+
weight: addTokenData.oracles[i].weight,
|
|
353
|
+
isRequired: addTokenData.oracles[i].is_required ? 1 : 0,
|
|
354
|
+
confThreshBps: addTokenData.oracles[i].conf_thresh_bps,
|
|
355
|
+
volatilityThreshBps: addTokenData.oracles[i].volatility_thresh_bps,
|
|
356
|
+
maxSlippageBps: addTokenData.oracles[i].max_slippage_bps,
|
|
357
|
+
minLiquidity: new BN(addTokenData.oracles[i].min_liquidity),
|
|
358
|
+
stalenessThresh: new BN(addTokenData.oracles[i].staleness_thresh),
|
|
359
|
+
stalenessConfRateBps: addTokenData.oracles[i].staleness_conf_rate_bps,
|
|
360
|
+
tokenDecimals: addTokenData.oracles[i].token_decimals,
|
|
361
|
+
twapSecondsAgo: new BN(addTokenData.oracles[i].twap_seconds_ago),
|
|
362
|
+
twapSecondarySecondsAgo: new BN(addTokenData.oracles[i].twap_secondary_seconds_ago),
|
|
363
|
+
quote: Quote.Wsol,
|
|
364
|
+
side: Side.Base,
|
|
365
|
+
},
|
|
366
|
+
accountsToLoadLutIds: new Array(MAX_ACCOUNTS_PER_ORACLE).fill(0),
|
|
367
|
+
accountsToLoadLutIndices: new Array(MAX_ACCOUNTS_PER_ORACLE).fill(0),
|
|
368
|
+
}
|
|
369
|
+
oracleDatas.push(oracleData);
|
|
370
|
+
}
|
|
371
|
+
while (oracleDatas.length < MAX_ORACLES_PER_TOKEN) {
|
|
372
|
+
oracleDatas.push({
|
|
373
|
+
oracleSettings: DEFAULT_ORACLE_SETTINGS,
|
|
374
|
+
accountsToLoadLutIds: new Array(MAX_ACCOUNTS_PER_ORACLE).fill(0),
|
|
375
|
+
accountsToLoadLutIndices: new Array(MAX_ACCOUNTS_PER_ORACLE).fill(0),
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
let oracleAggregator: OracleAggregator = {
|
|
379
|
+
numOracles: addTokenData.oracles.length,
|
|
380
|
+
minOraclesThresh: addTokenData.min_oracles_thresh,
|
|
381
|
+
oracles: oracleDatas,
|
|
382
|
+
minConfBps: addTokenData.min_conf_bps,
|
|
383
|
+
confThreshBps: addTokenData.conf_thresh_bps,
|
|
384
|
+
confMultiplier: decimalToFraction(new Decimal(addTokenData.conf_multiplier)),
|
|
385
|
+
}
|
|
386
|
+
OracleAggregatorLayout.encode(oracleAggregator, editDataBuf);
|
|
387
|
+
editDataBuf.writeUInt8(addTokenData.active ? 1 : 0, OracleAggregatorLayout.getSpan());
|
|
388
|
+
additionalAccounts.push({
|
|
389
|
+
pubkey: new PublicKey(addTokenData.token_mint),
|
|
390
|
+
isWritable: false,
|
|
391
|
+
isSigner: false
|
|
392
|
+
});
|
|
393
|
+
additionalAccounts.push({
|
|
394
|
+
pubkey: getAta(basket.ownAddress, new PublicKey(addTokenData.token_mint), tokenProgram),
|
|
395
|
+
isWritable: true,
|
|
396
|
+
isSigner: false
|
|
397
|
+
});
|
|
398
|
+
additionalAccounts.push({
|
|
399
|
+
pubkey: basket.lookupTables.active[0],
|
|
400
|
+
isWritable: true,
|
|
401
|
+
isSigner: false
|
|
402
|
+
});
|
|
403
|
+
additionalAccounts.push({
|
|
404
|
+
pubkey: basket.lookupTables.active[1],
|
|
405
|
+
isWritable: true,
|
|
406
|
+
isSigner: false
|
|
407
|
+
});
|
|
408
|
+
for (let i = 0; i < addTokenData.oracles.length; i++) {
|
|
409
|
+
additionalAccounts.push({
|
|
410
|
+
pubkey: new PublicKey(addTokenData.oracles[i].account),
|
|
411
|
+
isWritable: false,
|
|
412
|
+
isSigner: false
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
additionalAccounts.push({
|
|
416
|
+
pubkey: ADDRESS_LOOKUP_TABLE_PROGRAM_ID,
|
|
417
|
+
isWritable: false,
|
|
418
|
+
isSigner: false
|
|
419
|
+
});
|
|
420
|
+
break;
|
|
421
|
+
|
|
422
|
+
case TaskType.UpdateWeights: { // 15 - 202
|
|
423
|
+
const updateWeightsData = (editData as UpdateWeightsInput);
|
|
424
|
+
const weights = updateWeightsData.token_weights.slice(0, MAX_SUPPORTED_TOKENS_PER_BASKET);
|
|
425
|
+
while (weights.length < MAX_SUPPORTED_TOKENS_PER_BASKET) weights.push({ mint: '', weight_bps: 0 });
|
|
426
|
+
|
|
427
|
+
let tokenMintsHash = updateWeightsData.token_mints_hash ?? computeTokenMintsHash(
|
|
428
|
+
basket.composition.slice(0, basket.numTokens)
|
|
429
|
+
.filter((asset) => asset.active === 1)
|
|
430
|
+
.map((asset) => asset.mint.toBase58())
|
|
431
|
+
);
|
|
432
|
+
let updateWeights: UpdateWeights = {
|
|
433
|
+
tokenWeights: weights.map((weight) => weight.weight_bps),
|
|
434
|
+
tokenMintsHash: tokenMintsHash,
|
|
435
|
+
}
|
|
436
|
+
UpdateWeightsLayout.encode(updateWeights, editDataBuf);
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
case TaskType.MakeDirectSwap: // 16 - 203
|
|
441
|
+
let makeDirectSwapData = (editData as MakeDirectSwapInput);
|
|
442
|
+
let makeDirectSwap: MakeDirectSwap = {
|
|
443
|
+
fromTokenMint: new PublicKey(makeDirectSwapData.from_token_mint),
|
|
444
|
+
toTokenMint: new PublicKey(makeDirectSwapData.to_token_mint),
|
|
445
|
+
amountFrom: new BN(makeDirectSwapData.amount_from),
|
|
446
|
+
amountTo: new BN(makeDirectSwapData.amount_to),
|
|
447
|
+
}
|
|
448
|
+
MakeDirectSwapLayout.encode(makeDirectSwap, editDataBuf);
|
|
449
|
+
break;
|
|
450
|
+
|
|
451
|
+
default:
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const activationTimestampBuf = Buffer.from(activationTimestamp.toArray("le", 8));
|
|
456
|
+
const expirationTimestampBuf = Buffer.from(expirationTimestamp.toArray("le", 8));
|
|
457
|
+
const minBountyBuf = Buffer.from(minBounty.toArray("le", 8));
|
|
458
|
+
const maxBountyBuf = Buffer.from(maxBounty.toArray("le", 8));
|
|
459
|
+
|
|
460
|
+
const data = Buffer.concat([
|
|
461
|
+
CREATE_EDIT_BASKET_INTENT_DISCRIMINATOR,
|
|
462
|
+
intentSeedArrayBuf,
|
|
463
|
+
editTypeBuf,
|
|
464
|
+
editDataBuf,
|
|
465
|
+
activationTimestampBuf,
|
|
466
|
+
expirationTimestampBuf,
|
|
467
|
+
minBountyBuf,
|
|
468
|
+
maxBountyBuf,
|
|
469
|
+
]);
|
|
470
|
+
|
|
471
|
+
const keys: AccountMeta[] = [
|
|
472
|
+
{ pubkey: manager, isSigner: true, isWritable: true },
|
|
473
|
+
{ pubkey: basket.ownAddress, isSigner: false, isWritable: true },
|
|
474
|
+
{ pubkey: intent, isSigner: false, isWritable: true },
|
|
475
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
476
|
+
{ pubkey: bountyMint, isSigner: false, isWritable: false },
|
|
477
|
+
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
478
|
+
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
479
|
+
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
480
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
481
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
482
|
+
{ pubkey: TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
483
|
+
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
484
|
+
];
|
|
485
|
+
|
|
486
|
+
keys.push(...additionalAccounts);
|
|
487
|
+
|
|
488
|
+
return new TransactionInstruction({
|
|
489
|
+
keys,
|
|
490
|
+
programId: BASKETS_V3_PROGRAM_ID,
|
|
491
|
+
data,
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
export function executeEditBasketIntentIx(params: {
|
|
498
|
+
keeper: PublicKey,
|
|
499
|
+
basket: PublicKey,
|
|
500
|
+
intent: PublicKey,
|
|
501
|
+
editType: TaskType,
|
|
502
|
+
manager: PublicKey,
|
|
503
|
+
bountyMint: PublicKey,
|
|
504
|
+
basketMint?: PublicKey,
|
|
505
|
+
}): TransactionInstruction {
|
|
506
|
+
const {
|
|
507
|
+
keeper,
|
|
508
|
+
basket,
|
|
509
|
+
basketMint,
|
|
510
|
+
bountyMint,
|
|
511
|
+
manager,
|
|
512
|
+
editType,
|
|
513
|
+
intent,
|
|
514
|
+
} = params;
|
|
515
|
+
|
|
516
|
+
let metadataAccount: PublicKey | null = null;
|
|
517
|
+
if (editType === TaskType.EditMetadataSettings) {
|
|
518
|
+
if (!basketMint) {
|
|
519
|
+
throw new Error("basketMint is required for EditMetadataSettings");
|
|
520
|
+
}
|
|
521
|
+
metadataAccount = getMetadataAccount(basketMint);
|
|
522
|
+
}
|
|
523
|
+
let globalConfig = getGlobalConfigPda();
|
|
524
|
+
let bountyVault = getBountyVaultPda();
|
|
525
|
+
let keeperBountyATA = getAta(keeper, bountyMint);
|
|
526
|
+
let managerBountyATA = getAta(manager, bountyMint);
|
|
527
|
+
let bountyVaultATA = getAta(bountyVault, bountyMint);
|
|
528
|
+
|
|
529
|
+
// discriminator
|
|
530
|
+
const data = EDIT_BASKET_DISCRIMINATOR;
|
|
531
|
+
|
|
532
|
+
// accounts
|
|
533
|
+
const keys = [
|
|
534
|
+
{ pubkey: keeper, isSigner: true, isWritable: true },
|
|
535
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
536
|
+
{ pubkey: intent, isSigner: false, isWritable: true },
|
|
537
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
538
|
+
{ pubkey: bountyMint, isSigner: false, isWritable: false },
|
|
539
|
+
{ pubkey: keeperBountyATA, isSigner: false, isWritable: true },
|
|
540
|
+
{ pubkey: manager, isSigner: false, isWritable: true },
|
|
541
|
+
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
542
|
+
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
543
|
+
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
544
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
545
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
546
|
+
{ pubkey: TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
547
|
+
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
548
|
+
];
|
|
549
|
+
// remaining accounts
|
|
550
|
+
if(editType === TaskType.EditMetadataSettings){
|
|
551
|
+
keys.push({ pubkey: basket, isSigner: false, isWritable: false });
|
|
552
|
+
keys.push({ pubkey: metadataAccount!, isSigner: false, isWritable: true });
|
|
553
|
+
keys.push({ pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false });
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
return new TransactionInstruction({
|
|
557
|
+
keys,
|
|
558
|
+
programId: BASKETS_V3_PROGRAM_ID,
|
|
559
|
+
data,
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export function cancelIntentIx(params: {
|
|
564
|
+
keeper: PublicKey,
|
|
565
|
+
basket: PublicKey,
|
|
566
|
+
intent: PublicKey,
|
|
567
|
+
editType: TaskType,
|
|
568
|
+
manager: PublicKey,
|
|
569
|
+
bountyMint: PublicKey,
|
|
570
|
+
}): TransactionInstruction {
|
|
571
|
+
const { keeper, basket, intent, editType, bountyMint, manager } = params;
|
|
572
|
+
|
|
573
|
+
const globalConfig = getGlobalConfigPda();
|
|
574
|
+
const bountyVault = getBountyVaultPda();
|
|
575
|
+
|
|
576
|
+
const keeperBountyATA = getAta(keeper, bountyMint);
|
|
577
|
+
const managerBountyATA = getAta(manager, bountyMint);
|
|
578
|
+
const bountyVaultATA = getAta(bountyVault, bountyMint);
|
|
579
|
+
|
|
580
|
+
const keys: AccountMeta[] = [
|
|
581
|
+
{ pubkey: keeper, isSigner: true, isWritable: true },
|
|
582
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
583
|
+
{ pubkey: intent, isSigner: false, isWritable: true },
|
|
584
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
585
|
+
{ pubkey: bountyMint, isSigner: false, isWritable: false },
|
|
586
|
+
{ pubkey: keeperBountyATA, isSigner: false, isWritable: true },
|
|
587
|
+
{ pubkey: manager, isSigner: false, isWritable: true },
|
|
588
|
+
{ pubkey: managerBountyATA, isSigner: false, isWritable: true },
|
|
589
|
+
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
590
|
+
{ pubkey: bountyVaultATA, isSigner: false, isWritable: true },
|
|
591
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
592
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
593
|
+
{ pubkey: TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
594
|
+
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
595
|
+
];
|
|
596
|
+
|
|
597
|
+
return new TransactionInstruction({
|
|
598
|
+
keys,
|
|
599
|
+
programId: BASKETS_V3_PROGRAM_ID,
|
|
600
|
+
data: CANCEL_INTENT_DISCRIMINATOR,
|
|
601
|
+
});
|
|
602
|
+
}
|