@@ -12,12 +12,6 @@ pub struct ElectrumClient {
1212 url : lwk_wollet:: ElectrumUrl ,
1313}
1414
15- /// An url to an electrum server
16- #[ derive( uniffi:: Object , Debug ) ]
17- pub struct ElectrumUrl {
18- inner : lwk_wollet:: ElectrumUrl ,
19- }
20-
2115#[ uniffi:: export]
2216impl ElectrumClient {
2317 /// Construct an Electrum client
@@ -38,11 +32,14 @@ impl ElectrumClient {
3832
3933 #[ uniffi:: constructor]
4034 /// Construct an electrum client from an Electrum URL
41- pub fn from_url ( electrum_url : & ElectrumUrl ) -> Result < Arc < Self > , LwkError > {
42- let client = lwk_wollet:: ElectrumClient :: new ( & electrum_url. inner ) ?;
35+ pub fn from_url ( electrum_url : & str ) -> Result < Arc < Self > , LwkError > {
36+ let url = electrum_url
37+ . parse :: < lwk_wollet:: ElectrumUrl > ( )
38+ . map_err ( |e| LwkError :: Generic { msg : e. to_string ( ) } ) ?;
39+ let client = lwk_wollet:: ElectrumClient :: new ( & url) ?;
4340 Ok ( Arc :: new ( Self {
4441 inner : Arc :: new ( Mutex :: new ( client) ) ,
45- url : electrum_url . inner . clone ( ) ,
42+ url,
4643 } ) )
4744 }
4845
@@ -111,17 +108,6 @@ impl ElectrumClient {
111108 }
112109}
113110
114- #[ uniffi:: export]
115- impl ElectrumUrl {
116- /// Create a new electrum url
117- #[ uniffi:: constructor]
118- pub fn new ( url : & str , tls : bool , validate_domain : bool ) -> Result < Self , LwkError > {
119- let url = lwk_wollet:: ElectrumUrl :: new ( url, tls, validate_domain)
120- . map_err ( lwk_wollet:: Error :: Url ) ?;
121- Ok ( Self { inner : url } )
122- }
123- }
124-
125111impl ElectrumClient {
126112 /// Create a new electrum client with the same connection parameters
127113 #[ allow( unused) ] // TODO remove once lwk_boltz is integrated
0 commit comments