@lavarage/sdk 7.0.2 → 7.0.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 +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -4
- package/dist/index.mjs.map +1 -1
- package/index.ts +46 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3487,7 +3487,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3487
3487
|
swapInstruction: Record<string, unknown>;
|
|
3488
3488
|
addressLookupTableAddresses: string[];
|
|
3489
3489
|
};
|
|
3490
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3490
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3491
3491
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3492
3492
|
nodeWallet: PublicKey;
|
|
3493
3493
|
interestRate: number;
|
|
@@ -3498,7 +3498,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3498
3498
|
swapInstruction: Record<string, unknown>;
|
|
3499
3499
|
addressLookupTableAddresses: string[];
|
|
3500
3500
|
};
|
|
3501
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3501
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3502
3502
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3503
3503
|
pool: PublicKey;
|
|
3504
3504
|
seed: PublicKey;
|
|
@@ -3547,7 +3547,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
|
|
|
3547
3547
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3548
3548
|
};
|
|
3549
3549
|
quoteResponse: any;
|
|
3550
|
-
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3550
|
+
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3551
3551
|
declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
3552
3552
|
pool: PublicKey;
|
|
3553
3553
|
seed: PublicKey;
|
|
@@ -3566,7 +3566,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
3566
3566
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3567
3567
|
};
|
|
3568
3568
|
quoteResponse: any;
|
|
3569
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3569
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3570
3570
|
declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
|
|
3571
3571
|
parsed: {
|
|
3572
3572
|
tpPrice: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -3487,7 +3487,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
|
|
|
3487
3487
|
swapInstruction: Record<string, unknown>;
|
|
3488
3488
|
addressLookupTableAddresses: string[];
|
|
3489
3489
|
};
|
|
3490
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3490
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3491
3491
|
declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccount<{
|
|
3492
3492
|
nodeWallet: PublicKey;
|
|
3493
3493
|
interestRate: number;
|
|
@@ -3498,7 +3498,7 @@ declare const openTradeV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAc
|
|
|
3498
3498
|
swapInstruction: Record<string, unknown>;
|
|
3499
3499
|
addressLookupTableAddresses: string[];
|
|
3500
3500
|
};
|
|
3501
|
-
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3501
|
+
}, marginSOL: BN, leverage: number, randomSeed: Keypair, quoteToken: PublicKey, tokenProgram: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3502
3502
|
declare const createTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, position: ProgramAccount<{
|
|
3503
3503
|
pool: PublicKey;
|
|
3504
3504
|
seed: PublicKey;
|
|
@@ -3547,7 +3547,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
|
|
|
3547
3547
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3548
3548
|
};
|
|
3549
3549
|
quoteResponse: any;
|
|
3550
|
-
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3550
|
+
}, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3551
3551
|
declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
3552
3552
|
pool: PublicKey;
|
|
3553
3553
|
seed: PublicKey;
|
|
@@ -3566,7 +3566,7 @@ declare const closeTradeV2: (lavarageProgram: Program<Lavarage>, position: Progr
|
|
|
3566
3566
|
tokenLedgerInstruction?: Record<string, unknown>;
|
|
3567
3567
|
};
|
|
3568
3568
|
quoteResponse: any;
|
|
3569
|
-
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3569
|
+
}, quoteToken: PublicKey, partnerFeeRecipient?: PublicKey, partnerFeeMarkup?: number, computeBudgetMicroLamports?: number, platformFeeRecipient?: PublicKey) => Promise<VersionedTransaction>;
|
|
3570
3570
|
declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, userPubKey?: PublicKey) => Promise<{
|
|
3571
3571
|
parsed: {
|
|
3572
3572
|
tpPrice: any;
|
package/dist/index.js
CHANGED
|
@@ -4743,7 +4743,7 @@ var getLiquidatedPositions = (lavarageProgram) => {
|
|
|
4743
4743
|
var getAllPositions = (lavarageProgram) => {
|
|
4744
4744
|
return lavarageProgram.account.position.all([{ dataSize: 178 }]);
|
|
4745
4745
|
};
|
|
4746
|
-
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
4746
|
+
var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
4747
4747
|
let partnerFeeMarkupAsPkey;
|
|
4748
4748
|
if (partnerFeeMarkup) {
|
|
4749
4749
|
const feeBuffer = Buffer.alloc(8);
|
|
@@ -4769,6 +4769,12 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4769
4769
|
offer.account.collateralType,
|
|
4770
4770
|
tokenProgram
|
|
4771
4771
|
);
|
|
4772
|
+
const platformFeeRecipientAccount = platformFeeRecipient ? yield getTokenAccountOrCreateIfNotExists(
|
|
4773
|
+
lavarageProgram,
|
|
4774
|
+
platformFeeRecipient,
|
|
4775
|
+
offer.account.collateralType,
|
|
4776
|
+
tokenProgram
|
|
4777
|
+
) : void 0;
|
|
4772
4778
|
const tokenAccountCreationTx = new import_web32.Transaction();
|
|
4773
4779
|
if (fromTokenAccount.instruction) {
|
|
4774
4780
|
tokenAccountCreationTx.add(fromTokenAccount.instruction);
|
|
@@ -4776,6 +4782,9 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4776
4782
|
if (toTokenAccount.instruction) {
|
|
4777
4783
|
tokenAccountCreationTx.add(toTokenAccount.instruction);
|
|
4778
4784
|
}
|
|
4785
|
+
if (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) {
|
|
4786
|
+
tokenAccountCreationTx.add(platformFeeRecipientAccount.instruction);
|
|
4787
|
+
}
|
|
4779
4788
|
const instructionsJup = jupInstruction.instructions;
|
|
4780
4789
|
const {
|
|
4781
4790
|
setupInstructions,
|
|
@@ -4878,7 +4887,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4878
4887
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
4879
4888
|
return tx;
|
|
4880
4889
|
});
|
|
4881
|
-
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
4890
|
+
var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage, randomSeed, quoteToken, tokenProgram, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
4882
4891
|
let partnerFeeMarkupAsPkey;
|
|
4883
4892
|
if (partnerFeeMarkup) {
|
|
4884
4893
|
const feeBuffer = Buffer.alloc(8);
|
|
@@ -4906,6 +4915,12 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4906
4915
|
offer.account.collateralType,
|
|
4907
4916
|
tokenProgram
|
|
4908
4917
|
);
|
|
4918
|
+
const platformFeeRecipientAccount = platformFeeRecipient ? yield getTokenAccountOrCreateIfNotExists(
|
|
4919
|
+
lavarageProgram,
|
|
4920
|
+
platformFeeRecipient,
|
|
4921
|
+
offer.account.collateralType,
|
|
4922
|
+
tokenProgram
|
|
4923
|
+
) : void 0;
|
|
4909
4924
|
const tokenAccountCreationTx = new import_web32.Transaction();
|
|
4910
4925
|
if (fromTokenAccount.instruction) {
|
|
4911
4926
|
tokenAccountCreationTx.add(fromTokenAccount.instruction);
|
|
@@ -4913,6 +4928,9 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
|
|
|
4913
4928
|
if (toTokenAccount.instruction) {
|
|
4914
4929
|
tokenAccountCreationTx.add(toTokenAccount.instruction);
|
|
4915
4930
|
}
|
|
4931
|
+
if (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) {
|
|
4932
|
+
tokenAccountCreationTx.add(platformFeeRecipientAccount.instruction);
|
|
4933
|
+
}
|
|
4916
4934
|
const instructionsJup = jupInstruction.instructions;
|
|
4917
4935
|
const {
|
|
4918
4936
|
setupInstructions,
|
|
@@ -5200,7 +5218,7 @@ var partialRepayV2 = (lavarageProgram, position, repaymentBps) => __async(void 0
|
|
|
5200
5218
|
}).compileToV0Message();
|
|
5201
5219
|
return new import_web32.VersionedTransaction(messageV0);
|
|
5202
5220
|
});
|
|
5203
|
-
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5221
|
+
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
5204
5222
|
var _a, _b;
|
|
5205
5223
|
let partnerFeeMarkupAsPkey;
|
|
5206
5224
|
if (partnerFeeMarkup) {
|
|
@@ -5232,6 +5250,12 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
5232
5250
|
tokenAddressPubKey,
|
|
5233
5251
|
tokenProgram
|
|
5234
5252
|
);
|
|
5253
|
+
const platformFeeRecipientAccount = platformFeeRecipient ? yield getTokenAccountOrCreateIfNotExists(
|
|
5254
|
+
lavarageProgram,
|
|
5255
|
+
platformFeeRecipient,
|
|
5256
|
+
offer.account.collateralType,
|
|
5257
|
+
tokenProgram
|
|
5258
|
+
) : void 0;
|
|
5235
5259
|
const jupiterSellIx = jupInstruction.instructions;
|
|
5236
5260
|
const deserializeInstruction = (instruction) => {
|
|
5237
5261
|
return new import_web32.TransactionInstruction({
|
|
@@ -5363,6 +5387,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
5363
5387
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5364
5388
|
});
|
|
5365
5389
|
const allInstructions = [
|
|
5390
|
+
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
5366
5391
|
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? createAssociatedTokenAccountInstruction2 : null,
|
|
5367
5392
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
5368
5393
|
jupInstruction.instructions.tokenLedgerInstruction
|
|
@@ -5381,7 +5406,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
|
|
|
5381
5406
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5382
5407
|
return tx;
|
|
5383
5408
|
});
|
|
5384
|
-
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5409
|
+
var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup, computeBudgetMicroLamports, platformFeeRecipient) => __async(void 0, null, function* () {
|
|
5385
5410
|
var _a, _b;
|
|
5386
5411
|
let partnerFeeMarkupAsPkey;
|
|
5387
5412
|
if (partnerFeeMarkup) {
|
|
@@ -5415,6 +5440,12 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
5415
5440
|
tokenAddressPubKey,
|
|
5416
5441
|
tokenProgram
|
|
5417
5442
|
);
|
|
5443
|
+
const platformFeeRecipientAccount = platformFeeRecipient ? yield getTokenAccountOrCreateIfNotExists(
|
|
5444
|
+
lavarageProgram,
|
|
5445
|
+
platformFeeRecipient,
|
|
5446
|
+
offer.account.collateralType,
|
|
5447
|
+
tokenProgram
|
|
5448
|
+
) : void 0;
|
|
5418
5449
|
const jupiterSellIx = jupInstruction.instructions;
|
|
5419
5450
|
const deserializeInstruction = (instruction) => {
|
|
5420
5451
|
return new import_web32.TransactionInstruction({
|
|
@@ -5590,6 +5621,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
|
|
|
5590
5621
|
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5591
5622
|
});
|
|
5592
5623
|
const allInstructions = [
|
|
5624
|
+
jupInstruction.instructions && (platformFeeRecipientAccount == null ? void 0 : platformFeeRecipientAccount.instruction) ? platformFeeRecipientAccount.instruction : null,
|
|
5593
5625
|
((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? createAssociatedTokenAccountInstruction2 : null,
|
|
5594
5626
|
((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(
|
|
5595
5627
|
jupInstruction.instructions.tokenLedgerInstruction
|