From 537900fc06c874e3b35653b08486c03653029881 Mon Sep 17 00:00:00 2001 From: bguillaumat Date: Fri, 11 Aug 2023 16:33:56 +0200 Subject: [PATCH] chore(execute): Add the computeBudget ix --- package.json | 2 +- src/lib/menu.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 26e427b..b113755 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sqds/cli", - "version": "2.3.6", + "version": "2.3.7", "description": "", "main": "bin/index.js", "scripts": { diff --git a/src/lib/menu.ts b/src/lib/menu.ts index 206a823..f500565 100644 --- a/src/lib/menu.ts +++ b/src/lib/menu.ts @@ -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, @@ -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++){ @@ -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"); @@ -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"); @@ -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");