@lavarage/sdk 6.8.8 → 6.8.92
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 +70 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -32
- package/dist/index.mjs.map +1 -1
- package/evm.ts +2 -2
- package/index.ts +6 -4
- package/lending.ts +65 -15
- 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
|
-
let instruction;
|
|
1173
|
+
let instruction, createTokenAccountIx;
|
|
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,22 @@ 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
|
+
});
|
|
1197
|
+
const destinationTokenAccount = (0, import_spl_token.getAssociatedTokenAddressSync)(
|
|
1198
|
+
mintPubkey,
|
|
1199
|
+
new import_web3.PublicKey(params.nodeWallet),
|
|
1200
|
+
true,
|
|
1201
|
+
mintOwner == null ? void 0 : mintOwner.owner
|
|
1202
|
+
);
|
|
1203
|
+
createTokenAccountIx = (0, import_spl_token.createAssociatedTokenAccountIdempotentInstruction)(
|
|
1204
|
+
lavarageProgram.provider.publicKey,
|
|
1205
|
+
destinationTokenAccount,
|
|
1206
|
+
params.nodeWallet,
|
|
1207
|
+
new import_web3.PublicKey(params.mint),
|
|
1208
|
+
mintOwner == null ? void 0 : mintOwner.owner
|
|
1209
|
+
);
|
|
1193
1210
|
instruction = (0, import_spl_token.createTransferCheckedInstruction)(
|
|
1194
1211
|
(0, import_spl_token.getAssociatedTokenAddressSync)(
|
|
1195
1212
|
mintPubkey,
|
|
@@ -1198,12 +1215,7 @@ function depositFunds(lavarageProgram, params) {
|
|
|
1198
1215
|
mintOwner == null ? void 0 : mintOwner.owner
|
|
1199
1216
|
),
|
|
1200
1217
|
new import_web3.PublicKey(params.mint),
|
|
1201
|
-
|
|
1202
|
-
mintPubkey,
|
|
1203
|
-
new import_web3.PublicKey(params.nodeWallet),
|
|
1204
|
-
true,
|
|
1205
|
-
mintOwner == null ? void 0 : mintOwner.owner
|
|
1206
|
-
),
|
|
1218
|
+
destinationTokenAccount,
|
|
1207
1219
|
lavarageProgram.provider.publicKey,
|
|
1208
1220
|
params.amount,
|
|
1209
1221
|
mintAccount.decimals,
|
|
@@ -1211,22 +1223,29 @@ function depositFunds(lavarageProgram, params) {
|
|
|
1211
1223
|
mintOwner == null ? void 0 : mintOwner.owner
|
|
1212
1224
|
);
|
|
1213
1225
|
}
|
|
1226
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1227
|
+
microLamports: (_c = params.computeBudgetMicroLamports) != null ? _c : 15e4
|
|
1228
|
+
});
|
|
1214
1229
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1215
1230
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1216
1231
|
recentBlockhash: blockhash,
|
|
1217
|
-
instructions: [instruction, computeFeeIx]
|
|
1232
|
+
instructions: [createTokenAccountIx, instruction, computeFeeIx].filter(Boolean)
|
|
1218
1233
|
}).compileToV0Message();
|
|
1219
1234
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1220
1235
|
});
|
|
1221
1236
|
}
|
|
1222
1237
|
function withdrawFundsV1(lavarageProgram, params) {
|
|
1223
1238
|
return __async(this, null, function* () {
|
|
1239
|
+
var _a;
|
|
1224
1240
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1225
1241
|
const instruction = yield lavarageProgram.methods.lpOperatorWithdrawFromNodeWallet(new import_anchor.BN(params.amount)).accounts({
|
|
1226
1242
|
nodeWallet: params.nodeWallet,
|
|
1227
1243
|
funder: params.funder,
|
|
1228
1244
|
systemProgram: import_web3.SystemProgram.programId
|
|
1229
1245
|
}).instruction();
|
|
1246
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1247
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1248
|
+
});
|
|
1230
1249
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1231
1250
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1232
1251
|
recentBlockhash: blockhash,
|
|
@@ -1237,6 +1256,7 @@ function withdrawFundsV1(lavarageProgram, params) {
|
|
|
1237
1256
|
}
|
|
1238
1257
|
function withdrawFundsV2(lavarageProgram, params) {
|
|
1239
1258
|
return __async(this, null, function* () {
|
|
1259
|
+
var _a;
|
|
1240
1260
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1241
1261
|
const mintPubkey = new import_web3.PublicKey(params.mint);
|
|
1242
1262
|
const fromTokenAccount = params.fromTokenAccount || (0, import_spl_token.getAssociatedTokenAddressSync)(mintPubkey, params.nodeWallet, true);
|
|
@@ -1250,6 +1270,9 @@ function withdrawFundsV2(lavarageProgram, params) {
|
|
|
1250
1270
|
toTokenAccount,
|
|
1251
1271
|
tokenProgram: import_spl_token.TOKEN_PROGRAM_ID
|
|
1252
1272
|
}).instruction();
|
|
1273
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1274
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1275
|
+
});
|
|
1253
1276
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1254
1277
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1255
1278
|
recentBlockhash: blockhash,
|
|
@@ -1267,19 +1290,22 @@ function withdrawFunds(lavarageProgram, params) {
|
|
|
1267
1290
|
mint: params.mint,
|
|
1268
1291
|
amount: params.amount,
|
|
1269
1292
|
fromTokenAccount: params.fromTokenAccount,
|
|
1270
|
-
toTokenAccount: params.toTokenAccount
|
|
1293
|
+
toTokenAccount: params.toTokenAccount,
|
|
1294
|
+
computeBudgetMicroLamports: params.computeBudgetMicroLamports
|
|
1271
1295
|
});
|
|
1272
1296
|
} else {
|
|
1273
1297
|
return withdrawFundsV1(lavarageProgram, {
|
|
1274
1298
|
nodeWallet: params.nodeWallet,
|
|
1275
1299
|
funder: params.funder,
|
|
1276
|
-
amount: params.amount
|
|
1300
|
+
amount: params.amount,
|
|
1301
|
+
computeBudgetMicroLamports: params.computeBudgetMicroLamports
|
|
1277
1302
|
});
|
|
1278
1303
|
}
|
|
1279
1304
|
});
|
|
1280
1305
|
}
|
|
1281
1306
|
function createOffer(lavarageProgram, params) {
|
|
1282
1307
|
return __async(this, null, function* () {
|
|
1308
|
+
var _a;
|
|
1283
1309
|
let nodeWalletAccount, nodeWalletSigner, createNodeWalletInstruction, nodeWalletPubKey;
|
|
1284
1310
|
if (params.quoteMint === "So11111111111111111111111111111111111111112") {
|
|
1285
1311
|
const nodeWallets = yield lavarageProgram.account.nodeWallet.all();
|
|
@@ -1333,6 +1359,9 @@ function createOffer(lavarageProgram, params) {
|
|
|
1333
1359
|
operator: params.poolOwner,
|
|
1334
1360
|
systemProgram: import_web3.SystemProgram.programId
|
|
1335
1361
|
}).instruction();
|
|
1362
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1363
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1364
|
+
});
|
|
1336
1365
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1337
1366
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1338
1367
|
recentBlockhash: blockhash,
|
|
@@ -1353,6 +1382,7 @@ function createOffer(lavarageProgram, params) {
|
|
|
1353
1382
|
}
|
|
1354
1383
|
function updateMaxExposure(lavarageProgram, params) {
|
|
1355
1384
|
return __async(this, null, function* () {
|
|
1385
|
+
var _a;
|
|
1356
1386
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1357
1387
|
const instruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
|
|
1358
1388
|
tradingPool: params.tradingPool,
|
|
@@ -1360,16 +1390,20 @@ function updateMaxExposure(lavarageProgram, params) {
|
|
|
1360
1390
|
operator: params.poolOwner,
|
|
1361
1391
|
systemProgram: import_web3.SystemProgram.programId
|
|
1362
1392
|
}).instruction();
|
|
1393
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1394
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1395
|
+
});
|
|
1363
1396
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1364
1397
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1365
1398
|
recentBlockhash: blockhash,
|
|
1366
|
-
instructions: [instruction]
|
|
1399
|
+
instructions: [instruction, computeFeeIx]
|
|
1367
1400
|
}).compileToV0Message();
|
|
1368
1401
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1369
1402
|
});
|
|
1370
1403
|
}
|
|
1371
1404
|
function updateInterestRate(lavarageProgram, params) {
|
|
1372
1405
|
return __async(this, null, function* () {
|
|
1406
|
+
var _a;
|
|
1373
1407
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1374
1408
|
const instruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(new import_anchor.BN(params.interestRate)).accounts({
|
|
1375
1409
|
tradingPool: params.tradingPool,
|
|
@@ -1377,16 +1411,20 @@ function updateInterestRate(lavarageProgram, params) {
|
|
|
1377
1411
|
operator: params.poolOwner,
|
|
1378
1412
|
systemProgram: import_web3.SystemProgram.programId
|
|
1379
1413
|
}).instruction();
|
|
1414
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1415
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1416
|
+
});
|
|
1380
1417
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1381
1418
|
payerKey: lavarageProgram.provider.publicKey,
|
|
1382
1419
|
recentBlockhash: blockhash,
|
|
1383
|
-
instructions: [instruction]
|
|
1420
|
+
instructions: [instruction, computeFeeIx]
|
|
1384
1421
|
}).compileToV0Message();
|
|
1385
1422
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1386
1423
|
});
|
|
1387
1424
|
}
|
|
1388
1425
|
function updateOffer(lavarageProgram, params) {
|
|
1389
1426
|
return __async(this, null, function* () {
|
|
1427
|
+
var _a;
|
|
1390
1428
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1391
1429
|
const instructions = [];
|
|
1392
1430
|
const updateMaxExposureInstruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
|
|
@@ -1401,9 +1439,13 @@ function updateOffer(lavarageProgram, params) {
|
|
|
1401
1439
|
operator: params.poolOwner,
|
|
1402
1440
|
systemProgram: import_web3.SystemProgram.programId
|
|
1403
1441
|
}).instruction();
|
|
1442
|
+
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1443
|
+
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
1444
|
+
});
|
|
1404
1445
|
instructions.push(
|
|
1405
1446
|
updateMaxExposureInstruction,
|
|
1406
|
-
updateInterestRateInstruction
|
|
1447
|
+
updateInterestRateInstruction,
|
|
1448
|
+
computeFeeIx
|
|
1407
1449
|
);
|
|
1408
1450
|
const messageV0 = new import_web3.TransactionMessage({
|
|
1409
1451
|
payerKey: lavarageProgram.provider.publicKey,
|
|
@@ -4473,13 +4515,13 @@ var createTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
4473
4515
|
}
|
|
4474
4516
|
] : []
|
|
4475
4517
|
).instruction();
|
|
4476
|
-
const
|
|
4518
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4477
4519
|
microLamports: prioFee.toNumber()
|
|
4478
4520
|
});
|
|
4479
4521
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4480
4522
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4481
4523
|
recentBlockhash: blockhash,
|
|
4482
|
-
instructions: [ix,
|
|
4524
|
+
instructions: [ix, computeFeeIx].filter(Boolean)
|
|
4483
4525
|
}).compileToV0Message();
|
|
4484
4526
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4485
4527
|
});
|
|
@@ -4518,13 +4560,13 @@ var modifyTpDelegate = (lavarageProgram, position, tpPrice, tpTolerence, prioFee
|
|
|
4518
4560
|
}
|
|
4519
4561
|
] : []
|
|
4520
4562
|
).instruction();
|
|
4521
|
-
const
|
|
4563
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4522
4564
|
microLamports: prioFee.toNumber()
|
|
4523
4565
|
});
|
|
4524
4566
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4525
4567
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4526
4568
|
recentBlockhash: blockhash,
|
|
4527
|
-
instructions: [removeIx, ix,
|
|
4569
|
+
instructions: [removeIx, ix, computeFeeIx].filter(Boolean)
|
|
4528
4570
|
}).compileToV0Message();
|
|
4529
4571
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4530
4572
|
});
|
|
@@ -4540,13 +4582,13 @@ var removeTpDelegate = (lavarageProgram, position, prioFee) => __async(void 0, n
|
|
|
4540
4582
|
delegatedAccount: position.publicKey,
|
|
4541
4583
|
systemProgram: import_web32.SystemProgram.programId
|
|
4542
4584
|
}).instruction();
|
|
4543
|
-
const
|
|
4585
|
+
const computeFeeIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
4544
4586
|
microLamports: prioFee.toNumber()
|
|
4545
4587
|
});
|
|
4546
4588
|
const messageV0 = new import_web32.TransactionMessage({
|
|
4547
4589
|
payerKey: lavarageProgram.provider.publicKey,
|
|
4548
4590
|
recentBlockhash: blockhash,
|
|
4549
|
-
instructions: [removeIx,
|
|
4591
|
+
instructions: [removeIx, computeFeeIx].filter(Boolean)
|
|
4550
4592
|
}).compileToV0Message();
|
|
4551
4593
|
return new import_web32.VersionedTransaction(messageV0);
|
|
4552
4594
|
});
|
|
@@ -5034,7 +5076,7 @@ var getQuoteCurrencySpecificAddressLookupTable = (quoteCurrency) => {
|
|
|
5034
5076
|
return "2EdNtwVhyjkEgkKDC7GShfSSczZYMKLuJraeoJzG4E4R";
|
|
5035
5077
|
}
|
|
5036
5078
|
};
|
|
5037
|
-
var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBps) => __async(void 0, null, function* () {
|
|
5079
|
+
var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBps, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5038
5080
|
const positionAccountPDA = position.publicKey;
|
|
5039
5081
|
const newPosition1Seed = import_web32.Keypair.generate().publicKey;
|
|
5040
5082
|
const newPosition2Seed = import_web32.Keypair.generate().publicKey;
|
|
@@ -5100,7 +5142,7 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5100
5142
|
newPositionTokenAccountTwo: newPosition2TokenAccount
|
|
5101
5143
|
}).instruction();
|
|
5102
5144
|
const computeBudgetIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5103
|
-
microLamports: 1e5
|
|
5145
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5104
5146
|
});
|
|
5105
5147
|
const allInstructions = [
|
|
5106
5148
|
createNewPosition1TokenAccountIx,
|
|
@@ -5117,7 +5159,7 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
|
|
|
5117
5159
|
const tx = new import_web32.VersionedTransaction(messageV0);
|
|
5118
5160
|
return tx;
|
|
5119
5161
|
});
|
|
5120
|
-
var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken) => __async(void 0, null, function* () {
|
|
5162
|
+
var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken, computeBudgetMicroLamports) => __async(void 0, null, function* () {
|
|
5121
5163
|
const positionAccountPDA1 = position1.publicKey;
|
|
5122
5164
|
const positionAccountPDA2 = position2.publicKey;
|
|
5123
5165
|
const newPositionSeed = import_web32.Keypair.generate().publicKey;
|
|
@@ -5166,7 +5208,7 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken)
|
|
|
5166
5208
|
mergedPositionTokenAccount: newPositionTokenAccount
|
|
5167
5209
|
}).instruction();
|
|
5168
5210
|
const computeBudgetIx = import_web32.ComputeBudgetProgram.setComputeUnitPrice({
|
|
5169
|
-
microLamports: 1e5
|
|
5211
|
+
microLamports: computeBudgetMicroLamports != null ? computeBudgetMicroLamports : 1e5
|
|
5170
5212
|
});
|
|
5171
5213
|
const allInstructions = [
|
|
5172
5214
|
createNewPositionTokenAccountIx,
|