@haven-fi/solauto-sdk 1.0.562 → 1.0.564
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/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/transactions/transactionUtils.js +0 -2
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +7 -4
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +6 -12
- package/package.json +1 -1
- package/src/transactions/transactionUtils.ts +0 -2
- package/src/transactions/transactionsManager.ts +10 -4
- package/src/utils/jitoUtils.ts +6 -11
- package/tests/transactions/solautoMarginfi.ts +19 -25
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAoBxE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAsCzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA4LjD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAoH7B;AA2LD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,aAAa,oBAqDzE;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC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G,SAAS,CAAC,CAsI5C;AAED,wBAAsB,gCAAgC,CACpD,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,SAAS,EACvB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAsC5C;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,kBAAkB,EAAE,EACzB,KAAK,EAAE,KAAK,EACZ,oBAAoB,CAAC,EAAE,OAAO;;;;EA6G/B"}
|
@@ -449,7 +449,6 @@ async function convertReferralFeesToDestination(referralManager, tokenAccount, d
|
|
449
449
|
return { tx, lookupTableAddresses };
|
450
450
|
}
|
451
451
|
function getErrorInfo(umi, txs, error, simulationSuccessful) {
|
452
|
-
console.log(error);
|
453
452
|
let canBeIgnored = false;
|
454
453
|
let errorName = undefined;
|
455
454
|
let errorInfo = undefined;
|
@@ -460,7 +459,6 @@ function getErrorInfo(umi, txs, error, simulationSuccessful) {
|
|
460
459
|
const computeIxs = simulationSuccessful ? 2 : 1; // sub ixs to account for computeUnitLimit and computeUnitPrice that get added
|
461
460
|
try {
|
462
461
|
if (error instanceof transactions_1.BundleSimulationError) {
|
463
|
-
console.log(error.details);
|
464
462
|
errTxIdx = error.details.transactionIdx;
|
465
463
|
errIxIdx = error.details.instructionIdx - computeIxs;
|
466
464
|
errCode = error.details.errorCode;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAEL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAa7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAOjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IATtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACxB,WAAW,EAAE,OAAO,CAAS;IAC7B,SAAS,EAAE,MAAM,CAAK;gBAGb,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAKV,OAAO,CAAC,UAAU,EAAE,MAAM;IAOhC,cAAc,IAAI,MAAM,EAAE;CAY3B;
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAEL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAa7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAOjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IATtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACxB,WAAW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,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,UAAU,GAAE,OAAe,EAC3B,aAAa,CAAC,EAAE,aAAa,YAAA,EACrC,WAAW,CAAC,EAAE,WAAW;YAab,uBAAuB;IA0CrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,mBAAmB;YAoBb,SAAS;IAiBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA0GzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YAmCxB,6BAA6B;YA4I7B,qBAAqB;YAgDrB,eAAe;YA0Df,eAAe;CA4D9B"}
|
@@ -109,8 +109,10 @@ class TransactionSet {
|
|
109
109
|
prepend(...items) {
|
110
110
|
this.items.unshift(...items.filter((x) => x.tx && x.tx.getInstructions().length > 0));
|
111
111
|
}
|
112
|
-
async
|
112
|
+
async reset() {
|
113
113
|
await this.txHandler.resetLiveTxUpdates();
|
114
|
+
}
|
115
|
+
async refetchAll(attemptNum) {
|
114
116
|
for (const item of this.items) {
|
115
117
|
await item.refetch(attemptNum);
|
116
118
|
}
|
@@ -338,6 +340,7 @@ class TransactionsManager {
|
|
338
340
|
}
|
339
341
|
}
|
340
342
|
else if (attemptNum > 0) {
|
343
|
+
await this.txHandler.resetLiveTxUpdates();
|
341
344
|
for (const item of items) {
|
342
345
|
await item.refetch(attemptNum);
|
343
346
|
}
|
@@ -448,12 +451,12 @@ class TransactionsManager {
|
|
448
451
|
async refreshItemSets(itemSets, attemptNum, currentIndex) {
|
449
452
|
if (currentIndex !== undefined) {
|
450
453
|
const itemSet = itemSets[currentIndex];
|
454
|
+
await itemSet.reset();
|
451
455
|
await itemSet.refetchAll(attemptNum);
|
452
456
|
}
|
453
457
|
else {
|
454
|
-
|
455
|
-
|
456
|
-
}
|
458
|
+
await Promise.all(itemSets.map((itemSet) => itemSet.reset()));
|
459
|
+
await Promise.all(itemSets.map((itemSet) => itemSet.refetchAll(attemptNum)));
|
457
460
|
}
|
458
461
|
const newItemSets = await this.assembleTransactionSets(currentIndex !== undefined
|
459
462
|
? [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEH,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAYlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAgB,mBAAmB,IAAI,SAAS,CAG/C;
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEH,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAYlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAgB,mBAAmB,IAAI,SAAS,CAG/C;AA0MD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB;;;;IAkB7D;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EAAE,EACtB,GAAG,EAAE,kBAAkB,EAAE,EACzB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA+F/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -12,7 +12,6 @@ const solautoConstants_1 = require("../constants/solautoConstants");
|
|
12
12
|
const solanaUtils_1 = require("./solanaUtils");
|
13
13
|
const generalUtils_1 = require("./generalUtils");
|
14
14
|
const types_1 = require("../types");
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
16
15
|
const bs58_1 = __importDefault(require("bs58"));
|
17
16
|
const transactions_1 = require("../types/transactions");
|
18
17
|
const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
@@ -139,12 +138,7 @@ async function pollBundleStatus(umi, bundleId, interval = 1000, timeout = 40000)
|
|
139
138
|
async function sendJitoBundle(umi, transactions) {
|
140
139
|
let resp;
|
141
140
|
try {
|
142
|
-
resp = await
|
143
|
-
jsonrpc: "2.0",
|
144
|
-
id: 1,
|
145
|
-
method: "sendBundle",
|
146
|
-
params: [transactions],
|
147
|
-
});
|
141
|
+
resp = await (0, generalUtils_1.customRpcCall)(umi, "sendBundle", [transactions]);
|
148
142
|
}
|
149
143
|
catch (e) {
|
150
144
|
if (e.response.data.error) {
|
@@ -155,13 +149,13 @@ async function sendJitoBundle(umi, transactions) {
|
|
155
149
|
throw e;
|
156
150
|
}
|
157
151
|
}
|
158
|
-
if (resp
|
159
|
-
throw new Error(resp.
|
152
|
+
if (resp.error?.message === "All providers failed") {
|
153
|
+
throw new Error(resp.error.responses[0].response.error.message);
|
160
154
|
}
|
161
|
-
else if (resp.
|
162
|
-
throw new Error(resp.
|
155
|
+
else if (resp.error) {
|
156
|
+
throw new Error(resp.error);
|
163
157
|
}
|
164
|
-
const bundleId = resp
|
158
|
+
const bundleId = resp;
|
165
159
|
(0, generalUtils_1.consoleLog)("Bundle ID:", bundleId);
|
166
160
|
return bundleId ? await pollBundleStatus(umi, bundleId) : [];
|
167
161
|
}
|
package/package.json
CHANGED
@@ -844,7 +844,6 @@ export function getErrorInfo(
|
|
844
844
|
error: Error,
|
845
845
|
simulationSuccessful?: boolean
|
846
846
|
) {
|
847
|
-
console.log(error);
|
848
847
|
let canBeIgnored = false;
|
849
848
|
let errorName: string | undefined = undefined;
|
850
849
|
let errorInfo: string | undefined = undefined;
|
@@ -858,7 +857,6 @@ export function getErrorInfo(
|
|
858
857
|
|
859
858
|
try {
|
860
859
|
if (error instanceof BundleSimulationError) {
|
861
|
-
console.log(error.details);
|
862
860
|
errTxIdx = error.details.transactionIdx;
|
863
861
|
errIxIdx = error.details.instructionIdx - computeIxs;
|
864
862
|
errCode = error.details.errorCode;
|
@@ -177,8 +177,11 @@ class TransactionSet {
|
|
177
177
|
);
|
178
178
|
}
|
179
179
|
|
180
|
-
async
|
180
|
+
async reset() {
|
181
181
|
await this.txHandler.resetLiveTxUpdates();
|
182
|
+
}
|
183
|
+
|
184
|
+
async refetchAll(attemptNum: number) {
|
182
185
|
for (const item of this.items) {
|
183
186
|
await item.refetch(attemptNum);
|
184
187
|
}
|
@@ -549,6 +552,7 @@ export class TransactionsManager {
|
|
549
552
|
await item.initialize();
|
550
553
|
}
|
551
554
|
} else if (attemptNum > 0) {
|
555
|
+
await this.txHandler.resetLiveTxUpdates();
|
552
556
|
for (const item of items) {
|
553
557
|
await item.refetch(attemptNum);
|
554
558
|
}
|
@@ -768,11 +772,13 @@ export class TransactionsManager {
|
|
768
772
|
): Promise<TransactionSet[] | undefined> {
|
769
773
|
if (currentIndex !== undefined) {
|
770
774
|
const itemSet = itemSets[currentIndex];
|
775
|
+
await itemSet.reset();
|
771
776
|
await itemSet.refetchAll(attemptNum);
|
772
777
|
} else {
|
773
|
-
|
774
|
-
|
775
|
-
|
778
|
+
await Promise.all(itemSets.map((itemSet) => itemSet.reset()));
|
779
|
+
await Promise.all(
|
780
|
+
itemSets.map((itemSet) => itemSet.refetchAll(attemptNum))
|
781
|
+
);
|
776
782
|
}
|
777
783
|
|
778
784
|
const newItemSets = await this.assembleTransactionSets(
|
package/src/utils/jitoUtils.ts
CHANGED
@@ -220,12 +220,7 @@ async function sendJitoBundle(
|
|
220
220
|
): Promise<string[]> {
|
221
221
|
let resp: any;
|
222
222
|
try {
|
223
|
-
resp = await
|
224
|
-
jsonrpc: "2.0",
|
225
|
-
id: 1,
|
226
|
-
method: "sendBundle",
|
227
|
-
params: [transactions],
|
228
|
-
});
|
223
|
+
resp = await customRpcCall(umi, "sendBundle", [transactions]);
|
229
224
|
} catch (e: any) {
|
230
225
|
if (e.response.data.error) {
|
231
226
|
console.error("Jito send bundle error:", e.response.data.error);
|
@@ -235,13 +230,13 @@ async function sendJitoBundle(
|
|
235
230
|
}
|
236
231
|
}
|
237
232
|
|
238
|
-
if (resp
|
239
|
-
throw new Error(resp.
|
240
|
-
} else if (resp.
|
241
|
-
throw new Error(resp.
|
233
|
+
if (resp.error?.message === "All providers failed") {
|
234
|
+
throw new Error(resp.error.responses[0].response.error.message);
|
235
|
+
} else if (resp.error) {
|
236
|
+
throw new Error(resp.error);
|
242
237
|
}
|
243
238
|
|
244
|
-
const bundleId = resp
|
239
|
+
const bundleId = resp as string;
|
245
240
|
consoleLog("Bundle ID:", bundleId);
|
246
241
|
return bundleId ? await pollBundleStatus(umi, bundleId) : [];
|
247
242
|
}
|
@@ -40,16 +40,16 @@ import {
|
|
40
40
|
getSolautoPositionAccount,
|
41
41
|
retryWithExponentialBackoff,
|
42
42
|
} from "../../src/utils";
|
43
|
-
import {
|
43
|
+
import { PriorityFeeSetting } from "../../src/types";
|
44
44
|
import { buildIronforgeApiUrl, fromBaseUnit, tokenInfo, USD_DECIMALS } from "../../dist";
|
45
45
|
|
46
46
|
describe("Solauto Marginfi tests", async () => {
|
47
|
-
const signer = setupTest();
|
48
|
-
|
47
|
+
// const signer = setupTest();
|
48
|
+
const signer = setupTest("solauto-manager");
|
49
49
|
|
50
|
-
const payForTransactions =
|
51
|
-
const testProgram =
|
52
|
-
const positionId =
|
50
|
+
const payForTransactions = true;
|
51
|
+
const testProgram = false;
|
52
|
+
const positionId = 3;
|
53
53
|
|
54
54
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
55
55
|
const client = new SolautoMarginfiClient(
|
@@ -62,24 +62,18 @@ describe("Solauto Marginfi tests", async () => {
|
|
62
62
|
const supplyDecimals = 6;
|
63
63
|
const debtDecimals = 6;
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
try {
|
79
|
-
throw new BundleSimulationError("temp", 400, { transactionIdx: 1, instructionIdx: 1, errorCode: 1 });
|
80
|
-
} catch (e: any) {
|
81
|
-
console.log(e instanceof BundleSimulationError);
|
82
|
-
}
|
65
|
+
await client.initialize({
|
66
|
+
signer,
|
67
|
+
positionId,
|
68
|
+
authority: new PublicKey("FKYQs7KgRvaKQHxXwb8HKfoBcFdSxLL3JvHWpPdVQ16v"),
|
69
|
+
// new: true,
|
70
|
+
// marginfiAccount: new PublicKey(
|
71
|
+
// ""
|
72
|
+
// ),
|
73
|
+
// marginfiGroup: new PublicKey(""),
|
74
|
+
// supplyMint: new PublicKey(""),
|
75
|
+
// debtMint: new PublicKey(USDC),
|
76
|
+
});
|
83
77
|
|
84
78
|
const transactionItems: TransactionItem[] = [];
|
85
79
|
// const settingParams: SolautoSettingsParametersInpArgs = {
|
@@ -151,7 +145,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
151
145
|
transactionItems.push(
|
152
146
|
new TransactionItem(
|
153
147
|
async (attemptNum) =>
|
154
|
-
await buildSolautoRebalanceTransaction(client,
|
148
|
+
await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
|
155
149
|
"rebalance"
|
156
150
|
)
|
157
151
|
);
|