@kamino-finance/klend-sdk 5.13.1 → 5.13.4
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/classes/action.d.ts +32 -31
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +126 -95
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/index.d.ts +3 -2
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +3 -2
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/manager.d.ts +15 -7
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +57 -46
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/obligationOrder.d.ts +1 -1
- package/dist/classes/obligationOrder.d.ts.map +1 -1
- package/dist/classes/reserve.d.ts +2 -2
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +70 -70
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/shared.d.ts +13 -0
- package/dist/classes/shared.d.ts.map +1 -1
- package/dist/classes/utils.d.ts +1 -9
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +4 -51
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +22 -4
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +78 -43
- package/dist/classes/vault.js.map +1 -1
- package/dist/classes/{types.d.ts → vault_types.d.ts} +3 -15
- package/dist/classes/vault_types.d.ts.map +1 -0
- package/dist/classes/{types.js → vault_types.js} +1 -1
- package/dist/classes/vault_types.js.map +1 -0
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +44 -28
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +6 -6
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.d.ts +6 -6
- package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.js +61 -61
- package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
- package/dist/leverage/calcs.d.ts +0 -1
- package/dist/leverage/calcs.d.ts.map +1 -1
- package/dist/leverage/calcs.js +5 -8
- package/dist/leverage/calcs.js.map +1 -1
- package/dist/leverage/operations.d.ts +5 -5
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +73 -73
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/types.d.ts +1 -1
- package/dist/leverage/types.d.ts.map +1 -1
- package/dist/leverage/utils.d.ts +2 -2
- package/dist/leverage/utils.d.ts.map +1 -1
- package/dist/leverage/utils.js +5 -5
- package/dist/leverage/utils.js.map +1 -1
- package/dist/referrals/instructions.d.ts +3 -3
- package/dist/referrals/instructions.d.ts.map +1 -1
- package/dist/referrals/instructions.js +10 -10
- package/dist/referrals/instructions.js.map +1 -1
- package/dist/referrals/operations.js +6 -6
- package/dist/referrals/operations.js.map +1 -1
- package/dist/utils/ata.d.ts +3 -3
- package/dist/utils/ata.d.ts.map +1 -1
- package/dist/utils/ata.js +22 -22
- package/dist/utils/ata.js.map +1 -1
- package/dist/utils/instruction.d.ts +2 -2
- package/dist/utils/instruction.d.ts.map +1 -1
- package/dist/utils/instruction.js +12 -12
- package/dist/utils/instruction.js.map +1 -1
- package/dist/utils/lookupTable.js +6 -6
- package/dist/utils/lookupTable.js.map +1 -1
- package/dist/utils/metadata.d.ts +14 -0
- package/dist/utils/metadata.d.ts.map +1 -0
- package/dist/utils/metadata.js +78 -0
- package/dist/utils/metadata.js.map +1 -0
- package/dist/utils/seeds.d.ts +6 -0
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +10 -0
- package/dist/utils/seeds.js.map +1 -1
- package/dist/utils/userMetadata.d.ts +1 -1
- package/dist/utils/userMetadata.d.ts.map +1 -1
- package/dist/utils/userMetadata.js +3 -3
- package/dist/utils/userMetadata.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/action.ts +143 -102
- package/src/classes/index.ts +5 -2
- package/src/classes/manager.ts +74 -51
- package/src/classes/obligationOrder.ts +1 -1
- package/src/classes/reserve.ts +126 -132
- package/src/classes/shared.ts +15 -0
- package/src/classes/utils.ts +3 -52
- package/src/classes/vault.ts +125 -44
- package/src/classes/{types.ts → vault_types.ts} +2 -16
- package/src/client.ts +16 -16
- package/src/client_kamino_manager.ts +59 -27
- package/src/lending_operations/repay_with_collateral_operations.ts +13 -13
- package/src/lending_operations/swap_collateral_operations.ts +85 -85
- package/src/leverage/calcs.ts +2 -6
- package/src/leverage/operations.ts +84 -84
- package/src/leverage/types.ts +1 -1
- package/src/leverage/utils.ts +5 -5
- package/src/referrals/instructions.ts +6 -6
- package/src/referrals/operations.ts +9 -9
- package/src/utils/ata.ts +18 -18
- package/src/utils/instruction.ts +10 -10
- package/src/utils/lookupTable.ts +6 -6
- package/src/utils/metadata.ts +115 -0
- package/src/utils/seeds.ts +13 -0
- package/src/utils/userMetadata.ts +1 -1
- package/dist/classes/types.d.ts.map +0 -1
- package/dist/classes/types.js.map +0 -1
- package/dist/classes/types_utils.d.ts +0 -14
- package/dist/classes/types_utils.d.ts.map +0 -1
- package/dist/classes/types_utils.js +0 -50
- package/dist/classes/types_utils.js.map +0 -1
- package/src/classes/types_utils.ts +0 -49
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
LendingMarket,
|
|
27
27
|
MAINNET_BETA_CHAIN_ID,
|
|
28
28
|
parseZeroPaddedUtf8,
|
|
29
|
+
printHoldings,
|
|
29
30
|
Reserve,
|
|
30
31
|
ReserveAllocationConfig,
|
|
31
32
|
ReserveWithAddress,
|
|
@@ -57,7 +58,6 @@ import {
|
|
|
57
58
|
PerformanceFeeBps,
|
|
58
59
|
} from './idl_codegen_kamino_vault/types/VaultConfigField';
|
|
59
60
|
import { getAccountOwner } from './utils/rpc';
|
|
60
|
-
import { printHoldings } from './classes/types_utils';
|
|
61
61
|
import { getAssociatedTokenAddressSync } from '@solana/spl-token';
|
|
62
62
|
|
|
63
63
|
dotenv.config({
|
|
@@ -93,11 +93,11 @@ async function main() {
|
|
|
93
93
|
env.kVaultProgramId
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
-
const { market: marketKp,
|
|
96
|
+
const { market: marketKp, ixs: createMarketIxs } = await kaminoManager.createMarketIxs({
|
|
97
97
|
admin: mode === 'multisig' ? multisigPk : env.payer.publicKey,
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
await processTxn(env.client, env.payer,
|
|
100
|
+
await processTxn(env.client, env.payer, createMarketIxs, mode, 2500, [marketKp]);
|
|
101
101
|
|
|
102
102
|
mode === 'execute' && console.log('Market created:', marketKp.publicKey.toBase58());
|
|
103
103
|
});
|
|
@@ -142,7 +142,7 @@ async function main() {
|
|
|
142
142
|
? getAssociatedTokenAddressSync(tokenMint, multisigPk)
|
|
143
143
|
: getAssociatedTokenAddressSync(tokenMint, env.payer.publicKey);
|
|
144
144
|
|
|
145
|
-
const { reserve,
|
|
145
|
+
const { reserve, txnIxs } = await kaminoManager.addAssetToMarketIxs({
|
|
146
146
|
admin: mode === 'multisig' ? multisigPk : env.payer.publicKey,
|
|
147
147
|
adminLiquiditySource: adminAta,
|
|
148
148
|
marketAddress: marketAddress,
|
|
@@ -151,9 +151,9 @@ async function main() {
|
|
|
151
151
|
|
|
152
152
|
console.log('reserve: ', reserve.publicKey);
|
|
153
153
|
|
|
154
|
-
const _createReserveSig = await processTxn(env.client, env.payer,
|
|
154
|
+
const _createReserveSig = await processTxn(env.client, env.payer, txnIxs[0], mode, 2500, [reserve]);
|
|
155
155
|
|
|
156
|
-
const _updateReserveSig = await processTxn(env.client, env.payer,
|
|
156
|
+
const _updateReserveSig = await processTxn(env.client, env.payer, txnIxs[1], mode, 2500, [], 400_000);
|
|
157
157
|
|
|
158
158
|
mode === 'execute' &&
|
|
159
159
|
console.log(
|
|
@@ -207,7 +207,7 @@ async function main() {
|
|
|
207
207
|
|
|
208
208
|
const reserveConfig = parseReserveConfigFromFile(reserveConfigFromFile);
|
|
209
209
|
|
|
210
|
-
const
|
|
210
|
+
const ixs = await kaminoManager.updateReserveIxs(
|
|
211
211
|
marketWithAddress,
|
|
212
212
|
reserveAddress,
|
|
213
213
|
reserveConfig,
|
|
@@ -215,7 +215,7 @@ async function main() {
|
|
|
215
215
|
updateEntireConfig
|
|
216
216
|
);
|
|
217
217
|
|
|
218
|
-
const _updateReserveSig = await processTxn(env.client, env.payer,
|
|
218
|
+
const _updateReserveSig = await processTxn(env.client, env.payer, ixs, mode, 2500, [], 400_000);
|
|
219
219
|
|
|
220
220
|
mode === 'execute' && console.log('Reserve Updated with config -> ', JSON.parse(JSON.stringify(reserveConfig)));
|
|
221
221
|
});
|
|
@@ -252,10 +252,12 @@ async function main() {
|
|
|
252
252
|
`--mode <string>`,
|
|
253
253
|
'simulate - to print txn simulation, inspect - to get txn simulation in explorer, execute - execute txn, multisig - to get bs58 txn for multisig usage'
|
|
254
254
|
)
|
|
255
|
-
.
|
|
255
|
+
.requiredOption('--name <string>', 'The onchain name of the strat')
|
|
256
|
+
.requiredOption('--tokenName <string>', 'The name of the token in the vault')
|
|
257
|
+
.requiredOption('--extraTokenName <string>', 'The extra string appended to the token symbol')
|
|
256
258
|
.option(`--staging`, 'If true, will use the staging programs')
|
|
257
259
|
.option(`--multisig <string>`, 'If using multisig mode this is required, otherwise will be ignored')
|
|
258
|
-
.action(async ({ mint, mode, name, staging, multisig }) => {
|
|
260
|
+
.action(async ({ mint, mode, name, tokenName, extraTokenName, staging, multisig }) => {
|
|
259
261
|
const env = initializeClient(mode === 'multisig', staging);
|
|
260
262
|
const tokenMint = new PublicKey(mint);
|
|
261
263
|
|
|
@@ -279,6 +281,8 @@ async function main() {
|
|
|
279
281
|
performanceFeeRatePercentage: new Decimal(0.0),
|
|
280
282
|
managementFeeRatePercentage: new Decimal(0.0),
|
|
281
283
|
name,
|
|
284
|
+
vaultTokenSymbol: tokenName,
|
|
285
|
+
vaultTokenName: extraTokenName,
|
|
282
286
|
});
|
|
283
287
|
|
|
284
288
|
const { vault: vaultKp, initVaultIxs: instructions } = await kaminoManager.createVaultIxs(kaminoVaultConfig);
|
|
@@ -294,9 +298,37 @@ async function main() {
|
|
|
294
298
|
await sleep(2000);
|
|
295
299
|
const _populateLUTSig = await processTxn(env.client, env.payer, instructions.populateLUTIxs, mode, 2500, []);
|
|
296
300
|
|
|
301
|
+
const _setSharesMetadataSig = await processTxn(
|
|
302
|
+
env.client,
|
|
303
|
+
env.payer,
|
|
304
|
+
[instructions.initSharesMetadataIx],
|
|
305
|
+
mode,
|
|
306
|
+
2500,
|
|
307
|
+
[]
|
|
308
|
+
);
|
|
297
309
|
mode === 'execute' && console.log('Vault created:', vaultKp.publicKey.toBase58());
|
|
298
310
|
});
|
|
299
311
|
|
|
312
|
+
commands
|
|
313
|
+
.command('set-shares-metadata')
|
|
314
|
+
.requiredOption('--vault <string>', 'Vault address')
|
|
315
|
+
.requiredOption('--symbol <string>', 'The symbol of the kVault token')
|
|
316
|
+
.requiredOption('--extraName <string>', 'The name of the kVault token, appended to the symbol')
|
|
317
|
+
.action(async ({ vault, symbol, extraName }) => {
|
|
318
|
+
const env = initializeClient(false, false);
|
|
319
|
+
const kVault = new KaminoVault(new PublicKey(vault));
|
|
320
|
+
|
|
321
|
+
const kaminoManager = new KaminoManager(
|
|
322
|
+
env.connection,
|
|
323
|
+
DEFAULT_RECENT_SLOT_DURATION_MS,
|
|
324
|
+
env.kLendProgramId,
|
|
325
|
+
env.kVaultProgramId
|
|
326
|
+
);
|
|
327
|
+
const ix = await kaminoManager.getSetSharesMetadataIx(kVault, symbol, extraName);
|
|
328
|
+
|
|
329
|
+
await processTxn(env.client, env.payer, [ix], 'execute', 2500, []);
|
|
330
|
+
});
|
|
331
|
+
|
|
300
332
|
commands
|
|
301
333
|
.command('update-vault-pending-admin')
|
|
302
334
|
.requiredOption('--vault <string>', 'Vault address')
|
|
@@ -1242,11 +1274,11 @@ async function main() {
|
|
|
1242
1274
|
|
|
1243
1275
|
const newLendingMarket = LendingMarket.fromJSON(JSON.parse(fs.readFileSync(lendingMarketConfigPath, 'utf8')));
|
|
1244
1276
|
|
|
1245
|
-
const
|
|
1277
|
+
const ixs = kaminoManager.updateLendingMarketIxs(marketWithAddress, newLendingMarket);
|
|
1246
1278
|
|
|
1247
|
-
// executing 6
|
|
1248
|
-
for (let ixnIndex = 0; ixnIndex <
|
|
1249
|
-
const ixnToExecute =
|
|
1279
|
+
// executing 6 ixs in a txn to make sure they fit
|
|
1280
|
+
for (let ixnIndex = 0; ixnIndex < ixs.length; ixnIndex += 6) {
|
|
1281
|
+
const ixnToExecute = ixs.slice(ixnIndex, ixnIndex + 6);
|
|
1250
1282
|
const _updateLendingMarketSig = await processTxn(env.client, env.payer, ixnToExecute, mode, 2500, [], 400_000);
|
|
1251
1283
|
}
|
|
1252
1284
|
|
|
@@ -1285,9 +1317,9 @@ async function main() {
|
|
|
1285
1317
|
env.kVaultProgramId
|
|
1286
1318
|
);
|
|
1287
1319
|
|
|
1288
|
-
const
|
|
1320
|
+
const ix = kaminoManager.updateLendingMarketOwnerIxs(marketWithAddress);
|
|
1289
1321
|
|
|
1290
|
-
const _updateLendingMarketSig = await processTxn(env.client, env.payer, [
|
|
1322
|
+
const _updateLendingMarketSig = await processTxn(env.client, env.payer, [ix], mode, 2500, [], 400_000);
|
|
1291
1323
|
|
|
1292
1324
|
mode === 'execute' &&
|
|
1293
1325
|
console.log(
|
|
@@ -1340,9 +1372,9 @@ async function main() {
|
|
|
1340
1372
|
name: newNameEncoded,
|
|
1341
1373
|
};
|
|
1342
1374
|
|
|
1343
|
-
const
|
|
1375
|
+
const ixs = kaminoManager.updateLendingMarketIxs(marketWithAddress, newLendingMarket);
|
|
1344
1376
|
|
|
1345
|
-
const _updateLendingMarketSig = await processTxn(env.client, env.payer,
|
|
1377
|
+
const _updateLendingMarketSig = await processTxn(env.client, env.payer, ixs, mode, 2500, [], 400_000);
|
|
1346
1378
|
|
|
1347
1379
|
mode === 'execute' &&
|
|
1348
1380
|
console.log(
|
|
@@ -1395,9 +1427,9 @@ async function main() {
|
|
|
1395
1427
|
};
|
|
1396
1428
|
const newReserveConfig: ReserveConfig = new ReserveConfig(newReserveConfigFields);
|
|
1397
1429
|
|
|
1398
|
-
const
|
|
1430
|
+
const ixs = await kaminoManager.updateReserveIxs(marketWithAddress, reserveAddress, newReserveConfig);
|
|
1399
1431
|
|
|
1400
|
-
const _updateLendingMarketSig = await processTxn(env.client, env.payer,
|
|
1432
|
+
const _updateLendingMarketSig = await processTxn(env.client, env.payer, ixs, mode, 2500, [], 400_000);
|
|
1401
1433
|
|
|
1402
1434
|
mode === 'execute' &&
|
|
1403
1435
|
console.log(
|
|
@@ -1486,7 +1518,7 @@ export type Env = {
|
|
|
1486
1518
|
async function processTxn(
|
|
1487
1519
|
web3Client: Web3Client,
|
|
1488
1520
|
admin: Keypair,
|
|
1489
|
-
|
|
1521
|
+
ixs: TransactionInstruction[],
|
|
1490
1522
|
mode: string,
|
|
1491
1523
|
priorityFeeMultiplier: number = 2500,
|
|
1492
1524
|
extraSigners: Signer[],
|
|
@@ -1499,7 +1531,7 @@ async function processTxn(
|
|
|
1499
1531
|
if (mode === 'multisig') {
|
|
1500
1532
|
const { blockhash } = await web3Client.connection.getLatestBlockhash();
|
|
1501
1533
|
const txn = new Transaction();
|
|
1502
|
-
txn.add(...
|
|
1534
|
+
txn.add(...ixs);
|
|
1503
1535
|
txn.recentBlockhash = blockhash;
|
|
1504
1536
|
txn.feePayer = admin.publicKey;
|
|
1505
1537
|
|
|
@@ -1521,7 +1553,7 @@ async function processTxn(
|
|
|
1521
1553
|
}
|
|
1522
1554
|
tx.recentBlockhash = blockhash;
|
|
1523
1555
|
tx.feePayer = admin.publicKey;
|
|
1524
|
-
tx.add(...
|
|
1556
|
+
tx.add(...ixs);
|
|
1525
1557
|
|
|
1526
1558
|
if (mode === 'execute') {
|
|
1527
1559
|
return await signSendAndConfirmRawTransactionWithRetry({
|
|
@@ -1557,10 +1589,10 @@ async function processTxn(
|
|
|
1557
1589
|
}
|
|
1558
1590
|
|
|
1559
1591
|
function createAddExtraComputeUnitFeeTransaction(units: number, microLamports: number): TransactionInstruction[] {
|
|
1560
|
-
const
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
return
|
|
1592
|
+
const ixs: TransactionInstruction[] = [];
|
|
1593
|
+
ixs.push(ComputeBudgetProgram.setComputeUnitLimit({ units }));
|
|
1594
|
+
ixs.push(ComputeBudgetProgram.setComputeUnitPrice({ microLamports: new Decimal(microLamports).floor().toNumber() }));
|
|
1595
|
+
return ixs;
|
|
1564
1596
|
}
|
|
1565
1597
|
|
|
1566
1598
|
function parseReserveConfigFromFile(reserveConfigFromFile: any): ReserveConfig {
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
SwapIxsProvider,
|
|
8
8
|
SwapQuoteProvider,
|
|
9
9
|
getScopeRefreshIx,
|
|
10
|
-
|
|
10
|
+
LeverageIxsOutput,
|
|
11
11
|
FlashLoanInfo,
|
|
12
12
|
} from '../leverage';
|
|
13
13
|
import {
|
|
14
14
|
createAtasIdempotent,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
getComputeBudgetAndPriorityFeeIxs,
|
|
16
|
+
removeBudgetAndAtaIxs,
|
|
17
17
|
ScopePriceRefreshConfig,
|
|
18
18
|
U64_MAX,
|
|
19
19
|
uniqueAccountsWithProgramIds,
|
|
@@ -128,7 +128,7 @@ export async function getRepayWithCollSwapInputs<QuoteResponse>({
|
|
|
128
128
|
const inputAmountLamports = Decimal.min(withdrawableCollLamports, maxCollNeededFromOracle);
|
|
129
129
|
|
|
130
130
|
// Build the repay & withdraw collateral tx to get the number of accounts
|
|
131
|
-
const klendIxs:
|
|
131
|
+
const klendIxs: LeverageIxsOutput = await buildRepayWithCollateralIxs(
|
|
132
132
|
kaminoMarket,
|
|
133
133
|
debtReserve,
|
|
134
134
|
collReserve,
|
|
@@ -256,7 +256,7 @@ export async function getRepayWithCollIxs<QuoteResponse>({
|
|
|
256
256
|
);
|
|
257
257
|
|
|
258
258
|
const swapResponse = await swapper(swapInputs, initialInputs.klendAccounts, swapQuote);
|
|
259
|
-
const ixs:
|
|
259
|
+
const ixs: LeverageIxsOutput = await buildRepayWithCollateralIxs(
|
|
260
260
|
kaminoMarket,
|
|
261
261
|
debtReserve,
|
|
262
262
|
collReserve,
|
|
@@ -295,9 +295,9 @@ async function buildRepayWithCollateralIxs(
|
|
|
295
295
|
debtRepayAmountLamports: Decimal,
|
|
296
296
|
collWithdrawLamports: Decimal,
|
|
297
297
|
useV2Ixs: boolean
|
|
298
|
-
): Promise<
|
|
298
|
+
): Promise<LeverageIxsOutput> {
|
|
299
299
|
// 1. Create atas & budget txns
|
|
300
|
-
const
|
|
300
|
+
const budgetIxs = budgetAndPriorityFeeIxs || getComputeBudgetAndPriorityFeeIxs(1_400_000);
|
|
301
301
|
|
|
302
302
|
const atas = [
|
|
303
303
|
{ mint: collReserve.getLiquidityMint(), tokenProgram: collReserve.getLiquidityTokenProgram() },
|
|
@@ -311,7 +311,7 @@ async function buildRepayWithCollateralIxs(
|
|
|
311
311
|
|
|
312
312
|
// 2. Flash borrow & repay the debt to repay amount needed
|
|
313
313
|
const { flashBorrowIxn, flashRepayIxn } = getFlashLoanInstructions({
|
|
314
|
-
borrowIxnIndex:
|
|
314
|
+
borrowIxnIndex: budgetIxs.length + atasAndIxs.length + (scopeRefreshIxn.length > 0 ? 1 : 0),
|
|
315
315
|
walletPublicKey: obligation.state.owner,
|
|
316
316
|
lendingMarketAuthority: market.getLendingMarketAuthority(),
|
|
317
317
|
lendingMarketAddress: market.getAddress(),
|
|
@@ -369,11 +369,11 @@ async function buildRepayWithCollateralIxs(
|
|
|
369
369
|
|
|
370
370
|
// 4. Swap collateral to debt to repay flash loan
|
|
371
371
|
const { preActionIxs, swapIxs } = swapQuoteIxs;
|
|
372
|
-
const swapInstructions =
|
|
372
|
+
const swapInstructions = removeBudgetAndAtaIxs(swapIxs, []);
|
|
373
373
|
|
|
374
|
-
const
|
|
374
|
+
const ixs = [
|
|
375
375
|
...scopeRefreshIxn,
|
|
376
|
-
...
|
|
376
|
+
...budgetIxs,
|
|
377
377
|
...atasAndIxs.map((x) => x.createAtaIx),
|
|
378
378
|
flashBorrowIxn,
|
|
379
379
|
...preActionIxs,
|
|
@@ -382,12 +382,12 @@ async function buildRepayWithCollateralIxs(
|
|
|
382
382
|
flashRepayIxn,
|
|
383
383
|
];
|
|
384
384
|
|
|
385
|
-
const res:
|
|
385
|
+
const res: LeverageIxsOutput = {
|
|
386
386
|
flashLoanInfo: {
|
|
387
387
|
flashBorrowReserve: debtReserve.address,
|
|
388
388
|
flashLoanFee: debtReserve.getFlashLoanFee(),
|
|
389
389
|
},
|
|
390
|
-
instructions:
|
|
390
|
+
instructions: ixs,
|
|
391
391
|
};
|
|
392
392
|
|
|
393
393
|
return res;
|