@haven-fi/solauto-sdk 1.0.316 → 1.0.317
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":"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,EACL,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;AAW7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAMjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IARtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACjB,WAAW,EAAE,OAAO,CAAS;gBAG3B,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;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAyFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM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IAC1B,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAXpB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,UAAU,GAAE,OAAe,EAC3B,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,mBAAmB;YAMb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA4FzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YAmCxB,6BAA6B;YA2D7B,qBAAqB;YAuDrB,cAAc;YAqCd,eAAe;CAmD9B"}
|
@@ -336,33 +336,27 @@ class TransactionsManager {
|
|
336
336
|
}
|
337
337
|
async processTransactionsAtomically(itemSets) {
|
338
338
|
let num = 0;
|
339
|
-
let sets = itemSets;
|
340
339
|
await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => {
|
341
340
|
num = attemptNum;
|
342
341
|
if (attemptNum > 0) {
|
343
|
-
sets = [];
|
344
342
|
for (let i = 0; i < itemSets.length; i++) {
|
345
|
-
|
346
|
-
if (txSet) {
|
347
|
-
sets.push(txSet);
|
348
|
-
}
|
343
|
+
await itemSets[i].refetchAll(attemptNum);
|
349
344
|
}
|
350
345
|
}
|
351
346
|
let transactions = [];
|
352
|
-
for (const set of
|
347
|
+
for (const set of itemSets) {
|
353
348
|
transactions.push(await set.getSingleTransaction());
|
354
349
|
}
|
355
|
-
|
350
|
+
itemSets.forEach((x) => this.updateStatus(x.name(), TransactionStatus.Processing, attemptNum));
|
356
351
|
const txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.signer, transactions, false, this.priorityFeeSetting);
|
357
|
-
if (txSigs) {
|
358
|
-
|
352
|
+
if (Boolean(txSigs) && txSigs.length > 0) {
|
353
|
+
itemSets.forEach((x, i) => this.updateStatus(x.name(), TransactionStatus.Successful, attemptNum, txSigs[i]));
|
359
354
|
}
|
360
355
|
else {
|
361
|
-
sets.forEach((x) => this.updateStatus(x.name(), TransactionStatus.Failed, attemptNum, undefined, true));
|
362
356
|
throw new Error("Unknown error");
|
363
357
|
}
|
364
358
|
}, this.retries, this.retryDelay, this.errorsToThrow).catch((e) => {
|
365
|
-
|
359
|
+
itemSets.forEach((x) => this.updateStatus(x.name(), TransactionStatus.Failed, num, undefined, true, e.message));
|
366
360
|
throw e;
|
367
361
|
});
|
368
362
|
}
|
package/package.json
CHANGED
@@ -513,28 +513,23 @@ export class TransactionsManager {
|
|
513
513
|
|
514
514
|
private async processTransactionsAtomically(itemSets: TransactionSet[]) {
|
515
515
|
let num = 0;
|
516
|
-
let sets = itemSets;
|
517
516
|
|
518
517
|
await retryWithExponentialBackoff(
|
519
518
|
async (attemptNum) => {
|
520
519
|
num = attemptNum;
|
521
520
|
|
522
521
|
if (attemptNum > 0) {
|
523
|
-
sets = [];
|
524
522
|
for (let i = 0; i < itemSets.length; i++) {
|
525
|
-
|
526
|
-
if (txSet) {
|
527
|
-
sets.push(txSet);
|
528
|
-
}
|
523
|
+
await itemSets[i].refetchAll(attemptNum);
|
529
524
|
}
|
530
525
|
}
|
531
526
|
|
532
527
|
let transactions = [];
|
533
|
-
for (const set of
|
528
|
+
for (const set of itemSets) {
|
534
529
|
transactions.push(await set.getSingleTransaction());
|
535
530
|
}
|
536
531
|
|
537
|
-
|
532
|
+
itemSets.forEach((x) =>
|
538
533
|
this.updateStatus(x.name(), TransactionStatus.Processing, attemptNum)
|
539
534
|
);
|
540
535
|
const txSigs = await sendJitoBundledTransactions(
|
@@ -544,25 +539,16 @@ export class TransactionsManager {
|
|
544
539
|
false,
|
545
540
|
this.priorityFeeSetting
|
546
541
|
);
|
547
|
-
if (txSigs) {
|
548
|
-
|
542
|
+
if (Boolean(txSigs) && txSigs!.length > 0) {
|
543
|
+
itemSets.forEach((x, i) =>
|
549
544
|
this.updateStatus(
|
550
545
|
x.name(),
|
551
546
|
TransactionStatus.Successful,
|
552
547
|
attemptNum,
|
553
|
-
txSigs[i]
|
548
|
+
txSigs![i]
|
554
549
|
)
|
555
550
|
);
|
556
551
|
} else {
|
557
|
-
sets.forEach((x) =>
|
558
|
-
this.updateStatus(
|
559
|
-
x.name(),
|
560
|
-
TransactionStatus.Failed,
|
561
|
-
attemptNum,
|
562
|
-
undefined,
|
563
|
-
true
|
564
|
-
)
|
565
|
-
);
|
566
552
|
throw new Error("Unknown error");
|
567
553
|
}
|
568
554
|
},
|
@@ -570,7 +556,7 @@ export class TransactionsManager {
|
|
570
556
|
this.retryDelay,
|
571
557
|
this.errorsToThrow
|
572
558
|
).catch((e: Error) => {
|
573
|
-
|
559
|
+
itemSets.forEach((x) =>
|
574
560
|
this.updateStatus(
|
575
561
|
x.name(),
|
576
562
|
TransactionStatus.Failed,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { describe, it } from "mocha";
|
2
2
|
import { clusterApiUrl, Connection, PublicKey } from "@solana/web3.js";
|
3
3
|
import {
|
4
|
-
DEFAULT_PUBKEY,
|
5
4
|
MARGINFI_ACCOUNTS,
|
6
5
|
MARGINFI_ACCOUNTS_LOOKUP_TABLE,
|
7
6
|
} from "../../src/constants/marginfiAccounts";
|
@@ -28,7 +27,7 @@ describe("Assert lookup tables up-to-date", async () => {
|
|
28
27
|
|
29
28
|
const accounts = MARGINFI_ACCOUNTS[group][key];
|
30
29
|
const addresses = [
|
31
|
-
|
30
|
+
group,
|
32
31
|
accounts.bank,
|
33
32
|
accounts.liquidityVault,
|
34
33
|
accounts.vaultAuthority,
|