@@ -16,25 +16,60 @@ use rgb_lib::{
1616 AssignmentsCollection , Balance , BlockTime , BtcBalance , Cosigner as CosignerData ,
1717 DatabaseType , EmbeddedMedia , HubInfo , InflateBeginResult , InflateDetails ,
1818 InitOperationResult , Invoice as RgbLibInvoice , InvoiceData as RgbLibInvoiceData , Media ,
19- Metadata , MultisigKeys , MultisigVotingStatus as RgbLibMultisigVotingStatus ,
20- MultisigWallet as RgbLibMultisigWallet , Online , Operation as RgbLibOperation ,
21- OperationInfo as RgbLibOperationInfo , OperationResult , Outpoint , ProofOfReserves ,
22- PsbtInputInfo , PsbtInspection , PsbtOutputInfo , ReceiveData , Recipient as RgbLibRecipient ,
23- RecipientInfo as RgbLibRecipientInfo , RecipientType , RefreshFilter , RefreshTransferStatus ,
24- RefreshedTransfer , RespondToOperation as RgbLibRespondToOperation ,
25- RgbAllocation as RgbLibRgbAllocation , RgbInputInfo as RgbLibRgbInputInfo ,
26- RgbInspection as RgbLibRgbInspection , RgbOperationInfo as RgbLibRgbOperationInfo ,
27- RgbOutputInfo as RgbLibRgbOutputInfo , RgbTransitionInfo as RgbLibRgbTransitionInfo ,
28- RgbWalletOpsOffline , RgbWalletOpsOnline , SendBeginResult , SendDetails , SinglesigKeys ,
29- Token , TokenLight , Transaction , TransactionType , Transfer as RgbLibTransfer , TransferKind ,
30- TransferTransportEndpoint , TransportEndpoint as RgbLibTransportEndpoint , TypeOfTransition ,
31- Unspent as RgbLibUnspent , UserRole , Utxo , Wallet as RgbLibWallet , WalletData ,
32- WalletDescriptors , WitnessData ,
19+ Metadata , MultisigKeys , MultisigOnlineOptions ,
20+ MultisigVotingStatus as RgbLibMultisigVotingStatus , MultisigWallet as RgbLibMultisigWallet ,
21+ Online , OnlineOptions , Operation as RgbLibOperation , OperationInfo as RgbLibOperationInfo ,
22+ OperationResult , Outpoint , ProofOfReserves , PsbtInputInfo , PsbtInspection , PsbtOutputInfo ,
23+ ReceiveData , Recipient as RgbLibRecipient , RecipientInfo as RgbLibRecipientInfo ,
24+ RecipientType , RefreshFilter , RefreshTransferStatus , RefreshedTransfer ,
25+ RespondToOperation as RgbLibRespondToOperation , RgbAllocation as RgbLibRgbAllocation ,
26+ RgbInputInfo as RgbLibRgbInputInfo , RgbInspection as RgbLibRgbInspection ,
27+ RgbOperationInfo as RgbLibRgbOperationInfo , RgbOutputInfo as RgbLibRgbOutputInfo ,
28+ RgbTransitionInfo as RgbLibRgbTransitionInfo , RgbWalletOpsOffline , RgbWalletOpsOnline ,
29+ SendBeginResult , SendDetails , SinglesigKeys , SyncKeychain as RgbLibSyncKeychain ,
30+ SyncOptions as RgbLibSyncOptions , SyncStrategy , Token , TokenLight , Transaction ,
31+ TransactionType , Transfer as RgbLibTransfer , TransferKind , TransferTransportEndpoint ,
32+ TransportEndpoint as RgbLibTransportEndpoint , TypeOfTransition , Unspent as RgbLibUnspent ,
33+ UserRole , Utxo , Wallet as RgbLibWallet , WalletData , WalletDescriptors , WitnessData ,
3334 } ,
3435} ;
3536
3637uniffi:: include_scaffolding!( "rgb-lib" ) ;
3738
39+ // temporary solution needed because the Enum attribute doesn't support the Remote one
40+ pub enum SyncKeychain {
41+ Colored ,
42+ Vanilla { lookback : u32 } ,
43+ }
44+ impl From < RgbLibSyncKeychain > for SyncKeychain {
45+ fn from ( orig : RgbLibSyncKeychain ) -> Self {
46+ match orig {
47+ RgbLibSyncKeychain :: Colored => SyncKeychain :: Colored ,
48+ RgbLibSyncKeychain :: Vanilla { lookback } => SyncKeychain :: Vanilla { lookback } ,
49+ }
50+ }
51+ }
52+ impl From < SyncKeychain > for RgbLibSyncKeychain {
53+ fn from ( orig : SyncKeychain ) -> Self {
54+ match orig {
55+ SyncKeychain :: Colored => RgbLibSyncKeychain :: Colored ,
56+ SyncKeychain :: Vanilla { lookback } => RgbLibSyncKeychain :: Vanilla { lookback } ,
57+ }
58+ }
59+ }
60+ pub struct SyncOptions {
61+ pub keychain : SyncKeychain ,
62+ pub strategy : SyncStrategy ,
63+ }
64+ impl From < SyncOptions > for RgbLibSyncOptions {
65+ fn from ( orig : SyncOptions ) -> Self {
66+ Self {
67+ keychain : orig. keychain . into ( ) ,
68+ strategy : orig. strategy ,
69+ }
70+ }
71+ }
72+
3873// temporary solution needed because the Enum attribute doesn't support the Remote one
3974pub enum Assignment {
4075 Fungible { amount : u64 } ,
@@ -938,14 +973,8 @@ impl Wallet {
938973 . create_utxos_begin ( online, up_to, num, size, fee_rate, skip_sync, dry_run)
939974 }
940975
941- fn create_utxos_end (
942- & self ,
943- online : Online ,
944- signed_psbt : String ,
945- skip_sync : bool ,
946- ) -> Result < u8 , RgbLibError > {
947- self . _get_wallet ( )
948- . create_utxos_end ( online, signed_psbt, skip_sync)
976+ fn create_utxos_end ( & self , online : Online , signed_psbt : String ) -> Result < u8 , RgbLibError > {
977+ self . _get_wallet ( ) . create_utxos_end ( online, signed_psbt)
949978 }
950979
951980 fn delete_transfers (
@@ -1016,13 +1045,8 @@ impl Wallet {
10161045 self . _get_wallet ( ) . get_fee_estimation ( online, blocks)
10171046 }
10181047
1019- fn go_online (
1020- & self ,
1021- skip_consistency_check : bool ,
1022- indexer_url : String ,
1023- ) -> Result < Online , RgbLibError > {
1024- self . _get_wallet ( )
1025- . go_online ( skip_consistency_check, indexer_url)
1048+ fn go_online ( & self , online_options : OnlineOptions ) -> Result < Online , RgbLibError > {
1049+ self . _get_wallet ( ) . go_online ( online_options)
10261050 }
10271051
10281052 fn inflate (
@@ -1184,7 +1208,6 @@ impl Wallet {
11841208 fee_rate : u64 ,
11851209 min_confirmations : u8 ,
11861210 expiration_timestamp : Option < u64 > ,
1187- skip_sync : bool ,
11881211 ) -> Result < OperationResult , RgbLibError > {
11891212 self . _get_wallet ( ) . send (
11901213 online,
@@ -1193,7 +1216,6 @@ impl Wallet {
11931216 fee_rate,
11941217 min_confirmations,
11951218 expiration_timestamp,
1196- skip_sync,
11971219 )
11981220 }
11991221
@@ -1222,9 +1244,8 @@ impl Wallet {
12221244 & self ,
12231245 online : Online ,
12241246 signed_psbt : String ,
1225- skip_sync : bool ,
12261247 ) -> Result < OperationResult , RgbLibError > {
1227- self . _get_wallet ( ) . send_end ( online, signed_psbt, skip_sync )
1248+ self . _get_wallet ( ) . send_end ( online, signed_psbt)
12281249 }
12291250
12301251 fn send_btc (
@@ -1252,18 +1273,12 @@ impl Wallet {
12521273 . send_btc_begin ( online, address, amount, fee_rate, skip_sync, dry_run)
12531274 }
12541275
1255- fn send_btc_end (
1256- & self ,
1257- online : Online ,
1258- signed_psbt : String ,
1259- skip_sync : bool ,
1260- ) -> Result < String , RgbLibError > {
1261- self . _get_wallet ( )
1262- . send_btc_end ( online, signed_psbt, skip_sync)
1276+ fn send_btc_end ( & self , online : Online , signed_psbt : String ) -> Result < String , RgbLibError > {
1277+ self . _get_wallet ( ) . send_btc_end ( online, signed_psbt)
12631278 }
12641279
1265- fn sync ( & self , online : Online ) -> Result < ( ) , RgbLibError > {
1266- self . _get_wallet ( ) . sync ( online)
1280+ fn sync ( & self , online : Online , options : SyncOptions ) -> Result < ( ) , RgbLibError > {
1281+ self . _get_wallet ( ) . sync ( online, options . into ( ) )
12671282 }
12681283
12691284 fn inspect_psbt ( & self , psbt : String ) -> Result < PsbtInspection , RgbLibError > {
@@ -1432,13 +1447,11 @@ impl MultisigWallet {
14321447
14331448 fn go_online (
14341449 & self ,
1435- skip_consistency_check : bool ,
1436- indexer_url : String ,
1437- hub_url : String ,
1438- hub_token : String ,
1450+ online_options : OnlineOptions ,
1451+ multisig_online_options : MultisigOnlineOptions ,
14391452 ) -> Result < Online , RgbLibError > {
14401453 let mut wallet = self . wallet_mutex . lock ( ) . expect ( "wallet" ) ;
1441- wallet. go_online ( skip_consistency_check , indexer_url , hub_url , hub_token )
1454+ wallet. go_online ( online_options , multisig_online_options )
14421455 }
14431456
14441457 fn hub_info ( & self , online : Online ) -> Result < HubInfo , RgbLibError > {
@@ -1606,9 +1619,9 @@ impl MultisigWallet {
16061619 . send_btc_init ( online, address, amount, fee_rate, skip_sync)
16071620 }
16081621
1609- fn sync ( & self , online : Online ) -> Result < ( ) , RgbLibError > {
1622+ fn sync ( & self , online : Online , options : SyncOptions ) -> Result < ( ) , RgbLibError > {
16101623 let mut wallet = self . wallet_mutex . lock ( ) . expect ( "wallet" ) ;
1611- wallet. sync ( online)
1624+ wallet. sync ( online, options . into ( ) )
16121625 }
16131626
16141627 fn get_address ( & self , online : Online ) -> Result < String , RgbLibError > {
0 commit comments