@@ -97,7 +97,7 @@ pub type LastQueryTimestamp = u64;
97
97
pub struct Sdk {
98
98
inner : SdkInstance ,
99
99
/// Type of network we use. Determines some parameters, like quorum types.
100
- network_settings : NetworkSettings ,
100
+ network : Network ,
101
101
/// Use proofs when retrieving data from the platform.
102
102
///
103
103
/// This is set to `true` by default. `false` is not implemented yet.
@@ -149,7 +149,7 @@ impl Clone for Sdk {
149
149
metadata_height_tolerance : self . metadata_height_tolerance ,
150
150
metadata_time_tolerance_ms : self . metadata_time_tolerance_ms ,
151
151
dapi_client_settings : self . dapi_client_settings ,
152
- network_settings : self . network_settings ,
152
+ network : self . network ,
153
153
#[ cfg( feature = "mocks" ) ]
154
154
dump_dir : self . dump_dir . clone ( ) ,
155
155
}
@@ -278,7 +278,7 @@ impl Sdk {
278
278
279
279
/// Get configured Dash Core network type.
280
280
pub fn core_network ( & self ) -> Network {
281
- self . network_settings . core_network ( )
281
+ self . network . core_network ( )
282
282
}
283
283
284
284
/// Retrieve object `O` from proof contained in `request` (of type `R`) and `response`.
@@ -305,7 +305,7 @@ impl Sdk {
305
305
SdkInstance :: Dapi { .. } => O :: maybe_from_proof_with_metadata (
306
306
request,
307
307
response,
308
- self . network_settings . core_network ( ) ,
308
+ self . network . core_network ( ) ,
309
309
self . version ( ) ,
310
310
& provider,
311
311
) ,
@@ -533,8 +533,8 @@ impl Sdk {
533
533
}
534
534
535
535
/// Return configuration of quorum, like type of quorum used for instant lock.
536
- pub ( crate ) fn network_settings ( & self ) -> NetworkSettings {
537
- self . network_settings
536
+ pub ( crate ) fn network_settings ( & self ) -> Network {
537
+ self . network
538
538
}
539
539
540
540
/// Return [Dash Platform version](PlatformVersion) information used by this SDK.
@@ -731,8 +731,10 @@ pub struct SdkBuilder {
731
731
core_user : String ,
732
732
core_password : Zeroizing < String > ,
733
733
734
- /// Customized network settings of a Dash network used by the SDK.
735
- network_settings : NetworkSettings ,
734
+ /// Dash Core network type used by the SDK.
735
+ ///
736
+ /// Defaults to [NETWORK_MAINNET](crate::networks::NETWORK_MAINNET).
737
+ network : Network ,
736
738
737
739
/// If true, request and verify proofs of the responses.
738
740
proofs : bool ,
@@ -784,7 +786,7 @@ impl Default for SdkBuilder {
784
786
core_port : 0 ,
785
787
core_password : "" . to_string ( ) . into ( ) ,
786
788
core_user : "" . to_string ( ) ,
787
- network_settings : NETWORK_MAINNET . into ( ) ,
789
+ network : NETWORK_MAINNET ,
788
790
proofs : true ,
789
791
metadata_height_tolerance : Some ( 1 ) ,
790
792
metadata_time_tolerance_ms : None ,
@@ -825,7 +827,7 @@ impl SdkBuilder {
825
827
826
828
/// Create a new SdkBuilder that will generate mock client.
827
829
pub fn new_mock ( ) -> Self {
828
- Self :: default ( ) . with_network_settings ( NetworkSettings :: Mock )
830
+ Self :: default ( )
829
831
}
830
832
831
833
/// Create a new SdkBuilder instance preconfigured for testnet. NOT IMPLEMENTED YET.
@@ -867,8 +869,9 @@ impl SdkBuilder {
867
869
/// Defaults to [NETWORK_MAINNET](crate::networks::NETWORK_MAINNET).
868
870
///
869
871
/// For more control over the configuration, use [SdkBuilder::with_network_settings()].
870
- pub fn with_network ( self , network : Network ) -> Self {
871
- self . with_network_settings ( network)
872
+ pub fn with_network ( mut self , network : Network ) -> Self {
873
+ self . network = network;
874
+ self
872
875
}
873
876
874
877
/// Configure CA certificate to use when verifying TLS connections.
@@ -953,15 +956,6 @@ impl SdkBuilder {
953
956
self
954
957
}
955
958
956
- /// Customize custom Dash Platform network settings.
957
- ///
958
- /// This method is aimed for advanced use cases, where [SdkBuilder::with_network()] is not good enough.
959
- /// It allows to configure network settings like quorum type, network type, etc. by creating [NetworkSettings] directly.
960
- pub fn with_network_settings < T : Into < NetworkSettings > > ( mut self , network_type : T ) -> Self {
961
- self . network_settings = network_type. into ( ) ;
962
- self
963
- }
964
-
965
959
/// Use Dash Core as a wallet and context provider.
966
960
///
967
961
/// This is a convenience method that configures the SDK to use Dash Core as a wallet and context provider.
@@ -1063,7 +1057,7 @@ impl SdkBuilder {
1063
1057
let mut sdk= Sdk {
1064
1058
dapi_client_settings,
1065
1059
inner : SdkInstance :: Dapi { dapi, version : self . version } ,
1066
- network_settings : self . network_settings ,
1060
+ network : self . network ,
1067
1061
proofs : self . proofs ,
1068
1062
context_provider : ArcSwapOption :: new ( self . context_provider . map ( Arc :: new) ) ,
1069
1063
cancel_token : self . cancel_token ,
@@ -1131,7 +1125,7 @@ impl SdkBuilder {
1131
1125
address_list : AddressList :: new ( ) ,
1132
1126
version : self . version ,
1133
1127
} ,
1134
- network_settings : self . network_settings ,
1128
+ network : self . network ,
1135
1129
dump_dir : self . dump_dir . clone ( ) ,
1136
1130
proofs : self . proofs ,
1137
1131
internal_cache : Default :: default ( ) ,
0 commit comments