@haven-fi/solauto-sdk 1.0.690 → 1.0.691
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/services/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../../src/services/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAIL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA4BjE,OAAO,EAAE,qBAAqB,EAAyB,MAAM,aAAa,CAAC;AAwL3E,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAyF7B;AA+LD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,SAAS,EACvB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAuC5C;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,kBAAkB,EAAE,EACzB,KAAK,EAAE,KAAK,EACZ,oBAAoB,CAAC,EAAE,OAAO;;;;EAuH/B"}
|
@@ -212,7 +212,7 @@ function getSolautoActions(umi, tx) {
|
|
212
212
|
const discriminator = (0, utils_1.uint8ArrayToBigInt)(serializer
|
213
213
|
.serialize({
|
214
214
|
amount: 0,
|
215
|
-
depositUpToLimit: true
|
215
|
+
depositUpToLimit: true,
|
216
216
|
})
|
217
217
|
.slice(0, 8));
|
218
218
|
const [data, _] = serializer.deserialize(x.data);
|
@@ -347,17 +347,20 @@ function getErrorInfo(umi, txs, error, simulationSuccessful) {
|
|
347
347
|
let errIxIdx;
|
348
348
|
let errCode;
|
349
349
|
let errName;
|
350
|
-
|
350
|
+
// sub ixs to account for computeUnitLimit and computeUnitPrice that get added
|
351
|
+
const getComputeIxs = (txIdx) => (0, utils_1.addTxOptimizations)(umi, txs[txIdx], 1, !simulationSuccessful ? 1 : undefined).getInstructions().length - txs.length;
|
351
352
|
try {
|
352
353
|
if (error instanceof types_1.BundleSimulationError) {
|
353
354
|
errTxIdx = error.details.transactionIdx;
|
354
|
-
errIxIdx =
|
355
|
+
errIxIdx =
|
356
|
+
error.details.instructionIdx -
|
357
|
+
getComputeIxs(error.details.transactionIdx);
|
355
358
|
errCode = error.details.errorCode;
|
356
359
|
}
|
357
360
|
else if (typeof error === "object" &&
|
358
361
|
error["InstructionError"]) {
|
359
362
|
const err = error["InstructionError"];
|
360
|
-
errIxIdx = err[0] -
|
363
|
+
errIxIdx = err[0] - getComputeIxs(0);
|
361
364
|
errCode =
|
362
365
|
typeof err[1] === "object" && "Custom" in err[1]
|
363
366
|
? err[1]["Custom"]
|
package/local/txSandbox.ts
CHANGED
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
getBatches,
|
11
11
|
getClient,
|
12
12
|
getLiqUtilzationRateBps,
|
13
|
+
getMaxLiqUtilizationRateBps,
|
13
14
|
getPositionExBulk,
|
14
15
|
getSolanaRpcConnection,
|
15
16
|
getSolautoManagedPositions,
|
@@ -98,6 +99,7 @@ export async function main() {
|
|
98
99
|
23.530695876 * debtWeight
|
99
100
|
);
|
100
101
|
console.log(client.pos.maxBoostToBps);
|
102
|
+
console.log(getMaxLiqUtilizationRateBps(client.pos.state.maxLtvBps, client.pos.state.liqThresholdBps, 0));
|
101
103
|
|
102
104
|
// const debtBank = await fetchBank(
|
103
105
|
// umi,
|
package/package.json
CHANGED
@@ -40,6 +40,7 @@ import {
|
|
40
40
|
getTokenAccount,
|
41
41
|
getTokenAccountData,
|
42
42
|
isMarginfiClient,
|
43
|
+
addTxOptimizations,
|
43
44
|
} from "../../utils";
|
44
45
|
import {
|
45
46
|
createMarginfiProgram,
|
@@ -417,7 +418,7 @@ function getSolautoActions(umi: Umi, tx: TransactionBuilder): SolautoAction[] {
|
|
417
418
|
serializer
|
418
419
|
.serialize({
|
419
420
|
amount: 0,
|
420
|
-
depositUpToLimit: true
|
421
|
+
depositUpToLimit: true,
|
421
422
|
})
|
422
423
|
.slice(0, 8)
|
423
424
|
);
|
@@ -614,12 +615,21 @@ export function getErrorInfo(
|
|
614
615
|
let errCode: number | undefined;
|
615
616
|
let errName: string | undefined;
|
616
617
|
|
617
|
-
|
618
|
+
// sub ixs to account for computeUnitLimit and computeUnitPrice that get added
|
619
|
+
const getComputeIxs = (txIdx: number) =>
|
620
|
+
addTxOptimizations(
|
621
|
+
umi,
|
622
|
+
txs[txIdx],
|
623
|
+
1,
|
624
|
+
!simulationSuccessful ? 1 : undefined
|
625
|
+
).getInstructions().length - txs.length;
|
618
626
|
|
619
627
|
try {
|
620
628
|
if (error instanceof BundleSimulationError) {
|
621
629
|
errTxIdx = error.details.transactionIdx;
|
622
|
-
errIxIdx =
|
630
|
+
errIxIdx =
|
631
|
+
error.details.instructionIdx -
|
632
|
+
getComputeIxs(error.details.transactionIdx);
|
623
633
|
errCode = error.details.errorCode;
|
624
634
|
} else if (
|
625
635
|
typeof error === "object" &&
|
@@ -627,7 +637,7 @@ export function getErrorInfo(
|
|
627
637
|
) {
|
628
638
|
const err = (error as any)["InstructionError"];
|
629
639
|
|
630
|
-
errIxIdx = err[0] -
|
640
|
+
errIxIdx = err[0] - getComputeIxs(0);
|
631
641
|
errCode =
|
632
642
|
typeof err[1] === "object" && "Custom" in err[1]
|
633
643
|
? err[1]["Custom"]
|