@@ -37,9 +37,32 @@ pub struct Cli {
3737 pub command : Commands ,
3838}
3939
40+ /// Common parameters for key management subcommand.
41+ #[ derive( clap:: Args , Debug ) ]
42+ #[ group( required = true , multiple = false ) ]
43+ pub struct KeyManagementParams {
44+ /// Use the Alice development key to sign blob transactions.
45+ ///
46+ /// Cannot be used in conjunction with the `--submit-private-key` flag.
47+ #[ arg( long) ]
48+ pub submit_dev_alice : bool ,
49+
50+ /// Use the keyfile at the provided path to sign blob transactions.
51+ ///
52+ /// The keyfile should be 32 bytes of unencrypted, hex-encoded sr25519
53+ /// seed material.
54+ ///
55+ /// Cannot be used in conjunction with the `--submit-dev-alice` flag.
56+ #[ arg( long, value_name = "PATH" ) ]
57+ pub submit_private_key : Option < std:: path:: PathBuf > ,
58+ }
59+
4060/// Common parameters for the adapter subcommands.
4161#[ derive( clap:: Args , Debug ) ]
4262pub struct AdapterServerParams {
63+ #[ clap( flatten) ]
64+ pub key_management : KeyManagementParams ,
65+
4366 /// The address on which the shim should listen for incoming connections from the rollup nodes.
4467 #[ clap( short, long, default_value = "127.0.0.1" , group = "listen" ) ]
4568 pub address : String ,
@@ -53,7 +76,8 @@ pub struct AdapterServerParams {
5376 group = "listen"
5477 ) ]
5578 pub port : u16 ,
56- // TODO: e.g. --submit-key, prometheus stuff, enabled adapters, etc.
79+
80+ // TODO: e.g. prometheus stuff, enabled adapters, etc.
5781}
5882
5983/// Common parameters for that commands that connect to the sugondat-node.
@@ -105,7 +129,7 @@ pub mod query {
105129 // - query blob <id> - returns the blob for a given key. The key here is the same sense as
106130 // described here https://github.com/thrumdev/sugondat/issues/9#issuecomment-1814005570.
107131
108- use super :: { SugondatRpcParams , ENV_SUGONDAT_NAMESPACE } ;
132+ use super :: { SugondatRpcParams , KeyManagementParams , ENV_SUGONDAT_NAMESPACE } ;
109133 use clap:: { Args , Subcommand } ;
110134
111135 #[ derive( Debug , Args ) ]
@@ -123,7 +147,7 @@ pub mod query {
123147 pub mod submit {
124148 //! CLI definition for the `query submit` subcommand.
125149
126- use super :: { SugondatRpcParams , ENV_SUGONDAT_NAMESPACE } ;
150+ use super :: { SugondatRpcParams , KeyManagementParams , ENV_SUGONDAT_NAMESPACE } ;
127151 use clap:: Args ;
128152
129153 #[ derive( Debug , Args ) ]
@@ -141,6 +165,9 @@ pub mod query {
141165
142166 /// The file path of the blob to submit. Pass `-` to read from stdin.
143167 pub blob_path : String ,
168+
169+ #[ clap( flatten) ]
170+ pub key_management : KeyManagementParams ,
144171 }
145172 }
146173}
0 commit comments