@lavarage/sdk 6.0.3 → 6.1.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 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -1
- package/dist/index.mjs.map +1 -1
- package/index.ts +66 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2470,6 +2470,18 @@ declare const removeTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<
|
|
|
2470
2470
|
userPaid: BN;
|
|
2471
2471
|
amount: BN;
|
|
2472
2472
|
}>, prioFee: BN) => Promise<VersionedTransaction>;
|
|
2473
|
+
declare const partialRepayV1: (lavarageProgram: Program<Lavarage$1>, position: ProgramAccount<{
|
|
2474
|
+
pool: PublicKey;
|
|
2475
|
+
seed: PublicKey;
|
|
2476
|
+
userPaid: BN;
|
|
2477
|
+
amount: BN;
|
|
2478
|
+
}>, repaymentBps: number) => Promise<VersionedTransaction>;
|
|
2479
|
+
declare const partialRepayV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
2480
|
+
pool: PublicKey;
|
|
2481
|
+
seed: PublicKey;
|
|
2482
|
+
userPaid: BN;
|
|
2483
|
+
amount: BN;
|
|
2484
|
+
}>, repaymentBps: number) => Promise<VersionedTransaction>;
|
|
2473
2485
|
declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: ProgramAccount<{
|
|
2474
2486
|
pool: PublicKey;
|
|
2475
2487
|
seed: PublicKey;
|
|
@@ -2525,4 +2537,4 @@ declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Progr
|
|
|
2525
2537
|
};
|
|
2526
2538
|
}[]>;
|
|
2527
2539
|
|
|
2528
|
-
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getDelegateAccounts, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, removeTpDelegate };
|
|
2540
|
+
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getDelegateAccounts, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate };
|
package/dist/index.d.ts
CHANGED
|
@@ -2470,6 +2470,18 @@ declare const removeTpDelegate: (lavarageProgram: Program<Lavarage$1> | Program<
|
|
|
2470
2470
|
userPaid: BN;
|
|
2471
2471
|
amount: BN;
|
|
2472
2472
|
}>, prioFee: BN) => Promise<VersionedTransaction>;
|
|
2473
|
+
declare const partialRepayV1: (lavarageProgram: Program<Lavarage$1>, position: ProgramAccount<{
|
|
2474
|
+
pool: PublicKey;
|
|
2475
|
+
seed: PublicKey;
|
|
2476
|
+
userPaid: BN;
|
|
2477
|
+
amount: BN;
|
|
2478
|
+
}>, repaymentBps: number) => Promise<VersionedTransaction>;
|
|
2479
|
+
declare const partialRepayV2: (lavarageProgram: Program<Lavarage>, position: ProgramAccount<{
|
|
2480
|
+
pool: PublicKey;
|
|
2481
|
+
seed: PublicKey;
|
|
2482
|
+
userPaid: BN;
|
|
2483
|
+
amount: BN;
|
|
2484
|
+
}>, repaymentBps: number) => Promise<VersionedTransaction>;
|
|
2473
2485
|
declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: ProgramAccount<{
|
|
2474
2486
|
pool: PublicKey;
|
|
2475
2487
|
seed: PublicKey;
|
|
@@ -2525,4 +2537,4 @@ declare const getDelegateAccounts: (lavarageProgram: Program<Lavarage$1> | Progr
|
|
|
2525
2537
|
};
|
|
2526
2538
|
}[]>;
|
|
2527
2539
|
|
|
2528
|
-
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getDelegateAccounts, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, removeTpDelegate };
|
|
2540
|
+
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closeTradeV1, closeTradeV2, createTpDelegate, getAllPositions, getClosedPositions, getDelegateAccounts, getLiquidatedPositions, getOffers, getOpenPositions, getPda, getPositionAccountPDA, modifyTpDelegate, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate };
|
package/dist/index.js
CHANGED
|
@@ -83,6 +83,8 @@ __export(index_exports, {
|
|
|
83
83
|
modifyTpDelegate: () => modifyTpDelegate,
|
|
84
84
|
openTradeV1: () => openTradeV1,
|
|
85
85
|
openTradeV2: () => openTradeV2,
|
|
86
|
+
partialRepayV1: () => partialRepayV1,
|
|
87
|
+
partialRepayV2: () => partialRepayV2,
|
|
86
88
|
removeTpDelegate: () => removeTpDelegate
|
|
87
89
|
});
|
|
88
90
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -2814,6 +2816,52 @@ var removeTpDelegate = (lavarageProgram, position, prioFee) => __async(void 0, n
|
|
|
2814
2816
|
}).compileToV0Message();
|
|
2815
2817
|
return new import_web3.VersionedTransaction(messageV0);
|
|
2816
2818
|
});
|
|
2819
|
+
var partialRepayV1 = (lavarageProgram, position, repaymentBps) => __async(void 0, null, function* () {
|
|
2820
|
+
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
2821
|
+
const pool = yield lavarageProgram.account.pool.fetch(position.account.pool);
|
|
2822
|
+
const positionAccountPDA = position.publicKey;
|
|
2823
|
+
const ix = yield lavarageProgram.methods.tradingClosePartialRepaySol(new import_anchor.BN(repaymentBps)).accountsStrict({
|
|
2824
|
+
systemProgram: import_web3.SystemProgram.programId,
|
|
2825
|
+
positionAccount: positionAccountPDA,
|
|
2826
|
+
tradingPool: position.account.pool,
|
|
2827
|
+
nodeWallet: pool.nodeWallet,
|
|
2828
|
+
trader: lavarageProgram.provider.publicKey,
|
|
2829
|
+
clock: import_web3.SYSVAR_CLOCK_PUBKEY,
|
|
2830
|
+
randomAccountAsId: position.account.seed,
|
|
2831
|
+
feeReceipient: "6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"
|
|
2832
|
+
}).instruction();
|
|
2833
|
+
const messageV0 = new import_web3.TransactionMessage({
|
|
2834
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
2835
|
+
recentBlockhash: blockhash,
|
|
2836
|
+
instructions: [ix]
|
|
2837
|
+
}).compileToV0Message();
|
|
2838
|
+
return new import_web3.VersionedTransaction(messageV0);
|
|
2839
|
+
});
|
|
2840
|
+
var partialRepayV2 = (lavarageProgram, position, repaymentBps) => __async(void 0, null, function* () {
|
|
2841
|
+
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
2842
|
+
const pool = yield lavarageProgram.account.pool.fetch(position.account.pool);
|
|
2843
|
+
const positionAccountPDA = position.publicKey;
|
|
2844
|
+
const ix = yield lavarageProgram.methods.tradingPartialRepaySol(new import_anchor.BN(repaymentBps)).accountsStrict({
|
|
2845
|
+
systemProgram: import_web3.SystemProgram.programId,
|
|
2846
|
+
positionAccount: positionAccountPDA,
|
|
2847
|
+
tradingPool: position.account.pool,
|
|
2848
|
+
nodeWallet: pool.nodeWallet,
|
|
2849
|
+
trader: lavarageProgram.provider.publicKey,
|
|
2850
|
+
clock: import_web3.SYSVAR_CLOCK_PUBKEY,
|
|
2851
|
+
randomAccountAsId: position.account.seed,
|
|
2852
|
+
fromTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(pool.qtType, lavarageProgram.provider.publicKey),
|
|
2853
|
+
toTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(pool.qtType, pool.nodeWallet),
|
|
2854
|
+
mint: pool.qtType,
|
|
2855
|
+
feeTokenAccount: (0, import_spl_token.getAssociatedTokenAddressSync)(pool.qtType, new import_web3.PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF")),
|
|
2856
|
+
tokenProgram: import_spl_token.TOKEN_PROGRAM_ID
|
|
2857
|
+
}).instruction();
|
|
2858
|
+
const messageV0 = new import_web3.TransactionMessage({
|
|
2859
|
+
payerKey: lavarageProgram.provider.publicKey,
|
|
2860
|
+
recentBlockhash: blockhash,
|
|
2861
|
+
instructions: [ix]
|
|
2862
|
+
}).compileToV0Message();
|
|
2863
|
+
return new import_web3.VersionedTransaction(messageV0);
|
|
2864
|
+
});
|
|
2817
2865
|
var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, profitFeeMarkup) => __async(void 0, null, function* () {
|
|
2818
2866
|
if (position.account.pool.toBase58() != offer.publicKey.toBase58()) throw "Mismatch offer";
|
|
2819
2867
|
const pool = offer;
|
|
@@ -3083,6 +3131,8 @@ var getDelegateAccounts = (lavarageProgram, userPubKey) => __async(void 0, null,
|
|
|
3083
3131
|
modifyTpDelegate,
|
|
3084
3132
|
openTradeV1,
|
|
3085
3133
|
openTradeV2,
|
|
3134
|
+
partialRepayV1,
|
|
3135
|
+
partialRepayV2,
|
|
3086
3136
|
removeTpDelegate
|
|
3087
3137
|
});
|
|
3088
3138
|
//# sourceMappingURL=index.js.map
|