@@ -6,11 +6,9 @@ use bdk_kyoto::kyoto::AddrV2;
66use bdk_kyoto:: kyoto:: ScriptBuf ;
77use bdk_kyoto:: LightClient as BDKLightClient ;
88use bdk_kyoto:: NodeDefault ;
9- use bdk_kyoto:: NodeState ;
109use bdk_kyoto:: Receiver ;
1110use bdk_kyoto:: RejectReason ;
1211use bdk_kyoto:: Requester ;
13- use bdk_kyoto:: ScanType as WalletScanType ;
1412use bdk_kyoto:: UnboundedReceiver ;
1513use bdk_kyoto:: UpdateSubscriber ;
1614use bdk_kyoto:: WalletExt ;
@@ -30,6 +28,8 @@ use crate::FeeRate;
3028use crate :: Update ;
3129
3230type LogLevel = bdk_kyoto:: kyoto:: LogLevel ;
31+ type NodeState = bdk_kyoto:: NodeState ;
32+ type ScanType = bdk_kyoto:: ScanType ;
3333
3434const TIMEOUT : u64 = 10 ;
3535const DEFAULT_CONNECTIONS : u8 = 2 ;
@@ -184,7 +184,7 @@ impl CbfBuilder {
184184 let mut builder = BDKCbfBuilder :: new ( )
185185 . connections ( self . connections )
186186 . data_dir ( path_buf)
187- . scan_type ( self . scan_type . into ( ) )
187+ . scan_type ( self . scan_type )
188188 . log_level ( self . log_level )
189189 . timeout_duration ( Duration :: from_secs ( TIMEOUT ) )
190190 . peers ( trusted_peers) ;
@@ -401,9 +401,23 @@ pub enum LogLevel {
401401 Warning ,
402402}
403403
404+ /// The state of the node with respect to connected peers.
405+ #[ uniffi:: remote( Enum ) ]
406+ pub enum NodeState {
407+ /// We are behind on block headers according to our peers.
408+ Behind ,
409+ /// We may start downloading compact block filter headers.
410+ HeadersSynced ,
411+ /// We may start scanning compact block filters.
412+ FilterHeadersSynced ,
413+ /// We may start asking for blocks with matches.
414+ FiltersSynced ,
415+ /// We found all known transactions to the wallet.
416+ TransactionsSynced ,
417+ }
404418/// Sync a wallet from the last known block hash, recover a wallet from a specified height,
405419/// or perform an expedited block header download for a new wallet.
406- #[ derive ( Debug , Clone , Copy , Default , uniffi:: Enum ) ]
420+ #[ uniffi:: remote ( Enum ) ]
407421pub enum ScanType {
408422 /// Perform an expedited header and filter download for a new wallet.
409423 /// If this option is not set, and the wallet has no history, the
@@ -416,16 +430,6 @@ pub enum ScanType {
416430 Recovery { from_height : u32 } ,
417431}
418432
419- impl From < ScanType > for WalletScanType {
420- fn from ( value : ScanType ) -> Self {
421- match value {
422- ScanType :: New => WalletScanType :: New ,
423- ScanType :: Recovery { from_height } => WalletScanType :: Recovery { from_height } ,
424- ScanType :: Sync => WalletScanType :: Sync ,
425- }
426- }
427- }
428-
429433/// A peer to connect to over the Bitcoin peer-to-peer network.
430434#[ derive( Clone , uniffi:: Record ) ]
431435pub struct Peer {
0 commit comments