@haven-fi/solauto-sdk 1.0.589 → 1.0.591
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/solautoPosition/solautoPositionEx.d.ts +3 -0
- package/dist/solautoPosition/solautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/solautoPositionEx.js +6 -0
- package/package.json +1 -1
- package/src/solautoPosition/solautoPositionEx.ts +10 -1
- package/tests/transactions/shared.ts +2 -2
@@ -3,6 +3,7 @@ import { DCASettings, LendingPlatform, PositionState, SolautoPosition, SolautoSe
|
|
3
3
|
import { Umi } from "@metaplex-foundation/umi";
|
4
4
|
import { ContextUpdates } from "../utils";
|
5
5
|
import { RebalanceAction } from "../types";
|
6
|
+
import { TokenInfo } from "../constants";
|
6
7
|
export interface PositionCustomArgs {
|
7
8
|
lendingPlatform: LendingPlatform;
|
8
9
|
supplyMint?: PublicKey;
|
@@ -39,7 +40,9 @@ export declare abstract class SolautoPositionEx {
|
|
39
40
|
settings(): SolautoSettingsParameters | undefined;
|
40
41
|
dca(): DCASettings | undefined;
|
41
42
|
supplyMint(): PublicKey;
|
43
|
+
supplyMintInfo(): TokenInfo;
|
42
44
|
debtMint(): PublicKey;
|
45
|
+
debtMintInfo(): TokenInfo;
|
43
46
|
boostToBps(): number;
|
44
47
|
boostFromBps(): number;
|
45
48
|
repayToBps(): number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/solautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,WAAW,EAEX,eAAe,EACf,aAAa,EACb,eAAe,EACf,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAQL,cAAc,
|
1
|
+
{"version":3,"file":"solautoP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debtMint() {
|
55
58
|
return (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.state().debt.mint);
|
56
59
|
}
|
60
|
+
debtMintInfo() {
|
61
|
+
return (0, utils_1.tokenInfo)(this.debtMint());
|
62
|
+
}
|
57
63
|
boostToBps() {
|
58
64
|
return Math.min(this.settings()?.boostToBps ?? 0, (0, utils_1.maxBoostToBps)(this.state().maxLtvBps, this.state().liqThresholdBps));
|
59
65
|
}
|
package/package.json
CHANGED
@@ -25,10 +25,11 @@ import {
|
|
25
25
|
safeGetPrice,
|
26
26
|
solautoStrategyName,
|
27
27
|
supplyLiquidityUsdDepositable,
|
28
|
+
tokenInfo,
|
28
29
|
} from "../utils";
|
29
30
|
import { RebalanceAction } from "../types";
|
30
31
|
import { getDebtAdjustment } from "../services/rebalance";
|
31
|
-
import { MIN_POSITION_STATE_FRESHNESS_SECS } from "../constants";
|
32
|
+
import { MIN_POSITION_STATE_FRESHNESS_SECS, TokenInfo } from "../constants";
|
32
33
|
import {
|
33
34
|
fromWeb3JsPublicKey,
|
34
35
|
toWeb3JsPublicKey,
|
@@ -123,10 +124,18 @@ export abstract class SolautoPositionEx {
|
|
123
124
|
return toWeb3JsPublicKey(this.state().supply.mint);
|
124
125
|
}
|
125
126
|
|
127
|
+
supplyMintInfo(): TokenInfo {
|
128
|
+
return tokenInfo(this.supplyMint());
|
129
|
+
}
|
130
|
+
|
126
131
|
debtMint(): PublicKey {
|
127
132
|
return toWeb3JsPublicKey(this.state().debt.mint);
|
128
133
|
}
|
129
134
|
|
135
|
+
debtMintInfo(): TokenInfo {
|
136
|
+
return tokenInfo(this.debtMint());
|
137
|
+
}
|
138
|
+
|
130
139
|
boostToBps() {
|
131
140
|
return Math.min(
|
132
141
|
this.settings()?.boostToBps ?? 0,
|
@@ -73,7 +73,7 @@ export async function e2eTransactionTest(
|
|
73
73
|
return {
|
74
74
|
tx: client.protocolInteractionIx(
|
75
75
|
solautoAction("Deposit", [
|
76
|
-
toBaseUnit(supplyUsd / supplyPrice,
|
76
|
+
toBaseUnit(supplyUsd / supplyPrice, client.pos.supplyMintInfo().decimals),
|
77
77
|
])
|
78
78
|
),
|
79
79
|
};
|
@@ -86,7 +86,7 @@ export async function e2eTransactionTest(
|
|
86
86
|
return {
|
87
87
|
tx: client.protocolInteractionIx(
|
88
88
|
solautoAction("Borrow", [
|
89
|
-
toBaseUnit(debtUsd / debtPrice,
|
89
|
+
toBaseUnit(debtUsd / debtPrice, client.pos.debtMintInfo().decimals),
|
90
90
|
])
|
91
91
|
),
|
92
92
|
};
|