@haven-fi/solauto-sdk 1.0.670 → 1.0.672
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/generated/types/positionData.d.ts +3 -3
- package/dist/generated/types/positionData.d.ts.map +1 -1
- package/dist/generated/types/positionData.js +2 -2
- package/dist/idls/switchboard.json +0 -1949
- package/dist/services/rebalance/rebalanceTxBuilder.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceTxBuilder.js +3 -0
- package/dist/services/solauto/solautoClient.d.ts +1 -1
- package/dist/services/solauto/solautoClient.d.ts.map +1 -1
- package/dist/services/solauto/solautoClient.js +2 -25
- package/dist/services/solauto/solautoMarginfiClient.js +1 -1
- package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts +0 -2
- package/dist/solautoPosition/marginfiSolautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/marginfiSolautoPositionEx.js +3 -17
- package/dist/solautoPosition/positionUtils.d.ts.map +1 -1
- package/dist/solautoPosition/positionUtils.js +6 -1
- package/dist/solautoPosition/solautoPositionEx.d.ts +5 -7
- package/dist/solautoPosition/solautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/solautoPositionEx.js +8 -11
- package/dist/utils/marginfi/data.d.ts +2 -2
- package/dist/utils/marginfi/data.d.ts.map +1 -1
- package/dist/utils/marginfi/data.js +6 -2
- package/local/txSandbox.ts +67 -12
- package/package.json +1 -1
- package/src/generated/types/positionData.ts +4 -7
- package/src/services/rebalance/rebalanceTxBuilder.ts +4 -0
- package/src/services/solauto/solautoClient.ts +3 -27
- package/src/services/solauto/solautoMarginfiClient.ts +1 -1
- package/src/solautoPosition/marginfiSolautoPositionEx.ts +4 -32
- package/src/solautoPosition/positionUtils.ts +8 -1
- package/src/solautoPosition/solautoPositionEx.ts +14 -18
- package/src/utils/marginfi/data.ts +16 -7
- package/dist/constants/generalConstants.d.ts +0 -7
- package/dist/constants/generalConstants.d.ts.map +0 -1
- package/dist/constants/generalConstants.js +0 -10
- package/dist/constants/index.d.ts +0 -7
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js +0 -22
- package/dist/constants/marginfiAccounts.d.ts +0 -17
- package/dist/constants/marginfiAccounts.d.ts.map +0 -1
- package/dist/constants/marginfiAccounts.js +0 -234
- package/dist/constants/pythConstants.d.ts +0 -24
- package/dist/constants/pythConstants.d.ts.map +0 -1
- package/dist/constants/pythConstants.js +0 -52
- package/dist/constants/solautoConstants.d.ts +0 -19
- package/dist/constants/solautoConstants.d.ts.map +0 -1
- package/dist/constants/solautoConstants.js +0 -40
- package/dist/constants/switchboardConstants.d.ts +0 -9
- package/dist/constants/switchboardConstants.d.ts.map +0 -1
- package/dist/constants/switchboardConstants.js +0 -54
- package/dist/constants/tokenConstants.d.ts +0 -40
- package/dist/constants/tokenConstants.d.ts.map +0 -1
- package/dist/constants/tokenConstants.js +0 -174
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -27
- package/dist/utils/index.d.ts +0 -14
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -29
- package/dist/utils/switchboardUtils.d.ts +0 -12
- package/dist/utils/switchboardUtils.d.ts.map +0 -1
- package/dist/utils/switchboardUtils.js +0 -81
@@ -1,19 +0,0 @@
|
|
1
|
-
import { PublicKey } from "@solana/web3.js";
|
2
|
-
export declare const SOLAUTO_PROD_PROGRAM: PublicKey;
|
3
|
-
export declare const SOLAUTO_TEST_PROGRAM: PublicKey;
|
4
|
-
export declare const MIN_REPAY_GAP_BPS = 50;
|
5
|
-
export declare const MIN_BOOST_GAP_BPS = 50;
|
6
|
-
export declare const MIN_USD_SUPPORTED_POSITION = 1000;
|
7
|
-
export declare const OFFSET_FROM_MAX_LTV = 0.005;
|
8
|
-
export declare const REFERRER_PERCENTAGE = 0.15;
|
9
|
-
export declare const PRICES: {
|
10
|
-
[key: string]: {
|
11
|
-
realtimePrice: number;
|
12
|
-
emaPrice: number;
|
13
|
-
time: number;
|
14
|
-
};
|
15
|
-
};
|
16
|
-
export declare const JITO_TIP_ACCOUNTS: string[];
|
17
|
-
export declare const SOLAUTO_LUT = "8b7KefQDroVLGao71J5H3hFwABeyMCgCrLpXWssNFhk9";
|
18
|
-
export declare const STANDARD_LUT_ACCOUNTS: string[];
|
19
|
-
//# sourceMappingURL=solautoConstants.d.ts.map
|
@@ -1 +0,0 @@
|
|
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,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAO,CAAC;AAEvG,eAAO,MAAM,iBAAiB,UAS7B,CAAC;AAEF,eAAO,MAAM,WAAW,iDAAiD,CAAC;AAC1E,eAAO,MAAM,qBAAqB,UAYR,CAAC"}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.STANDARD_LUT_ACCOUNTS = exports.SOLAUTO_LUT = exports.JITO_TIP_ACCOUNTS = exports.PRICES = exports.REFERRER_PERCENTAGE = exports.OFFSET_FROM_MAX_LTV = exports.MIN_USD_SUPPORTED_POSITION = exports.MIN_BOOST_GAP_BPS = exports.MIN_REPAY_GAP_BPS = exports.SOLAUTO_TEST_PROGRAM = exports.SOLAUTO_PROD_PROGRAM = void 0;
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
5
|
-
const spl_token_1 = require("@solana/spl-token");
|
6
|
-
const generalConstants_1 = require("./generalConstants");
|
7
|
-
const jupiter_sdk_1 = require("../jupiter-sdk");
|
8
|
-
exports.SOLAUTO_PROD_PROGRAM = new web3_js_1.PublicKey("AutoyKBRaHSBHy9RsmXCZMy6nNFAg5FYijrvZyQcNLV");
|
9
|
-
exports.SOLAUTO_TEST_PROGRAM = new web3_js_1.PublicKey("TesTjfQ6TbXv96Tv6fqr95XTZ1LYPxtkafmShN9PjBp");
|
10
|
-
globalThis.SHOW_LOGS = false;
|
11
|
-
exports.MIN_REPAY_GAP_BPS = 50;
|
12
|
-
exports.MIN_BOOST_GAP_BPS = 50;
|
13
|
-
exports.MIN_USD_SUPPORTED_POSITION = 1000;
|
14
|
-
exports.OFFSET_FROM_MAX_LTV = 0.005;
|
15
|
-
exports.REFERRER_PERCENTAGE = 0.15;
|
16
|
-
exports.PRICES = {};
|
17
|
-
exports.JITO_TIP_ACCOUNTS = [
|
18
|
-
"96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
|
19
|
-
"HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
|
20
|
-
"Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY",
|
21
|
-
"ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49",
|
22
|
-
"DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh",
|
23
|
-
"ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt",
|
24
|
-
"DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL",
|
25
|
-
"3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT",
|
26
|
-
];
|
27
|
-
exports.SOLAUTO_LUT = "8b7KefQDroVLGao71J5H3hFwABeyMCgCrLpXWssNFhk9";
|
28
|
-
exports.STANDARD_LUT_ACCOUNTS = [
|
29
|
-
web3_js_1.PublicKey.default,
|
30
|
-
exports.SOLAUTO_PROD_PROGRAM,
|
31
|
-
exports.SOLAUTO_TEST_PROGRAM,
|
32
|
-
generalConstants_1.SOLAUTO_MANAGER,
|
33
|
-
web3_js_1.SystemProgram.programId,
|
34
|
-
spl_token_1.TOKEN_PROGRAM_ID,
|
35
|
-
spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
36
|
-
web3_js_1.SYSVAR_CLOCK_PUBKEY,
|
37
|
-
web3_js_1.SYSVAR_RENT_PUBKEY,
|
38
|
-
web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
39
|
-
jupiter_sdk_1.JUPITER_PROGRAM_ID,
|
40
|
-
].map((x) => x.toString());
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"switchboardConstants.d.ts","sourceRoot":"","sources":["../../src/constants/switchboardConstants.ts"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,eAAO,MAAM,0BAA0B,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAA;CA+BxE,CAAC"}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.SWITCHBOARD_PRICE_FEED_IDS = void 0;
|
27
|
-
const tokens = __importStar(require("./tokenConstants"));
|
28
|
-
// https://beta.ondemand.switchboard.xyz/solana/mainnet
|
29
|
-
exports.SWITCHBOARD_PRICE_FEED_IDS = {
|
30
|
-
[tokens.JUP_SOL]: {
|
31
|
-
feedId: "HX5WM3qzogAfRCjBUWwnniLByMfFrjm1b5yo4KoWGR27",
|
32
|
-
feedHash: "0xc02f22d47b20b43bafde474328ac027283dbd7bb443660f5ec414c93faec56dc",
|
33
|
-
},
|
34
|
-
[tokens.H_SOL]: {
|
35
|
-
feedId: "1snBjCaHejZqQsAqkELAKNaqUrDNNCr7zmNX6qaQCzg",
|
36
|
-
feedHash: "0x59206aa3da593cd2312bde1930cf3368f6119a650229e147060be4fc2fcd1367",
|
37
|
-
},
|
38
|
-
[tokens.POPCAT]: {
|
39
|
-
feedId: "FTcFqwCjAgv2VMaowQ9XSBcesVzFzZkaju25nKio6bki",
|
40
|
-
feedHash: "0xeb4f9a43024f8f33786b7291404510af8e94a66e1acb44953a3137878ee7033f",
|
41
|
-
},
|
42
|
-
[tokens.RETARDIO]: {
|
43
|
-
feedId: "EvPXnpMoyrj4B6P55LDP2VpSLkTBWom2SqL4486ToNhM",
|
44
|
-
feedHash: "0x982d968a0608046986aec84d95ae884c4dc2140f0b3e14ed7b8161ada573d18b",
|
45
|
-
},
|
46
|
-
[tokens.BILLY]: {
|
47
|
-
feedId: "uBe4er4VSMgYvBNwSbFctSShRXNPkCfaPh7zHMBFeBi",
|
48
|
-
feedHash: "0xbbd0d393111ff1ad7cc1a2f15ce24b61d4d6b3e99e440aa77572bd7f1da9afbe",
|
49
|
-
},
|
50
|
-
[tokens.HMTR]: {
|
51
|
-
feedId: "F2hKL67W4ZDe9k7ZrJKnp2LhWrgqg2JQTkJf2dgBggRD",
|
52
|
-
feedHash: "0x61999c4f8a03208b5b5b50663323b1ef8d0acbb3642ec79053b33b5768605fb5",
|
53
|
-
},
|
54
|
-
};
|
@@ -1,40 +0,0 @@
|
|
1
|
-
export declare const B_SOL = "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1";
|
2
|
-
export declare const JITO_SOL = "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn";
|
3
|
-
export declare const LST = "LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp";
|
4
|
-
export declare const M_SOL = "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So";
|
5
|
-
export declare const INF = "5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm";
|
6
|
-
export declare const H_SOL = "he1iusmfkpAdwvxLNGV8Y1iSbj4rUy6yMhEA3fotn9A";
|
7
|
-
export declare const JUP_SOL = "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v";
|
8
|
-
export declare const JUP = "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN";
|
9
|
-
export declare const JTO = "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL";
|
10
|
-
export declare const JLP = "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4";
|
11
|
-
export declare const WBTC = "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
12
|
-
export declare const WETH = "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
13
|
-
export declare const HNT = "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux";
|
14
|
-
export declare const PYTH = "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3";
|
15
|
-
export declare const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
16
|
-
export declare const USDT = "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
|
17
|
-
export declare const BONK = "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263";
|
18
|
-
export declare const WIF = "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm";
|
19
|
-
export declare const POPCAT = "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr";
|
20
|
-
export declare const RETARDIO = "6ogzHhzdrQr9Pgv6hZ2MNze7UrzBMAFyBBWUYp1Fhitx";
|
21
|
-
export declare const BILLY = "3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump";
|
22
|
-
export declare const HMTR = "7JhmUcZrrfhyt5nTSu3AfsrUq2L9992a7AhwdSDxdoL2";
|
23
|
-
export declare const ALL_SUPPORTED_TOKENS: string[];
|
24
|
-
export interface TokenInfo {
|
25
|
-
ticker: string;
|
26
|
-
decimals: number;
|
27
|
-
isStableCoin?: boolean;
|
28
|
-
isLST?: boolean;
|
29
|
-
isMeme?: boolean;
|
30
|
-
isMajor?: boolean;
|
31
|
-
}
|
32
|
-
export declare const TOKEN_INFO: {
|
33
|
-
[key: string]: TokenInfo;
|
34
|
-
};
|
35
|
-
export declare const MAJORS_PRIO: {
|
36
|
-
[x: string]: number;
|
37
|
-
"3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh": number;
|
38
|
-
"7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs": number;
|
39
|
-
};
|
40
|
-
//# sourceMappingURL=tokenConstants.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"tokenConstants.d.ts","sourceRoot":"","sources":["../../src/constants/tokenConstants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,QAAQ,iDAAiD,CAAC;AACvE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AACjE,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,GAAG,iDAAiD,CAAC;AAClE,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,OAAO,gDAAgD,CAAC;AACrE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AACjE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AACjE,eAAO,MAAM,GAAG,iDAAiD,CAAC;AAClE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AACnE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AACnE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AACjE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AACnE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AACnE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AACnE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AACnE,eAAO,MAAM,GAAG,iDAAiD,CAAC;AAClE,eAAO,MAAM,MAAM,iDAAiD,CAAC;AACrE,eAAO,MAAM,QAAQ,iDAAiD,CAAC;AACvE,eAAO,MAAM,KAAK,iDAAiD,CAAC;AACpE,eAAO,MAAM,IAAI,iDAAiD,CAAC;AAEnE,eAAO,MAAM,oBAAoB,UAwBhC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAmHlD,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAIvB,CAAC"}
|
@@ -1,174 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.MAJORS_PRIO = exports.TOKEN_INFO = exports.ALL_SUPPORTED_TOKENS = exports.HMTR = exports.BILLY = exports.RETARDIO = exports.POPCAT = exports.WIF = exports.BONK = exports.USDT = exports.USDC = exports.PYTH = exports.HNT = exports.WETH = exports.WBTC = exports.JLP = exports.JTO = exports.JUP = exports.JUP_SOL = exports.H_SOL = exports.INF = exports.M_SOL = exports.LST = exports.JITO_SOL = exports.B_SOL = void 0;
|
4
|
-
const spl_token_1 = require("@solana/spl-token");
|
5
|
-
const web3_js_1 = require("@solana/web3.js");
|
6
|
-
// When adding token ensure a price feed is provided in pythConstants.ts & the token is in TOKEN_INFO
|
7
|
-
exports.B_SOL = "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1";
|
8
|
-
exports.JITO_SOL = "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn";
|
9
|
-
exports.LST = "LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp";
|
10
|
-
exports.M_SOL = "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So";
|
11
|
-
exports.INF = "5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm";
|
12
|
-
exports.H_SOL = "he1iusmfkpAdwvxLNGV8Y1iSbj4rUy6yMhEA3fotn9A";
|
13
|
-
exports.JUP_SOL = "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v";
|
14
|
-
exports.JUP = "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN";
|
15
|
-
exports.JTO = "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL";
|
16
|
-
exports.JLP = "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4";
|
17
|
-
exports.WBTC = "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
18
|
-
exports.WETH = "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
19
|
-
exports.HNT = "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux";
|
20
|
-
exports.PYTH = "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3";
|
21
|
-
exports.USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
22
|
-
exports.USDT = "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
|
23
|
-
exports.BONK = "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263";
|
24
|
-
exports.WIF = "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm";
|
25
|
-
exports.POPCAT = "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr";
|
26
|
-
exports.RETARDIO = "6ogzHhzdrQr9Pgv6hZ2MNze7UrzBMAFyBBWUYp1Fhitx";
|
27
|
-
exports.BILLY = "3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump";
|
28
|
-
exports.HMTR = "7JhmUcZrrfhyt5nTSu3AfsrUq2L9992a7AhwdSDxdoL2";
|
29
|
-
exports.ALL_SUPPORTED_TOKENS = [
|
30
|
-
spl_token_1.NATIVE_MINT.toString(),
|
31
|
-
exports.B_SOL,
|
32
|
-
exports.M_SOL,
|
33
|
-
exports.JITO_SOL,
|
34
|
-
exports.LST,
|
35
|
-
exports.INF,
|
36
|
-
exports.H_SOL,
|
37
|
-
exports.JUP_SOL,
|
38
|
-
exports.JUP,
|
39
|
-
exports.JTO,
|
40
|
-
exports.JLP,
|
41
|
-
exports.WBTC,
|
42
|
-
exports.WETH,
|
43
|
-
exports.HNT,
|
44
|
-
exports.PYTH,
|
45
|
-
exports.USDC,
|
46
|
-
exports.USDT,
|
47
|
-
exports.BONK,
|
48
|
-
exports.WIF,
|
49
|
-
exports.POPCAT,
|
50
|
-
exports.RETARDIO,
|
51
|
-
exports.BILLY,
|
52
|
-
exports.HMTR,
|
53
|
-
];
|
54
|
-
exports.TOKEN_INFO = {
|
55
|
-
[web3_js_1.PublicKey.default.toString()]: {
|
56
|
-
ticker: "",
|
57
|
-
decimals: 1,
|
58
|
-
},
|
59
|
-
[spl_token_1.NATIVE_MINT.toString()]: {
|
60
|
-
ticker: "SOL",
|
61
|
-
decimals: 9,
|
62
|
-
isMajor: true,
|
63
|
-
},
|
64
|
-
[exports.B_SOL]: {
|
65
|
-
ticker: "bSOL",
|
66
|
-
decimals: 9,
|
67
|
-
isLST: true,
|
68
|
-
},
|
69
|
-
[exports.M_SOL]: {
|
70
|
-
ticker: "mSOL",
|
71
|
-
decimals: 9,
|
72
|
-
isLST: true,
|
73
|
-
},
|
74
|
-
[exports.JITO_SOL]: {
|
75
|
-
ticker: "JitoSOL",
|
76
|
-
decimals: 9,
|
77
|
-
isLST: true,
|
78
|
-
},
|
79
|
-
[exports.LST]: {
|
80
|
-
ticker: "LST",
|
81
|
-
decimals: 9,
|
82
|
-
isLST: true,
|
83
|
-
},
|
84
|
-
[exports.INF]: {
|
85
|
-
ticker: "INF",
|
86
|
-
decimals: 9,
|
87
|
-
isLST: true,
|
88
|
-
},
|
89
|
-
[exports.H_SOL]: {
|
90
|
-
ticker: "hSOL",
|
91
|
-
decimals: 9,
|
92
|
-
isLST: true,
|
93
|
-
},
|
94
|
-
[exports.JUP_SOL]: {
|
95
|
-
ticker: "JupSOL",
|
96
|
-
decimals: 9,
|
97
|
-
isLST: true,
|
98
|
-
},
|
99
|
-
[exports.JUP]: {
|
100
|
-
ticker: "JUP",
|
101
|
-
decimals: 6,
|
102
|
-
},
|
103
|
-
[exports.JTO]: {
|
104
|
-
ticker: "JTO",
|
105
|
-
decimals: 9,
|
106
|
-
},
|
107
|
-
[exports.JLP]: {
|
108
|
-
ticker: "JLP",
|
109
|
-
decimals: 6,
|
110
|
-
},
|
111
|
-
[exports.WBTC]: {
|
112
|
-
ticker: "WBTC",
|
113
|
-
decimals: 8,
|
114
|
-
isMajor: true,
|
115
|
-
},
|
116
|
-
[exports.WETH]: {
|
117
|
-
ticker: "WETH",
|
118
|
-
decimals: 8,
|
119
|
-
isMajor: true,
|
120
|
-
},
|
121
|
-
[exports.HNT]: {
|
122
|
-
ticker: "HNT",
|
123
|
-
decimals: 8,
|
124
|
-
},
|
125
|
-
[exports.PYTH]: {
|
126
|
-
ticker: "PYTH",
|
127
|
-
decimals: 6,
|
128
|
-
},
|
129
|
-
[exports.USDC]: {
|
130
|
-
ticker: "USDC",
|
131
|
-
decimals: 6,
|
132
|
-
isStableCoin: true,
|
133
|
-
},
|
134
|
-
[exports.USDT]: {
|
135
|
-
ticker: "USDT",
|
136
|
-
decimals: 6,
|
137
|
-
isStableCoin: true,
|
138
|
-
},
|
139
|
-
[exports.BONK]: {
|
140
|
-
ticker: "BONK",
|
141
|
-
decimals: 5,
|
142
|
-
isMeme: true,
|
143
|
-
},
|
144
|
-
[exports.WIF]: {
|
145
|
-
ticker: "WIF",
|
146
|
-
decimals: 6,
|
147
|
-
isMeme: true,
|
148
|
-
},
|
149
|
-
[exports.POPCAT]: {
|
150
|
-
ticker: "POPCAT",
|
151
|
-
decimals: 9,
|
152
|
-
isMeme: true,
|
153
|
-
},
|
154
|
-
[exports.RETARDIO]: {
|
155
|
-
ticker: "RETARDIO",
|
156
|
-
decimals: 6,
|
157
|
-
isMeme: true,
|
158
|
-
},
|
159
|
-
[exports.BILLY]: {
|
160
|
-
ticker: "BILLY",
|
161
|
-
decimals: 6,
|
162
|
-
isMeme: true,
|
163
|
-
},
|
164
|
-
[exports.HMTR]: {
|
165
|
-
ticker: "HMTR",
|
166
|
-
decimals: 0,
|
167
|
-
isMeme: true,
|
168
|
-
},
|
169
|
-
};
|
170
|
-
exports.MAJORS_PRIO = {
|
171
|
-
[exports.WBTC]: 0,
|
172
|
-
[exports.WETH]: 1,
|
173
|
-
[spl_token_1.NATIVE_MINT.toString()]: 2,
|
174
|
-
};
|
package/dist/index.d.ts
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
export * from "./constants";
|
2
|
-
export * from "./generated/accounts";
|
3
|
-
export * from "./generated/instructions";
|
4
|
-
export * from "./generated/types";
|
5
|
-
export * from "./marginfi-sdk/accounts";
|
6
|
-
export * from "./marginfi-sdk/instructions";
|
7
|
-
export * from "./marginfi-sdk/types";
|
8
|
-
export * from "./services";
|
9
|
-
export * from "./solautoPosition";
|
10
|
-
export * from "./types";
|
11
|
-
export * from "./utils";
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./constants"), exports);
|
18
|
-
__exportStar(require("./generated/accounts"), exports);
|
19
|
-
__exportStar(require("./generated/instructions"), exports);
|
20
|
-
__exportStar(require("./generated/types"), exports);
|
21
|
-
__exportStar(require("./marginfi-sdk/accounts"), exports);
|
22
|
-
__exportStar(require("./marginfi-sdk/instructions"), exports);
|
23
|
-
__exportStar(require("./marginfi-sdk/types"), exports);
|
24
|
-
__exportStar(require("./services"), exports);
|
25
|
-
__exportStar(require("./solautoPosition"), exports);
|
26
|
-
__exportStar(require("./types"), exports);
|
27
|
-
__exportStar(require("./utils"), exports);
|
package/dist/utils/index.d.ts
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
export * from "./accountUtils";
|
2
|
-
export * from "./generalUtils";
|
3
|
-
export * from "./instructionUtils";
|
4
|
-
export * from "./jitoUtils";
|
5
|
-
export * from "./jupiterUtils";
|
6
|
-
export * from "./marginfi";
|
7
|
-
export * from "./numberUtils";
|
8
|
-
export * from "./solautoUtils";
|
9
|
-
export * from "./solanaUtils";
|
10
|
-
export * from "./stringUtils";
|
11
|
-
export * from "./priceUtils";
|
12
|
-
export * from "./pythUtils";
|
13
|
-
export * from "./switchboardUtils";
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
package/dist/utils/index.js
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./accountUtils"), exports);
|
18
|
-
__exportStar(require("./generalUtils"), exports);
|
19
|
-
__exportStar(require("./instructionUtils"), exports);
|
20
|
-
__exportStar(require("./jitoUtils"), exports);
|
21
|
-
__exportStar(require("./jupiterUtils"), exports);
|
22
|
-
__exportStar(require("./marginfi"), exports);
|
23
|
-
__exportStar(require("./numberUtils"), exports);
|
24
|
-
__exportStar(require("./solautoUtils"), exports);
|
25
|
-
__exportStar(require("./solanaUtils"), exports);
|
26
|
-
__exportStar(require("./stringUtils"), exports);
|
27
|
-
__exportStar(require("./priceUtils"), exports);
|
28
|
-
__exportStar(require("./pythUtils"), exports);
|
29
|
-
__exportStar(require("./switchboardUtils"), exports);
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Connection, PublicKey } from "@solana/web3.js";
|
2
|
-
import { Signer } from "@metaplex-foundation/umi";
|
3
|
-
import * as OnDemand from "@switchboard-xyz/on-demand";
|
4
|
-
import { TransactionItemInputs } from "../types";
|
5
|
-
export declare function getPullFeed(conn: Connection, mint: PublicKey, wallet?: PublicKey): OnDemand.PullFeed;
|
6
|
-
export declare function buildSwbSubmitResponseTx(conn: Connection, signer: Signer, mint: PublicKey): Promise<TransactionItemInputs | undefined>;
|
7
|
-
export declare function getSwitchboardFeedData(conn: Connection, mints: PublicKey[]): Promise<{
|
8
|
-
mint: PublicKey;
|
9
|
-
price: number;
|
10
|
-
stale: boolean;
|
11
|
-
}[]>;
|
12
|
-
//# sourceMappingURL=switchboardUtils.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"switchboardUtils.d.ts","sourceRoot":"","sources":["../../src/utils/switchboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAsB,MAAM,0BAA0B,CAAC;AAGtE,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD,wBAAgB,WAAW,CACzB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS,qBAuBnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAsB5C;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,SAAS,EAAE,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,CAuB/D"}
|
@@ -1,81 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.getPullFeed = getPullFeed;
|
30
|
-
exports.buildSwbSubmitResponseTx = buildSwbSubmitResponseTx;
|
31
|
-
exports.getSwitchboardFeedData = getSwitchboardFeedData;
|
32
|
-
const web3_js_1 = require("@solana/web3.js");
|
33
|
-
const umi_1 = require("@metaplex-foundation/umi");
|
34
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
35
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
36
|
-
const OnDemand = __importStar(require("@switchboard-xyz/on-demand"));
|
37
|
-
const switchboard_json_1 = __importDefault(require("../idls/switchboard.json"));
|
38
|
-
const constants_1 = require("../constants");
|
39
|
-
const generalUtils_1 = require("./generalUtils");
|
40
|
-
const solanaUtils_1 = require("./solanaUtils");
|
41
|
-
function getPullFeed(conn, mint, wallet) {
|
42
|
-
const dummyWallet = {
|
43
|
-
publicKey: wallet ?? new web3_js_1.PublicKey("11111111111111111111111111111111"),
|
44
|
-
signTransaction: async (tx) => tx,
|
45
|
-
signAllTransactions: async (txs) => txs,
|
46
|
-
};
|
47
|
-
const provider = new anchor_1.AnchorProvider(conn, dummyWallet, anchor_1.AnchorProvider.defaultOptions());
|
48
|
-
const program = new anchor_1.Program(switchboard_json_1.default, provider);
|
49
|
-
const { PullFeed } = OnDemand;
|
50
|
-
return new PullFeed(program, new web3_js_1.PublicKey(constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId));
|
51
|
-
}
|
52
|
-
async function buildSwbSubmitResponseTx(conn, signer, mint) {
|
53
|
-
const feed = getPullFeed(conn, mint, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(signer.publicKey));
|
54
|
-
const [pullIx, responses] = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await feed.fetchUpdateIx({
|
55
|
-
chain: "solana",
|
56
|
-
network: "mainnet-beta",
|
57
|
-
}), 2, 200);
|
58
|
-
if (!pullIx) {
|
59
|
-
throw new Error("Unable to fetch SWB crank IX");
|
60
|
-
}
|
61
|
-
return {
|
62
|
-
tx: (0, umi_1.transactionBuilder)([(0, solanaUtils_1.getWrappedInstruction)(signer, pullIx)]),
|
63
|
-
lookupTableAddresses: responses
|
64
|
-
.filter((x) => Boolean(x.oracle.lut?.key))
|
65
|
-
.map((x) => x.oracle.lut.key.toString()),
|
66
|
-
};
|
67
|
-
}
|
68
|
-
async function getSwitchboardFeedData(conn, mints) {
|
69
|
-
if (mints.length === 0) {
|
70
|
-
return [];
|
71
|
-
}
|
72
|
-
const currSlot = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await conn.getSlot("confirmed"), 5);
|
73
|
-
const results = await Promise.all(mints.map(async (mint) => {
|
74
|
-
const feed = getPullFeed(conn, mint);
|
75
|
-
const result = await feed.loadData();
|
76
|
-
const price = Number(result.result.value) / Math.pow(10, 18);
|
77
|
-
const stale = currSlot > result.result.slot.toNumber() + result.maxStaleness;
|
78
|
-
return { mint, price, stale };
|
79
|
-
}));
|
80
|
-
return results;
|
81
|
-
}
|