@@ -2978,6 +2978,9 @@ async fn offline_multisig_transfer_with_nonce(test_validator: &TestValidator, pa
29782978 let m = 2 ;
29792979 let n = 3u8 ;
29802980
2981+ let fee_payer_keypair_file = NamedTempFile :: new ( ) . unwrap ( ) ;
2982+ write_keypair_file ( payer, & fee_payer_keypair_file) . unwrap ( ) ;
2983+
29812984 let ( multisig_members, multisig_paths) : ( Vec < _ > , Vec < _ > ) = std:: iter:: repeat_with ( Keypair :: new)
29822985 . take ( n as usize )
29832986 . map ( |s| {
@@ -3059,28 +3062,82 @@ async fn offline_multisig_transfer_with_nonce(test_validator: &TestValidator, pa
30593062 "--owner" ,
30603063 & multisig_pubkey. to_string ( ) ,
30613064 "--fee-payer" ,
3062- & multisig_members[ 0 ] . to_string ( ) ,
3065+ & payer. pubkey ( ) . to_string ( ) ,
3066+ "--program-id" ,
3067+ & program_id. to_string ( ) ,
30633068 ] ,
30643069 )
30653070 . await
30663071 . unwrap ( ) ;
30673072 // the provided signer has a signature, denoted by the pubkey followed
30683073 // by "=" and the signature
3069- assert ! ( result. contains( & format!( "{}=" , multisig_members[ 1 ] ) ) ) ;
3074+ let member_prefix = format ! ( "{}=" , multisig_members[ 1 ] ) ;
3075+ let signature_position = result. find ( & member_prefix) . unwrap ( ) ;
3076+ let end_position = result[ signature_position..] . find ( '\n' ) . unwrap ( ) ;
3077+ let signer = result[ signature_position..] . get ( ..end_position) . unwrap ( ) ;
30703078
30713079 // other three expected signers are absent
30723080 let absent_signers_position = result. find ( "Absent Signers" ) . unwrap ( ) ;
30733081 let absent_signers = result. get ( absent_signers_position..) . unwrap ( ) ;
3074- assert ! ( absent_signers. contains( & multisig_members[ 0 ] . to_string( ) ) ) ;
30753082 assert ! ( absent_signers. contains( & multisig_members[ 2 ] . to_string( ) ) ) ;
30763083 assert ! ( absent_signers. contains( & payer. pubkey( ) . to_string( ) ) ) ;
30773084
30783085 // and nothing else is marked a signer
3086+ assert ! ( !absent_signers. contains( & multisig_members[ 0 ] . to_string( ) ) ) ;
30793087 assert ! ( !absent_signers. contains( & multisig_pubkey. to_string( ) ) ) ;
30803088 assert ! ( !absent_signers. contains( & nonce. to_string( ) ) ) ;
30813089 assert ! ( !absent_signers. contains( & source. to_string( ) ) ) ;
30823090 assert ! ( !absent_signers. contains( & destination. to_string( ) ) ) ;
30833091 assert ! ( !absent_signers. contains( & token. to_string( ) ) ) ;
3092+
3093+ // now send the transaction
3094+ let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
3095+ ProgramRpcClient :: new ( config. rpc_client . clone ( ) , ProgramRpcClientSendTransaction ) ,
3096+ ) ;
3097+ config. program_client = program_client;
3098+ exec_test_cmd (
3099+ & config,
3100+ & [
3101+ "spl-token" ,
3102+ CommandName :: Transfer . into ( ) ,
3103+ & token. to_string ( ) ,
3104+ "10" ,
3105+ & destination. to_string ( ) ,
3106+ "--blockhash" ,
3107+ & blockhash. to_string ( ) ,
3108+ "--nonce" ,
3109+ & nonce. to_string ( ) ,
3110+ "--nonce-authority" ,
3111+ & fee_payer_keypair_file. path ( ) . to_str ( ) . unwrap ( ) ,
3112+ "--mint-decimals" ,
3113+ & format ! ( "{}" , TEST_DECIMALS ) ,
3114+ "--multisig-signer" ,
3115+ & multisig_members[ 1 ] . to_string ( ) ,
3116+ "--multisig-signer" ,
3117+ multisig_paths[ 2 ] . path ( ) . to_str ( ) . unwrap ( ) ,
3118+ "--from" ,
3119+ & source. to_string ( ) ,
3120+ "--owner" ,
3121+ & multisig_pubkey. to_string ( ) ,
3122+ "--fee-payer" ,
3123+ & fee_payer_keypair_file. path ( ) . to_str ( ) . unwrap ( ) ,
3124+ "--program-id" ,
3125+ & program_id. to_string ( ) ,
3126+ "--signer" ,
3127+ signer,
3128+ ] ,
3129+ )
3130+ . await
3131+ . unwrap ( ) ;
3132+
3133+ let account = config. rpc_client . get_account ( & source) . await . unwrap ( ) ;
3134+ let token_account = StateWithExtensionsOwned :: < Account > :: unpack ( account. data ) . unwrap ( ) ;
3135+ let amount = spl_token:: ui_amount_to_amount ( 90.0 , TEST_DECIMALS ) ;
3136+ assert_eq ! ( token_account. base. amount, amount) ;
3137+ let account = config. rpc_client . get_account ( & destination) . await . unwrap ( ) ;
3138+ let token_account = StateWithExtensionsOwned :: < Account > :: unpack ( account. data ) . unwrap ( ) ;
3139+ let amount = spl_token:: ui_amount_to_amount ( 10.0 , TEST_DECIMALS ) ;
3140+ assert_eq ! ( token_account. base. amount, amount) ;
30843141 }
30853142}
30863143
0 commit comments