@@ -3129,14 +3129,16 @@ async fn do_offline_multisig_transfer(
31293129 . await
31303130 . unwrap ( ) ;
31313131
3132- let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
3133- ProgramOfflineClient :: new ( blockhash, ProgramRpcClientSendTransaction ) ,
3134- ) ;
3132+ let offline_program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > =
3133+ Arc :: new ( ProgramOfflineClient :: new (
3134+ blockhash,
3135+ ProgramRpcClientSendTransaction ,
3136+ ) ) ;
31353137 let mut args = vec ! [
31363138 "spl-token" . to_string( ) ,
31373139 CommandName :: Transfer . as_ref( ) . to_string( ) ,
31383140 token. to_string( ) ,
3139- "10 " . to_string( ) ,
3141+ "100 " . to_string( ) ,
31403142 destination. to_string( ) ,
31413143 "--blockhash" . to_string( ) ,
31423144 blockhash. to_string( ) ,
@@ -3166,7 +3168,7 @@ async fn do_offline_multisig_transfer(
31663168 args. push ( "--with-compute-unit-limit" . to_string ( ) ) ;
31673169 args. push ( 10_000 . to_string ( ) ) ;
31683170 }
3169- config. program_client = program_client ;
3171+ config. program_client = offline_program_client ;
31703172 let result = exec_test_cmd ( & config, & args) . await . unwrap ( ) ;
31713173 // the provided signer has a signature, denoted by the pubkey followed
31723174 // by "=" and the signature
@@ -3190,15 +3192,15 @@ async fn do_offline_multisig_transfer(
31903192 assert ! ( !absent_signers. contains( & token. to_string( ) ) ) ;
31913193
31923194 // now send the transaction
3193- let program_client : Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
3195+ let rpc_program_client : Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
31943196 ProgramRpcClient :: new ( config. rpc_client . clone ( ) , ProgramRpcClientSendTransaction ) ,
31953197 ) ;
3196- config. program_client = program_client ;
3198+ config. program_client = rpc_program_client ;
31973199 let mut args = vec ! [
31983200 "spl-token" . to_string( ) ,
31993201 CommandName :: Transfer . as_ref( ) . to_string( ) ,
32003202 token. to_string( ) ,
3201- "10 " . to_string( ) ,
3203+ "100 " . to_string( ) ,
32023204 destination. to_string( ) ,
32033205 "--blockhash" . to_string( ) ,
32043206 blockhash. to_string( ) ,
@@ -3233,12 +3235,46 @@ async fn do_offline_multisig_transfer(
32333235
32343236 let account = config. rpc_client . get_account ( & source) . await . unwrap ( ) ;
32353237 let token_account = StateWithExtensionsOwned :: < Account > :: unpack ( account. data ) . unwrap ( ) ;
3236- let amount = spl_token:: ui_amount_to_amount ( 90 .0, TEST_DECIMALS ) ;
3238+ let amount = spl_token:: ui_amount_to_amount ( 0 .0, TEST_DECIMALS ) ;
32373239 assert_eq ! ( token_account. base. amount, amount) ;
32383240 let account = config. rpc_client . get_account ( & destination) . await . unwrap ( ) ;
32393241 let token_account = StateWithExtensionsOwned :: < Account > :: unpack ( account. data ) . unwrap ( ) ;
3240- let amount = spl_token:: ui_amount_to_amount ( 10 .0, TEST_DECIMALS ) ;
3242+ let amount = spl_token:: ui_amount_to_amount ( 100 .0, TEST_DECIMALS ) ;
32413243 assert_eq ! ( token_account. base. amount, amount) ;
3244+
3245+ // get new nonce
3246+ let nonce_account = config. rpc_client . get_account ( & nonce) . await . unwrap ( ) ;
3247+ let blockhash = Hash :: new ( & nonce_account. data [ start_hash_index..start_hash_index + 32 ] ) ;
3248+ let mut args = vec ! [
3249+ "spl-token" . to_string( ) ,
3250+ CommandName :: Close . as_ref( ) . to_string( ) ,
3251+ "--address" . to_string( ) ,
3252+ source. to_string( ) ,
3253+ "--blockhash" . to_string( ) ,
3254+ blockhash. to_string( ) ,
3255+ "--nonce" . to_string( ) ,
3256+ nonce. to_string( ) ,
3257+ "--nonce-authority" . to_string( ) ,
3258+ fee_payer_keypair_file. path( ) . to_str( ) . unwrap( ) . to_string( ) ,
3259+ "--multisig-signer" . to_string( ) ,
3260+ multisig_paths[ 1 ] . path( ) . to_str( ) . unwrap( ) . to_string( ) ,
3261+ "--multisig-signer" . to_string( ) ,
3262+ multisig_paths[ 2 ] . path( ) . to_str( ) . unwrap( ) . to_string( ) ,
3263+ "--owner" . to_string( ) ,
3264+ multisig_pubkey. to_string( ) ,
3265+ "--fee-payer" . to_string( ) ,
3266+ fee_payer_keypair_file. path( ) . to_str( ) . unwrap( ) . to_string( ) ,
3267+ "--program-id" . to_string( ) ,
3268+ program_id. to_string( ) ,
3269+ ] ;
3270+ if let Some ( compute_unit_price) = compute_unit_price {
3271+ args. push ( "--with-compute-unit-price" . to_string ( ) ) ;
3272+ args. push ( compute_unit_price. to_string ( ) ) ;
3273+ args. push ( "--with-compute-unit-limit" . to_string ( ) ) ;
3274+ args. push ( 10_000 . to_string ( ) ) ;
3275+ }
3276+ exec_test_cmd ( & config, & args) . await . unwrap ( ) ;
3277+ let _ = config. rpc_client . get_account ( & source) . await . unwrap_err ( ) ;
32423278 }
32433279}
32443280
0 commit comments