@haven-fi/solauto-sdk 1.0.331 → 1.0.332
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/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +9 -9
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +3 -0
- package/package.json +1 -1
- package/src/transactions/transactionsManager.ts +43 -31
- package/src/utils/jitoUtils.ts +4 -0
@@ -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,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CAAC,kBAAkB;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;YAoBb,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;YAmE7B,qBAAqB;YAuDrB,cAAc;YAqCd,eAAe;CAmD9B"}
|
@@ -244,9 +244,9 @@ class TransactionsManager {
|
|
244
244
|
}
|
245
245
|
return this.priorityFeeSetting;
|
246
246
|
}
|
247
|
-
updateStatusForSets(itemSets) {
|
248
|
-
itemSets.forEach((itemSet) => {
|
249
|
-
this.updateStatus(itemSet.name(),
|
247
|
+
updateStatusForSets(itemSets, status, attemptNum, txSigs, simulationSuccessful, moreInfo) {
|
248
|
+
itemSets.forEach((itemSet, i) => {
|
249
|
+
this.updateStatus(itemSet.name(), status, attemptNum, txSigs !== undefined ? txSigs[i] : undefined, simulationSuccessful, moreInfo);
|
250
250
|
});
|
251
251
|
}
|
252
252
|
async updateLut(tx, newLut) {
|
@@ -316,7 +316,7 @@ class TransactionsManager {
|
|
316
316
|
}
|
317
317
|
this.txHandler.log("Transaction items:", items.length);
|
318
318
|
const itemSets = await this.assembleTransactionSets(items);
|
319
|
-
this.updateStatusForSets(itemSets);
|
319
|
+
this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
|
320
320
|
this.txHandler.log("Initial item sets:", itemSets.length);
|
321
321
|
if (this.txType === "only-simulate" && itemSets.length > 1) {
|
322
322
|
this.txHandler.log("Only simulate and more than 1 transaction. Skipping...");
|
@@ -342,23 +342,23 @@ class TransactionsManager {
|
|
342
342
|
for (let i = 0; i < itemSets.length; i++) {
|
343
343
|
await itemSets[i].refetchAll(attemptNum);
|
344
344
|
}
|
345
|
-
itemSets = await this.assembleTransactionSets(itemSets.flatMap(x => x.items));
|
345
|
+
itemSets = await this.assembleTransactionSets(itemSets.flatMap((x) => x.items));
|
346
346
|
}
|
347
347
|
let transactions = [];
|
348
348
|
for (const set of itemSets) {
|
349
349
|
transactions.push(await set.getSingleTransaction());
|
350
350
|
}
|
351
|
-
|
351
|
+
this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum);
|
352
352
|
const txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.signer, transactions, false, this.priorityFeeSetting);
|
353
353
|
if (Boolean(txSigs) && txSigs.length > 0) {
|
354
|
-
|
354
|
+
this.updateStatusForSets(itemSets, TransactionStatus.Successful, attemptNum, txSigs);
|
355
355
|
}
|
356
356
|
else {
|
357
|
-
|
357
|
+
this.updateStatusForSets(itemSets, TransactionStatus.Failed, attemptNum, txSigs, true);
|
358
358
|
throw new Error("Unknown error");
|
359
359
|
}
|
360
360
|
}, this.retries, this.retryDelay, this.errorsToThrow).catch((e) => {
|
361
|
-
|
361
|
+
this.updateStatusForSets(itemSets, TransactionStatus.Failed, num, undefined, true, e.message);
|
362
362
|
throw e;
|
363
363
|
});
|
364
364
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAsHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,kBAA2C,GAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAsHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,kBAA2C,GAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAkD/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -115,6 +115,9 @@ async function sendJitoBundledTransactions(umi, signer, txs, simulateOnly, prior
|
|
115
115
|
: undefined;
|
116
116
|
let builtTxs = await umiToVersionedTransactions(umi, signer, txs, true, // false if simulating first and rebuilding later
|
117
117
|
feeEstimates);
|
118
|
+
for (let i = 0; i < txs.length; i++) {
|
119
|
+
(0, generalUtils_1.consoleLog)("Transaction", i, txs[i].getInstructions());
|
120
|
+
}
|
118
121
|
// const simulationResults = await simulateJitoBundle(umi, builtTxs);
|
119
122
|
if (!simulateOnly) {
|
120
123
|
// let builtTxs = await umiToVersionedTransactions(
|
package/package.json
CHANGED
@@ -358,9 +358,23 @@ export class TransactionsManager {
|
|
358
358
|
return this.priorityFeeSetting;
|
359
359
|
}
|
360
360
|
|
361
|
-
private updateStatusForSets(
|
362
|
-
itemSets
|
363
|
-
|
361
|
+
private updateStatusForSets(
|
362
|
+
itemSets: TransactionSet[],
|
363
|
+
status: TransactionStatus,
|
364
|
+
attemptNum: number,
|
365
|
+
txSigs?: string[],
|
366
|
+
simulationSuccessful?: boolean,
|
367
|
+
moreInfo?: string
|
368
|
+
) {
|
369
|
+
itemSets.forEach((itemSet, i) => {
|
370
|
+
this.updateStatus(
|
371
|
+
itemSet.name(),
|
372
|
+
status,
|
373
|
+
attemptNum,
|
374
|
+
txSigs !== undefined ? txSigs[i] : undefined,
|
375
|
+
simulationSuccessful,
|
376
|
+
moreInfo
|
377
|
+
);
|
364
378
|
});
|
365
379
|
}
|
366
380
|
|
@@ -488,7 +502,7 @@ export class TransactionsManager {
|
|
488
502
|
|
489
503
|
this.txHandler.log("Transaction items:", items.length);
|
490
504
|
const itemSets = await this.assembleTransactionSets(items);
|
491
|
-
this.updateStatusForSets(itemSets);
|
505
|
+
this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
|
492
506
|
this.txHandler.log("Initial item sets:", itemSets.length);
|
493
507
|
|
494
508
|
if (this.txType === "only-simulate" && itemSets.length > 1) {
|
@@ -522,7 +536,9 @@ export class TransactionsManager {
|
|
522
536
|
for (let i = 0; i < itemSets.length; i++) {
|
523
537
|
await itemSets[i].refetchAll(attemptNum);
|
524
538
|
}
|
525
|
-
itemSets = await this.assembleTransactionSets(
|
539
|
+
itemSets = await this.assembleTransactionSets(
|
540
|
+
itemSets.flatMap((x) => x.items)
|
541
|
+
);
|
526
542
|
}
|
527
543
|
|
528
544
|
let transactions = [];
|
@@ -530,8 +546,10 @@ export class TransactionsManager {
|
|
530
546
|
transactions.push(await set.getSingleTransaction());
|
531
547
|
}
|
532
548
|
|
533
|
-
|
534
|
-
|
549
|
+
this.updateStatusForSets(
|
550
|
+
itemSets,
|
551
|
+
TransactionStatus.Processing,
|
552
|
+
attemptNum
|
535
553
|
);
|
536
554
|
const txSigs = await sendJitoBundledTransactions(
|
537
555
|
this.txHandler.umi,
|
@@ -541,23 +559,19 @@ export class TransactionsManager {
|
|
541
559
|
this.priorityFeeSetting
|
542
560
|
);
|
543
561
|
if (Boolean(txSigs) && txSigs!.length > 0) {
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
txSigs![i]
|
550
|
-
)
|
562
|
+
this.updateStatusForSets(
|
563
|
+
itemSets,
|
564
|
+
TransactionStatus.Successful,
|
565
|
+
attemptNum,
|
566
|
+
txSigs
|
551
567
|
);
|
552
568
|
} else {
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
true,
|
560
|
-
)
|
569
|
+
this.updateStatusForSets(
|
570
|
+
itemSets,
|
571
|
+
TransactionStatus.Failed,
|
572
|
+
attemptNum,
|
573
|
+
txSigs,
|
574
|
+
true
|
561
575
|
);
|
562
576
|
throw new Error("Unknown error");
|
563
577
|
}
|
@@ -566,15 +580,13 @@ export class TransactionsManager {
|
|
566
580
|
this.retryDelay,
|
567
581
|
this.errorsToThrow
|
568
582
|
).catch((e: Error) => {
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
e.message
|
577
|
-
)
|
583
|
+
this.updateStatusForSets(
|
584
|
+
itemSets,
|
585
|
+
TransactionStatus.Failed,
|
586
|
+
num,
|
587
|
+
undefined,
|
588
|
+
true,
|
589
|
+
e.message
|
578
590
|
);
|
579
591
|
throw e;
|
580
592
|
});
|
package/src/utils/jitoUtils.ts
CHANGED
@@ -184,6 +184,10 @@ export async function sendJitoBundledTransactions(
|
|
184
184
|
feeEstimates
|
185
185
|
);
|
186
186
|
|
187
|
+
for (let i = 0; i < txs.length; i++) {
|
188
|
+
consoleLog("Transaction", i, txs[i].getInstructions());
|
189
|
+
}
|
190
|
+
|
187
191
|
// const simulationResults = await simulateJitoBundle(umi, builtTxs);
|
188
192
|
|
189
193
|
if (!simulateOnly) {
|