Skip to content

Commit

Permalink
Merge pull request #1129 from oraidex/fix/resolve-issue
Browse files Browse the repository at this point in the history
add compute unit price
  • Loading branch information
haunv3 authored Jan 14, 2025
2 parents 08119d4 + 4fcb341 commit 16bbdd8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/program/web3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ComputeBudgetProgram,
Connection,
LAMPORTS_PER_SOL,
PublicKey,
Expand Down Expand Up @@ -61,6 +62,14 @@ export class Web3SolanaProgramInteraction {
const parsedAmount = toAmount(tokenAmountRaw, token.decimals);

let transaction = new Transaction();
const updateCpIx = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 1_000_000
});
const updateCuIx = ComputeBudgetProgram.setComputeUnitLimit({
units: 500_000
});
transaction.add(updateCpIx, updateCuIx);

if (lamports == 0) {
transaction.add(
createAssociatedTokenAccountInstruction(wallet.publicKey, relayerTokenAccount, relayerPubkey, mintPubkey)
Expand Down

0 comments on commit 16bbdd8

Please sign in to comment.