mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 15:04:50 +01:00
Merge pull request #7529 from BlueWallet/psb
ADD: Test electrum connection prior to saving
This commit is contained in:
commit
9a8158a384
1 changed files with 4 additions and 0 deletions
|
@ -173,6 +173,8 @@ const ElectrumSettings: React.FC = () => {
|
|||
const serverSslPort = v?.ssl ? v.ssl.toString() : sslPort?.toString() || '';
|
||||
|
||||
if (serverHost && (serverPort || serverSslPort)) {
|
||||
const testConnect = await BlueElectrum.testConnection(serverHost, Number(serverPort), Number(serverSslPort));
|
||||
if (!testConnect) return;
|
||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||
|
||||
// Clear current data for the preferred host
|
||||
|
@ -197,6 +199,8 @@ const ElectrumSettings: React.FC = () => {
|
|||
await DefaultPreference.set(BlueElectrum.ELECTRUM_SERVER_HISTORY, JSON.stringify(Array.from(newServerHistory)));
|
||||
setServerHistory(newServerHistory);
|
||||
}
|
||||
} else {
|
||||
throw new Error(loc.settings.electrum_error_connect);
|
||||
}
|
||||
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
|
|
Loading…
Add table
Reference in a new issue