mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
auto-select custom node on wallet creation (#3592)
* auto-select custom node on wallet creation * safeguard for wallet type
This commit is contained in:
@@ -8,14 +8,18 @@ void startOnCurrentNodeChangeReaction(AppStore appStore) {
|
||||
_onCurrentNodeChangeReaction?.reaction.dispose();
|
||||
appStore.settingsStore.nodes.observe((change) async {
|
||||
try {
|
||||
await appStore.wallet!.connectToNode(node: change.newValue!);
|
||||
if(change.newValue?.type == appStore.wallet!.type) {
|
||||
await appStore.wallet!.connectToNode(node: change.newValue!);
|
||||
}
|
||||
} catch (e) {
|
||||
printV(e.toString());
|
||||
}
|
||||
});
|
||||
appStore.settingsStore.powNodes.observe((change) async {
|
||||
try {
|
||||
await appStore.wallet!.connectToPowNode(node: change.newValue!);
|
||||
if(change.newValue?.type == appStore.wallet!.type) {
|
||||
await appStore.wallet!.connectToPowNode(node: change.newValue!);
|
||||
}
|
||||
} catch (e) {
|
||||
printV(e.toString());
|
||||
}
|
||||
|
||||
@@ -343,13 +343,14 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
LoadingPrimaryButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
if (widget.privacySettingsViewModel.addCustomNode) {
|
||||
if (_formKey.currentState != null && !_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
widget.nodeViewModel.save();
|
||||
await widget.nodeViewModel.save();
|
||||
widget.nodeViewModel.setAsCurrent(widget.nodeViewModel.editingNode!);
|
||||
}
|
||||
if (testnetValue == true &&
|
||||
widget.privacySettingsViewModel.type == WalletType.bitcoin) {
|
||||
@@ -358,7 +359,7 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
|
||||
widget.nodeViewModel.address = publicBitcoinTestnetElectrumAddress;
|
||||
widget.nodeViewModel.port = publicBitcoinTestnetElectrumPort;
|
||||
|
||||
widget.nodeViewModel.save();
|
||||
await widget.nodeViewModel.save();
|
||||
}
|
||||
if (_passphraseFormKey.currentState != null &&
|
||||
!_passphraseFormKey.currentState!.validate()) {
|
||||
|
||||
Reference in New Issue
Block a user