11use crate :: commands:: KeySubCommand ;
22use crate :: error:: BDKCliError as Error ;
3+ use crate :: handlers:: Init ;
34use crate :: handlers:: { AppCommand , AppContext } ;
45use crate :: utils:: output:: FormatOutput ;
56use crate :: utils:: types:: KeyResult ;
@@ -15,7 +16,7 @@ use bdk_wallet::miniscript::{self, Segwitv0};
1516use clap:: Parser ;
1617
1718impl KeySubCommand {
18- pub fn execute ( & self , ctx : & mut AppContext ) -> Result < ( ) , Error > {
19+ pub fn execute ( & self , ctx : & mut AppContext < Init > ) -> Result < ( ) , Error > {
1920 match self {
2021 KeySubCommand :: Generate ( generate_key_command) => generate_key_command
2122 . execute ( ctx) ?
@@ -44,10 +45,10 @@ pub struct GenerateKeyCommand {
4445 password : Option < String > ,
4546}
4647
47- impl AppCommand for GenerateKeyCommand {
48+ impl AppCommand < AppContext < Init > > for GenerateKeyCommand {
4849 type Output = KeyResult ;
4950
50- fn execute ( & self , ctx : & mut AppContext ) -> Result < Self :: Output , Error > {
51+ fn execute ( & self , ctx : & mut AppContext < Init > ) -> Result < Self :: Output , Error > {
5152 let secp = Secp256k1 :: new ( ) ;
5253 let mnemonic_type = match self . word_count {
5354 12 => WordCount :: Words12 ,
@@ -88,10 +89,10 @@ pub struct DeriveKeyCommand {
8889 path : DerivationPath ,
8990}
9091
91- impl AppCommand for DeriveKeyCommand {
92+ impl AppCommand < AppContext < Init > > for DeriveKeyCommand {
9293 type Output = KeyResult ;
9394
94- fn execute ( & self , ctx : & mut AppContext ) -> Result < Self :: Output , Error > {
95+ fn execute ( & self , ctx : & mut AppContext < Init > ) -> Result < Self :: Output , Error > {
9596 let secp = Secp256k1 :: new ( ) ;
9697
9798 let derived_xprv = & self . xprv . derive_priv ( & secp, & self . path ) ?;
@@ -134,10 +135,10 @@ pub struct RestoreKeyCommand {
134135 password : Option < String > ,
135136}
136137
137- impl AppCommand for RestoreKeyCommand {
138+ impl AppCommand < AppContext < Init > > for RestoreKeyCommand {
138139 type Output = KeyResult ;
139140
140- fn execute ( & self , ctx : & mut AppContext ) -> Result < Self :: Output , Error > {
141+ fn execute ( & self , ctx : & mut AppContext < Init > ) -> Result < Self :: Output , Error > {
141142 let secp = Secp256k1 :: new ( ) ;
142143
143144 let mnemonic = Mnemonic :: parse_in ( Language :: English , & self . mnemonic ) ?;
0 commit comments