@haven-fi/solauto-sdk 1.0.79 → 1.0.80
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/constants/tokenConstants.d.ts +1 -0
- package/dist/constants/tokenConstants.d.ts.map +1 -1
- package/dist/constants/tokenConstants.js +5 -0
- package/dist/utils/numberUtils.d.ts +1 -1
- package/dist/utils/numberUtils.d.ts.map +1 -1
- package/dist/utils/numberUtils.js +4 -4
- package/package.json +1 -1
- package/src/constants/tokenConstants.ts +6 -0
- package/src/utils/numberUtils.ts +7 -4
@@ -3,6 +3,7 @@ export declare const B_SOL = "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1";
|
|
3
3
|
export declare const JUP = "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN";
|
4
4
|
export declare const ALL_SUPPORTED_TOKENS: string[];
|
5
5
|
interface TokenInfo {
|
6
|
+
ticker: string;
|
6
7
|
decimals: number;
|
7
8
|
isStableCoin?: boolean;
|
8
9
|
isLST?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tokenConstants.d.ts","sourceRoot":"","sources":["../../src/constants/tokenConstants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,iDAAiD,CAAC;AACxE,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AAGjE,eAAO,MAAM,oBAAoB,UAKhC,CAAC;AAEF,UAAU,SAAS;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"tokenConstants.d.ts","sourceRoot":"","sources":["../../src/constants/tokenConstants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,iDAAiD,CAAC;AACxE,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AAGjE,eAAO,MAAM,oBAAoB,UAKhC,CAAC;AAEF,UAAU,SAAS;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAuBlD,CAAC"}
|
@@ -15,20 +15,25 @@ exports.ALL_SUPPORTED_TOKENS = [
|
|
15
15
|
];
|
16
16
|
exports.TOKEN_INFO = {
|
17
17
|
[web3_js_1.PublicKey.default.toString()]: {
|
18
|
+
ticker: "",
|
18
19
|
decimals: 1
|
19
20
|
},
|
20
21
|
[spl_token_1.NATIVE_MINT.toString()]: {
|
22
|
+
ticker: "SOL",
|
21
23
|
decimals: 9,
|
22
24
|
},
|
23
25
|
[exports.USDC_MINT]: {
|
26
|
+
ticker: "USDC",
|
24
27
|
decimals: 6,
|
25
28
|
isStableCoin: true
|
26
29
|
},
|
27
30
|
[exports.B_SOL]: {
|
31
|
+
ticker: "BSOL",
|
28
32
|
decimals: 9,
|
29
33
|
isLST: true
|
30
34
|
},
|
31
35
|
[exports.JUP]: {
|
36
|
+
ticker: "JUP",
|
32
37
|
decimals: 6
|
33
38
|
}
|
34
39
|
};
|
@@ -13,7 +13,7 @@ export declare function getSolautoFeesBps(isReferred: boolean, feeType: FeeType,
|
|
13
13
|
total: number;
|
14
14
|
};
|
15
15
|
export declare function getMaxLiqUtilizationRateBps(maxLtvBps: number, liqThresholdBps: number, offsetFromMaxLtv: number): number;
|
16
|
-
export declare function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number): number;
|
17
16
|
export declare function maxRepayFromBps(maxLtvBps: number, liqThresholdBps: number): number;
|
18
17
|
export declare function maxRepayToBps(maxLtvBps: number, liqThresholdBps: number): number;
|
18
|
+
export declare function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number): number;
|
19
19
|
//# sourceMappingURL=numberUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GACtB,MAAM,CAMR;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqBrD;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAejE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,2BAA2B,EAAE,MAAM,EACnC,gBAAgB,CAAC,EAAE,MAAM,UAW1B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,MAAM,GAC1B;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CA8BA;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,gB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AAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKzE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE"}
|
@@ -10,9 +10,9 @@ exports.uint8ArrayToBigInt = uint8ArrayToBigInt;
|
|
10
10
|
exports.getDebtAdjustmentUsd = getDebtAdjustmentUsd;
|
11
11
|
exports.getSolautoFeesBps = getSolautoFeesBps;
|
12
12
|
exports.getMaxLiqUtilizationRateBps = getMaxLiqUtilizationRateBps;
|
13
|
-
exports.maxBoostToBps = maxBoostToBps;
|
14
13
|
exports.maxRepayFromBps = maxRepayFromBps;
|
15
14
|
exports.maxRepayToBps = maxRepayToBps;
|
15
|
+
exports.maxBoostToBps = maxBoostToBps;
|
16
16
|
const constants_1 = require("../constants");
|
17
17
|
const generated_1 = require("../generated");
|
18
18
|
function getLiqUtilzationRateBps(supplyUsd, debtUsd, liqThresholdBps) {
|
@@ -100,12 +100,12 @@ function getSolautoFeesBps(isReferred, feeType, positionNetWorthUsd) {
|
|
100
100
|
function getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, offsetFromMaxLtv) {
|
101
101
|
return toBps((fromBps(maxLtvBps) - offsetFromMaxLtv) / fromBps(liqThresholdBps)) - 1; // -1 to account for any rounding issues
|
102
102
|
}
|
103
|
-
function maxBoostToBps(maxLtvBps, liqThresholdBps) {
|
104
|
-
return getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015);
|
105
|
-
}
|
106
103
|
function maxRepayFromBps(maxLtvBps, liqThresholdBps) {
|
107
104
|
return Math.min(9000, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps - 1000, 0.005));
|
108
105
|
}
|
109
106
|
function maxRepayToBps(maxLtvBps, liqThresholdBps) {
|
110
107
|
return Math.min(maxRepayFromBps(maxLtvBps, liqThresholdBps) - constants_1.MIN_REPAY_GAP_BPS, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005));
|
111
108
|
}
|
109
|
+
function maxBoostToBps(maxLtvBps, liqThresholdBps) {
|
110
|
+
return Math.min(maxRepayToBps(maxLtvBps, liqThresholdBps), getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015));
|
111
|
+
}
|
package/package.json
CHANGED
@@ -15,6 +15,7 @@ export const ALL_SUPPORTED_TOKENS = [
|
|
15
15
|
];
|
16
16
|
|
17
17
|
interface TokenInfo {
|
18
|
+
ticker: string;
|
18
19
|
decimals: number;
|
19
20
|
isStableCoin?: boolean;
|
20
21
|
isLST?: boolean;
|
@@ -22,20 +23,25 @@ interface TokenInfo {
|
|
22
23
|
|
23
24
|
export const TOKEN_INFO: { [key: string]: TokenInfo } = {
|
24
25
|
[PublicKey.default.toString()]: {
|
26
|
+
ticker: "",
|
25
27
|
decimals: 1
|
26
28
|
},
|
27
29
|
[NATIVE_MINT.toString()]: {
|
30
|
+
ticker: "SOL",
|
28
31
|
decimals: 9,
|
29
32
|
},
|
30
33
|
[USDC_MINT]: {
|
34
|
+
ticker: "USDC",
|
31
35
|
decimals: 6,
|
32
36
|
isStableCoin: true
|
33
37
|
},
|
34
38
|
[B_SOL]: {
|
39
|
+
ticker: "BSOL",
|
35
40
|
decimals: 9,
|
36
41
|
isLST: true
|
37
42
|
},
|
38
43
|
[JUP]: {
|
44
|
+
ticker: "JUP",
|
39
45
|
decimals: 6
|
40
46
|
}
|
41
47
|
};
|
package/src/utils/numberUtils.ts
CHANGED
@@ -135,10 +135,6 @@ export function getMaxLiqUtilizationRateBps(
|
|
135
135
|
return toBps((fromBps(maxLtvBps) - offsetFromMaxLtv) / fromBps(liqThresholdBps)) - 1; // -1 to account for any rounding issues
|
136
136
|
}
|
137
137
|
|
138
|
-
export function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number) {
|
139
|
-
return getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015);
|
140
|
-
}
|
141
|
-
|
142
138
|
export function maxRepayFromBps(maxLtvBps: number, liqThresholdBps: number) {
|
143
139
|
return Math.min(
|
144
140
|
9000,
|
@@ -152,3 +148,10 @@ export function maxRepayToBps(maxLtvBps: number, liqThresholdBps: number) {
|
|
152
148
|
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005)
|
153
149
|
);
|
154
150
|
}
|
151
|
+
|
152
|
+
export function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number) {
|
153
|
+
return Math.min(
|
154
|
+
maxRepayToBps(maxLtvBps, liqThresholdBps),
|
155
|
+
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015)
|
156
|
+
);
|
157
|
+
}
|