@lavarage/sdk 7.1.2 → 7.2.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/index.d.mts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +127 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -9
- package/dist/index.mjs.map +1 -1
- package/index.ts +269 -122
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3491,7 +3491,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3491
3491
|
swapInstruction: Record<string, unknown>;
|
|
3492
3492
|
addressLookupTableAddresses: string[];
|
|
3493
3493
|
};
|
|
3494
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3494
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3495
3495
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3496
3496
|
nodeWallet: PublicKey;
|
|
3497
3497
|
interestRate: number;
|
|
@@ -3502,7 +3502,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3502
3502
|
swapInstruction: Record<string, unknown>;
|
|
3503
3503
|
addressLookupTableAddresses: string[];
|
|
3504
3504
|
};
|
|
3505
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3505
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3506
3506
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3507
3507
|
pool: PublicKey;
|
|
3508
3508
|
seed: PublicKey;
|
|
@@ -3551,7 +3551,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
|
|
|
3551
3551
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3552
3552
|
};
|
|
3553
3553
|
quoteResponse: any;
|
|
3554
|
-
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3554
|
+
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3555
3555
|
declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
3556
3556
|
pool: PublicKey;
|
|
3557
3557
|
seed: PublicKey;
|
|
@@ -3570,7 +3570,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
3570
3570
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3571
3571
|
};
|
|
3572
3572
|
quoteResponse: any;
|
|
3573
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3573
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3574
3574
|
declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
|
|
3575
3575
|
parsed: {
|
|
3576
3576
|
tpPrice: any;
|
|
@@ -3598,7 +3598,11 @@ declare const splitPositionV2: (lavarageProgram: Program<Lavarage> | Program<Lav
|
|
|
3598
3598
|
nodeWallet: PublicKey;
|
|
3599
3599
|
interestRate: number;
|
|
3600
3600
|
collateralType: PublicKey;
|
|
3601
|
-
}>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<
|
|
3601
|
+
}>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<{
|
|
3602
|
+
transaction: VersionedTransaction;
|
|
3603
|
+
newPositionAddresses: string[];
|
|
3604
|
+
newPositionSeeds: string[];
|
|
3605
|
+
}>;
|
|
3602
3606
|
declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: ProgramAccount<{
|
|
3603
3607
|
pool: PublicKey;
|
|
3604
3608
|
seed: PublicKey;
|
package/dist/index.d.ts
CHANGED
|
@@ -3491,7 +3491,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3491
3491
|
swapInstruction: Record<string, unknown>;
|
|
3492
3492
|
addressLookupTableAddresses: string[];
|
|
3493
3493
|
};
|
|
3494
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3494
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3495
3495
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3496
3496
|
nodeWallet: PublicKey;
|
|
3497
3497
|
interestRate: number;
|
|
@@ -3502,7 +3502,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3502
3502
|
swapInstruction: Record<string, unknown>;
|
|
3503
3503
|
addressLookupTableAddresses: string[];
|
|
3504
3504
|
};
|
|
3505
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3505
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3506
3506
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3507
3507
|
pool: PublicKey;
|
|
3508
3508
|
seed: PublicKey;
|
|
@@ -3551,7 +3551,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
|
|
|
3551
3551
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3552
3552
|
};
|
|
3553
3553
|
quoteResponse: any;
|
|
3554
|
-
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3554
|
+
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3555
3555
|
declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
3556
3556
|
pool: PublicKey;
|
|
3557
3557
|
seed: PublicKey;
|
|
@@ -3570,7 +3570,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
3570
3570
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3571
3571
|
};
|
|
3572
3572
|
quoteResponse: any;
|
|
3573
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3573
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey, splitTransactions?: boolean) => Promise<VersionedTransaction | VersionedTransaction[]>;
|
|
3574
3574
|
declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
|
|
3575
3575
|
parsed: {
|
|
3576
3576
|
tpPrice: any;
|
|
@@ -3598,7 +3598,11 @@ declare const splitPositionV2: (lavarageProgram: Program<Lavarage> | Program<Lav
|
|
|
3598
3598
|
nodeWallet: PublicKey;
|
|
3599
3599
|
interestRate: number;
|
|
3600
3600
|
collateralType: PublicKey;
|
|
3601
|
-
}>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<
|
|
3601
|
+
}>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<{
|
|
3602
|
+
transaction: VersionedTransaction;
|
|
3603
|
+
newPositionAddresses: string[];
|
|
3604
|
+
newPositionSeeds: string[];
|
|
3605
|
+
}>;
|
|
3602
3606
|
declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: ProgramAccount<{
|
|
3603
3607
|
pool: PublicKey;
|
|
3604
3608
|
seed: PublicKey;
|
package/dist/index.js
CHANGED
|
@@ -4764,7 +4764,7 @@ var getLiquidatedPositions = (lavarageProgram) => {
|
|
|
4764
4764
|
var getAllPositions = (lavarageProgram) => {
|
|
4765
4765
|
return lavarageProgram.account.position.all([{ dataSize: 178 }]);
|
|
4766
4766
|
};
|
|
4767
|
-
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
4767
|
+
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions) => __async(void 0, null, function* () {
|
|
4768
4768
|
let partnerFeeMarkupAsPkey;
|
|
4769
4769
|
if (partnerFeeMarkup) {
|
|
4770
4770
|
const feeBuffer = Buffer.alloc(8);
|
|
@@ -4892,6 +4892,33 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4892
4892
|
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4893
4893
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
4894
4894
|
});
|
|
4895
|
+
if (splitTransactions) {
|
|
4896
|
+
const setUpInstructions = [
|
|
4897
|
+
fromTokenAccount.instruction,
|
|
4898
|
+
toTokenAccount.instruction,
|
|
4899
|
+
...setupInstructions.map(deserializeInstruction)
|
|
4900
|
+
];
|
|
4901
|
+
const allInstructions2 = [
|
|
4902
|
+
tradingOpenBorrowInstruction,
|
|
4903
|
+
deserializeInstruction(swapInstructionPayload),
|
|
4904
|
+
,
|
|
4905
|
+
openAddCollateralInstruction,
|
|
4906
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
4907
|
+
].filter(Boolean);
|
|
4908
|
+
const messageV01 = new import_web32.TransactionMessage({
|
|
4909
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
4910
|
+
recentBlockhash: blockhash,
|
|
4911
|
+
instructions: setUpInstructions
|
|
4912
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
4913
|
+
const tx2 = new import_web32.VersionedTransaction(messageV01);
|
|
4914
|
+
const messageV02 = new import_web32.TransactionMessage({
|
|
4915
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
4916
|
+
recentBlockhash: blockhash,
|
|
4917
|
+
instructions: allInstructions2
|
|
4918
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
4919
|
+
const tx3 = new import_web32.VersionedTransaction(messageV02);
|
|
4920
|
+
return [tx2, tx3];
|
|
4921
|
+
}
|
|
4895
4922
|
const allInstructions = [
|
|
4896
4923
|
fromTokenAccount.instruction,
|
|
4897
4924
|
toTokenAccount.instruction,
|
|
@@ -4908,7 +4935,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4908
4935
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
4909
4936
|
return tx;
|
|
4910
4937
|
});
|
|
4911
|
-
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
4938
|
+
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions) => __async(void 0, null, function* () {
|
|
4912
4939
|
let partnerFeeMarkupAsPkey;
|
|
4913
4940
|
if (partnerFeeMarkup) {
|
|
4914
4941
|
const feeBuffer = Buffer.alloc(8);
|
|
@@ -5062,6 +5089,33 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
5062
5089
|
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5063
5090
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5064
5091
|
});
|
|
5092
|
+
if (splitTransactions) {
|
|
5093
|
+
const setUpInstructions = [
|
|
5094
|
+
fromTokenAccount.instruction,
|
|
5095
|
+
toTokenAccount.instruction,
|
|
5096
|
+
...setupInstructions.map(deserializeInstruction)
|
|
5097
|
+
];
|
|
5098
|
+
const allInstructions2 = [
|
|
5099
|
+
tradingOpenBorrowInstruction,
|
|
5100
|
+
deserializeInstruction(swapInstructionPayload),
|
|
5101
|
+
,
|
|
5102
|
+
openAddCollateralInstruction,
|
|
5103
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
5104
|
+
].filter(Boolean);
|
|
5105
|
+
const messageV01 = new import_web32.TransactionMessage({
|
|
5106
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
5107
|
+
recentBlockhash: blockhash,
|
|
5108
|
+
instructions: setUpInstructions
|
|
5109
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
5110
|
+
const tx2 = new import_web32.VersionedTransaction(messageV01);
|
|
5111
|
+
const messageV02 = new import_web32.TransactionMessage({
|
|
5112
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
5113
|
+
recentBlockhash: blockhash,
|
|
5114
|
+
instructions: allInstructions2
|
|
5115
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
5116
|
+
const tx3 = new import_web32.VersionedTransaction(messageV02);
|
|
5117
|
+
return [tx2, tx3];
|
|
5118
|
+
}
|
|
5065
5119
|
const allInstructions = [
|
|
5066
5120
|
fromTokenAccount.instruction,
|
|
5067
5121
|
toTokenAccount.instruction,
|
|
@@ -5239,7 +5293,7 @@ var partialRepayV2 = (lavarageProgram, position, repaymentBps) => __async(void 0
|
|
|
5239
5293
|
}).compileToV0Message();
|
|
5240
5294
|
return new import_web32.VersionedTransaction(messageV0);
|
|
5241
5295
|
});
|
|
5242
|
-
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
5296
|
+
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions) => __async(void 0, null, function* () {
|
|
5243
5297
|
var _a, _b;
|
|
5244
5298
|
let partnerFeeMarkupAsPkey;
|
|
5245
5299
|
if (partnerFeeMarkup) {
|
|
@@ -5407,13 +5461,40 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
5407
5461
|
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5408
5462
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5409
5463
|
});
|
|
5464
|
+
if (splitTransactions) {
|
|
5465
|
+
const setUpInstructions = [
|
|
5466
|
+
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
5467
|
+
createAssociatedTokenAccountInstruction2
|
|
5468
|
+
].filter((i) => !!i);
|
|
5469
|
+
const allInstructions2 = [
|
|
5470
|
+
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? deserializeInstruction(
|
|
5471
|
+
jupInstruction.instructions.tokenLedgerInstruction
|
|
5472
|
+
) : null,
|
|
5473
|
+
closePositionIx,
|
|
5474
|
+
...jupiterIxs,
|
|
5475
|
+
repaySolIx,
|
|
5476
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
5477
|
+
].filter((i) => !!i);
|
|
5478
|
+
const messageV01 = new import_web32.TransactionMessage({
|
|
5479
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
5480
|
+
recentBlockhash: blockhash,
|
|
5481
|
+
instructions: setUpInstructions
|
|
5482
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
5483
|
+
const tx2 = new import_web32.VersionedTransaction(messageV01);
|
|
5484
|
+
const messageV02 = new import_web32.TransactionMessage({
|
|
5485
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
5486
|
+
recentBlockhash: blockhash,
|
|
5487
|
+
instructions: allInstructions2
|
|
5488
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
5489
|
+
const tx22 = new import_web32.VersionedTransaction(messageV02);
|
|
5490
|
+
return [tx2, tx22];
|
|
5491
|
+
}
|
|
5410
5492
|
const allInstructions = [
|
|
5411
5493
|
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
5412
|
-
|
|
5494
|
+
createAssociatedTokenAccountInstruction2,
|
|
5413
5495
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
5414
5496
|
jupInstruction.instructions.tokenLedgerInstruction
|
|
5415
5497
|
) : null,
|
|
5416
|
-
toTokenAccount.instruction,
|
|
5417
5498
|
closePositionIx,
|
|
5418
5499
|
...jupiterIxs,
|
|
5419
5500
|
repaySolIx,
|
|
@@ -5427,7 +5508,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
5427
5508
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5428
5509
|
return tx;
|
|
5429
5510
|
});
|
|
5430
|
-
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
5511
|
+
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient, splitTransactions) => __async(void 0, null, function* () {
|
|
5431
5512
|
var _a, _b;
|
|
5432
5513
|
let partnerFeeMarkupAsPkey;
|
|
5433
5514
|
if (partnerFeeMarkup) {
|
|
@@ -5641,13 +5722,40 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
5641
5722
|
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5642
5723
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5643
5724
|
});
|
|
5725
|
+
if (splitTransactions) {
|
|
5726
|
+
const setUpInstructions = [
|
|
5727
|
+
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
5728
|
+
createAssociatedTokenAccountInstruction2
|
|
5729
|
+
].filter((i) => !!i);
|
|
5730
|
+
const allInstructions2 = [
|
|
5731
|
+
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? deserializeInstruction(
|
|
5732
|
+
jupInstruction.instructions.tokenLedgerInstruction
|
|
5733
|
+
) : null,
|
|
5734
|
+
closePositionIx,
|
|
5735
|
+
...jupiterIxs,
|
|
5736
|
+
repaySolIx,
|
|
5737
|
+
computeBudgetMicroLamports ? computeFeeIx : void 0
|
|
5738
|
+
].filter((i) => !!i);
|
|
5739
|
+
const messageV01 = new import_web32.TransactionMessage({
|
|
5740
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
5741
|
+
recentBlockhash: blockhash,
|
|
5742
|
+
instructions: setUpInstructions
|
|
5743
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
5744
|
+
const tx2 = new import_web32.VersionedTransaction(messageV01);
|
|
5745
|
+
const messageV02 = new import_web32.TransactionMessage({
|
|
5746
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
5747
|
+
recentBlockhash: blockhash,
|
|
5748
|
+
instructions: allInstructions2
|
|
5749
|
+
}).compileToV0Message(addressLookupTableAccounts);
|
|
5750
|
+
const tx22 = new import_web32.VersionedTransaction(messageV02);
|
|
5751
|
+
return [tx2, tx22];
|
|
5752
|
+
}
|
|
5644
5753
|
const allInstructions = [
|
|
5645
5754
|
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
5646
|
-
|
|
5755
|
+
createAssociatedTokenAccountInstruction2,
|
|
5647
5756
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
5648
5757
|
jupInstruction.instructions.tokenLedgerInstruction
|
|
5649
5758
|
) : null,
|
|
5650
|
-
toTokenAccount.instruction,
|
|
5651
5759
|
closePositionIx,
|
|
5652
5760
|
...jupiterIxs,
|
|
5653
5761
|
repaySolIx,
|
|
@@ -5770,7 +5878,17 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5770
5878
|
instructions: allInstructions
|
|
5771
5879
|
}).compileToV0Message();
|
|
5772
5880
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5773
|
-
return
|
|
5881
|
+
return {
|
|
5882
|
+
transaction: tx,
|
|
5883
|
+
newPositionAddresses: [
|
|
5884
|
+
newPosition1AccountPDA.toBase58(),
|
|
5885
|
+
newPosition2AccountPDA.toBase58()
|
|
5886
|
+
],
|
|
5887
|
+
newPositionSeeds: [
|
|
5888
|
+
newPosition1Seed.toBase58(),
|
|
5889
|
+
newPosition2Seed.toBase58()
|
|
5890
|
+
]
|
|
5891
|
+
};
|
|
5774
5892
|
});
|
|
5775
5893
|
var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5776
5894
|
const positionAccountPDA1 = position1.publicKey;
|