@@ -87,17 +87,17 @@ impl<'a> BitcoinClient {
8787
8888 // Parse app response; if the response is a Response::Error, it is converted to BitcoinClientError::AppError.
8989 async fn parse_response ( response_raw : & ' a [ u8 ] ) -> Result < Response , BitcoinClientError > {
90- let resp: Response = postcard :: from_bytes ( response_raw) . map_err ( |_| {
90+ let resp: Response = minicbor :: decode ( response_raw) . map_err ( |_| {
9191 BitcoinClientError :: GenericError ( "Failed to parse response" . to_string ( ) )
9292 } ) ?;
93- if let Response :: Error ( e ) = resp {
94- return Err ( BitcoinClientError :: AppError ( e ) ) ;
93+ if let Response :: Error { error } = resp {
94+ return Err ( BitcoinClientError :: AppError ( error ) ) ;
9595 }
9696 Ok ( resp)
9797 }
9898
9999 pub async fn exit ( & mut self ) -> Result < i32 , BitcoinClientError > {
100- let msg = postcard :: to_allocvec ( & Request :: Exit ) . map_err ( |_| {
100+ let msg = minicbor :: to_vec ( & Request :: Exit ) . map_err ( |_| {
101101 BitcoinClientError :: GenericError ( "Failed to serialize Exit request" . to_string ( ) )
102102 } ) ?;
103103
@@ -123,15 +123,15 @@ impl<'a> BitcoinClient {
123123 & mut self ,
124124 tree : message:: KeyTree ,
125125 ) -> Result < u32 , BitcoinClientError > {
126- let msg = postcard :: to_allocvec ( & Request :: GetMasterFingerprint { tree } ) . map_err ( |_| {
126+ let msg = minicbor :: to_vec ( & Request :: GetMasterFingerprint { tree } ) . map_err ( |_| {
127127 BitcoinClientError :: GenericError (
128128 "Failed to serialize GetMasterFingerprint request" . to_string ( ) ,
129129 )
130130 } ) ?;
131131
132132 let response_raw = self . send_message ( & msg) . await ?;
133133 match Self :: parse_response ( & response_raw) . await ? {
134- Response :: MasterFingerprint ( fpr ) => Ok ( fpr ) ,
134+ Response :: MasterFingerprint { fingerprint } => Ok ( fingerprint ) ,
135135 e => Err ( BitcoinClientError :: InvalidResponse ( format ! (
136136 "Invalid response: {:?}" ,
137137 e
@@ -149,7 +149,7 @@ impl<'a> BitcoinClient {
149149 let path = DerivationPath :: from_str ( bip32_path)
150150 . map_err ( |e| format ! ( "Failed to convert bip32_path: {}" , e) ) ?;
151151
152- let msg = postcard :: to_allocvec ( & Request :: GetExtendedPubkey {
152+ let msg = minicbor :: to_vec ( & Request :: GetExtendedPubkey {
153153 tree,
154154 display,
155155 path : message:: Bip32Path ( path. to_u32_vec ( ) ) ,
@@ -182,7 +182,7 @@ impl<'a> BitcoinClient {
182182 display : bool ,
183183 ) -> Result < [ u8 ; 78 ] , BitcoinClientError > {
184184 let path = common:: identity:: identity_derivation_path ( index) ;
185- let msg = postcard :: to_allocvec ( & Request :: GetExtendedPubkey {
185+ let msg = minicbor :: to_vec ( & Request :: GetExtendedPubkey {
186186 tree : message:: KeyTree :: Standard ,
187187 display,
188188 path : message:: Bip32Path ( path) ,
@@ -222,7 +222,7 @@ impl<'a> BitcoinClient {
222222 ) ,
223223 BitcoinClientError ,
224224 > {
225- let msg = postcard :: to_allocvec ( & Request :: RegisterAccount {
225+ let msg = minicbor :: to_vec ( & Request :: RegisterAccount {
226226 name : name. into ( ) ,
227227 account : account. clone ( ) ,
228228 registered_identities,
@@ -259,7 +259,7 @@ impl<'a> BitcoinClient {
259259 ) ,
260260 BitcoinClientError ,
261261 > {
262- let msg = postcard :: to_allocvec ( & Request :: RegisterIdentityKey {
262+ let msg = minicbor :: to_vec ( & Request :: RegisterIdentityKey {
263263 name : name. into ( ) ,
264264 pubkey : pubkey. to_vec ( ) ,
265265 } )
@@ -291,7 +291,7 @@ impl<'a> BitcoinClient {
291291 display : bool ,
292292 identity_index : Option < u32 > ,
293293 ) -> Result < ( String , Option < IdentitySignature > ) , BitcoinClientError > {
294- let msg = postcard :: to_allocvec ( & Request :: GetAddress {
294+ let msg = minicbor :: to_vec ( & Request :: GetAddress {
295295 display,
296296 name : Some ( name. to_string ( ) ) ,
297297 account : account. clone ( ) ,
@@ -322,7 +322,7 @@ impl<'a> BitcoinClient {
322322 & mut self ,
323323 psbt : & [ u8 ] ,
324324 ) -> Result < Vec < PartialSignature > , BitcoinClientError > {
325- let msg = postcard :: to_allocvec ( & Request :: SignPsbt {
325+ let msg = minicbor :: to_vec ( & Request :: SignPsbt {
326326 psbt : psbt. to_vec ( ) ,
327327 } )
328328 . map_err ( |_| {
@@ -331,7 +331,7 @@ impl<'a> BitcoinClient {
331331
332332 let response_raw = self . send_message ( & msg) . await ?;
333333 match Self :: parse_response ( & response_raw) . await ? {
334- Response :: PsbtSigned ( partial_sigs ) => Ok ( partial_sigs ) ,
334+ Response :: PsbtSigned { signatures } => Ok ( signatures ) ,
335335 e => Err ( BitcoinClientError :: InvalidResponse ( format ! (
336336 "Invalid response: {:?}" ,
337337 e
0 commit comments