This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ impl<'a> Config<'a> {
69
69
) ) ;
70
70
let sign_only = matches. is_present ( SIGN_ONLY_ARG . name ) ;
71
71
let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = if sign_only {
72
- let blockhash = value_of ( matches, BLOCKHASH_ARG . name ) ;
72
+ let blockhash = value_of ( matches, BLOCKHASH_ARG . name ) . unwrap_or_default ( ) ;
73
73
Arc :: new ( ProgramOfflineClient :: new (
74
74
blockhash,
75
75
ProgramRpcClientSendTransaction ,
Original file line number Diff line number Diff line change @@ -3138,7 +3138,7 @@ async fn handle_tx<'a>(
3138
3138
) -> Result < TransactionReturnData , Error > {
3139
3139
let fee_payer = Some ( & config. fee_payer ) ;
3140
3140
3141
- let recent_blockhash = config. rpc_client . get_latest_blockhash ( ) . await ?;
3141
+ let recent_blockhash = config. program_client . get_latest_blockhash ( ) . await ?;
3142
3142
let message = if let Some ( nonce_account) = config. nonce_account . as_ref ( ) {
3143
3143
let mut message = Message :: new_with_nonce (
3144
3144
instructions,
@@ -3151,9 +3151,9 @@ async fn handle_tx<'a>(
3151
3151
} else {
3152
3152
Message :: new_with_blockhash ( & instructions, fee_payer, & recent_blockhash)
3153
3153
} ;
3154
- let fee = config. rpc_client . get_fee_for_message ( & message) . await ?;
3155
3154
3156
3155
if !config. sign_only {
3156
+ let fee = config. rpc_client . get_fee_for_message ( & message) . await ?;
3157
3157
check_fee_payer_balance ( config, minimum_balance_for_rent_exemption + fee) . await ?;
3158
3158
}
3159
3159
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ where
243
243
244
244
/// Program client for offline signing.
245
245
pub struct ProgramOfflineClient < ST > {
246
- maybe_blockhash : Option < Hash > ,
246
+ blockhash : Hash ,
247
247
_send : ST ,
248
248
}
249
249
@@ -254,9 +254,9 @@ impl<ST> fmt::Debug for ProgramOfflineClient<ST> {
254
254
}
255
255
256
256
impl < ST > ProgramOfflineClient < ST > {
257
- pub fn new ( maybe_blockhash : Option < Hash > , send : ST ) -> Self {
257
+ pub fn new ( blockhash : Hash , send : ST ) -> Self {
258
258
Self {
259
- maybe_blockhash ,
259
+ blockhash ,
260
260
_send : send,
261
261
}
262
262
}
@@ -275,7 +275,7 @@ where
275
275
}
276
276
277
277
async fn get_latest_blockhash ( & self ) -> ProgramClientResult < Hash > {
278
- Ok ( self . maybe_blockhash . unwrap ( ) )
278
+ Ok ( self . blockhash )
279
279
}
280
280
281
281
async fn send_transaction ( & self , transaction : & Transaction ) -> ProgramClientResult < ST :: Output > {
You can’t perform that action at this time.
0 commit comments