diff --git a/cw_monero/lib/api/wallet.dart b/cw_monero/lib/api/wallet.dart index 43e0875a6..61cb271a8 100644 --- a/cw_monero/lib/api/wallet.dart +++ b/cw_monero/lib/api/wallet.dart @@ -175,7 +175,10 @@ int getNodeHeightSync() { return cachedNodeHeight; } -bool isConnectedSync() => currentWallet?.connected() != 0; +Future isConnected() async { + final wptrAddress = currentWallet!.ffiAddress(); + return await Isolate.run(() => monero.Wallet_connected(Pointer.fromAddress(wptrAddress))) == 1; +} Future setupNodeSync( {required String address, @@ -396,8 +399,6 @@ void startRefresh() => startRefreshSync(); Future store() async => _storeSync(0); -Future isConnected() async => isConnectedSync(); - Future getNodeHeight() async => getNodeHeightSync(); void rescanBlockchainAsync() => currentWallet!.rescanBlockchainAsync(); diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 40e544c4a..eceac205b 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -188,7 +188,7 @@ abstract class MoneroWalletBase extends WalletBase checkNodeHealth() async { try { // Check if the wallet is currently connected to the daemon - final isConnected = monero_wallet.isConnectedSync(); + final isConnected = await monero_wallet.isConnected(); if (!isConnected) { return false; // It's not connected to daemon