@lavarage/sdk 6.8.8 → 6.8.9
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/abi/borrowerOperations.ts +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +54 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -20
- package/dist/index.mjs.map +1 -1
- package/evm.ts +2 -2
- package/index.ts +6 -4
- package/lending.ts +48 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export const borrowerOperationsAbi = [{"type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"buy","inputs":[{"name":"buyingCode","type":"bytes","internalType":"bytes"},{"name":"tokenCollateral","type":"address","internalType":"contract IERC20"},{"name":"borrowAmount","type":"uint256","internalType":"uint256"},{"name":"tokenHolder","type":"address","internalType":"contract TokenHolder"},{"name":"inchRouter","type":"address","internalType":"address"},{"name":"integratorFeeAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"initialize","inputs":[{"name":"_weth","type":"address","internalType":"contract IERC20"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"liquidate","inputs":[{"name":"loanId","type":"uint256","internalType":"uint256"},{"name":"tokenHolder","type":"address","internalType":"contract TokenHolder"},{"name":"closingPositionSize","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"loanRecords","inputs":[{"name":"","type":"address","internalType":"address"},{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"tokenHolder","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"openingFee","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"profitFee","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"sell","inputs":[{"name":"loanId","type":"uint256","internalType":"uint256"},{"name":"sellingCode","type":"bytes","internalType":"bytes"},{"name":"tokenHolder","type":"address","internalType":"contract TokenHolder"},{"name":"inchRouter","type":"address","internalType":"address"},{"name":"integratorFeeAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"setAdmin","inputs":[{"name":"_admin","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setOpeningFee","inputs":[{"name":"_openingFee","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setProfitFee","inputs":[{"name":"_profitFee","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"Buy","inputs":[{"name":"buyer","type":"address","indexed":true,"internalType":"address"},{"name":"tokenHolder","type":"address","indexed":true,"internalType":"address"},{"name":"tokenCollateral","type":"address","indexed":true,"internalType":"address"},{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"openingPositionSize","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"collateralAmount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"initialMargin","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"Liquidation","inputs":[{"name":"borrower","type":"address","indexed":true,"internalType":"address"},{"name":"tokenHolder","type":"address","indexed":true,"internalType":"address"},{"name":"tokenCollateral","type":"address","indexed":true,"internalType":"address"},{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"closingPositionSize","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"liquidatorRepaidAmount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Sell","inputs":[{"name":"buyer","type":"address","indexed":true,"internalType":"address"},{"name":"tokenHolder","type":"address","indexed":true,"internalType":"address"},{"name":"tokenCollateral","type":"address","indexed":true,"internalType":"address"},{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"closingPositionSize","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"profit","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"ReentrancyGuardReentrantCall","inputs":[]}]
|
|
1
|
+
export const borrowerOperationsAbi = [{ "type": "function", "name": "admin", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "buy", "inputs": [{ "name": "buyingCode", "type": "bytes", "internalType": "bytes" }, { "name": "tokenCollateral", "type": "address", "internalType": "contract IERC20" }, { "name": "borrowAmount", "type": "uint256", "internalType": "uint256" }, { "name": "tokenHolder", "type": "address", "internalType": "contract TokenHolder" }, { "name": "inchRouter", "type": "address", "internalType": "address" }, { "name": "integratorFeeAddress", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "initialize", "inputs": [{ "name": "_weth", "type": "address", "internalType": "contract IERC20" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "liquidate", "inputs": [{ "name": "loanId", "type": "uint256", "internalType": "uint256" }, { "name": "tokenHolder", "type": "address", "internalType": "contract TokenHolder" }, { "name": "closingPositionSize", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "loanRecords", "inputs": [{ "name": "", "type": "address", "internalType": "address" }, { "name": "", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "id", "type": "uint256", "internalType": "uint256" }, { "name": "tokenHolder", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "openingFee", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "profitFee", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "sell", "inputs": [{ "name": "loanId", "type": "uint256", "internalType": "uint256" }, { "name": "sellingCode", "type": "bytes", "internalType": "bytes" }, { "name": "tokenHolder", "type": "address", "internalType": "contract TokenHolder" }, { "name": "inchRouter", "type": "address", "internalType": "address" }, { "name": "integratorFeeAddress", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "setAdmin", "inputs": [{ "name": "_admin", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setOpeningFee", "inputs": [{ "name": "_openingFee", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setProfitFee", "inputs": [{ "name": "_profitFee", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "Buy", "inputs": [{ "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenHolder", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenCollateral", "type": "address", "indexed": true, "internalType": "address" }, { "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "openingPositionSize", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "collateralAmount", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "initialMargin", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Initialized", "inputs": [{ "name": "version", "type": "uint64", "indexed": false, "internalType": "uint64" }], "anonymous": false }, { "type": "event", "name": "Liquidation", "inputs": [{ "name": "borrower", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenHolder", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenCollateral", "type": "address", "indexed": true, "internalType": "address" }, { "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "closingPositionSize", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "liquidatorRepaidAmount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Sell", "inputs": [{ "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenHolder", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenCollateral", "type": "address", "indexed": true, "internalType": "address" }, { "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "closingPositionSize", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "profit", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "error", "name": "InvalidInitialization", "inputs": [] }, { "type": "error", "name": "NotInitializing", "inputs": [] }, { "type": "error", "name": "ReentrancyGuardReentrantCall", "inputs": [] }]
|
package/dist/index.d.mts
CHANGED
|
@@ -2859,11 +2859,13 @@ declare function depositFunds(lavarageProgram: Program<Lavarage$1>, params: {
|
|
|
2859
2859
|
mint?: string;
|
|
2860
2860
|
funder: PublicKey;
|
|
2861
2861
|
amount: number;
|
|
2862
|
+
computeBudgetMicroLamports?: number;
|
|
2862
2863
|
}): Promise<VersionedTransaction>;
|
|
2863
2864
|
declare function withdrawFundsV1(lavarageProgram: Program<Lavarage$1>, params: {
|
|
2864
2865
|
nodeWallet: PublicKey;
|
|
2865
2866
|
funder: PublicKey;
|
|
2866
2867
|
amount: number;
|
|
2868
|
+
computeBudgetMicroLamports?: number;
|
|
2867
2869
|
}): Promise<VersionedTransaction>;
|
|
2868
2870
|
declare function withdrawFundsV2(lavarageProgram: Program<Lavarage>, params: {
|
|
2869
2871
|
nodeWallet: PublicKey;
|
|
@@ -2872,6 +2874,7 @@ declare function withdrawFundsV2(lavarageProgram: Program<Lavarage>, params: {
|
|
|
2872
2874
|
amount: number;
|
|
2873
2875
|
fromTokenAccount?: PublicKey;
|
|
2874
2876
|
toTokenAccount?: PublicKey;
|
|
2877
|
+
computeBudgetMicroLamports?: number;
|
|
2875
2878
|
}): Promise<VersionedTransaction>;
|
|
2876
2879
|
declare function withdrawFunds(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2877
2880
|
nodeWallet: PublicKey;
|
|
@@ -2880,6 +2883,7 @@ declare function withdrawFunds(lavarageProgram: Program<Lavarage$1> | Program<La
|
|
|
2880
2883
|
mint?: string;
|
|
2881
2884
|
fromTokenAccount?: PublicKey;
|
|
2882
2885
|
toTokenAccount?: PublicKey;
|
|
2886
|
+
computeBudgetMicroLamports?: number;
|
|
2883
2887
|
}): Promise<VersionedTransaction>;
|
|
2884
2888
|
declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2885
2889
|
tradingPool: PublicKey;
|
|
@@ -2888,18 +2892,21 @@ declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
|
|
|
2888
2892
|
quoteMint: string;
|
|
2889
2893
|
interestRate: number;
|
|
2890
2894
|
maxExposure: number;
|
|
2895
|
+
computeBudgetMicroLamports?: number;
|
|
2891
2896
|
}): Promise<VersionedTransaction>;
|
|
2892
2897
|
declare function updateMaxExposure(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2893
2898
|
tradingPool: PublicKey;
|
|
2894
2899
|
nodeWallet: string;
|
|
2895
2900
|
poolOwner: PublicKey;
|
|
2896
2901
|
maxExposure: number;
|
|
2902
|
+
computeBudgetMicroLamports?: number;
|
|
2897
2903
|
}): Promise<VersionedTransaction>;
|
|
2898
2904
|
declare function updateInterestRate(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2899
2905
|
tradingPool: PublicKey;
|
|
2900
2906
|
nodeWallet: string;
|
|
2901
2907
|
poolOwner: PublicKey;
|
|
2902
2908
|
interestRate: number;
|
|
2909
|
+
computeBudgetMicroLamports?: number;
|
|
2903
2910
|
}): Promise<VersionedTransaction>;
|
|
2904
2911
|
declare function updateOffer(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2905
2912
|
tradingPool: PublicKey;
|
|
@@ -2908,6 +2915,7 @@ declare function updateOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
|
|
|
2908
2915
|
mint: string;
|
|
2909
2916
|
interestRate: number;
|
|
2910
2917
|
maxExposure: number;
|
|
2918
|
+
computeBudgetMicroLamports?: number;
|
|
2911
2919
|
}): Promise<VersionedTransaction>;
|
|
2912
2920
|
|
|
2913
2921
|
declare const lending_createOffer: typeof createOffer;
|
|
@@ -3108,7 +3116,7 @@ declare const splitPositionV2: (lavarageProgram: Program<Lavarage>, position: Pr
|
|
|
3108
3116
|
nodeWallet: PublicKey;
|
|
3109
3117
|
interestRate: number;
|
|
3110
3118
|
collateralType: PublicKey;
|
|
3111
|
-
}>, quoteToken: PublicKey, propotionBps: number) => Promise<VersionedTransaction>;
|
|
3119
|
+
}>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3112
3120
|
declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: ProgramAccount<{
|
|
3113
3121
|
pool: PublicKey;
|
|
3114
3122
|
seed: PublicKey;
|
|
@@ -3123,6 +3131,6 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3123
3131
|
nodeWallet: PublicKey;
|
|
3124
3132
|
interestRate: number;
|
|
3125
3133
|
collateralType: PublicKey;
|
|
3126
|
-
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
3134
|
+
}>, quoteToken: PublicKey, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3127
3135
|
|
|
3128
3136
|
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getActiveLoanCountEvm, getActiveLoansBatchEvm, getAllPositions, getAvailableExposureEvm, getClosedPositions, getClosedPositionsEvm, getCollateralExposureEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getLoansByBorrowerEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, lending, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.d.ts
CHANGED
|
@@ -2859,11 +2859,13 @@ declare function depositFunds(lavarageProgram: Program<Lavarage$1>, params: {
|
|
|
2859
2859
|
mint?: string;
|
|
2860
2860
|
funder: PublicKey;
|
|
2861
2861
|
amount: number;
|
|
2862
|
+
computeBudgetMicroLamports?: number;
|
|
2862
2863
|
}): Promise<VersionedTransaction>;
|
|
2863
2864
|
declare function withdrawFundsV1(lavarageProgram: Program<Lavarage$1>, params: {
|
|
2864
2865
|
nodeWallet: PublicKey;
|
|
2865
2866
|
funder: PublicKey;
|
|
2866
2867
|
amount: number;
|
|
2868
|
+
computeBudgetMicroLamports?: number;
|
|
2867
2869
|
}): Promise<VersionedTransaction>;
|
|
2868
2870
|
declare function withdrawFundsV2(lavarageProgram: Program<Lavarage>, params: {
|
|
2869
2871
|
nodeWallet: PublicKey;
|
|
@@ -2872,6 +2874,7 @@ declare function withdrawFundsV2(lavarageProgram: Program<Lavarage>, params: {
|
|
|
2872
2874
|
amount: number;
|
|
2873
2875
|
fromTokenAccount?: PublicKey;
|
|
2874
2876
|
toTokenAccount?: PublicKey;
|
|
2877
|
+
computeBudgetMicroLamports?: number;
|
|
2875
2878
|
}): Promise<VersionedTransaction>;
|
|
2876
2879
|
declare function withdrawFunds(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2877
2880
|
nodeWallet: PublicKey;
|
|
@@ -2880,6 +2883,7 @@ declare function withdrawFunds(lavarageProgram: Program<Lavarage$1> | Program<La
|
|
|
2880
2883
|
mint?: string;
|
|
2881
2884
|
fromTokenAccount?: PublicKey;
|
|
2882
2885
|
toTokenAccount?: PublicKey;
|
|
2886
|
+
computeBudgetMicroLamports?: number;
|
|
2883
2887
|
}): Promise<VersionedTransaction>;
|
|
2884
2888
|
declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2885
2889
|
tradingPool: PublicKey;
|
|
@@ -2888,18 +2892,21 @@ declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
|
|
|
2888
2892
|
quoteMint: string;
|
|
2889
2893
|
interestRate: number;
|
|
2890
2894
|
maxExposure: number;
|
|
2895
|
+
computeBudgetMicroLamports?: number;
|
|
2891
2896
|
}): Promise<VersionedTransaction>;
|
|
2892
2897
|
declare function updateMaxExposure(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2893
2898
|
tradingPool: PublicKey;
|
|
2894
2899
|
nodeWallet: string;
|
|
2895
2900
|
poolOwner: PublicKey;
|
|
2896
2901
|
maxExposure: number;
|
|
2902
|
+
computeBudgetMicroLamports?: number;
|
|
2897
2903
|
}): Promise<VersionedTransaction>;
|
|
2898
2904
|
declare function updateInterestRate(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2899
2905
|
tradingPool: PublicKey;
|
|
2900
2906
|
nodeWallet: string;
|
|
2901
2907
|
poolOwner: PublicKey;
|
|
2902
2908
|
interestRate: number;
|
|
2909
|
+
computeBudgetMicroLamports?: number;
|
|
2903
2910
|
}): Promise<VersionedTransaction>;
|
|
2904
2911
|
declare function updateOffer(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
2905
2912
|
tradingPool: PublicKey;
|
|
@@ -2908,6 +2915,7 @@ declare function updateOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
|
|
|
2908
2915
|
mint: string;
|
|
2909
2916
|
interestRate: number;
|
|
2910
2917
|
maxExposure: number;
|
|
2918
|
+
computeBudgetMicroLamports?: number;
|
|
2911
2919
|
}): Promise<VersionedTransaction>;
|
|
2912
2920
|
|
|
2913
2921
|
declare const lending_createOffer: typeof createOffer;
|
|
@@ -3108,7 +3116,7 @@ declare const splitPositionV2: (lavarageProgram: Program<Lavarage>, position: Pr
|
|
|
3108
3116
|
nodeWallet: PublicKey;
|
|
3109
3117
|
interestRate: number;
|
|
3110
3118
|
collateralType: PublicKey;
|
|
3111
|
-
}>, quoteToken: PublicKey, propotionBps: number) => Promise<VersionedTransaction>;
|
|
3119
|
+
}>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3112
3120
|
declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: ProgramAccount<{
|
|
3113
3121
|
pool: PublicKey;
|
|
3114
3122
|
seed: PublicKey;
|
|
@@ -3123,6 +3131,6 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3123
3131
|
nodeWallet: PublicKey;
|
|
3124
3132
|
interestRate: number;
|
|
3125
3133
|
collateralType: PublicKey;
|
|
3126
|
-
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
3134
|
+
}>, quoteToken: PublicKey, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3127
3135
|
|
|
3128
3136
|
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getActiveLoanCountEvm, getActiveLoansBatchEvm, getAllPositions, getAvailableExposureEvm, getClosedPositions, getClosedPositionsEvm, getCollateralExposureEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getLoansByBorrowerEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, lending, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.js
CHANGED
|
@@ -886,12 +886,12 @@ function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
|
886
886
|
}
|
|
887
887
|
return Promise.all(
|
|
888
888
|
allEvents.map((event) => __async(this, null, function* () {
|
|
889
|
-
const { buyer, tokenCollateral, loanId, closingPositionSize, profit } = event.args;
|
|
889
|
+
const { buyer, tokenHolder, tokenCollateral, loanId, closingPositionSize, profit } = event.args;
|
|
890
890
|
const block = yield provider.getBlock(event.blockNumber);
|
|
891
891
|
const timestamp = block ? Number(block.timestamp) : 0;
|
|
892
892
|
return {
|
|
893
893
|
trader: buyer,
|
|
894
|
-
tokenCollateral,
|
|
894
|
+
tokenCollateral: tokenHolder,
|
|
895
895
|
loanId,
|
|
896
896
|
closingPositionSize,
|
|
897
897
|
profit,
|
|
@@ -1135,9 +1135,6 @@ function getTradingPoolPDA(poolOwnerPublicKey, tokenPublicKey, programId) {
|
|
|
1135
1135
|
programId
|
|
1136
1136
|
);
|
|
1137
1137
|
}
|
|
1138
|
-
var computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1139
|
-
microLamports: 15e4
|
|
1140
|
-
});
|
|
1141
1138
|
function createNodeWallet(lavarageProgram, params) {
|
|
1142
1139
|
return __async(this, null, function* () {
|
|
1143
1140
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
@@ -1171,9 +1168,13 @@ function createNodeWallet(lavarageProgram, params) {
|
|
|
1171
1168
|
}
|
|
1172
1169
|
function depositFunds(lavarageProgram, params) {
|
|
1173
1170
|
return __async(this, null, function* () {
|
|
1171
|
+
var _a, _b, _c;
|
|
1174
1172
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1175
1173
|
let instruction;
|
|
1176
1174
|
if (params.mint === void 0) {
|
|
1175
|
+
const computeFeeIx2 = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1176
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1177
|
+
});
|
|
1177
1178
|
instruction = yield lavarageProgram.methods.lpOperatorFundNodeWallet(new import_anchor.BN(params.amount)).accounts({
|
|
1178
1179
|
nodeWallet: params.nodeWallet,
|
|
1179
1180
|
funder: params.funder,
|
|
@@ -1190,6 +1191,9 @@ function depositFunds(lavarageProgram, params) {
|
|
|
1190
1191
|
"confirmed",
|
|
1191
1192
|
mintOwner == null ? void 0 : mintOwner.owner
|
|
1192
1193
|
);
|
|
1194
|
+
const computeFeeIx2 = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1195
|
+
microLamports: (_b = params.computeBudgetMicroLamports) != null ? _b : 15e4
|
|
1196
|
+
});
|
|
1193
1197
|
instruction = (0, import_spl_token.createTransferCheckedInstruction)(
|
|
1194
1198
|
(0, import_spl_token.getAssociatedTokenAddressSync)(
|
|
1195
1199
|
mintPubkey,
|
|
@@ -1211,6 +1215,9 @@ function depositFunds(lavarageProgram, params) {
|
|
|
1211
1215
|
mintOwner == null ? void 0 : mintOwner.owner
|
|
1212
1216
|
);
|
|
1213
1217
|
}
|
|
1218
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1219
|
+
microLamports: (_c = params.computeBudgetMicroLamports) != null ? _c : 15e4
|
|
1220
|
+
});
|
|
1214
1221
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1215
1222
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1216
1223
|
recentBlockhash: blockhash,
|
|
@@ -1221,12 +1228,16 @@ function depositFunds(lavarageProgram, params) {
|
|
|
1221
1228
|
}
|
|
1222
1229
|
function withdrawFundsV1(lavarageProgram, params) {
|
|
1223
1230
|
return __async(this, null, function* () {
|
|
1231
|
+
var _a;
|
|
1224
1232
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1225
1233
|
const instruction = yield lavarageProgram.methods.lpOperatorWithdrawFromNodeWallet(new import_anchor.BN(params.amount)).accounts({
|
|
1226
1234
|
nodeWallet: params.nodeWallet,
|
|
1227
1235
|
funder: params.funder,
|
|
1228
1236
|
systemProgram: import_web3.SystemProgram.programId
|
|
1229
1237
|
}).instruction();
|
|
1238
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1239
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1240
|
+
});
|
|
1230
1241
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1231
1242
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1232
1243
|
recentBlockhash: blockhash,
|
|
@@ -1237,6 +1248,7 @@ function withdrawFundsV1(lavarageProgram, params) {
|
|
|
1237
1248
|
}
|
|
1238
1249
|
function withdrawFundsV2(lavarageProgram, params) {
|
|
1239
1250
|
return __async(this, null, function* () {
|
|
1251
|
+
var _a;
|
|
1240
1252
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1241
1253
|
const mintPubkey = new import_web3.PublicKey(params.mint);
|
|
1242
1254
|
const fromTokenAccount = params.fromTokenAccount || (0, import_spl_token.getAssociatedTokenAddressSync)(mintPubkey, params.nodeWallet, true);
|
|
@@ -1250,6 +1262,9 @@ function withdrawFundsV2(lavarageProgram, params) {
|
|
|
1250
1262
|
toTokenAccount,
|
|
1251
1263
|
tokenProgram: import_spl_token.TOKEN_PROGRAM_ID
|
|
1252
1264
|
}).instruction();
|
|
1265
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1266
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1267
|
+
});
|
|
1253
1268
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1254
1269
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1255
1270
|
recentBlockhash: blockhash,
|
|
@@ -1267,19 +1282,22 @@ function withdrawFunds(lavarageProgram, params) {
|
|
|
1267
1282
|
mint: params.mint,
|
|
1268
1283
|
amount: params.amount,
|
|
1269
1284
|
fromTokenAccount: params.fromTokenAccount,
|
|
1270
|
-
toTokenAccount: params.toTokenAccount
|
|
1285
|
+
toTokenAccount: params.toTokenAccount,
|
|
1286
|
+
computeBudgetMicroLamports: params.computeBudgetMicroLamports
|
|
1271
1287
|
});
|
|
1272
1288
|
} else {
|
|
1273
1289
|
return withdrawFundsV1(lavarageProgram, {
|
|
1274
1290
|
nodeWallet: params.nodeWallet,
|
|
1275
1291
|
funder: params.funder,
|
|
1276
|
-
amount: params.amount
|
|
1292
|
+
amount: params.amount,
|
|
1293
|
+
computeBudgetMicroLamports: params.computeBudgetMicroLamports
|
|
1277
1294
|
});
|
|
1278
1295
|
}
|
|
1279
1296
|
});
|
|
1280
1297
|
}
|
|
1281
1298
|
function createOffer(lavarageProgram, params) {
|
|
1282
1299
|
return __async(this, null, function* () {
|
|
1300
|
+
var _a;
|
|
1283
1301
|
let nodeWalletAccount, nodeWalletSigner, createNodeWalletInstruction, nodeWalletPubKey;
|
|
1284
1302
|
if (params.quoteMint === "So11111111111111111111111111111111111111112") {
|
|
1285
1303
|
const nodeWallets = yield lavarageProgram.account.nodeWallet.all();
|
|
@@ -1333,6 +1351,9 @@ function createOffer(lavarageProgram, params) {
|
|
|
1333
1351
|
operator: params.poolOwner,
|
|
1334
1352
|
systemProgram: import_web3.SystemProgram.programId
|
|
1335
1353
|
}).instruction();
|
|
1354
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1355
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1356
|
+
});
|
|
1336
1357
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1337
1358
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1338
1359
|
recentBlockhash: blockhash,
|
|
@@ -1353,6 +1374,7 @@ function createOffer(lavarageProgram, params) {
|
|
|
1353
1374
|
}
|
|
1354
1375
|
function updateMaxExposure(lavarageProgram, params) {
|
|
1355
1376
|
return __async(this, null, function* () {
|
|
1377
|
+
var _a;
|
|
1356
1378
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1357
1379
|
const instruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
|
|
1358
1380
|
tradingPool: params.tradingPool,
|
|
@@ -1360,16 +1382,20 @@ function updateMaxExposure(lavarageProgram, params) {
|
|
|
1360
1382
|
operator: params.poolOwner,
|
|
1361
1383
|
systemProgram: import_web3.SystemProgram.programId
|
|
1362
1384
|
}).instruction();
|
|
1385
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1386
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1387
|
+
});
|
|
1363
1388
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1364
1389
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1365
1390
|
recentBlockhash: blockhash,
|
|
1366
|
-
instructions: [instruction]
|
|
1391
|
+
instructions: [instruction, computeFeeIx]
|
|
1367
1392
|
}).compileToV0Message();
|
|
1368
1393
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1369
1394
|
});
|
|
1370
1395
|
}
|
|
1371
1396
|
function updateInterestRate(lavarageProgram, params) {
|
|
1372
1397
|
return __async(this, null, function* () {
|
|
1398
|
+
var _a;
|
|
1373
1399
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1374
1400
|
const instruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(new import_anchor.BN(params.interestRate)).accounts({
|
|
1375
1401
|
tradingPool: params.tradingPool,
|
|
@@ -1377,16 +1403,20 @@ function updateInterestRate(lavarageProgram, params) {
|
|
|
1377
1403
|
operator: params.poolOwner,
|
|
1378
1404
|
systemProgram: import_web3.SystemProgram.programId
|
|
1379
1405
|
}).instruction();
|
|
1406
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1407
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1408
|
+
});
|
|
1380
1409
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1381
1410
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1382
1411
|
recentBlockhash: blockhash,
|
|
1383
|
-
instructions: [instruction]
|
|
1412
|
+
instructions: [instruction, computeFeeIx]
|
|
1384
1413
|
}).compileToV0Message();
|
|
1385
1414
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1386
1415
|
});
|
|
1387
1416
|
}
|
|
1388
1417
|
function updateOffer(lavarageProgram, params) {
|
|
1389
1418
|
return __async(this, null, function* () {
|
|
1419
|
+
var _a;
|
|
1390
1420
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1391
1421
|
const instructions = [];
|
|
1392
1422
|
const updateMaxExposureInstruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
|
|
@@ -1401,9 +1431,13 @@ function updateOffer(lavarageProgram, params) {
|
|
|
1401
1431
|
operator: params.poolOwner,
|
|
1402
1432
|
systemProgram: import_web3.SystemProgram.programId
|
|
1403
1433
|
}).instruction();
|
|
1434
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1435
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1436
|
+
});
|
|
1404
1437
|
instructions.push(
|
|
1405
1438
|
updateMaxExposureInstruction,
|
|
1406
|
-
updateInterestRateInstruction
|
|
1439
|
+
updateInterestRateInstruction,
|
|
1440
|
+
computeFeeIx
|
|
1407
1441
|
);
|
|
1408
1442
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1409
1443
|
payerKey: lavarageProgram.provider.publicKey,
|
|
@@ -4473,13 +4507,13 @@ var createTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
4473
4507
|
}
|
|
4474
4508
|
] : []
|
|
4475
4509
|
).instruction();
|
|
4476
|
-
const
|
|
4510
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4477
4511
|
microLamports: prioFee.toNumber()
|
|
4478
4512
|
});
|
|
4479
4513
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4480
4514
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4481
4515
|
recentBlockhash: blockhash,
|
|
4482
|
-
instructions: [ix,
|
|
4516
|
+
instructions: [ix, computeFeeIx].filter(Boolean)
|
|
4483
4517
|
}).compileToV0Message();
|
|
4484
4518
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4485
4519
|
});
|
|
@@ -4518,13 +4552,13 @@ var modifyTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
4518
4552
|
}
|
|
4519
4553
|
] : []
|
|
4520
4554
|
).instruction();
|
|
4521
|
-
const
|
|
4555
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4522
4556
|
microLamports: prioFee.toNumber()
|
|
4523
4557
|
});
|
|
4524
4558
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4525
4559
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4526
4560
|
recentBlockhash: blockhash,
|
|
4527
|
-
instructions: [removeIx, ix,
|
|
4561
|
+
instructions: [removeIx, ix, computeFeeIx].filter(Boolean)
|
|
4528
4562
|
}).compileToV0Message();
|
|
4529
4563
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4530
4564
|
});
|
|
@@ -4540,13 +4574,13 @@ var removeTpDelegate = (lavarageProgram, position, prioFee) => __async(void 0, n
|
|
|
4540
4574
|
delegatedAccount: position.publicKey,
|
|
4541
4575
|
systemProgram: import_web32.SystemProgram.programId
|
|
4542
4576
|
}).instruction();
|
|
4543
|
-
const
|
|
4577
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4544
4578
|
microLamports: prioFee.toNumber()
|
|
4545
4579
|
});
|
|
4546
4580
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4547
4581
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4548
4582
|
recentBlockhash: blockhash,
|
|
4549
|
-
instructions: [removeIx,
|
|
4583
|
+
instructions: [removeIx, computeFeeIx].filter(Boolean)
|
|
4550
4584
|
}).compileToV0Message();
|
|
4551
4585
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4552
4586
|
});
|
|
@@ -5034,7 +5068,7 @@ var getQuoteCurrencySpecificAddressLookupTable = (quoteCurrency) => {
|
|
|
5034
5068
|
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
5035
5069
|
}
|
|
5036
5070
|
};
|
|
5037
|
-
var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBps) => __async(void 0, null, function* () {
|
|
5071
|
+
var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBps, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5038
5072
|
const positionAccountPDA = position.publicKey;
|
|
5039
5073
|
const newPosition1Seed = import_web32.Keypair.generate().publicKey;
|
|
5040
5074
|
const newPosition2Seed = import_web32.Keypair.generate().publicKey;
|
|
@@ -5100,7 +5134,7 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5100
5134
|
newPositionTokenAccountTwo: newPosition2TokenAccount
|
|
5101
5135
|
}).instruction();
|
|
5102
5136
|
const computeBudgetIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5103
|
-
microLamports: 1e5
|
|
5137
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5104
5138
|
});
|
|
5105
5139
|
const allInstructions = [
|
|
5106
5140
|
createNewPosition1TokenAccountIx,
|
|
@@ -5117,7 +5151,7 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5117
5151
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5118
5152
|
return tx;
|
|
5119
5153
|
});
|
|
5120
|
-
var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken) => __async(void 0, null, function* () {
|
|
5154
|
+
var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5121
5155
|
const positionAccountPDA1 = position1.publicKey;
|
|
5122
5156
|
const positionAccountPDA2 = position2.publicKey;
|
|
5123
5157
|
const newPositionSeed = import_web32.Keypair.generate().publicKey;
|
|
@@ -5166,7 +5200,7 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken)
|
|
|
5166
5200
|
mergedPositionTokenAccount: newPositionTokenAccount
|
|
5167
5201
|
}).instruction();
|
|
5168
5202
|
const computeBudgetIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5169
|
-
microLamports: 1e5
|
|
5203
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5170
5204
|
});
|
|
5171
5205
|
const allInstructions = [
|
|
5172
5206
|
createNewPositionTokenAccountIx,
|