@haven-fi/solauto-sdk 1.0.47 → 1.0.50
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/solautoClient.js +1 -1
- package/dist/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +4 -5
- package/dist/utils/generalUtils.d.ts.map +1 -1
- package/dist/utils/generalUtils.js +0 -2
- package/dist/utils/solauto/generalUtils.js +2 -2
- package/package.json +1 -1
- package/src/clients/solautoClient.ts +1 -1
- package/src/transactions/transactionUtils.ts +1 -0
- package/src/transactions/transactionsManager.ts +6 -7
- package/src/utils/generalUtils.ts +0 -2
- package/src/utils/solauto/generalUtils.ts +2 -2
- package/tests/transactions/solautoMarginfi.ts +13 -11
@@ -35,7 +35,7 @@ class SolautoClient {
|
|
35
35
|
: (0, umi_signer_wallet_adapters_1.walletAdapterIdentity)(args.wallet, true));
|
36
36
|
this.signer = this.umi.identity;
|
37
37
|
this.authority =
|
38
|
-
args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.
|
38
|
+
args.authority ?? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey);
|
39
39
|
this.positionId = args.positionId;
|
40
40
|
this.selfManaged = this.positionId === 0;
|
41
41
|
this.lendingPlatform = lendingPlatform;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,OAAO,IAAI,eAAe,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,aAAa,EASd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAqMzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACt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@@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EAGvB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAK/B,cAAM,YAAY;IAIJ,OAAO,CAAC,MAAM;IAH1B,WAAW,EAAE,MAAM,EAAE,CAAM;IAC3B,KAAK,EAAE,uBAAuB,EAAE,CAAM;gBAElB,MAAM,EAAE,aAAa;IAInC,YAAY,CAChB,mBAAmB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAqBtC;AAED,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAED,cAAM,cAAc;IAEhB,OAAO,CAAC,MAAM;IACP,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,eAAe,EAAE;gBAFvB,MAAM,EAAE,aAAa,EACtB,YAAY,EAAE,YAAY,EAC1B,KAAK,GAAE,eAAe,EAAO;IAGhC,QAAQ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EAAE,MAAM;IAO7B,oBAAoB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAYzD,YAAY,IAAI,MAAM,EAAE;IAMxB,IAAI,IAAI,MAAM;CAYf;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;YAKzB,uBAAuB;IA0CrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAiB9D,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,kBAAkB;IAkB7D,IAAI;CA4JX"}
|
@@ -184,10 +184,6 @@ class TransactionsManager {
|
|
184
184
|
async debugAccounts(itemSet, tx) {
|
185
185
|
const lutInputs = await itemSet.lookupTables.getLutInputs([]);
|
186
186
|
const lutAccounts = lutInputs.map((x) => x.addresses).flat();
|
187
|
-
const keys = tx
|
188
|
-
.getInstructions()
|
189
|
-
.map((x) => x.keys)
|
190
|
-
.flat();
|
191
187
|
for (const ix of tx.getInstructions()) {
|
192
188
|
const ixAccounts = ix.keys.map((x) => x.pubkey);
|
193
189
|
const accountsNotInLut = ixAccounts.filter((x) => !lutAccounts.includes(x));
|
@@ -269,7 +265,7 @@ class TransactionsManager {
|
|
269
265
|
this.client.log(this.statuses);
|
270
266
|
itemSets.splice(i + 1, itemSets.length - i - 1, ...newItemSets.slice(1));
|
271
267
|
}
|
272
|
-
return newItemSets[0];
|
268
|
+
return newItemSets.length > 0 ? newItemSets[0] : undefined;
|
273
269
|
};
|
274
270
|
let itemSet = itemSets[i];
|
275
271
|
await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => {
|
@@ -277,6 +273,9 @@ class TransactionsManager {
|
|
277
273
|
i > 0 || attemptNum > 0
|
278
274
|
? await getFreshItemSet(itemSet, attemptNum)
|
279
275
|
: itemSet;
|
276
|
+
if (!itemSet) {
|
277
|
+
return;
|
278
|
+
}
|
280
279
|
const tx = await itemSet.getSingleTransaction();
|
281
280
|
if (tx.getInstructions().length === 0) {
|
282
281
|
this.updateStatus(itemSet.name(), TransactionStatus.Skipped);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAM3E,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,SAAS,GACZ,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEnE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAU1E;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,
|
1
|
+
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAM3E,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,SAAS,GACZ,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEnE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAU1E;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA+C1E;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC;AAEjE,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,GAAE,MAAU,EACnB,KAAK,GAAE,MAAY,EACnB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,CAAC,CAAC,CA8BZ"}
|
@@ -47,10 +47,8 @@ async function getTokenPrices(mints) {
|
|
47
47
|
const currentTime = currentUnixSeconds();
|
48
48
|
if (!mints.some((mint) => !(mint.toString() in solautoConstants_1.PRICES) ||
|
49
49
|
currentTime - solautoConstants_1.PRICES[mint.toString()].time > 3)) {
|
50
|
-
console.log("Accessing price cache");
|
51
50
|
return mints.map((mint) => solautoConstants_1.PRICES[mint.toString()].price);
|
52
51
|
}
|
53
|
-
console.log(`Fetching prices for ${mints.join(", ")}`);
|
54
52
|
const priceFeedIds = mints.map((mint) => pythConstants_1.PYTH_PRICE_FEED_IDS[mint.toString()]);
|
55
53
|
const getReq = async () => await fetch(`https://hermes.pyth.network/v2/updates/price/latest?${priceFeedIds.map((x) => `ids%5B%5D=${x}`).join("&")}`);
|
56
54
|
let resp = await getReq();
|
@@ -75,8 +75,8 @@ function eligibileForRebalance(positionState, positionSettings, positionDca) {
|
|
75
75
|
if (positionState.liqUtilizationRateBps <= boostFrom) {
|
76
76
|
return true;
|
77
77
|
}
|
78
|
-
else if (positionState.liqUtilizationRateBps >= repayFrom
|
79
|
-
|
78
|
+
else if (positionState.liqUtilizationRateBps >= repayFrom) {
|
79
|
+
console.log(`Requires repay ${positionState.liqUtilizationRateBps} > ${repayFrom}`);
|
80
80
|
return true;
|
81
81
|
}
|
82
82
|
return false;
|
package/package.json
CHANGED
@@ -137,7 +137,7 @@ export abstract class SolautoClient {
|
|
137
137
|
|
138
138
|
this.signer = this.umi.identity;
|
139
139
|
this.authority =
|
140
|
-
args.authority ?? toWeb3JsPublicKey(this.
|
140
|
+
args.authority ?? toWeb3JsPublicKey(this.signer.publicKey);
|
141
141
|
|
142
142
|
this.positionId = args.positionId;
|
143
143
|
this.selfManaged = this.positionId === 0;
|
@@ -256,10 +256,6 @@ export class TransactionsManager {
|
|
256
256
|
async debugAccounts(itemSet: TransactionSet, tx: TransactionBuilder) {
|
257
257
|
const lutInputs = await itemSet.lookupTables.getLutInputs([]);
|
258
258
|
const lutAccounts = lutInputs.map((x) => x.addresses).flat();
|
259
|
-
const keys = tx
|
260
|
-
.getInstructions()
|
261
|
-
.map((x) => x.keys)
|
262
|
-
.flat();
|
263
259
|
for (const ix of tx.getInstructions()) {
|
264
260
|
const ixAccounts = ix.keys.map((x) => x.pubkey);
|
265
261
|
const accountsNotInLut = ixAccounts.filter(
|
@@ -382,16 +378,19 @@ export class TransactionsManager {
|
|
382
378
|
...newItemSets.slice(1)
|
383
379
|
);
|
384
380
|
}
|
385
|
-
return newItemSets[0];
|
381
|
+
return newItemSets.length > 0 ? newItemSets[0] : undefined;
|
386
382
|
};
|
387
383
|
|
388
|
-
let itemSet = itemSets[i];
|
384
|
+
let itemSet: TransactionSet | undefined = itemSets[i];
|
389
385
|
await retryWithExponentialBackoff(
|
390
386
|
async (attemptNum) => {
|
391
387
|
itemSet =
|
392
388
|
i > 0 || attemptNum > 0
|
393
|
-
? await getFreshItemSet(itemSet
|
389
|
+
? await getFreshItemSet(itemSet!, attemptNum)
|
394
390
|
: itemSet;
|
391
|
+
if (!itemSet) {
|
392
|
+
return;
|
393
|
+
}
|
395
394
|
const tx = await itemSet.getSingleTransaction();
|
396
395
|
|
397
396
|
if (tx.getInstructions().length === 0) {
|
@@ -55,11 +55,9 @@ export async function getTokenPrices(mints: PublicKey[]): Promise<number[]> {
|
|
55
55
|
currentTime - PRICES[mint.toString()].time > 3
|
56
56
|
)
|
57
57
|
) {
|
58
|
-
console.log("Accessing price cache");
|
59
58
|
return mints.map((mint) => PRICES[mint.toString()].price);
|
60
59
|
}
|
61
60
|
|
62
|
-
console.log(`Fetching prices for ${mints.join(", ")}`);
|
63
61
|
const priceFeedIds = mints.map(
|
64
62
|
(mint) => PYTH_PRICE_FEED_IDS[mint.toString()]
|
65
63
|
);
|
@@ -150,9 +150,9 @@ export function eligibileForRebalance(
|
|
150
150
|
if (positionState.liqUtilizationRateBps <= boostFrom) {
|
151
151
|
return true;
|
152
152
|
} else if (
|
153
|
-
positionState.liqUtilizationRateBps >= repayFrom
|
154
|
-
repayFrom - positionState.liqUtilizationRateBps < repayFrom * 0.01
|
153
|
+
positionState.liqUtilizationRateBps >= repayFrom
|
155
154
|
) {
|
155
|
+
console.log(`Requires repay ${positionState.liqUtilizationRateBps} > ${repayFrom}`);
|
156
156
|
return true;
|
157
157
|
}
|
158
158
|
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
SolautoMarginfiClient,
|
6
6
|
} from "../../src/clients/solautoMarginfiClient";
|
7
7
|
import {
|
8
|
+
LendingPlatform,
|
8
9
|
solautoAction,
|
9
10
|
SolautoSettingsParametersInpArgs,
|
10
11
|
} from "../../src/generated";
|
@@ -18,14 +19,15 @@ import {
|
|
18
19
|
} from "../../src/transactions/transactionsManager";
|
19
20
|
import { PublicKey } from "@solana/web3.js";
|
20
21
|
import { USDC_MINT } from "../../src/constants";
|
22
|
+
import { positionStateWithLatestPrices } from "../../src/utils/solauto/generalUtils";
|
21
23
|
|
22
24
|
describe("Solauto Marginfi tests", async () => {
|
23
|
-
const signer = setupTest();
|
24
|
-
|
25
|
+
// const signer = setupTest();
|
26
|
+
const signer = setupTest("solauto-manager");
|
25
27
|
|
26
28
|
const payForTransactions = false;
|
27
29
|
const useJitoBundle = false;
|
28
|
-
const positionId =
|
30
|
+
const positionId = 2;
|
29
31
|
|
30
32
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
31
33
|
const client = new SolautoMarginfiClient(process.env.HELIUS_API_KEY!, true);
|
@@ -48,14 +50,14 @@ describe("Solauto Marginfi tests", async () => {
|
|
48
50
|
);
|
49
51
|
|
50
52
|
const transactionItems: TransactionItem[] = [];
|
51
|
-
const settingParams: SolautoSettingsParametersInpArgs = {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
};
|
53
|
+
// const settingParams: SolautoSettingsParametersInpArgs = {
|
54
|
+
// boostToBps: 4000,
|
55
|
+
// boostGap: 500,
|
56
|
+
// repayToBps: 7456,
|
57
|
+
// repayGap: 500,
|
58
|
+
// automation: none(),
|
59
|
+
// targetBoostToBps: none(),
|
60
|
+
// };
|
59
61
|
|
60
62
|
// if (client.solautoPositionData === null) {
|
61
63
|
// transactionItems.push(
|