88 keypair:: DefaultSigner ,
99 } ,
1010 solana_client:: rpc_client:: RpcClient ,
11- solana_remote_wallet:: remote_wallet:: RemoteWalletManager ,
12- solana_sdk:: {
13- commitment_config:: CommitmentConfig ,
14- instruction:: AccountMeta ,
15- native_token:: Sol ,
16- signature:: { Keypair , Signer } ,
17- } ,
18- std:: { env, process:: exit, sync:: Arc } ,
11+ solana_sdk:: { commitment_config:: CommitmentConfig , native_token:: Sol , signature:: Signer } ,
12+ std:: { env, process:: exit} ,
1913} ;
14+
15+ #[ cfg( feature = "remote-wallet" ) ]
16+ use solana_remote_wallet:: remote_wallet:: RemoteWalletManager ;
2017pub mod clparse;
2118pub mod prelude;
2219pub mod utils;
2320
24- /// Space allocated for account state
25- const ACCOUNT_STATE_SPACE : usize = 1024 ;
26-
2721struct Config {
2822 commitment_config : CommitmentConfig ,
2923 default_signer : Box < dyn Signer > ,
3024 json_rpc_url : String ,
3125 verbose : u8 , // 0=normal, 1=verbose (-v), 2=very verbose (-vv), 3=debug (-vvv)
26+ #[ allow( dead_code) ]
3227 no_color : bool ,
3328}
3429
@@ -37,8 +32,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3732 let app_matches = parse_command_line ( ) ;
3833 let ( sub_command, sub_matches) = app_matches. subcommand ( ) ;
3934 let matches = sub_matches. unwrap ( ) ;
35+
36+ #[ cfg( feature = "remote-wallet" ) ]
4037 let mut wallet_manager: Option < Arc < RemoteWalletManager > > = None ;
4138
39+ #[ cfg( not( feature = "remote-wallet" ) ) ]
40+ let mut wallet_manager = None ;
41+
4242 // Check if colors should be disabled (via flag or environment variable)
4343 let no_color = matches. is_present ( "no_color" ) || env:: var ( "NO_COLOR" ) . is_ok ( ) ;
4444 if no_color {
@@ -54,9 +54,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5454 } ;
5555
5656 let default_signer = DefaultSigner :: new (
57- "keypair" . to_string ( ) ,
57+ "keypair" ,
5858 matches
59- . value_of ( & "keypair" )
59+ . value_of ( "keypair" )
6060 . map ( |s| s. to_string ( ) )
6161 . unwrap_or_else ( || cli_config. keypair_path . clone ( ) ) ,
6262 ) ;
@@ -65,9 +65,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6565 json_rpc_url : normalize_to_url_if_moniker (
6666 matches
6767 . value_of ( "json_rpc_url" )
68- . unwrap_or ( & cli_config. json_rpc_url )
69- . to_string ( ) ,
68+ . unwrap_or ( & cli_config. json_rpc_url ) ,
7069 ) ,
70+ #[ cfg( feature = "remote-wallet" ) ]
71+ default_signer : default_signer
72+ . signer_from_path ( matches, & mut wallet_manager)
73+ . unwrap_or_else ( |err| {
74+ eprintln ! ( "error: {}" , err) ;
75+ exit ( 1 ) ;
76+ } ) ,
77+ #[ cfg( not( feature = "remote-wallet" ) ) ]
7178 default_signer : default_signer
7279 . signer_from_path ( matches, & mut wallet_manager)
7380 . unwrap_or_else ( |err| {
@@ -725,22 +732,6 @@ mod test {
725732 use borsh:: { BorshDeserialize , BorshSerialize } ;
726733 use solana_sdk:: pubkey:: Pubkey ;
727734
728- use { super :: * , solana_test_validator:: * } ;
729-
730- // Tests commented out as they depend on removed functions
731- /*
732- #[test]
733- fn test_ping() {
734- let (test_validator, payer) = TestValidatorGenesis::default().start();
735- let rpc_client = test_validator.get_rpc_client();
736-
737- assert!(matches!(
738- ping_instruction(&rpc_client, &payer, CommitmentConfig::confirmed()),
739- Ok(_)
740- ));
741- }
742- */
743-
744735 #[ test]
745736 fn test_borsh ( ) {
746737 #[ repr( C ) ]
@@ -755,9 +746,13 @@ mod test {
755746 update_authority : Some ( Pubkey :: default ( ) ) ,
756747 primary_sale_happened : Some ( true ) ,
757748 } ;
758- let bout = faux. try_to_vec ( ) . unwrap ( ) ;
759- println ! ( "{:?}" , bout) ;
760- let in_faux = UpdateMetadataAccountArgs :: try_from_slice ( & bout) . unwrap ( ) ;
761- println ! ( "{:?}" , in_faux) ;
749+ // With borsh 1.5.5, we need to use BorshSerialize in a different way
750+ let mut bout = Vec :: new ( ) ;
751+ faux. serialize ( & mut bout) . unwrap ( ) ;
752+ // With borsh 1.5.5, use the BorshDeserialize trait method
753+ let in_faux = UpdateMetadataAccountArgs :: deserialize ( & mut & bout[ ..] ) . unwrap ( ) ;
754+
755+ // Assert that the deserialized data matches the original
756+ assert_eq ! ( faux, in_faux) ;
762757 }
763758}
0 commit comments