@haven-fi/solauto-sdk 1.0.160 → 1.0.161
Sign up to get free protection for your applications and to get access to all the features.
@@ -157,7 +157,7 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, txType, attem
|
|
157
157
|
if (txType !== "skip-simulation") {
|
158
158
|
// TODO: we should only retry simulation if it's not a solauto error
|
159
159
|
const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(connection, (0, umi_web3js_adapters_1.toWeb3JsTransaction)(await (await assembleFinalTransaction(umi.identity, tx, feeEstimate, 1400000).setLatestBlockhash(umi)).build(umi))), 3);
|
160
|
-
const computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.
|
160
|
+
const computeUnitLimit = Math.round(Math.min(1400000, simulationResult.value.unitsConsumed * 1.3));
|
161
161
|
console.log("Compute unit limit: ", computeUnitLimit);
|
162
162
|
}
|
163
163
|
if (txType !== "only-simulate") {
|
package/package.json
CHANGED
package/src/utils/solanaUtils.ts
CHANGED
@@ -309,7 +309,7 @@ export async function sendSingleOptimizedTransaction(
|
|
309
309
|
);
|
310
310
|
|
311
311
|
const computeUnitLimit = Math.round(
|
312
|
-
simulationResult.value.unitsConsumed! * 1.
|
312
|
+
Math.min(1_400_000, simulationResult.value.unitsConsumed! * 1.3)
|
313
313
|
);
|
314
314
|
console.log("Compute unit limit: ", computeUnitLimit);
|
315
315
|
}
|