File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -986,6 +986,10 @@ interface ElectrumClient {
986986 [Throws=ElectrumError]
987987 constructor(string url);
988988
989+ /// Set the proxy of the builder
990+ [Name=new_with_proxy, Throws=ElectrumError]
991+ constructor(string url, string proxy);
992+
989993 /// Full scan the keychain scripts specified with the blockchain (via an Electrum client) and
990994 /// returns updates for bdk_chain data structures.
991995 ///
Original file line number Diff line number Diff line change @@ -32,6 +32,18 @@ impl ElectrumClient {
3232 Ok ( Self ( client) )
3333 }
3434
35+ pub fn new_with_proxy ( url : String , proxy : String ) -> Result < Self , ElectrumError > {
36+ let config = bdk_electrum:: electrum_client:: ConfigBuilder :: new ( )
37+ . socks5 ( Some ( bdk_electrum:: electrum_client:: Socks5Config :: new (
38+ proxy. as_str ( ) ,
39+ ) ) )
40+ . build ( ) ;
41+ let inner_client =
42+ bdk_electrum:: electrum_client:: Client :: from_config ( url. as_str ( ) , config) ?;
43+ let client = BdkBdkElectrumClient :: new ( inner_client) ;
44+ Ok ( Self ( client) )
45+ }
46+
3547 pub fn full_scan (
3648 & self ,
3749 request : Arc < FullScanRequest > ,
You can’t perform that action at this time.
0 commit comments