@@ -2,6 +2,8 @@ use crate::cli::{Cli, HelperCommand};
22use crate :: config:: Config ;
33use crate :: error:: Error ;
44use crate :: wallet:: Wallet ;
5+ use coin_store:: utxo_store:: UtxoStore ;
6+ use simplicityhl:: elements:: bitcoin:: secp256k1;
57
68impl Cli {
79 pub ( crate ) async fn run_helper ( & self , config : Config , command : & HelperCommand ) -> Result < ( ) , Error > {
@@ -26,14 +28,14 @@ impl Cli {
2628 HelperCommand :: Balance => {
2729 let wallet = self . get_wallet ( & config) . await ?;
2830
29- let filter = coin_store:: Filter :: new ( )
31+ let filter = coin_store:: UtxoFilter :: new ( )
3032 . script_pubkey ( wallet. signer ( ) . p2pk_address ( config. address_params ( ) ) ?. script_pubkey ( ) ) ;
31- let results = wallet. store ( ) . query ( & [ filter] ) . await ?;
33+ let results = < _ as UtxoStore > :: query_utxos ( wallet. store ( ) , & [ filter] ) . await ?;
3234
3335 let mut balances: std:: collections:: HashMap < simplicityhl:: elements:: AssetId , u64 > =
3436 std:: collections:: HashMap :: new ( ) ;
3537
36- if let Some ( coin_store:: QueryResult :: Found ( entries) ) = results. into_iter ( ) . next ( ) {
38+ if let Some ( coin_store:: UtxoQueryResult :: Found ( entries) ) = results. into_iter ( ) . next ( ) {
3739 for entry in entries {
3840 let ( asset, value) = match entry {
3941 coin_store:: UtxoEntry :: Confidential { secrets, .. } => ( secrets. asset , secrets. value ) ,
@@ -59,10 +61,10 @@ impl Cli {
5961 HelperCommand :: Utxos => {
6062 let wallet = self . get_wallet ( & config) . await ?;
6163
62- let filter = coin_store:: Filter :: new ( ) ;
63- let results = wallet. store ( ) . query ( & [ filter] ) . await ?;
64+ let filter = coin_store:: UtxoFilter :: new ( ) ;
65+ let results = wallet. store ( ) . query_utxos ( & [ filter] ) . await ?;
6466
65- if let Some ( coin_store:: QueryResult :: Found ( entries) ) = results. into_iter ( ) . next ( ) {
67+ if let Some ( coin_store:: UtxoQueryResult :: Found ( entries) ) = results. into_iter ( ) . next ( ) {
6668 for entry in & entries {
6769 let outpoint = entry. outpoint ( ) ;
6870 let ( asset, value) = match entry {
@@ -88,7 +90,7 @@ impl Cli {
8890
8991 let blinder = match blinding_key {
9092 Some ( key_hex) => {
91- let bytes: [ u8 ; 32 ] = hex:: decode ( key_hex)
93+ let bytes: [ u8 ; secp256k1 :: constants :: SECRET_KEY_SIZE ] = hex:: decode ( key_hex)
9294 . map_err ( |e| Error :: Config ( format ! ( "Invalid blinding key hex: {e}" ) ) ) ?
9395 . try_into ( )
9496 . map_err ( |_| Error :: Config ( "Blinding key must be 32 bytes" . to_string ( ) ) ) ?;
0 commit comments