Skip to content

Commit

Permalink
log errors
Browse files Browse the repository at this point in the history
  • Loading branch information
artursapek committed Mar 18, 2024
1 parent 2bac879 commit 74c390a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sdk/src/contexts/solana/utils/computeBudget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export async function determineComputeBudget(
try {
const simulateResponse = await connection.simulateTransaction(transaction);

if (simulateResponse.value.err) {
console.error(
`Error simulating Solana transaction: ${simulateResponse.value.err}`,
);
}

if (simulateResponse?.value?.unitsConsumed) {
// Set compute budget to 120% of the units used in the simulated transaction
computeBudget = Math.round(simulateResponse.value.unitsConsumed * 1.2);
Expand Down

0 comments on commit 74c390a

Please sign in to comment.