1
1
use crate :: { signers_of, Error , MULTISIG_SIGNER_ARG } ;
2
2
use clap:: ArgMatches ;
3
3
use solana_clap_utils:: {
4
- input_parsers:: { pubkey_of, pubkey_of_signer} ,
4
+ input_parsers:: { pubkey_of, pubkey_of_signer, value_of } ,
5
5
input_validators:: normalize_to_url_if_moniker,
6
6
keypair:: { signer_from_path, signer_from_path_with_config, SignerFromPathConfig } ,
7
7
nonce:: { NONCE_ARG , NONCE_AUTHORITY_ARG } ,
8
- offline:: { DUMP_TRANSACTION_MESSAGE , SIGN_ONLY_ARG } ,
8
+ offline:: { BLOCKHASH_ARG , DUMP_TRANSACTION_MESSAGE , SIGN_ONLY_ARG } ,
9
9
} ;
10
10
use solana_cli_output:: OutputFormat ;
11
11
use solana_client:: nonblocking:: rpc_client:: RpcClient ;
@@ -16,7 +16,9 @@ use spl_token_2022::{
16
16
extension:: StateWithExtensionsOwned ,
17
17
state:: { Account , Mint } ,
18
18
} ;
19
- use spl_token_client:: client:: { ProgramClient , ProgramRpcClient , ProgramRpcClientSendTransaction } ;
19
+ use spl_token_client:: client:: {
20
+ ProgramClient , ProgramOfflineClient , ProgramRpcClient , ProgramRpcClientSendTransaction ,
21
+ } ;
20
22
use std:: { process:: exit, sync:: Arc } ;
21
23
22
24
pub ( crate ) struct MintInfo {
@@ -65,9 +67,19 @@ impl<'a> Config<'a> {
65
67
json_rpc_url,
66
68
CommitmentConfig :: confirmed ( ) ,
67
69
) ) ;
68
- let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
69
- ProgramRpcClient :: new ( rpc_client. clone ( ) , ProgramRpcClientSendTransaction ) ,
70
- ) ;
70
+ let sign_only = matches. is_present ( SIGN_ONLY_ARG . name ) ;
71
+ let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = if sign_only {
72
+ let blockhash = value_of ( matches, BLOCKHASH_ARG . name ) ;
73
+ Arc :: new ( ProgramOfflineClient :: new (
74
+ blockhash,
75
+ ProgramRpcClientSendTransaction ,
76
+ ) )
77
+ } else {
78
+ Arc :: new ( ProgramRpcClient :: new (
79
+ rpc_client. clone ( ) ,
80
+ ProgramRpcClientSendTransaction ,
81
+ ) )
82
+ } ;
71
83
Self :: new_with_clients_and_ws_url (
72
84
matches,
73
85
wallet_manager,
0 commit comments