File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
examples/bitcoind-rpc-client/src Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11use std:: convert:: TryInto ;
22
3- use bitcoin:: { BlockHash , hashes:: hex:: FromHex } ;
3+ use bitcoin:: { Amount , BlockHash , hashes:: hex:: FromHex } ;
44use lightning_block_sync:: http:: JsonResponse ;
55
66/// TryInto implementation specifies the conversion logic from json response to BlockchainInfo object.
@@ -36,12 +36,13 @@ impl TryInto<CreateWalletResponse> for JsonResponse {
3636 } )
3737 }
3838}
39- pub struct GetBalanceResponse ( pub usize ) ;
39+ pub struct GetBalanceResponse ( pub Amount ) ;
4040
4141impl TryInto < GetBalanceResponse > for JsonResponse {
4242 type Error = std:: io:: Error ;
4343 fn try_into ( self ) -> std:: io:: Result < GetBalanceResponse > {
44- Ok ( GetBalanceResponse ( self . 0 . as_f64 ( ) . unwrap ( ) as usize ) )
44+ let balance = Amount :: from_btc ( self . 0 . as_f64 ( ) . unwrap ( ) ) . unwrap ( ) ;
45+ Ok ( GetBalanceResponse ( balance) )
4546 }
4647}
4748
You can’t perform that action at this time.
0 commit comments