@lavarage/sdk 6.8.7 → 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 +55 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -24
- package/dist/index.mjs.map +1 -1
- package/evm.ts +2 -2
- package/index.ts +6 -4
- package/lending.ts +49 -11
- 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,
|
|
@@ -1345,10 +1366,7 @@ function createOffer(lavarageProgram, params) {
|
|
|
1345
1366
|
}).compileToV0Message();
|
|
1346
1367
|
if (nodeWalletSigner) {
|
|
1347
1368
|
const transaction = new import_web3.VersionedTransaction(messageV0);
|
|
1348
|
-
transaction.
|
|
1349
|
-
nodeWalletSigner.publicKey,
|
|
1350
|
-
nodeWalletSigner.secretKey
|
|
1351
|
-
);
|
|
1369
|
+
transaction.sign([nodeWalletSigner]);
|
|
1352
1370
|
return transaction;
|
|
1353
1371
|
}
|
|
1354
1372
|
return new import_web3.VersionedTransaction(messageV0);
|
|
@@ -1356,6 +1374,7 @@ function createOffer(lavarageProgram, params) {
|
|
|
1356
1374
|
}
|
|
1357
1375
|
function updateMaxExposure(lavarageProgram, params) {
|
|
1358
1376
|
return __async(this, null, function* () {
|
|
1377
|
+
var _a;
|
|
1359
1378
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1360
1379
|
const instruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
|
|
1361
1380
|
tradingPool: params.tradingPool,
|
|
@@ -1363,16 +1382,20 @@ function updateMaxExposure(lavarageProgram, params) {
|
|
|
1363
1382
|
operator: params.poolOwner,
|
|
1364
1383
|
systemProgram: import_web3.SystemProgram.programId
|
|
1365
1384
|
}).instruction();
|
|
1385
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1386
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1387
|
+
});
|
|
1366
1388
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1367
1389
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1368
1390
|
recentBlockhash: blockhash,
|
|
1369
|
-
instructions: [instruction]
|
|
1391
|
+
instructions: [instruction, computeFeeIx]
|
|
1370
1392
|
}).compileToV0Message();
|
|
1371
1393
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1372
1394
|
});
|
|
1373
1395
|
}
|
|
1374
1396
|
function updateInterestRate(lavarageProgram, params) {
|
|
1375
1397
|
return __async(this, null, function* () {
|
|
1398
|
+
var _a;
|
|
1376
1399
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1377
1400
|
const instruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(new import_anchor.BN(params.interestRate)).accounts({
|
|
1378
1401
|
tradingPool: params.tradingPool,
|
|
@@ -1380,16 +1403,20 @@ function updateInterestRate(lavarageProgram, params) {
|
|
|
1380
1403
|
operator: params.poolOwner,
|
|
1381
1404
|
systemProgram: import_web3.SystemProgram.programId
|
|
1382
1405
|
}).instruction();
|
|
1406
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1407
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1408
|
+
});
|
|
1383
1409
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1384
1410
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1385
1411
|
recentBlockhash: blockhash,
|
|
1386
|
-
instructions: [instruction]
|
|
1412
|
+
instructions: [instruction, computeFeeIx]
|
|
1387
1413
|
}).compileToV0Message();
|
|
1388
1414
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1389
1415
|
});
|
|
1390
1416
|
}
|
|
1391
1417
|
function updateOffer(lavarageProgram, params) {
|
|
1392
1418
|
return __async(this, null, function* () {
|
|
1419
|
+
var _a;
|
|
1393
1420
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1394
1421
|
const instructions = [];
|
|
1395
1422
|
const updateMaxExposureInstruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
|
|
@@ -1404,9 +1431,13 @@ function updateOffer(lavarageProgram, params) {
|
|
|
1404
1431
|
operator: params.poolOwner,
|
|
1405
1432
|
systemProgram: import_web3.SystemProgram.programId
|
|
1406
1433
|
}).instruction();
|
|
1434
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1435
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1436
|
+
});
|
|
1407
1437
|
instructions.push(
|
|
1408
1438
|
updateMaxExposureInstruction,
|
|
1409
|
-
updateInterestRateInstruction
|
|
1439
|
+
updateInterestRateInstruction,
|
|
1440
|
+
computeFeeIx
|
|
1410
1441
|
);
|
|
1411
1442
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1412
1443
|
payerKey: lavarageProgram.provider.publicKey,
|
|
@@ -4476,13 +4507,13 @@ var createTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
4476
4507
|
}
|
|
4477
4508
|
] : []
|
|
4478
4509
|
).instruction();
|
|
4479
|
-
const
|
|
4510
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4480
4511
|
microLamports: prioFee.toNumber()
|
|
4481
4512
|
});
|
|
4482
4513
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4483
4514
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4484
4515
|
recentBlockhash: blockhash,
|
|
4485
|
-
instructions: [ix,
|
|
4516
|
+
instructions: [ix, computeFeeIx].filter(Boolean)
|
|
4486
4517
|
}).compileToV0Message();
|
|
4487
4518
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4488
4519
|
});
|
|
@@ -4521,13 +4552,13 @@ var modifyTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
4521
4552
|
}
|
|
4522
4553
|
] : []
|
|
4523
4554
|
).instruction();
|
|
4524
|
-
const
|
|
4555
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4525
4556
|
microLamports: prioFee.toNumber()
|
|
4526
4557
|
});
|
|
4527
4558
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4528
4559
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4529
4560
|
recentBlockhash: blockhash,
|
|
4530
|
-
instructions: [removeIx, ix,
|
|
4561
|
+
instructions: [removeIx, ix, computeFeeIx].filter(Boolean)
|
|
4531
4562
|
}).compileToV0Message();
|
|
4532
4563
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4533
4564
|
});
|
|
@@ -4543,13 +4574,13 @@ var removeTpDelegate = (lavarageProgram, position, prioFee) => __async(void 0, n
|
|
|
4543
4574
|
delegatedAccount: position.publicKey,
|
|
4544
4575
|
systemProgram: import_web32.SystemProgram.programId
|
|
4545
4576
|
}).instruction();
|
|
4546
|
-
const
|
|
4577
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4547
4578
|
microLamports: prioFee.toNumber()
|
|
4548
4579
|
});
|
|
4549
4580
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4550
4581
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4551
4582
|
recentBlockhash: blockhash,
|
|
4552
|
-
instructions: [removeIx,
|
|
4583
|
+
instructions: [removeIx, computeFeeIx].filter(Boolean)
|
|
4553
4584
|
}).compileToV0Message();
|
|
4554
4585
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4555
4586
|
});
|
|
@@ -5037,7 +5068,7 @@ var getQuoteCurrencySpecificAddressLookupTable = (quoteCurrency) => {
|
|
|
5037
5068
|
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
5038
5069
|
}
|
|
5039
5070
|
};
|
|
5040
|
-
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* () {
|
|
5041
5072
|
const positionAccountPDA = position.publicKey;
|
|
5042
5073
|
const newPosition1Seed = import_web32.Keypair.generate().publicKey;
|
|
5043
5074
|
const newPosition2Seed = import_web32.Keypair.generate().publicKey;
|
|
@@ -5103,7 +5134,7 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5103
5134
|
newPositionTokenAccountTwo: newPosition2TokenAccount
|
|
5104
5135
|
}).instruction();
|
|
5105
5136
|
const computeBudgetIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5106
|
-
microLamports: 1e5
|
|
5137
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5107
5138
|
});
|
|
5108
5139
|
const allInstructions = [
|
|
5109
5140
|
createNewPosition1TokenAccountIx,
|
|
@@ -5120,7 +5151,7 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5120
5151
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5121
5152
|
return tx;
|
|
5122
5153
|
});
|
|
5123
|
-
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* () {
|
|
5124
5155
|
const positionAccountPDA1 = position1.publicKey;
|
|
5125
5156
|
const positionAccountPDA2 = position2.publicKey;
|
|
5126
5157
|
const newPositionSeed = import_web32.Keypair.generate().publicKey;
|
|
@@ -5169,7 +5200,7 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken)
|
|
|
5169
5200
|
mergedPositionTokenAccount: newPositionTokenAccount
|
|
5170
5201
|
}).instruction();
|
|
5171
5202
|
const computeBudgetIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5172
|
-
microLamports: 1e5
|
|
5203
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5173
5204
|
});
|
|
5174
5205
|
const allInstructions = [
|
|
5175
5206
|
createNewPositionTokenAccountIx,
|