@@ -78,6 +78,41 @@ pub const COMPUTE_UNIT_LIMIT_ARG: ArgConstant<'static> = ArgConstant {
78
78
help : "Set compute unit limit for transaction, in compute units." ,
79
79
} ;
80
80
81
+ // The `signer_arg` in clap-v3-utils` specifies the argument as a
82
+ // `PubkeySignature` type, but supporting `PubkeySignature` in the token-cli
83
+ // requires a significant re-structuring of the code. Therefore, hard-code the
84
+ // `signer_arg` and `OfflineArgs` from clap-utils` here and remove
85
+ // it in a subsequent PR.
86
+ fn signer_arg < ' a > ( ) -> Arg < ' a > {
87
+ Arg :: new ( SIGNER_ARG . name )
88
+ . long ( SIGNER_ARG . long )
89
+ . takes_value ( true )
90
+ . value_name ( "PUBKEY=SIGNATURE" )
91
+ . requires ( BLOCKHASH_ARG . name )
92
+ . action ( clap:: ArgAction :: Append )
93
+ . multiple_values ( false )
94
+ . help ( SIGNER_ARG . help )
95
+ }
96
+
97
+ pub trait OfflineArgs {
98
+ fn offline_args ( self ) -> Self ;
99
+ fn offline_args_config ( self , config : & dyn ArgsConfig ) -> Self ;
100
+ }
101
+
102
+ impl OfflineArgs for clap:: Command < ' _ > {
103
+ fn offline_args_config ( self , config : & dyn ArgsConfig ) -> Self {
104
+ self . arg ( config. blockhash_arg ( blockhash_arg ( ) ) )
105
+ . arg ( config. sign_only_arg ( sign_only_arg ( ) ) )
106
+ . arg ( config. signer_arg ( signer_arg ( ) ) )
107
+ . arg ( config. dump_transaction_message_arg ( dump_transaction_message ( ) ) )
108
+ }
109
+ fn offline_args ( self ) -> Self {
110
+ struct NullArgsConfig { }
111
+ impl ArgsConfig for NullArgsConfig { }
112
+ self . offline_args_config ( & NullArgsConfig { } )
113
+ }
114
+ }
115
+
81
116
pub static VALID_TOKEN_PROGRAM_IDS : [ Pubkey ; 2 ] = [ spl_token_2022:: ID , spl_token:: ID ] ;
82
117
83
118
#[ derive( AsRefStr , Debug , Clone , Copy , PartialEq , EnumString , IntoStaticStr ) ]
0 commit comments