@haven-fi/solauto-sdk 1.0.309 → 1.0.311
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/solautoConstants.d.ts +1 -0
- package/dist/constants/solautoConstants.d.ts.map +1 -1
- package/dist/constants/solautoConstants.js +2 -7
- package/dist/transactions/transactionsManager.d.ts +3 -1
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +35 -7
- package/dist/utils/jitoUtils.d.ts +5 -0
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +98 -151
- package/dist/utils/priceUtils.d.ts +1 -6
- package/dist/utils/priceUtils.d.ts.map +1 -1
- package/dist/utils/priceUtils.js +3 -17
- package/dist/utils/solanaUtils.js +1 -1
- package/dist/utils/switchboardUtils.d.ts +6 -0
- package/dist/utils/switchboardUtils.d.ts.map +1 -1
- package/dist/utils/switchboardUtils.js +27 -2
- package/package.json +2 -1
- package/src/constants/solautoConstants.ts +1 -6
- package/src/transactions/transactionsManager.ts +74 -7
- package/src/utils/jitoUtils.ts +166 -166
- package/src/utils/priceUtils.ts +6 -32
- package/src/utils/solanaUtils.ts +1 -1
- package/src/utils/switchboardUtils.ts +58 -3
- package/tests/transactions/solautoMarginfi.ts +27 -26
@@ -27,7 +27,7 @@ import {
|
|
27
27
|
SOLAUTO_TEST_PROGRAM,
|
28
28
|
USDC,
|
29
29
|
} from "../../src/constants";
|
30
|
-
import { buildHeliusApiUrl
|
30
|
+
import { buildHeliusApiUrl } from "../../src/utils";
|
31
31
|
import { PriorityFeeSetting } from "../../src/types";
|
32
32
|
|
33
33
|
describe("Solauto Marginfi tests", async () => {
|
@@ -41,8 +41,8 @@ describe("Solauto Marginfi tests", async () => {
|
|
41
41
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
42
42
|
const client = new SolautoMarginfiClient(
|
43
43
|
buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
|
44
|
-
true
|
45
|
-
|
44
|
+
true,
|
45
|
+
testProgram ? SOLAUTO_TEST_PROGRAM : SOLAUTO_PROD_PROGRAM
|
46
46
|
);
|
47
47
|
|
48
48
|
const supply = NATIVE_MINT;
|
@@ -52,7 +52,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
52
52
|
await client.initialize({
|
53
53
|
signer,
|
54
54
|
positionId,
|
55
|
-
authority: new PublicKey("rC5dMP5dmSsfQ66rynzfFzuc122Eex9h1RJHVDkeH6D"),
|
55
|
+
authority: new PublicKey("rC5dMP5dmSsfQ66rynzfFzuc122Eex9h1RJHVDkeH6D"), // positions 1 & 3 are taken
|
56
56
|
// new: true,
|
57
57
|
// marginfiAccount: new PublicKey(
|
58
58
|
// "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
|
@@ -63,20 +63,20 @@ describe("Solauto Marginfi tests", async () => {
|
|
63
63
|
});
|
64
64
|
|
65
65
|
const transactionItems: TransactionItem[] = [];
|
66
|
-
const settingParams: SolautoSettingsParametersInpArgs = {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
};
|
66
|
+
// const settingParams: SolautoSettingsParametersInpArgs = {
|
67
|
+
// boostToBps: maxBoostToBps(
|
68
|
+
// client.solautoPositionState?.maxLtvBps ?? 0,
|
69
|
+
// client.solautoPositionState?.liqThresholdBps ?? 0
|
70
|
+
// ),
|
71
|
+
// boostGap: 50,
|
72
|
+
// repayToBps: maxRepayToBps(
|
73
|
+
// client.solautoPositionState?.maxLtvBps ?? 0,
|
74
|
+
// client.solautoPositionState?.liqThresholdBps ?? 0
|
75
|
+
// ),
|
76
|
+
// repayGap: 50,
|
77
|
+
// automation: none(),
|
78
|
+
// targetBoostToBps: none(),
|
79
|
+
// };
|
80
80
|
|
81
81
|
// if (client.solautoPositionData === null) {
|
82
82
|
// transactionItems.push(
|
@@ -123,7 +123,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
123
123
|
transactionItems.push(
|
124
124
|
new TransactionItem(
|
125
125
|
async (attemptNum) =>
|
126
|
-
await buildSolautoRebalanceTransaction(client,
|
126
|
+
await buildSolautoRebalanceTransaction(client, 5000, attemptNum),
|
127
127
|
"rebalance"
|
128
128
|
)
|
129
129
|
);
|
@@ -156,13 +156,14 @@ describe("Solauto Marginfi tests", async () => {
|
|
156
156
|
// )
|
157
157
|
// );
|
158
158
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
159
|
+
const statuses = await new TransactionsManager(
|
160
|
+
client,
|
161
|
+
undefined,
|
162
|
+
!payForTransactions ? "only-simulate" : "normal",
|
163
|
+
PriorityFeeSetting.Low,
|
164
|
+
true
|
165
|
+
).clientSend(transactionItems);
|
165
166
|
|
166
|
-
|
167
|
+
console.log(statuses);
|
167
168
|
});
|
168
169
|
});
|