@haven-fi/solauto-sdk 1.0.720 → 1.0.722
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/services/rebalance/rebalanceTxBuilder.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceTxBuilder.js +1 -1
- package/dist/services/rebalance/rebalanceValues.d.ts +1 -1
- package/dist/services/rebalance/rebalanceValues.d.ts.map +1 -1
- package/dist/services/rebalance/rebalanceValues.js +5 -5
- package/dist/services/transactions/manager/transactionsManager.d.ts.map +1 -1
- package/dist/services/transactions/manager/transactionsManager.js +7 -6
- package/dist/services/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/services/transactions/transactionUtils.js +5 -1
- package/dist/utils/jitoUtils.d.ts +1 -1
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +6 -5
- package/local/txSandbox.ts +4 -4
- package/package.json +1 -1
- package/src/services/rebalance/rebalanceTxBuilder.ts +2 -2
- package/src/services/rebalance/rebalanceValues.ts +9 -9
- package/src/services/transactions/manager/transactionsManager.ts +7 -6
- package/src/services/transactions/transactionUtils.ts +7 -3
- package/src/utils/jitoUtils.ts +19 -16
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAgCrB,qBAAa,kBAAkB;IAQ3B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,2BAA2B,CAAC;IACpC,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,wBAAwB,CAAC;IAVnC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAC,CAAwB;IAC/C,OAAO,CAAC,SAAS,CAAiC;gBAGxC,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,YAAA,EACpC,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,wBAAwB,CAAC,EAAE,MAAM,YAAA;IAG3C,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,iCAAiC;YAgC3B,qBAAqB;IA0CnC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,yBAAyB;YAqBnB,mBAAmB;YAyBnB,sBAAsB;YAyBtB,mBAAmB;IAsFpB,gBAAgB,CAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAe9C"}
|
@@ -26,7 +26,7 @@ class RebalanceTxBuilder {
|
|
26
26
|
this.client.pos.eligibleForRebalance(this.bpsDistanceFromRebalance)));
|
27
27
|
}
|
28
28
|
getRebalanceValues() {
|
29
|
-
return (0, rebalanceValues_1.getRebalanceValues)(this.client.pos, this.priceType, this.targetLiqUtilizationRateBps, solautoFees_1.SolautoFeesBps.create(this.client.isReferred, this.targetLiqUtilizationRateBps, this.client.pos.netWorthUsd(this.priceType)), this.flRequirements?.flFeeBps ?? 0);
|
29
|
+
return (0, rebalanceValues_1.getRebalanceValues)(this.client.pos, this.priceType, this.targetLiqUtilizationRateBps, solautoFees_1.SolautoFeesBps.create(this.client.isReferred, this.targetLiqUtilizationRateBps, this.client.pos.netWorthUsd(this.priceType)), this.flRequirements?.flFeeBps ?? 0, this.bpsDistanceFromRebalance);
|
30
30
|
}
|
31
31
|
getFlLiquiditySource(supplyLiquidityAvailable, debtLiquidityAvailable) {
|
32
32
|
const debtAdjustmentUsd = Math.abs(this.values.debtAdjustmentUsd);
|
@@ -29,6 +29,6 @@ export interface RebalanceValues extends DebtAdjustment {
|
|
29
29
|
tokenBalanceChange?: TokenBalanceChange;
|
30
30
|
repayingCloseToMaxLtv: boolean;
|
31
31
|
}
|
32
|
-
export declare function getRebalanceValues(solautoPosition: SolautoPositionEx, priceType: PriceType, targetLiqUtilizationRateBps?: number, solautoFeeBps?: SolautoFeesBps, flFeeBps?: number): RebalanceValues | undefined;
|
32
|
+
export declare function getRebalanceValues(solautoPosition: SolautoPositionEx, priceType: PriceType, targetLiqUtilizationRateBps?: number, solautoFeeBps?: SolautoFeesBps, flFeeBps?: number, bpsDistanceFromRebalance?: number): RebalanceValues | undefined;
|
33
33
|
export {};
|
34
34
|
//# sourceMappingURL=rebalanceValues.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceValues.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceValues.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"rebalanceValues.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC;IAC1B,iCAAiC,EAAE,MAAM,CAAC;CAC3C;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,yBAAyB;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,iCAAiC,EAAE,MAAM,CAAC;CAC3C;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,uBAAuB,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3E,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,gBAAgB,GACtB,yBAAyB,CAmC3B;AAED,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,cAAc,EACnB,2BAA2B,EAAE,MAAM,EACnC,IAAI,CAAC,EAAE,gBAAgB,GACtB,cAAc,CAgChB;AA6ED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,iBAAiB,EAClC,SAAS,EAAE,SAAS,EACpB,2BAA2B,CAAC,EAAE,MAAM,EACpC,aAAa,CAAC,EAAE,cAAc,EAC9B,QAAQ,CAAC,EAAE,MAAM,EACjB,wBAAwB,CAAC,EAAE,MAAM,GAChC,eAAe,GAAG,SAAS,CA+C7B"}
|
@@ -55,15 +55,15 @@ function getTokenBalanceChange() {
|
|
55
55
|
// TODO: DCA, limit orders, take profit, stop loss, etc.
|
56
56
|
return undefined;
|
57
57
|
}
|
58
|
-
function getTargetLiqUtilizationRateBps(solautoPosition, priceType, targetLiqUtilizationRateBps, tokenBalanceChange) {
|
58
|
+
function getTargetLiqUtilizationRateBps(solautoPosition, priceType, targetLiqUtilizationRateBps, tokenBalanceChange, bpsDistanceFromRebalance) {
|
59
59
|
if (targetLiqUtilizationRateBps !== undefined) {
|
60
60
|
return targetLiqUtilizationRateBps;
|
61
61
|
}
|
62
|
-
if (solautoPosition.liqUtilizationRateBps(generated_1.PriceType.Realtime) >=
|
62
|
+
if (solautoPosition.liqUtilizationRateBps(generated_1.PriceType.Realtime) + (bpsDistanceFromRebalance ?? 0) >=
|
63
63
|
solautoPosition.repayFromBps) {
|
64
64
|
return solautoPosition.settings.repayToBps;
|
65
65
|
}
|
66
|
-
else if (solautoPosition.liqUtilizationRateBps(priceType) <=
|
66
|
+
else if (solautoPosition.liqUtilizationRateBps(priceType) - (bpsDistanceFromRebalance ?? 0) <=
|
67
67
|
solautoPosition.boostFromBps) {
|
68
68
|
return solautoPosition.settings.boostToBps;
|
69
69
|
}
|
@@ -101,9 +101,9 @@ function getRebalanceDirection(solautoPosition, targetLtvBps, priceType) {
|
|
101
101
|
? generated_1.RebalanceDirection.Boost
|
102
102
|
: generated_1.RebalanceDirection.Repay;
|
103
103
|
}
|
104
|
-
function getRebalanceValues(solautoPosition, priceType, targetLiqUtilizationRateBps, solautoFeeBps, flFeeBps) {
|
104
|
+
function getRebalanceValues(solautoPosition, priceType, targetLiqUtilizationRateBps, solautoFeeBps, flFeeBps, bpsDistanceFromRebalance) {
|
105
105
|
const tokenBalanceChange = getTokenBalanceChange();
|
106
|
-
const targetRate = getTargetLiqUtilizationRateBps(solautoPosition, priceType, targetLiqUtilizationRateBps, tokenBalanceChange);
|
106
|
+
const targetRate = getTargetLiqUtilizationRateBps(solautoPosition, priceType, targetLiqUtilizationRateBps, tokenBalanceChange, bpsDistanceFromRebalance);
|
107
107
|
if (targetRate === undefined) {
|
108
108
|
return undefined;
|
109
109
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../../../src/services/transactions/manager/transactionsManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,aAAa,EAId,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAkB,MAAM,UAAU,CAAC;AAEzE,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAED,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,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,UAAU,WAAW;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,SAAS;IAC1D,SAAS,EAAE,CAAC,CAAC;IACb,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,qBAAa,mBAAmB,CAAC,CAAC,SAAS,SAAS;IAClD,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;IACvB,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAC1E,SAAS,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IACzC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IACjD,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACxC,SAAS,CAAC,QAAQ,EAAE,0BAA0B,CAAM;IACpD,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;IAE5C,kBAAkB,SAAmB;gBAEzB,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC;YAoB9B,uBAAuB;IA0CrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,SAAS,CAAC,4BAA4B,CACpC,SAAS,EAAE,KAAK,GAAG,SAAS,EAC5B,UAAU,EAAE,MAAM;IAcpB,OAAO,CAAC,mBAAmB;IAoBd,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;IA8BtC,OAAO,CAAC,mBAAmB;YAoBb,6BAA6B;YAyJ7B,qBAAqB;
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../../../src/services/transactions/manager/transactionsManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAElB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,aAAa,EAId,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAkB,MAAM,UAAU,CAAC;AAEzE,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAED,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,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,UAAU,WAAW;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,SAAS;IAC1D,SAAS,EAAE,CAAC,CAAC;IACb,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,qBAAa,mBAAmB,CAAC,CAAC,SAAS,SAAS;IAClD,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;IACvB,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAC1E,SAAS,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IACzC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IACjD,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACxC,SAAS,CAAC,QAAQ,EAAE,0BAA0B,CAAM;IACpD,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;IAE5C,kBAAkB,SAAmB;gBAEzB,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC;YAoB9B,uBAAuB;IA0CrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,SAAS,CAAC,4BAA4B,CACpC,SAAS,EAAE,KAAK,GAAG,SAAS,EAC5B,UAAU,EAAE,MAAM;IAcpB,OAAO,CAAC,mBAAmB;IAoBd,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;IA8BtC,OAAO,CAAC,mBAAmB;YAoBb,6BAA6B;YAyJ7B,qBAAqB;YAoDrB,eAAe;cAkDb,eAAe,CAC7B,EAAE,EAAE,kBAAkB,EACtB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,SAAS,CAAC,EAAE,kBAAkB;CA0DjC"}
|
@@ -181,7 +181,6 @@ class TransactionsManager {
|
|
181
181
|
}
|
182
182
|
async processTransactionsAtomically(itemSets) {
|
183
183
|
let num = 0;
|
184
|
-
let priorityFeeSetting;
|
185
184
|
let transactions = [];
|
186
185
|
await (0, utils_1.retryWithExponentialBackoff)(async (attemptNum, prevError) => {
|
187
186
|
if (prevError &&
|
@@ -190,7 +189,7 @@ class TransactionsManager {
|
|
190
189
|
throw prevError;
|
191
190
|
}
|
192
191
|
num = attemptNum;
|
193
|
-
priorityFeeSetting = this.getUpdatedPriorityFeeSetting(prevError, attemptNum);
|
192
|
+
this.priorityFeeSetting = this.getUpdatedPriorityFeeSetting(prevError, attemptNum);
|
194
193
|
if (attemptNum > 0) {
|
195
194
|
const refreshedSets = await this.refreshItemSets(itemSets, attemptNum, prevError);
|
196
195
|
if (!refreshedSets || !refreshedSets.length) {
|
@@ -219,21 +218,22 @@ class TransactionsManager {
|
|
219
218
|
let txSigs;
|
220
219
|
let error;
|
221
220
|
try {
|
222
|
-
txSigs = await (0, utils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, this.txHandler.otherSigners, transactions, this.txRunType, priorityFeeSetting, () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true), this.abortController);
|
221
|
+
txSigs = await (0, utils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, this.txHandler.otherSigners, transactions, this.txRunType, this.priorityFeeSetting, () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true), this.abortController);
|
223
222
|
}
|
224
223
|
catch (e) {
|
225
224
|
error = e;
|
226
225
|
}
|
227
226
|
if (error ||
|
228
227
|
(this.txRunType !== "only-simulate" &&
|
229
|
-
(!Boolean(txSigs) || txSigs?.length === 0)
|
228
|
+
(!Boolean(txSigs) || txSigs?.length === 0) &&
|
229
|
+
!this.abortController?.signal.aborted)) {
|
230
230
|
this.updateStatusForSets(itemSets, TransactionStatus.Failed, attemptNum, txSigs, undefined, error?.message);
|
231
231
|
throw error ? error : new Error("Unknown error");
|
232
232
|
}
|
233
233
|
this.updateStatusForSets(itemSets, TransactionStatus.Successful, attemptNum, txSigs);
|
234
234
|
}, this.totalRetries, this.retryDelay, this.errorsToThrow).catch((e) => {
|
235
235
|
this.txHandler.log("Capturing error info...");
|
236
|
-
const errorDetails = (0, transactionUtils_1.getErrorInfo)(this.txHandler.umi, transactions, e, itemSets.filter((x) => this.statuses.find((y) => x.name() === y.name)?.simulationSuccessful).length === itemSets.length, priorityFeeSetting);
|
236
|
+
const errorDetails = (0, transactionUtils_1.getErrorInfo)(this.txHandler.umi, transactions, e, itemSets.filter((x) => this.statuses.find((y) => x.name() === y.name)?.simulationSuccessful).length === itemSets.length, this.priorityFeeSetting);
|
237
237
|
const errorString = `${errorDetails.errorName ?? "Unknown error"}: ${errorDetails.errorInfo?.split("\n")[0] ?? "unknown"}`;
|
238
238
|
const errorInfo = errorDetails.errorName || errorDetails.errorInfo
|
239
239
|
? errorString
|
@@ -268,7 +268,8 @@ class TransactionsManager {
|
|
268
268
|
}
|
269
269
|
else {
|
270
270
|
await this.debugAccounts(itemSet, tx);
|
271
|
-
|
271
|
+
this.priorityFeeSetting = this.getUpdatedPriorityFeeSetting(prevError, attemptNum);
|
272
|
+
await this.sendTransaction(tx, itemSet.name(), attemptNum, this.priorityFeeSetting);
|
272
273
|
}
|
273
274
|
}, this.totalRetries, this.retryDelay, this.errorsToThrow);
|
274
275
|
}
|
@@ -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;AA4BjE,OAAO,EACL,qBAAqB,EAErB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAyLrB,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,EAC9B,kBAAkB,CAAC,EAAE,kBAAkB;;;;
|
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,EACL,qBAAqB,EAErB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAyLrB,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,EAC9B,kBAAkB,CAAC,EAAE,kBAAkB;;;;EA2HxC;AAED,wBAAgB,cAAc,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,8JAKrE"}
|
@@ -349,7 +349,11 @@ function getErrorInfo(umi, txs, error, simulationSuccessful, priorityFeeSetting)
|
|
349
349
|
let errCode;
|
350
350
|
let errName;
|
351
351
|
// sub ixs to account for computeUnitLimit and computeUnitPrice that get added
|
352
|
-
const getComputeIxs = (txIdx) => (0, utils_1.addTxOptimizations)(umi, txs[txIdx],
|
352
|
+
const getComputeIxs = (txIdx) => (0, utils_1.addTxOptimizations)(umi, txs[txIdx], simulationSuccessful && usePriorityFee(priorityFeeSetting)
|
353
|
+
? 1
|
354
|
+
: undefined, 1).getInstructions().length -
|
355
|
+
txs[txIdx].getInstructions().length -
|
356
|
+
(txs.length > 1 && txIdx === 0 ? 1 : 0); // Account for jito tip IX
|
353
357
|
try {
|
354
358
|
if (error instanceof types_1.BundleSimulationError) {
|
355
359
|
errTxIdx = error.details.transactionIdx;
|
@@ -7,5 +7,5 @@ export declare function getAdditionalSigners(message: TransactionMessage): {
|
|
7
7
|
publicKey: string;
|
8
8
|
isWritable: boolean;
|
9
9
|
}[];
|
10
|
-
export declare function sendJitoBundledTransactions(umi: Umi, connection: Connection, userSigner: Signer, otherSigners: Signer[],
|
10
|
+
export declare function sendJitoBundledTransactions(umi: Umi, connection: Connection, userSigner: Signer, otherSigners: Signer[], transactions: TransactionBuilder[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void, abortController?: AbortController): Promise<string[] | undefined>;
|
11
11
|
//# sourceMappingURL=jitoUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEH,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAgBlE,wBAAgB,mBAAmB,IAAI,SAAS,CAG/C;AAiGD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB;;;;IAkB/D;AAwHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EAAE,EACtB,
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEH,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAgBlE,wBAAgB,mBAAmB,IAAI,SAAS,CAG/C;AAiGD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB;;;;IAkB/D;AAwHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,kBAAkB,EAAE,EAClC,MAAM,CAAC,EAAE,kBAAkB,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,cAAc,CAAC,EAAE,MAAM,IAAI,EAC3B,eAAe,CAAC,EAAE,eAAe,GAChC,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAwG/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -181,7 +181,8 @@ async function sendJitoBundle(umi, transactions) {
|
|
181
181
|
(0, generalUtils_1.consoleLog)("Bundle ID:", bundleId);
|
182
182
|
return bundleId ? await pollBundleStatus(umi, bundleId) : [];
|
183
183
|
}
|
184
|
-
async function sendJitoBundledTransactions(umi, connection, userSigner, otherSigners,
|
184
|
+
async function sendJitoBundledTransactions(umi, connection, userSigner, otherSigners, transactions, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign, abortController) {
|
185
|
+
const txs = [...transactions];
|
185
186
|
if (txs.length === 1) {
|
186
187
|
const resp = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(umi, connection, txs[0], txType, priorityFeeSetting, onAwaitingSign, abortController);
|
187
188
|
return resp ? [bs58_1.default.encode(resp)] : undefined;
|
@@ -191,9 +192,6 @@ async function sendJitoBundledTransactions(umi, connection, userSigner, otherSig
|
|
191
192
|
(0, generalUtils_1.consoleLog)(txs.map((tx) => tx.getInstructions().map((x) => x.programId.toString())));
|
192
193
|
(0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
|
193
194
|
txs[0] = txs[0].prepend(getTipInstruction(userSigner, 150000));
|
194
|
-
const feeEstimates = (0, services_1.usePriorityFee)(priorityFeeSetting)
|
195
|
-
? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting, true)) ?? 1000000))
|
196
|
-
: undefined;
|
197
195
|
const latestBlockhash = (await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })).blockhash;
|
198
196
|
if (abortController?.signal.aborted) {
|
199
197
|
return;
|
@@ -201,9 +199,12 @@ async function sendJitoBundledTransactions(umi, connection, userSigner, otherSig
|
|
201
199
|
let builtTxs = [];
|
202
200
|
let simulationResults;
|
203
201
|
if (txType !== "skip-simulation") {
|
204
|
-
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, false,
|
202
|
+
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, userSigner, otherSigners, txs, false, undefined, Array(txs.length).map(_ => 1400000));
|
205
203
|
simulationResults = await simulateJitoBundle(umi, builtTxs);
|
206
204
|
}
|
205
|
+
const feeEstimates = (0, services_1.usePriorityFee)(priorityFeeSetting)
|
206
|
+
? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting, true)) ?? 1000000))
|
207
|
+
: undefined;
|
207
208
|
if (abortController?.signal.aborted) {
|
208
209
|
return;
|
209
210
|
}
|
package/local/txSandbox.ts
CHANGED
@@ -23,7 +23,7 @@ import {
|
|
23
23
|
import { getSecretKey } from "./shared";
|
24
24
|
|
25
25
|
const payForTransaction = false;
|
26
|
-
const testProgram =
|
26
|
+
const testProgram = true;
|
27
27
|
const lpEnv: ProgramEnv = "Prod";
|
28
28
|
|
29
29
|
let [, umi] = getSolanaRpcConnection(
|
@@ -47,14 +47,14 @@ export async function main() {
|
|
47
47
|
});
|
48
48
|
|
49
49
|
await client.initializeExistingSolautoPosition({
|
50
|
-
positionId:
|
51
|
-
authority: new PublicKey("
|
50
|
+
positionId: 5,
|
51
|
+
authority: new PublicKey("5UqsR2PGzbP8pGPbXEeXx86Gjz2N2UFBAuFZUSVydAEe"),
|
52
52
|
// lpUserAccount: new PublicKey(
|
53
53
|
// "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
|
54
54
|
// ),
|
55
55
|
});
|
56
56
|
|
57
|
-
const transactionItems = [rebalance(client)];
|
57
|
+
const transactionItems = [rebalance(client, undefined, 300)];
|
58
58
|
|
59
59
|
const txManager = new ClientTransactionsManager({
|
60
60
|
txHandler: client,
|
package/package.json
CHANGED
@@ -12,7 +12,6 @@ import {
|
|
12
12
|
consoleLog,
|
13
13
|
fromBaseUnit,
|
14
14
|
fromBps,
|
15
|
-
getLiqUtilzationRateBps,
|
16
15
|
getMaxLiqUtilizationRateBps,
|
17
16
|
getTokenAccount,
|
18
17
|
hasFirstRebalance,
|
@@ -77,7 +76,8 @@ export class RebalanceTxBuilder {
|
|
77
76
|
this.targetLiqUtilizationRateBps,
|
78
77
|
this.client.pos.netWorthUsd(this.priceType)
|
79
78
|
),
|
80
|
-
this.flRequirements?.flFeeBps ?? 0
|
79
|
+
this.flRequirements?.flFeeBps ?? 0,
|
80
|
+
this.bpsDistanceFromRebalance
|
81
81
|
);
|
82
82
|
}
|
83
83
|
|
@@ -1,6 +1,4 @@
|
|
1
1
|
import {
|
2
|
-
createSolautoProgram,
|
3
|
-
InvalidRebalanceConditionError,
|
4
2
|
PriceType,
|
5
3
|
RebalanceDirection,
|
6
4
|
TokenBalanceChange,
|
@@ -9,7 +7,6 @@ import {
|
|
9
7
|
import {
|
10
8
|
fromBps,
|
11
9
|
getLiqUtilzationRateBps,
|
12
|
-
maxRepayToBps,
|
13
10
|
toBps,
|
14
11
|
} from "../../utils";
|
15
12
|
import { SolautoPositionEx } from "../../solautoPosition";
|
@@ -126,20 +123,21 @@ function getTokenBalanceChange(): TokenBalanceChange | undefined {
|
|
126
123
|
function getTargetLiqUtilizationRateBps(
|
127
124
|
solautoPosition: SolautoPositionEx,
|
128
125
|
priceType: PriceType,
|
129
|
-
targetLiqUtilizationRateBps
|
130
|
-
tokenBalanceChange
|
126
|
+
targetLiqUtilizationRateBps?: number,
|
127
|
+
tokenBalanceChange?: TokenBalanceChange,
|
128
|
+
bpsDistanceFromRebalance?: number
|
131
129
|
): number | undefined {
|
132
130
|
if (targetLiqUtilizationRateBps !== undefined) {
|
133
131
|
return targetLiqUtilizationRateBps;
|
134
132
|
}
|
135
133
|
|
136
134
|
if (
|
137
|
-
solautoPosition.liqUtilizationRateBps(PriceType.Realtime) >=
|
135
|
+
solautoPosition.liqUtilizationRateBps(PriceType.Realtime) + (bpsDistanceFromRebalance ?? 0) >=
|
138
136
|
solautoPosition.repayFromBps
|
139
137
|
) {
|
140
138
|
return solautoPosition.settings!.repayToBps;
|
141
139
|
} else if (
|
142
|
-
solautoPosition.liqUtilizationRateBps(priceType) <=
|
140
|
+
solautoPosition.liqUtilizationRateBps(priceType) - (bpsDistanceFromRebalance ?? 0) <=
|
143
141
|
solautoPosition.boostFromBps
|
144
142
|
) {
|
145
143
|
return solautoPosition.settings!.boostToBps;
|
@@ -203,7 +201,8 @@ export function getRebalanceValues(
|
|
203
201
|
priceType: PriceType,
|
204
202
|
targetLiqUtilizationRateBps?: number,
|
205
203
|
solautoFeeBps?: SolautoFeesBps,
|
206
|
-
flFeeBps?: number
|
204
|
+
flFeeBps?: number,
|
205
|
+
bpsDistanceFromRebalance?: number
|
207
206
|
): RebalanceValues | undefined {
|
208
207
|
const tokenBalanceChange = getTokenBalanceChange();
|
209
208
|
|
@@ -211,7 +210,8 @@ export function getRebalanceValues(
|
|
211
210
|
solautoPosition,
|
212
211
|
priceType,
|
213
212
|
targetLiqUtilizationRateBps,
|
214
|
-
tokenBalanceChange
|
213
|
+
tokenBalanceChange,
|
214
|
+
bpsDistanceFromRebalance
|
215
215
|
);
|
216
216
|
if (targetRate === undefined) {
|
217
217
|
return undefined;
|
@@ -292,7 +292,6 @@ export class TransactionsManager<T extends TxHandler> {
|
|
292
292
|
|
293
293
|
private async processTransactionsAtomically(itemSets: TransactionSet[]) {
|
294
294
|
let num = 0;
|
295
|
-
let priorityFeeSetting: PriorityFeeSetting;
|
296
295
|
let transactions: TransactionBuilder[] = [];
|
297
296
|
|
298
297
|
await retryWithExponentialBackoff(
|
@@ -306,7 +305,7 @@ export class TransactionsManager<T extends TxHandler> {
|
|
306
305
|
}
|
307
306
|
|
308
307
|
num = attemptNum;
|
309
|
-
priorityFeeSetting = this.getUpdatedPriorityFeeSetting(
|
308
|
+
this.priorityFeeSetting = this.getUpdatedPriorityFeeSetting(
|
310
309
|
prevError,
|
311
310
|
attemptNum
|
312
311
|
);
|
@@ -366,7 +365,7 @@ export class TransactionsManager<T extends TxHandler> {
|
|
366
365
|
this.txHandler.otherSigners,
|
367
366
|
transactions,
|
368
367
|
this.txRunType,
|
369
|
-
priorityFeeSetting,
|
368
|
+
this.priorityFeeSetting,
|
370
369
|
() =>
|
371
370
|
this.updateStatusForSets(
|
372
371
|
itemSets,
|
@@ -384,7 +383,8 @@ export class TransactionsManager<T extends TxHandler> {
|
|
384
383
|
if (
|
385
384
|
error ||
|
386
385
|
(this.txRunType !== "only-simulate" &&
|
387
|
-
(!Boolean(txSigs) || txSigs?.length === 0)
|
386
|
+
(!Boolean(txSigs) || txSigs?.length === 0) &&
|
387
|
+
!this.abortController?.signal.aborted)
|
388
388
|
) {
|
389
389
|
this.updateStatusForSets(
|
390
390
|
itemSets,
|
@@ -417,7 +417,7 @@ export class TransactionsManager<T extends TxHandler> {
|
|
417
417
|
(x) =>
|
418
418
|
this.statuses.find((y) => x.name() === y.name)?.simulationSuccessful
|
419
419
|
).length === itemSets.length,
|
420
|
-
priorityFeeSetting
|
420
|
+
this.priorityFeeSetting
|
421
421
|
);
|
422
422
|
|
423
423
|
const errorString = `${errorDetails.errorName ?? "Unknown error"}: ${errorDetails.errorInfo?.split("\n")[0] ?? "unknown"}`;
|
@@ -480,11 +480,12 @@ export class TransactionsManager<T extends TxHandler> {
|
|
480
480
|
);
|
481
481
|
} else {
|
482
482
|
await this.debugAccounts(itemSet, tx);
|
483
|
+
this.priorityFeeSetting = this.getUpdatedPriorityFeeSetting(prevError, attemptNum);
|
483
484
|
await this.sendTransaction(
|
484
485
|
tx,
|
485
486
|
itemSet.name(),
|
486
487
|
attemptNum,
|
487
|
-
this.
|
488
|
+
this.priorityFeeSetting
|
488
489
|
);
|
489
490
|
}
|
490
491
|
},
|
@@ -626,9 +626,13 @@ export function getErrorInfo(
|
|
626
626
|
addTxOptimizations(
|
627
627
|
umi,
|
628
628
|
txs[txIdx],
|
629
|
-
usePriorityFee(priorityFeeSetting)
|
630
|
-
|
631
|
-
|
629
|
+
simulationSuccessful && usePriorityFee(priorityFeeSetting)
|
630
|
+
? 1
|
631
|
+
: undefined,
|
632
|
+
1
|
633
|
+
).getInstructions().length -
|
634
|
+
txs[txIdx].getInstructions().length -
|
635
|
+
(txs.length > 1 && txIdx === 0 ? 1 : 0); // Account for jito tip IX
|
632
636
|
|
633
637
|
try {
|
634
638
|
if (error instanceof BundleSimulationError) {
|
package/src/utils/jitoUtils.ts
CHANGED
@@ -273,12 +273,14 @@ export async function sendJitoBundledTransactions(
|
|
273
273
|
connection: Connection,
|
274
274
|
userSigner: Signer,
|
275
275
|
otherSigners: Signer[],
|
276
|
-
|
276
|
+
transactions: TransactionBuilder[],
|
277
277
|
txType?: TransactionRunType,
|
278
278
|
priorityFeeSetting: PriorityFeeSetting = PriorityFeeSetting.Min,
|
279
279
|
onAwaitingSign?: () => void,
|
280
280
|
abortController?: AbortController
|
281
281
|
): Promise<string[] | undefined> {
|
282
|
+
const txs = [...transactions];
|
283
|
+
|
282
284
|
if (txs.length === 1) {
|
283
285
|
const resp = await sendSingleOptimizedTransaction(
|
284
286
|
umi,
|
@@ -304,20 +306,6 @@ export async function sendJitoBundledTransactions(
|
|
304
306
|
|
305
307
|
txs[0] = txs[0].prepend(getTipInstruction(userSigner, 150_000));
|
306
308
|
|
307
|
-
const feeEstimates = usePriorityFee(priorityFeeSetting)
|
308
|
-
? await Promise.all(
|
309
|
-
txs.map(
|
310
|
-
async (x) =>
|
311
|
-
(await getComputeUnitPriceEstimate(
|
312
|
-
umi,
|
313
|
-
x,
|
314
|
-
priorityFeeSetting,
|
315
|
-
true
|
316
|
-
)) ?? 1000000
|
317
|
-
)
|
318
|
-
)
|
319
|
-
: undefined;
|
320
|
-
|
321
309
|
const latestBlockhash = (
|
322
310
|
await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })
|
323
311
|
).blockhash;
|
@@ -335,11 +323,26 @@ export async function sendJitoBundledTransactions(
|
|
335
323
|
otherSigners,
|
336
324
|
txs,
|
337
325
|
false,
|
338
|
-
|
326
|
+
undefined,
|
327
|
+
Array(txs.length).map(_ => 1_400_000)
|
339
328
|
);
|
340
329
|
simulationResults = await simulateJitoBundle(umi, builtTxs);
|
341
330
|
}
|
342
331
|
|
332
|
+
const feeEstimates = usePriorityFee(priorityFeeSetting)
|
333
|
+
? await Promise.all(
|
334
|
+
txs.map(
|
335
|
+
async (x) =>
|
336
|
+
(await getComputeUnitPriceEstimate(
|
337
|
+
umi,
|
338
|
+
x,
|
339
|
+
priorityFeeSetting,
|
340
|
+
true
|
341
|
+
)) ?? 1000000
|
342
|
+
)
|
343
|
+
)
|
344
|
+
: undefined;
|
345
|
+
|
343
346
|
if (abortController?.signal.aborted) {
|
344
347
|
return;
|
345
348
|
}
|