@haven-fi/solauto-sdk 1.0.558 → 1.0.560
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.
@@ -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,
|
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,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,GAAG,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;;;;EA8G/B"}
|
@@ -375,7 +375,7 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
|
|
375
375
|
client.log("Rebalance values: ", values);
|
376
376
|
const flRequirements = await (0, rebalanceUtils_1.getFlashLoanRequirements)(client, values, attemptNum);
|
377
377
|
const swapDetails = await (0, rebalanceUtils_1.getJupSwapRebalanceDetails)(client, values, flRequirements, targetLiqUtilizationRateBps, attemptNum);
|
378
|
-
const { jupQuote, lookupTableAddresses, setupInstructions, swapIx
|
378
|
+
const { jupQuote, lookupTableAddresses, setupInstructions, swapIx } = await (0, jupiterUtils_1.getJupSwapTransaction)(client.signer, swapDetails, attemptNum);
|
379
379
|
const flashLoan = flRequirements
|
380
380
|
? (0, rebalanceUtils_1.getFlashLoanDetails)(client, flRequirements, values, jupQuote)
|
381
381
|
: undefined;
|
@@ -458,7 +458,14 @@ function getErrorInfo(umi, txs, error, simulationSuccessful) {
|
|
458
458
|
let errName;
|
459
459
|
const computeIxs = simulationSuccessful ? 2 : 1; // sub ixs to account for computeUnitLimit and computeUnitPrice that get added
|
460
460
|
try {
|
461
|
-
if (
|
461
|
+
if (error instanceof transactions_1.BundleSimulationError) {
|
462
|
+
console.log(error.details);
|
463
|
+
errTxIdx = error.details.transactionIdx;
|
464
|
+
errIxIdx = error.details.instructionIdx - computeIxs;
|
465
|
+
errCode = error.details.errorCode;
|
466
|
+
}
|
467
|
+
else if (typeof error === "object" &&
|
468
|
+
error["InstructionError"]) {
|
462
469
|
const err = error["InstructionError"];
|
463
470
|
errIxIdx = err[0] - computeIxs;
|
464
471
|
errCode =
|
@@ -467,11 +474,6 @@ function getErrorInfo(umi, txs, error, simulationSuccessful) {
|
|
467
474
|
: undefined;
|
468
475
|
errName = errCode === undefined ? err[1] : undefined;
|
469
476
|
}
|
470
|
-
else if (error instanceof transactions_1.BundleSimulationError) {
|
471
|
-
errTxIdx = error.details.transactionIdx;
|
472
|
-
errIxIdx = error.details.instructionIdx - computeIxs;
|
473
|
-
errCode = error.details.errorCode;
|
474
|
-
}
|
475
477
|
(0, generalUtils_1.consoleLog)("Transaction instructions:", txs.map((x) => x
|
476
478
|
.getInstructions()
|
477
479
|
.map((y) => y.programId.toString())
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -205,13 +205,7 @@ async function sendJitoBundledTransactions(umi, connection, userSigner, otherSig
|
|
205
205
|
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, true, feeEstimates, simulationResults
|
206
206
|
? simulationResults.map((x) => x.unitsConsumed * 1.15)
|
207
207
|
: undefined);
|
208
|
-
|
209
|
-
// builtTxs.map((x) =>
|
210
|
-
// x.message.compiledInstructions.map((y) =>
|
211
|
-
// x.message.staticAccountKeys[y.programIdIndex].toString()
|
212
|
-
// )
|
213
|
-
// )
|
214
|
-
// );
|
208
|
+
(0, generalUtils_1.consoleLog)(builtTxs.map((x) => x.message.compiledInstructions.map((y) => x.message.staticAccountKeys[y.programIdIndex].toString())));
|
215
209
|
const serializedTxs = builtTxs.map((x) => x.serialize());
|
216
210
|
if (serializedTxs.find((x) => x.length > 1232)) {
|
217
211
|
throw new Error("A transaction is too large");
|
package/package.json
CHANGED
@@ -599,9 +599,7 @@ export async function getTransactionChores(
|
|
599
599
|
return [choresBefore, choresAfter];
|
600
600
|
}
|
601
601
|
|
602
|
-
export async function requiresRefreshBeforeRebalance(
|
603
|
-
client: SolautoClient,
|
604
|
-
) {
|
602
|
+
export async function requiresRefreshBeforeRebalance(client: SolautoClient) {
|
605
603
|
const neverRefreshedBefore =
|
606
604
|
client.solautoPositionData &&
|
607
605
|
client.solautoPositionData.state.supply.amountCanBeUsed.baseUnit ===
|
@@ -693,7 +691,11 @@ export async function buildSolautoRebalanceTransaction(
|
|
693
691
|
);
|
694
692
|
client.log("Rebalance values: ", values);
|
695
693
|
|
696
|
-
const flRequirements = await getFlashLoanRequirements(
|
694
|
+
const flRequirements = await getFlashLoanRequirements(
|
695
|
+
client,
|
696
|
+
values,
|
697
|
+
attemptNum
|
698
|
+
);
|
697
699
|
const swapDetails = await getJupSwapRebalanceDetails(
|
698
700
|
client,
|
699
701
|
values,
|
@@ -701,12 +703,8 @@ export async function buildSolautoRebalanceTransaction(
|
|
701
703
|
targetLiqUtilizationRateBps,
|
702
704
|
attemptNum
|
703
705
|
);
|
704
|
-
const {
|
705
|
-
|
706
|
-
lookupTableAddresses,
|
707
|
-
setupInstructions,
|
708
|
-
swapIx,
|
709
|
-
} = await getJupSwapTransaction(client.signer, swapDetails, attemptNum);
|
706
|
+
const { jupQuote, lookupTableAddresses, setupInstructions, swapIx } =
|
707
|
+
await getJupSwapTransaction(client.signer, swapDetails, attemptNum);
|
710
708
|
|
711
709
|
const flashLoan = flRequirements
|
712
710
|
? getFlashLoanDetails(client, flRequirements, values, jupQuote)
|
@@ -858,7 +856,15 @@ export function getErrorInfo(
|
|
858
856
|
const computeIxs = simulationSuccessful ? 2 : 1; // sub ixs to account for computeUnitLimit and computeUnitPrice that get added
|
859
857
|
|
860
858
|
try {
|
861
|
-
if (
|
859
|
+
if (error instanceof BundleSimulationError) {
|
860
|
+
console.log(error.details);
|
861
|
+
errTxIdx = error.details.transactionIdx;
|
862
|
+
errIxIdx = error.details.instructionIdx - computeIxs;
|
863
|
+
errCode = error.details.errorCode;
|
864
|
+
} else if (
|
865
|
+
typeof error === "object" &&
|
866
|
+
(error as any)["InstructionError"]
|
867
|
+
) {
|
862
868
|
const err = (error as any)["InstructionError"];
|
863
869
|
|
864
870
|
errIxIdx = err[0] - computeIxs;
|
@@ -867,10 +873,6 @@ export function getErrorInfo(
|
|
867
873
|
? err[1]["Custom"]
|
868
874
|
: undefined;
|
869
875
|
errName = errCode === undefined ? (err[1] as string) : undefined;
|
870
|
-
} else if (error instanceof BundleSimulationError) {
|
871
|
-
errTxIdx = error.details.transactionIdx;
|
872
|
-
errIxIdx = error.details.instructionIdx - computeIxs;
|
873
|
-
errCode = error.details.errorCode;
|
874
876
|
}
|
875
877
|
|
876
878
|
consoleLog(
|
package/src/utils/jitoUtils.ts
CHANGED
@@ -349,13 +349,13 @@ export async function sendJitoBundledTransactions(
|
|
349
349
|
? simulationResults.map((x) => x.unitsConsumed! * 1.15)
|
350
350
|
: undefined
|
351
351
|
);
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
352
|
+
consoleLog(
|
353
|
+
builtTxs.map((x) =>
|
354
|
+
x.message.compiledInstructions.map((y) =>
|
355
|
+
x.message.staticAccountKeys[y.programIdIndex].toString()
|
356
|
+
)
|
357
|
+
)
|
358
|
+
);
|
359
359
|
|
360
360
|
const serializedTxs = builtTxs.map((x) => x.serialize());
|
361
361
|
if (serializedTxs.find((x) => x.length > 1232)) {
|