Skip to content

Commit 89ca041

Browse files
authored
Surface underlying transaction errors in the CLI (#111)
This fixes the CLI swallowing useful transaction errors when executing an instruction plan (e.g. uploading an IDL). The runOrExport helper called the deprecated low-level transactionPlanExecutor, which threw a generic "The provided transaction plan failed to execute" error that hid the real cause. It now uses the client's sendTransactions method, which unwraps failures into readable messages reporting which transaction failed and its underlying program error.
1 parent b4f021b commit 89ca041

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

clients/js/pnpm-workspace.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
allowBuilds:
2+
esbuild: false

clients/js/src/cli/utils.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
address,
1010
ClientWithRpc,
1111
ClientWithTransactionPlanning,
12+
ClientWithTransactionSending,
1213
Commitment,
1314
compileTransaction,
1415
createClient,
@@ -32,7 +33,6 @@ import {
3233
SolanaRpcSubscriptionsApi,
3334
TransactionMessage,
3435
TransactionPlan,
35-
TransactionPlanExecutor,
3636
TransactionSigner,
3737
} from '@solana/kit';
3838
import { solanaRpc, TransactionPlannerConfig } from '@solana/kit-plugin-rpc';
@@ -131,10 +131,7 @@ function cliConfigs(configs: SolanaConfigs) {
131131
*/
132132
function cliRunOrExport(options: ExportOption & ExportEncodingOption) {
133133
return <
134-
T extends ClientWithRpc<GetLatestBlockhashApi> &
135-
ClientWithTransactionPlanning & {
136-
transactionPlanExecutor: TransactionPlanExecutor;
137-
},
134+
T extends ClientWithRpc<GetLatestBlockhashApi> & ClientWithTransactionPlanning & ClientWithTransactionSending,
138135
>(
139136
client: T,
140137
) =>
@@ -144,8 +141,8 @@ function cliRunOrExport(options: ExportOption & ExportEncodingOption) {
144141
if (options.export) {
145142
await exportTransactionPlan(transactionPlan, client, options);
146143
} else {
147-
// TODO: progress + error handling.
148-
await client.transactionPlanExecutor(transactionPlan);
144+
// TODO: progress reporting.
145+
await client.sendTransactions(transactionPlan);
149146
logSuccess('Operation executed successfully');
150147
}
151148
},

0 commit comments

Comments
 (0)