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