fix: cached electrumx constructor usage

This commit is contained in:
julian 2023-05-25 14:37:18 -06:00
parent 5eec303476
commit e0e4ffe0f4
9 changed files with 25 additions and 51 deletions

View file

@ -1342,16 +1342,14 @@ class BitcoinWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -1234,16 +1234,14 @@ class BitcoinCashWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -56,17 +56,7 @@ abstract class CoinServiceAPI {
prefs: prefs,
);
final cachedClient = CachedElectrumX.from(
node: electrumxNode,
failovers: failovers
.map((e) => ElectrumXNode(
address: e.host,
port: e.port,
name: e.name,
id: e.id,
useSSL: e.useSSL,
))
.toList(),
prefs: prefs,
electrumXClient: client,
);
switch (coin) {
case Coin.firo:

View file

@ -1194,16 +1194,14 @@ class DogecoinWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -410,16 +410,14 @@ class ECashWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -1840,16 +1840,14 @@ class FiroWallet extends CoinServiceAPI
)
.toList();
final newNode = await _getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -1325,16 +1325,14 @@ class LitecoinWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -1314,16 +1314,14 @@ class NamecoinWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());

View file

@ -1242,16 +1242,14 @@ class ParticlWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_cachedElectrumXClient = CachedElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_electrumXClient = ElectrumX.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
electrumXClient: _electrumXClient,
);
if (shouldRefresh) {
unawaited(refresh());