Skip to content

Commit

Permalink
chore(execute): Add the computeBudget ix
Browse files Browse the repository at this point in the history
  • Loading branch information
bguillaumat committed Aug 11, 2023
1 parent 75ff21c commit 537900f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sqds/cli",
"version": "2.3.6",
"version": "2.3.7",
"description": "",
"main": "bin/index.js",
"scripts": {
Expand Down
12 changes: 8 additions & 4 deletions src/lib/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import path from 'path';
import { getAuthorityPDA, DEFAULT_MULTISIG_PROGRAM_ID, DEFAULT_PROGRAM_MANAGER_PROGRAM_ID, getIxPDA } from '@sqds/sdk';
import { TXMETA_PROGRAM_ID } from './constants.js';
import BN from 'bn.js';
import { PublicKey, Transaction } from '@solana/web3.js';
import {ComputeBudgetProgram, PublicKey, Transaction} from '@solana/web3.js';
import {
mainMenu,
viewMultisigsMenu,
Expand Down Expand Up @@ -355,6 +355,10 @@ class Menu{
const status = new Spinner("Executing transaction...");
status.start();
let successfullyExecuted = 0;
const additionalComputeBudgetInstruction =
ComputeBudgetProgram.setComputeUnitLimit({
units: 1400000,
})
try {
if(tx.instructionIndex > 3) {
for (let ixIndex = tx.executedIndex + 1; ixIndex <= tx.instructionIndex; ixIndex++){
Expand All @@ -364,7 +368,7 @@ class Menu{
const ix = await this.api.executeInstructionBuilder(tx.publicKey, ixPDA);
const {blockhash, lastValidBlockHeight} = await this.api.connection.getLatestBlockhash();
const executeIxTx = new Transaction({lastValidBlockHeight, blockhash, feePayer: this.wallet.publicKey});
executeIxTx.add(ix);
executeIxTx.add(additionalComputeBudgetInstruction,ix);
const signed = await this.wallet.signTransaction(executeIxTx);
const txid = await this.api.connection.sendRawTransaction(signed.serialize());
await this.api.connection.confirmTransaction(txid, "processed");
Expand All @@ -375,7 +379,7 @@ class Menu{
const ix = await this.api.executeInstructionBuilder(tx.publicKey, ixPDA);
const {blockhash, lastValidBlockHeight} = await this.api.connection.getLatestBlockhash();
const executeIxTx = new Transaction({lastValidBlockHeight, blockhash, feePayer: this.wallet.publicKey});
executeIxTx.add(ix);
executeIxTx.add(additionalComputeBudgetInstruction,ix);
const signed = await this.wallet.signTransaction(executeIxTx);
const txid = await this.api.connection.sendRawTransaction(signed.serialize());
await this.api.connection.confirmTransaction(txid, "processed");
Expand All @@ -387,7 +391,7 @@ class Menu{
const ix = await this.api.executeTransactionBuilder(tx.publicKey);
const {blockhash, lastValidBlockHeight} = await this.api.connection.getLatestBlockhash();
const executeTx = new Transaction({lastValidBlockHeight, blockhash, feePayer: this.wallet.publicKey});
executeTx.add(ix);
executeTx.add(additionalComputeBudgetInstruction,ix);
const signed = await this.wallet.signTransaction(executeTx);
const txid = await this.api.connection.sendRawTransaction(signed.serialize());
await this.api.connection.confirmTransaction(txid, "processed");
Expand Down

0 comments on commit 537900f

Please sign in to comment.