@haven-fi/solauto-sdk 1.0.624 → 1.0.626
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/{generalAccounts.d.ts → generalConstants.d.ts} +3 -1
- package/dist/constants/generalConstants.d.ts.map +1 -0
- package/dist/constants/{generalAccounts.js → generalConstants.js} +4 -1
- package/dist/constants/index.d.ts +6 -5
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +2 -1
- package/dist/constants/marginfiAccounts.d.ts +12 -4
- package/dist/constants/marginfiAccounts.d.ts.map +1 -1
- package/dist/constants/marginfiAccounts.js +62 -8
- package/dist/constants/solautoConstants.d.ts +0 -3
- package/dist/constants/solautoConstants.d.ts.map +1 -1
- package/dist/constants/solautoConstants.js +3 -8
- package/dist/services/flashLoans/flProviderAggregator.d.ts +3 -3
- package/dist/services/flashLoans/flProviderAggregator.d.ts.map +1 -1
- package/dist/services/flashLoans/flProviderAggregator.js +5 -5
- package/dist/services/flashLoans/flProviderBase.d.ts +4 -3
- package/dist/services/flashLoans/flProviderBase.d.ts.map +1 -1
- package/dist/services/flashLoans/flProviderBase.js +3 -2
- package/dist/services/flashLoans/marginfiFlProvider.d.ts +2 -2
- package/dist/services/flashLoans/marginfiFlProvider.d.ts.map +1 -1
- package/dist/services/flashLoans/marginfiFlProvider.js +6 -6
- package/dist/services/rebalance/rebalanceSwapManager.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceSwapManager.js +1 -1
- package/dist/services/rebalance/rebalanceTxBuilder.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceTxBuilder.js +4 -4
- package/dist/services/rebalance/rebalanceValues.d.ts.map +1 -1
- package/dist/services/rebalance/solautoFees.d.ts.map +1 -1
- package/dist/services/rebalance/solautoFees.js +4 -2
- package/dist/services/solauto/solautoClient.d.ts +4 -3
- package/dist/services/solauto/solautoClient.d.ts.map +1 -1
- package/dist/services/solauto/solautoClient.js +22 -24
- package/dist/services/solauto/solautoMarginfiClient.d.ts +5 -5
- package/dist/services/solauto/solautoMarginfiClient.d.ts.map +1 -1
- package/dist/services/solauto/solautoMarginfiClient.js +22 -20
- package/dist/services/solauto/txHandler.d.ts +4 -2
- package/dist/services/solauto/txHandler.d.ts.map +1 -1
- package/dist/services/solauto/txHandler.js +4 -6
- package/dist/services/swap/jupSwapManager.d.ts +1 -1
- package/dist/services/swap/jupSwapManager.d.ts.map +1 -1
- package/dist/services/swap/jupSwapManager.js +7 -10
- package/dist/services/transactions/transactionUtils.d.ts +2 -3
- package/dist/services/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/services/transactions/transactionUtils.js +43 -46
- package/dist/services/transactions/transactionsManager.d.ts +2 -3
- package/dist/services/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/services/transactions/transactionsManager.js +16 -20
- package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/marginfiSolautoPositionEx.js +6 -5
- package/dist/solautoPosition/solautoPositionEx.d.ts +4 -2
- package/dist/solautoPosition/solautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/solautoPositionEx.js +12 -5
- package/dist/solautoPosition/utils.d.ts +2 -2
- package/dist/solautoPosition/utils.d.ts.map +1 -1
- package/dist/solautoPosition/utils.js +2 -2
- package/dist/types/solauto.d.ts +1 -0
- package/dist/types/solauto.d.ts.map +1 -1
- package/dist/utils/generalUtils.d.ts +2 -0
- package/dist/utils/generalUtils.d.ts.map +1 -1
- package/dist/utils/generalUtils.js +9 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +7 -8
- package/dist/utils/jupiterUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.d.ts +13 -4
- package/dist/utils/marginfiUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.js +78 -22
- package/dist/utils/numberUtils.d.ts.map +1 -1
- package/dist/utils/priceUtils.d.ts.map +1 -1
- package/dist/utils/priceUtils.js +13 -15
- package/dist/utils/solanaUtils.d.ts +3 -5
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +7 -15
- package/dist/utils/solautoUtils.d.ts +3 -3
- package/dist/utils/solautoUtils.d.ts.map +1 -1
- package/dist/utils/solautoUtils.js +5 -5
- package/dist/utils/stringUtils.d.ts.map +1 -1
- package/dist/utils/stringUtils.js +3 -3
- package/dist/utils/switchboardUtils.d.ts +1 -1
- package/dist/utils/switchboardUtils.d.ts.map +1 -1
- package/dist/utils/switchboardUtils.js +4 -4
- package/local/createISMAccounts.ts +29 -12
- package/local/createTokenAccounts.ts +12 -11
- package/local/logPositions.ts +5 -5
- package/local/shared.ts +16 -10
- package/local/txSandbox.ts +5 -5
- package/local/updateMarginfiLUT.ts +40 -49
- package/local/updateSolautoLUT.ts +11 -13
- package/package.json +1 -1
- package/src/constants/{generalAccounts.ts → generalConstants.ts} +6 -1
- package/src/constants/index.ts +6 -5
- package/src/constants/marginfiAccounts.ts +88 -10
- package/src/constants/solautoConstants.ts +2 -10
- package/src/services/flashLoans/flProviderAggregator.ts +9 -7
- package/src/services/flashLoans/flProviderBase.ts +5 -4
- package/src/services/flashLoans/marginfiFlProvider.ts +9 -8
- package/src/services/rebalance/rebalanceSwapManager.ts +1 -1
- package/src/services/rebalance/rebalanceTxBuilder.ts +5 -5
- package/src/services/rebalance/rebalanceValues.ts +1 -1
- package/src/services/rebalance/solautoFees.ts +3 -4
- package/src/services/solauto/solautoClient.ts +10 -15
- package/src/services/solauto/solautoMarginfiClient.ts +26 -30
- package/src/services/solauto/txHandler.ts +10 -9
- package/src/services/swap/jupSwapManager.ts +7 -6
- package/src/services/transactions/transactionUtils.ts +17 -18
- package/src/services/transactions/transactionsManager.ts +23 -22
- package/src/solautoPosition/marginfiSolautoPositionEx.ts +7 -8
- package/src/solautoPosition/solautoPositionEx.ts +21 -10
- package/src/solautoPosition/utils.ts +7 -7
- package/src/types/solauto.ts +2 -0
- package/src/utils/generalUtils.ts +9 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/jitoUtils.ts +17 -14
- package/src/utils/jupiterUtils.ts +1 -1
- package/src/utils/marginfiUtils.ts +105 -28
- package/src/utils/numberUtils.ts +0 -1
- package/src/utils/priceUtils.ts +7 -5
- package/src/utils/solanaUtils.ts +24 -32
- package/src/utils/solautoUtils.ts +13 -13
- package/src/utils/stringUtils.ts +3 -3
- package/src/utils/switchboardUtils.ts +4 -4
- package/tests/transactions/shared.ts +9 -14
- package/tests/transactions/solautoMarginfi.ts +13 -3
- package/tests/unit/accounts.ts +14 -17
- package/tests/unit/lookupTables.ts +5 -5
- package/tests/unit/rebalanceCalculations.ts +17 -11
- package/README.md +0 -3
- package/dist/constants/generalAccounts.d.ts.map +0 -1
- package/src/constants/README.md +0 -7
@@ -2,4 +2,6 @@ import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
export declare const USD_DECIMALS = 9;
|
3
3
|
export declare const SOLAUTO_FEES_WALLET: PublicKey;
|
4
4
|
export declare const SOLAUTO_MANAGER: PublicKey;
|
5
|
-
|
5
|
+
export declare const LOCAL_IRONFORGE_API_URL: string;
|
6
|
+
export declare const BASIS_POINTS = 10000;
|
7
|
+
//# sourceMappingURL=generalConstants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generalConstants.d.ts","sourceRoot":"","sources":["../../src/constants/generalConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,mBAAmB,WAAgE,CAAC;AACjG,eAAO,MAAM,eAAe,WAA+D,CAAC;AAE5F,eAAO,MAAM,uBAAuB,QAAuD,CAAC;AAE5F,eAAO,MAAM,YAAY,QAAQ,CAAC"}
|
@@ -1,7 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SOLAUTO_MANAGER = exports.SOLAUTO_FEES_WALLET = exports.USD_DECIMALS = void 0;
|
3
|
+
exports.BASIS_POINTS = exports.LOCAL_IRONFORGE_API_URL = exports.SOLAUTO_MANAGER = exports.SOLAUTO_FEES_WALLET = exports.USD_DECIMALS = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
const utils_1 = require("../utils");
|
5
6
|
exports.USD_DECIMALS = 9;
|
6
7
|
exports.SOLAUTO_FEES_WALLET = new web3_js_1.PublicKey("AprYCPiVeKMCgjQ2ZufwChMzvQ5kFjJo2ekTLSkXsQDm");
|
7
8
|
exports.SOLAUTO_MANAGER = new web3_js_1.PublicKey("MNGRcX4nc7quPdzBbNKJ4ScK5EE73JnwJVGxuJXhHCY");
|
9
|
+
exports.LOCAL_IRONFORGE_API_URL = (0, utils_1.buildIronforgeApiUrl)(process.env.IRONFORGE_API_KEY);
|
10
|
+
exports.BASIS_POINTS = 10000;
|
@@ -1,6 +1,7 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
1
|
+
export * from "./generalConstants";
|
2
|
+
export * from "./marginfiAccounts";
|
3
|
+
export * from "./pythConstants";
|
4
|
+
export * from "./solautoConstants";
|
5
|
+
export * from "./switchboardConstants";
|
6
|
+
export * from "./tokenConstants";
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
|
package/dist/constants/index.js
CHANGED
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./
|
17
|
+
__exportStar(require("./generalConstants"), exports);
|
18
18
|
__exportStar(require("./marginfiAccounts"), exports);
|
19
19
|
__exportStar(require("./pythConstants"), exports);
|
20
20
|
__exportStar(require("./solautoConstants"), exports);
|
21
|
+
__exportStar(require("./switchboardConstants"), exports);
|
21
22
|
__exportStar(require("./tokenConstants"), exports);
|
@@ -1,10 +1,18 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
1
2
|
import { MarginfiAssetAccounts } from "../types/accounts";
|
2
|
-
|
3
|
-
export declare const
|
4
|
-
export declare const
|
3
|
+
import { ProgramEnv } from "../types";
|
4
|
+
export declare const MARGINFI_PROD_PROGRAM: PublicKey;
|
5
|
+
export declare const MARGINFI_STAGING_PROGRAM: PublicKey;
|
6
|
+
export type MarginfiAccountsMap = {
|
5
7
|
[group: string]: {
|
6
8
|
[token: string]: MarginfiAssetAccounts;
|
7
9
|
};
|
8
10
|
};
|
9
|
-
export
|
11
|
+
export interface MarginfiProgramAccounts {
|
12
|
+
program: PublicKey;
|
13
|
+
defaultGroup: PublicKey;
|
14
|
+
lookupTable: PublicKey;
|
15
|
+
bankAccounts: MarginfiAccountsMap;
|
16
|
+
}
|
17
|
+
export declare function getMarginfiAccounts(programEnv?: ProgramEnv, marginfiGroup?: PublicKey): MarginfiProgramAccounts;
|
10
18
|
//# sourceMappingURL=marginfiAccounts.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiAccounts.d.ts","sourceRoot":"","sources":["../../src/constants/marginfiAccounts.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"marginfiAccounts.d.ts","sourceRoot":"","sources":["../../src/constants/marginfiAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,qBAAqB,WAEjC,CAAC;AACF,eAAO,MAAM,wBAAwB,WAEpC,CAAC;AAUF,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAAA;KAAE,CAAC;CAC7D,CAAC;AA+MF,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,SAAS,CAAC;IACnB,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,SAAS,CAAC;IACvB,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAED,wBAAgB,mBAAmB,CACjC,UAAU,CAAC,EAAE,UAAU,EACvB,aAAa,CAAC,EAAE,SAAS,GACxB,uBAAuB,CA4BzB"}
|
@@ -23,16 +23,41 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.
|
26
|
+
exports.MARGINFI_STAGING_PROGRAM = exports.MARGINFI_PROD_PROGRAM = void 0;
|
27
|
+
exports.getMarginfiAccounts = getMarginfiAccounts;
|
28
|
+
const web3_js_1 = require("@solana/web3.js");
|
27
29
|
const spl_token_1 = require("@solana/spl-token");
|
28
30
|
const tokens = __importStar(require("./tokenConstants"));
|
29
|
-
const web3_js_1 = require("@solana/web3.js");
|
30
31
|
const switchboardConstants_1 = require("./switchboardConstants");
|
31
|
-
exports.
|
32
|
-
exports.
|
32
|
+
exports.MARGINFI_PROD_PROGRAM = new web3_js_1.PublicKey("MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA");
|
33
|
+
exports.MARGINFI_STAGING_PROGRAM = new web3_js_1.PublicKey("stag8sTKds2h4KzjUw3zKTsxbqvT4XKHdaR9X9E6Rct");
|
34
|
+
const PROD_DEFAULT_MARGINFI_GROUP = "4qp6Fx6tnZkY5Wropq9wUYgtFxXKwE6viZxFHg3rdAG8";
|
35
|
+
const STAGING_DEFAULT_MARGINFI_GROUP = "FCPfpHA69EbS8f9KKSreTRkXbzFpunsKuYf5qNmnJjpo";
|
33
36
|
const USDC_PRICE_ORACLE = "Dpw1EAVrSB1ibxiDQyTAW6Zip3J4Btk2x4SgApQCeFbX";
|
34
|
-
|
35
|
-
[
|
37
|
+
const MARGINFI_STAGING_ACCOUNTS = {
|
38
|
+
[STAGING_DEFAULT_MARGINFI_GROUP]: {
|
39
|
+
[spl_token_1.NATIVE_MINT.toString()]: {
|
40
|
+
bank: "3evdJSa25nsUiZzEUzd92UNa13TPRJrje1dRyiQP5Lhp",
|
41
|
+
liquidityVault: "FVXESa7wCd1tf3o9LGroBc3Ym8Gpcq1HdsLek6oo7Ykv",
|
42
|
+
vaultAuthority: "DuYk1WGq8UsjW5ThLtaehFLrnJeupTjtF7TaPzja9LBQ",
|
43
|
+
priceOracle: "7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE",
|
44
|
+
},
|
45
|
+
[tokens.USDC]: {
|
46
|
+
bank: "Ek5JSFJFD8QgXM6rPDCzf31XhDp1q3xezaWYSkJWqbqc",
|
47
|
+
liquidityVault: "6n7xXMni5WJKUMb4Vm5Zis6UaUtGF5xEGmagZNVWWoKB",
|
48
|
+
vaultAuthority: "9mXNyA5yS4WSTpYUa5gi3yBrSJWWM7XNPNDWRzWGjdVe",
|
49
|
+
priceOracle: USDC_PRICE_ORACLE,
|
50
|
+
},
|
51
|
+
[tokens.USDT]: {
|
52
|
+
bank: "4WFCsVXwfnQvZG52VvPwae7CtL13PUFVWdjkw5YCRBo6",
|
53
|
+
liquidityVault: "BFSyniKfXU9rHqUvHLKeZMivQsAKWTE7HZ1fW6vZcvJp",
|
54
|
+
vaultAuthority: "Fgxe3SUMzcNuLtT9Xkv8QhhWXCmu4VxynzUMwCF4HvJd",
|
55
|
+
priceOracle: "HT2PLQBcG5EiCcNSaMHAjSgd9F98ecpATbk4Sk5oYuM",
|
56
|
+
},
|
57
|
+
},
|
58
|
+
};
|
59
|
+
const MARGINFI_PROD_ACCOUNTS = {
|
60
|
+
[PROD_DEFAULT_MARGINFI_GROUP.toString()]: {
|
36
61
|
[spl_token_1.NATIVE_MINT.toString()]: {
|
37
62
|
bank: "CCKtUs6Cgwo4aaQUmBPmyoApH2gUDErxNZCAntD6LYGh",
|
38
63
|
liquidityVault: "2eicbpitfJXDwqCuFAmPgDP7t2oUotnAzbGzRKLMgSLe",
|
@@ -202,7 +227,36 @@ exports.MARGINFI_ACCOUNTS = {
|
|
202
227
|
liquidityVault: "4U1UBjXrPrW7JuQ894JbLUBqcb5LFfK9rfkWFwT7EdQ9",
|
203
228
|
vaultAuthority: "CY74V1r48kuuHA6APD3AaU2oPV1mBqe9srikrQQSHNR6",
|
204
229
|
priceOracle: USDC_PRICE_ORACLE,
|
230
|
+
},
|
231
|
+
},
|
232
|
+
};
|
233
|
+
const MARGINFI_PROD_ACCOUNTS_LOOKUP_TABLE = "GAjmWmBPcH5Gxbiykasydj6RsCEaCLyHEvK6kHdFigc6";
|
234
|
+
const MARGINFI_STAGING_ACCOUNTS_LOOKUP_TABLE = "EoEVYjz3MnsX6fKyxrwJkRhzMCHKjj6dvnjTCHoZLMc7";
|
235
|
+
function getMarginfiAccounts(programEnv, marginfiGroup) {
|
236
|
+
if (programEnv === undefined) {
|
237
|
+
if (Boolean(marginfiGroup)) {
|
238
|
+
programEnv = Object.keys(MARGINFI_PROD_ACCOUNTS).includes(marginfiGroup.toString())
|
239
|
+
? "Prod"
|
240
|
+
: "Staging";
|
241
|
+
}
|
242
|
+
else {
|
243
|
+
programEnv = "Prod";
|
205
244
|
}
|
206
245
|
}
|
207
|
-
|
208
|
-
|
246
|
+
if (programEnv === "Prod") {
|
247
|
+
return {
|
248
|
+
program: exports.MARGINFI_PROD_PROGRAM,
|
249
|
+
defaultGroup: new web3_js_1.PublicKey(PROD_DEFAULT_MARGINFI_GROUP),
|
250
|
+
lookupTable: new web3_js_1.PublicKey(MARGINFI_PROD_ACCOUNTS_LOOKUP_TABLE),
|
251
|
+
bankAccounts: MARGINFI_PROD_ACCOUNTS,
|
252
|
+
};
|
253
|
+
}
|
254
|
+
else {
|
255
|
+
return {
|
256
|
+
program: exports.MARGINFI_STAGING_PROGRAM,
|
257
|
+
defaultGroup: new web3_js_1.PublicKey(STAGING_DEFAULT_MARGINFI_GROUP),
|
258
|
+
lookupTable: new web3_js_1.PublicKey(MARGINFI_STAGING_ACCOUNTS_LOOKUP_TABLE),
|
259
|
+
bankAccounts: MARGINFI_STAGING_ACCOUNTS,
|
260
|
+
};
|
261
|
+
}
|
262
|
+
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
export declare const SOLAUTO_PROD_PROGRAM: PublicKey;
|
3
3
|
export declare const SOLAUTO_TEST_PROGRAM: PublicKey;
|
4
|
-
export declare const BASIS_POINTS = 10000;
|
5
4
|
export declare const MIN_POSITION_STATE_FRESHNESS_SECS = 5;
|
6
5
|
export declare const MIN_REPAY_GAP_BPS = 50;
|
7
6
|
export declare const MIN_BOOST_GAP_BPS = 50;
|
@@ -13,9 +12,7 @@ export declare const PRICES: {
|
|
13
12
|
time: number;
|
14
13
|
};
|
15
14
|
};
|
16
|
-
export declare const JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
|
17
15
|
export declare const JITO_TIP_ACCOUNTS: string[];
|
18
16
|
export declare const SOLAUTO_LUT = "8b7KefQDroVLGao71J5H3hFwABeyMCgCrLpXWssNFhk9";
|
19
17
|
export declare const STANDARD_LUT_ACCOUNTS: string[];
|
20
|
-
export declare const BROKEN_TOKENS: string[];
|
21
18
|
//# sourceMappingURL=solautoConstants.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACV,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"solautoConstants.d.ts","sourceRoot":"","sources":["../../src/constants/solautoConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAQzB,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AACF,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AAIF,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAO,CAAC;AAE7E,eAAO,MAAM,iBAAiB,UAS7B,CAAC;AAEF,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAC1E,eAAO,MAAM,qBAAqB,UAYR,CAAC"}
|
@@ -1,22 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.STANDARD_LUT_ACCOUNTS = exports.SOLAUTO_LUT = exports.JITO_TIP_ACCOUNTS = exports.PRICES = exports.REFERRER_PERCENTAGE = exports.MIN_USD_SUPPORTED_POSITION = exports.MIN_BOOST_GAP_BPS = exports.MIN_REPAY_GAP_BPS = exports.MIN_POSITION_STATE_FRESHNESS_SECS = exports.SOLAUTO_TEST_PROGRAM = exports.SOLAUTO_PROD_PROGRAM = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
const spl_token_1 = require("@solana/spl-token");
|
6
|
-
const
|
6
|
+
const generalConstants_1 = require("./generalConstants");
|
7
7
|
const jupiter_sdk_1 = require("../jupiter-sdk");
|
8
|
-
const tokenConstants_1 = require("./tokenConstants");
|
9
8
|
exports.SOLAUTO_PROD_PROGRAM = new web3_js_1.PublicKey("AutoyKBRaHSBHy9RsmXCZMy6nNFAg5FYijrvZyQcNLV");
|
10
9
|
exports.SOLAUTO_TEST_PROGRAM = new web3_js_1.PublicKey("TesTjfQ6TbXv96Tv6fqr95XTZ1LYPxtkafmShN9PjBp");
|
11
10
|
globalThis.SHOW_LOGS = false;
|
12
|
-
exports.BASIS_POINTS = 10000;
|
13
11
|
exports.MIN_POSITION_STATE_FRESHNESS_SECS = 5;
|
14
12
|
exports.MIN_REPAY_GAP_BPS = 50;
|
15
13
|
exports.MIN_BOOST_GAP_BPS = 50;
|
16
14
|
exports.MIN_USD_SUPPORTED_POSITION = 1000;
|
17
15
|
exports.REFERRER_PERCENTAGE = 0.15;
|
18
16
|
exports.PRICES = {};
|
19
|
-
exports.JITO_BLOCK_ENGINE = "https://mainnet.block-engine.jito.wtf";
|
20
17
|
exports.JITO_TIP_ACCOUNTS = [
|
21
18
|
"96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
|
22
19
|
"HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
|
@@ -32,7 +29,7 @@ exports.STANDARD_LUT_ACCOUNTS = [
|
|
32
29
|
web3_js_1.PublicKey.default,
|
33
30
|
exports.SOLAUTO_PROD_PROGRAM,
|
34
31
|
exports.SOLAUTO_TEST_PROGRAM,
|
35
|
-
|
32
|
+
generalConstants_1.SOLAUTO_MANAGER,
|
36
33
|
web3_js_1.SystemProgram.programId,
|
37
34
|
spl_token_1.TOKEN_PROGRAM_ID,
|
38
35
|
spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
@@ -41,5 +38,3 @@ exports.STANDARD_LUT_ACCOUNTS = [
|
|
41
38
|
web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
42
39
|
jupiter_sdk_1.JUPITER_PROGRAM_ID,
|
43
40
|
].map((x) => x.toString());
|
44
|
-
// TODO:
|
45
|
-
exports.BROKEN_TOKENS = [tokenConstants_1.JUP, tokenConstants_1.JLP, tokenConstants_1.WETH, tokenConstants_1.HNT, tokenConstants_1.JTO, tokenConstants_1.PYTH];
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { FlProviderBase } from "./flProviderBase";
|
2
1
|
import { PublicKey } from "@solana/web3.js";
|
3
|
-
import { FlashLoanDetails } from "../../types";
|
4
2
|
import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
|
3
|
+
import { FlProviderBase } from "./flProviderBase";
|
4
|
+
import { FlashLoanDetails, ProgramEnv } from "../../types";
|
5
5
|
import { TokenType } from "../../generated";
|
6
6
|
export declare class FlProviderAggregator extends FlProviderBase {
|
7
7
|
private marginfiFlProvider;
|
8
|
-
constructor(umi: Umi, signer: Signer, authority: PublicKey, supplyMint: PublicKey, debtMint: PublicKey);
|
8
|
+
constructor(umi: Umi, signer: Signer, authority: PublicKey, supplyMint: PublicKey, debtMint: PublicKey, programEnv?: ProgramEnv);
|
9
9
|
initialize(): Promise<void>;
|
10
10
|
flAccountPrereqIxs(): Promise<TransactionBuilder>;
|
11
11
|
otherSigners(): Signer[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flProviderAggregator.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/flProviderAggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"flProviderAggregator.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/flProviderAggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,OAAO,CAAC,kBAAkB,CAAsB;gBAG9C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,UAAU,CAAC,EAAE,UAAU;IAanB,UAAU;IAMV,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIvD,YAAY,IAAI,MAAM,EAAE;IAKxB,gBAAgB,IAAI,SAAS,EAAE;IAS/B,OAAO,CAAC,UAAU;IAKlB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAI7C,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IAI9D,WAAW,CACT,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IAOrB,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;CAG5D"}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FlProviderAggregator = void 0;
|
4
|
+
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
4
5
|
const flProviderBase_1 = require("./flProviderBase");
|
5
6
|
const marginfiFlProvider_1 = require("./marginfiFlProvider");
|
6
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
7
7
|
class FlProviderAggregator extends flProviderBase_1.FlProviderBase {
|
8
|
-
constructor(umi, signer, authority, supplyMint, debtMint) {
|
9
|
-
super(umi, signer, authority, supplyMint, debtMint);
|
10
|
-
this.marginfiFlProvider = new marginfiFlProvider_1.MarginfiFlProvider(umi, signer, authority, supplyMint, debtMint);
|
8
|
+
constructor(umi, signer, authority, supplyMint, debtMint, programEnv) {
|
9
|
+
super(umi, signer, authority, supplyMint, debtMint, programEnv);
|
10
|
+
this.marginfiFlProvider = new marginfiFlProvider_1.MarginfiFlProvider(umi, signer, authority, supplyMint, debtMint, programEnv);
|
11
11
|
}
|
12
12
|
async initialize() {
|
13
13
|
// TODO: PF
|
@@ -37,7 +37,7 @@ class FlProviderAggregator extends flProviderBase_1.FlProviderBase {
|
|
37
37
|
return this.flProvider(source).liquidityAvailable(source);
|
38
38
|
}
|
39
39
|
flFeeBps(source, signerFlashLoan) {
|
40
|
-
return this.flProvider(source).flFeeBps(source);
|
40
|
+
return this.flProvider(source).flFeeBps(source, signerFlashLoan);
|
41
41
|
}
|
42
42
|
flashBorrow(flashLoan, destTokenAccount) {
|
43
43
|
return this.flProvider(flashLoan.liquiditySource).flashBorrow(flashLoan, destTokenAccount);
|
@@ -1,15 +1,16 @@
|
|
1
|
-
import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
|
2
1
|
import { PublicKey } from "@solana/web3.js";
|
2
|
+
import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
|
3
3
|
import { TokenType } from "../../generated";
|
4
|
-
import { FlashLoanDetails } from "../../types";
|
4
|
+
import { FlashLoanDetails, ProgramEnv } from "../../types";
|
5
5
|
export declare abstract class FlProviderBase {
|
6
6
|
protected umi: Umi;
|
7
7
|
protected signer: Signer;
|
8
8
|
protected authority: PublicKey;
|
9
9
|
protected supplyMint: PublicKey;
|
10
10
|
protected debtMint: PublicKey;
|
11
|
+
protected programEnv: ProgramEnv;
|
11
12
|
protected flSigners: Signer[];
|
12
|
-
constructor(umi: Umi, signer: Signer, authority: PublicKey, supplyMint: PublicKey, debtMint: PublicKey);
|
13
|
+
constructor(umi: Umi, signer: Signer, authority: PublicKey, supplyMint: PublicKey, debtMint: PublicKey, programEnv?: ProgramEnv);
|
13
14
|
abstract initialize(): Promise<void>;
|
14
15
|
lutAccountsToAdd(): PublicKey[];
|
15
16
|
otherSigners(): Signer[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"flProviderBase.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/flProviderBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"flProviderBase.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/flProviderBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,8BAAsB,cAAc;IAIhC,SAAS,CAAC,GAAG,EAAE,GAAG;IAClB,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,SAAS,EAAE,SAAS;IAC9B,SAAS,CAAC,UAAU,EAAE,SAAS;IAC/B,SAAS,CAAC,QAAQ,EAAE,SAAS;IAC7B,SAAS,CAAC,UAAU,EAAE,UAAU;IARlC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;gBAGvB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,UAAU,GAAE,UAAmB;IAG3C,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAEpC,gBAAgB,IAAI,SAAS,EAAE;IAI/B,YAAY,IAAI,MAAM,EAAE;IAIxB,IAAI,CAAC,MAAM,EAAE,SAAS;IAItB,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IACtD,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAShD,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IACvE,QAAQ,CAAC,WAAW,CAClB,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IACrB,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;IAEpE,SAAS,CAAC,iBAAiB,CACzB,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;CAyBtB"}
|
@@ -2,16 +2,17 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FlProviderBase = void 0;
|
4
4
|
const umi_1 = require("@metaplex-foundation/umi");
|
5
|
+
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
5
6
|
const utils_1 = require("../../utils");
|
6
7
|
const generated_1 = require("../../generated");
|
7
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
8
8
|
class FlProviderBase {
|
9
|
-
constructor(umi, signer, authority, supplyMint, debtMint) {
|
9
|
+
constructor(umi, signer, authority, supplyMint, debtMint, programEnv = "Prod") {
|
10
10
|
this.umi = umi;
|
11
11
|
this.signer = signer;
|
12
12
|
this.authority = authority;
|
13
13
|
this.supplyMint = supplyMint;
|
14
14
|
this.debtMint = debtMint;
|
15
|
+
this.programEnv = programEnv;
|
15
16
|
this.flSigners = [];
|
16
17
|
}
|
17
18
|
lutAccountsToAdd() {
|
@@ -1,8 +1,8 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
1
2
|
import { TransactionBuilder } from "@metaplex-foundation/umi";
|
2
3
|
import { FlProviderBase } from "./flProviderBase";
|
3
|
-
import { PublicKey } from "@solana/web3.js";
|
4
|
-
import { TokenType } from "../../generated";
|
5
4
|
import { FlashLoanDetails } from "../../types";
|
5
|
+
import { TokenType } from "../../generated";
|
6
6
|
export declare class MarginfiFlProvider extends FlProviderBase {
|
7
7
|
private existingMarginfiAccounts;
|
8
8
|
private supplyBankLiquiditySource;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiFlProvider.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/marginfiFlProvider.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"marginfiFlProvider.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/marginfiFlProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAML,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAclC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAelD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,OAAO,CAAC,wBAAwB,CAAqB;IACrD,OAAO,CAAC,yBAAyB,CAAQ;IACzC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,iBAAiB,CAAe;IACxC,OAAO,CAAC,eAAe,CAAe;IAEhC,UAAU;YAiBF,iBAAiB;IA6C/B,OAAO,CAAC,sBAAsB;IA0CxB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAyC3D,gBAAgB,IAAI,SAAS,EAAE;IAY/B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAMnB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAI7C,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IAc9D,WAAW,CACT,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IAoCrB,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;IA2E3D,YAAY,CACV,eAAe,EAAE,SAAS,EAC1B,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,SAAS;CAW3B"}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.MarginfiFlProvider = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
4
5
|
const umi_1 = require("@metaplex-foundation/umi");
|
6
|
+
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
5
7
|
const constants_1 = require("../../constants");
|
6
8
|
const marginfi_sdk_1 = require("../../marginfi-sdk");
|
7
9
|
const flProviderBase_1 = require("./flProviderBase");
|
8
|
-
const web3_js_1 = require("@solana/web3.js");
|
9
10
|
const utils_1 = require("../../utils");
|
10
11
|
const generated_1 = require("../../generated");
|
11
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
12
12
|
class MarginfiFlProvider extends flProviderBase_1.FlProviderBase {
|
13
13
|
async initialize() {
|
14
14
|
await this.setAvailableBanks();
|
@@ -23,13 +23,14 @@ class MarginfiFlProvider extends flProviderBase_1.FlProviderBase {
|
|
23
23
|
}
|
24
24
|
}
|
25
25
|
async setAvailableBanks() {
|
26
|
+
const bankAccounts = (0, constants_1.getMarginfiAccounts)(this.programEnv).bankAccounts;
|
26
27
|
const availableBanks = [];
|
27
28
|
const checkIfUsable = (group, mint) => {
|
28
|
-
if (Object.keys(
|
29
|
-
availableBanks.push(
|
29
|
+
if (Object.keys(bankAccounts[group]).includes(mint.toString())) {
|
30
|
+
availableBanks.push(bankAccounts[group][mint.toString()].bank);
|
30
31
|
}
|
31
32
|
};
|
32
|
-
for (const group of Object.keys(
|
33
|
+
for (const group of Object.keys(bankAccounts)) {
|
33
34
|
checkIfUsable(group, this.supplyMint);
|
34
35
|
checkIfUsable(group, this.debtMint);
|
35
36
|
}
|
@@ -53,7 +54,6 @@ class MarginfiFlProvider extends flProviderBase_1.FlProviderBase {
|
|
53
54
|
}
|
54
55
|
setIntermediaryAccount(sources) {
|
55
56
|
const compatibleMarginfiAccounts = this.existingMarginfiAccounts.filter((x) => x.group.toString() == this.liquidityBank(sources[0]).group);
|
56
|
-
// TODO: instead of picking first compatibleMarginfiAccoutn, pick one where we already have it in the marginfi Lut
|
57
57
|
const signer = compatibleMarginfiAccounts.length > 0
|
58
58
|
? undefined
|
59
59
|
: (0, umi_1.createSignerFromKeypair)(this.umi, this.umi.eddsa.generateKeypair());
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceSwapManager.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceSwapManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"rebalanceSwapManager.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceSwapManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAkB,UAAU,EAAa,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAYpD,qBAAa,oBAAoB;IAQ7B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,2BAA2B,CAAC;IAV/B,UAAU,EAAG,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,cAAc,CAAkB;gBAG9B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,cAAc,CAAC,EAAE,qBAAqB,YAAA,EACtC,2BAA2B,CAAC,EAAE,MAAM,YAAA;IAK9C,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,kCAAkC;YA6B5B,mBAAmB;IAoCjC,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,mBAAmB;IAIrB,aAAa,CAAC,UAAU,EAAE,MAAM;IAkFhC,aAAa;;;;;;CAWpB"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.RebalanceSwapManager = void 0;
|
4
|
+
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
4
5
|
const swap_1 = require("../swap");
|
5
6
|
const generated_1 = require("../../generated");
|
6
7
|
const utils_1 = require("../../utils");
|
7
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
8
8
|
class RebalanceSwapManager {
|
9
9
|
constructor(client, values, flRequirements, targetLiqUtilizationRateBps) {
|
10
10
|
this.client = client;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAwBrB,qBAAa,kBAAkB;IAO3B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,2BAA2B,CAAC;IAPtC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAC,CAAwB;gBAGrC,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,YAAA;IAG9C,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;YAyCd,qBAAqB;IAyCnC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gBAAgB;YA+BV,mBAAmB;YAmBnB,sBAAsB;YAyBtB,mBAAmB;IAiEpB,gBAAgB,CAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAW9C"}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.RebalanceTxBuilder = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
6
|
+
const umi_1 = require("@metaplex-foundation/umi");
|
4
7
|
const utils_1 = require("../../utils");
|
8
|
+
const generated_1 = require("../../generated");
|
5
9
|
const rebalanceValues_1 = require("./rebalanceValues");
|
6
10
|
const solautoFees_1 = require("./solautoFees");
|
7
|
-
const generated_1 = require("../../generated");
|
8
|
-
const web3_js_1 = require("@solana/web3.js");
|
9
11
|
const rebalanceSwapManager_1 = require("./rebalanceSwapManager");
|
10
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
11
|
-
const umi_1 = require("@metaplex-foundation/umi");
|
12
12
|
class RebalanceTxBuilder {
|
13
13
|
constructor(client, targetLiqUtilizationRateBps) {
|
14
14
|
this.client = client;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceValues.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"rebalanceValues.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC;IAC1B,iCAAiC,EAAE,MAAM,CAAC;CAC3C;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,yBAAyB;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,iCAAiC,EAAE,MAAM,CAAC;CAC3C;AAED,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,gBAAgB,GACtB,yBAAyB,CA8B3B;AAED,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,cAAc,EACnB,2BAA2B,EAAE,MAAM,EACnC,IAAI,CAAC,EAAE,gBAAgB,GACtB,cAAc,CAgChB;AAqED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,iBAAiB,EAClC,2BAA2B,CAAC,EAAE,MAAM,EACpC,aAAa,CAAC,EAAE,cAAc,EAC9B,QAAQ,CAAC,EAAE,MAAM,GAChB,eAAe,CA6CjB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoFees.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/solautoFees.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,cAAc;IAEvB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,mBAAmB;gBAFnB,UAAU,EAAE,OAAO,EACnB,2BAA2B,EAAE,MAAM,GAAG,SAAS,EAC/C,mBAAmB,EAAE,MAAM;IAGrC,MAAM,CAAC,MAAM,CACX,UAAU,EAAE,OAAO,EACnB,2BAA2B,EAAE,MAAM,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM;IASrB,iBAAiB,CAAC,kBAAkB,EAAE,kBAAkB;;;;;
|
1
|
+
{"version":3,"file":"solautoFees.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/solautoFees.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,cAAc;IAEvB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,mBAAmB;gBAFnB,UAAU,EAAE,OAAO,EACnB,2BAA2B,EAAE,MAAM,GAAG,SAAS,EAC/C,mBAAmB,EAAE,MAAM;IAGrC,MAAM,CAAC,MAAM,CACX,UAAU,EAAE,OAAO,EACnB,2BAA2B,EAAE,MAAM,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM;IASrB,iBAAiB,CAAC,kBAAkB,EAAE,kBAAkB;;;;;CA8CzD"}
|
@@ -26,8 +26,10 @@ class SolautoFeesBps {
|
|
26
26
|
};
|
27
27
|
}
|
28
28
|
let feeBps = 0;
|
29
|
-
if (this.targetLiqUtilizationRateBps !== undefined
|
30
|
-
|
29
|
+
if (this.targetLiqUtilizationRateBps !== undefined) {
|
30
|
+
feeBps = 15;
|
31
|
+
}
|
32
|
+
else if (rebalanceDirection === generated_1.RebalanceDirection.Repay) {
|
31
33
|
feeBps = 25;
|
32
34
|
}
|
33
35
|
else if (this.positionNetWorthUsd <= minSize) {
|
@@ -2,11 +2,11 @@ import "rpc-websockets/dist/lib/client";
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
3
3
|
import { TransactionBuilder } from "@metaplex-foundation/umi";
|
4
4
|
import { DCASettingsInpArgs, LendingPlatform, RebalanceStep, SolautoActionArgs, SolautoSettingsParametersInpArgs, UpdatePositionDataArgs } from "../../generated";
|
5
|
-
import { ContextUpdates } from "../../utils
|
5
|
+
import { ContextUpdates } from "../../utils";
|
6
|
+
import { ProgramEnv, RebalanceDetails } from "../../types";
|
6
7
|
import { ReferralStateManager, ReferralStateManagerArgs } from "./referralStateManager";
|
7
8
|
import { SolautoPositionEx } from "../../solautoPosition";
|
8
|
-
import {
|
9
|
-
import { FlProviderAggregator } from "../flashLoans/flProviderAggregator";
|
9
|
+
import { FlProviderAggregator } from "../flashLoans";
|
10
10
|
export interface SolautoClientArgs extends ReferralStateManagerArgs {
|
11
11
|
new?: boolean;
|
12
12
|
positionId?: number;
|
@@ -17,6 +17,7 @@ export interface SolautoClientArgs extends ReferralStateManagerArgs {
|
|
17
17
|
}
|
18
18
|
export declare abstract class SolautoClient extends ReferralStateManager {
|
19
19
|
lendingPlatform: LendingPlatform;
|
20
|
+
lpEnv: ProgramEnv;
|
20
21
|
authority: PublicKey;
|
21
22
|
positionId: number;
|
22
23
|
selfManaged: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,
|
1
|
+
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gCAAgC,EAEhC,sBAAsB,EAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAML,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,8BAAsB,aAAc,SAAQ,oBAAoB;IACvD,eAAe,EAAG,eAAe,CAAC;IAClC,KAAK,EAAG,UAAU,CAAC;IAEnB,SAAS,EAAG,SAAS,CAAC;IAEtB,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,EAAG,OAAO,CAAC;IACtB,GAAG,EAAG,iBAAiB,CAAC;IAExB,gBAAgB,EAAG,SAAS,CAAC;IAC7B,cAAc,EAAG,SAAS,CAAC;IAE3B,cAAc,EAAG,SAAS,CAAC;IAC3B,YAAY,EAAG,SAAS,CAAC;IAEzB,mBAAmB,EAAG,SAAS,CAAC;IAChC,iBAAiB,EAAG,SAAS,CAAC;IAE9B,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAEhC,UAAU,EAAG,oBAAoB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAwB;IAE7D,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,iBAAiB,CAAqB;IAExC,UAAU,CAAC,IAAI,EAAE,iBAAiB;IAoFxC,kBAAkB,IAAI,SAAS,GAAG,SAAS;IAO3C,gBAAgB,IAAI,SAAS,GAAG,SAAS;IAOnC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO;IAkB1C,mBAAmB,IAAI,MAAM,EAAE;IAS/B,gBAAgB,IAAI,SAAS,EAAE;IAoBzB,iCAAiC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAUzD,iBAAiB,IAAI,OAAO,CAC9B;QACE,EAAE,EAAE,kBAAkB,CAAC;QACvB,GAAG,EAAE,OAAO,CAAC;QACb,aAAa,EAAE,SAAS,EAAE,CAAC;KAC5B,GACD,SAAS,CACZ;IA4DK,cAAc,IAAI,OAAO,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IAgBF,cAAc,CACZ,QAAQ,CAAC,EAAE,gCAAgC,EAC3C,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IA0BrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IAsDlE,QAAQ,CAAC,eAAe,IAAI,kBAAkB;IAE9C,WAAW,IAAI,kBAAkB;IAgCjC,QAAQ,CAAC,SAAS,IAAI,kBAAkB;IAExC,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAsFlE,QAAQ,CAAC,WAAW,CAClB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,gBAAgB,GACrB,kBAAkB;CACtB"}
|