From 62d0d1a574a6bd1bed73f7cdfaa7cb5863994bcf Mon Sep 17 00:00:00 2001 From: Charon-Fan Date: Thu, 12 Dec 2024 10:48:24 +0800 Subject: [PATCH] feat: update wallet checks from isHardwareWallet to isLedger --- lib/buy/dfx/dfx_buy_provider.dart | 2 +- lib/buy/robinhood/robinhood_buy_provider.dart | 2 +- lib/di.dart | 4 ++-- lib/src/screens/send/send_page.dart | 2 +- lib/view_model/send/send_view_model.dart | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/buy/dfx/dfx_buy_provider.dart b/lib/buy/dfx/dfx_buy_provider.dart index c1ed762b1..d0537bc0e 100644 --- a/lib/buy/dfx/dfx_buy_provider.dart +++ b/lib/buy/dfx/dfx_buy_provider.dart @@ -290,7 +290,7 @@ class DFXBuyProvider extends BuyProvider { required bool isBuyAction, required String cryptoCurrencyAddress, String? countryCode}) async { - if (wallet.isHardwareWallet) { + if (wallet.isLedger) { if (!ledgerVM!.isConnected) { await Navigator.of(context).pushNamed(Routes.connectDevices, arguments: ConnectDevicePageParams( diff --git a/lib/buy/robinhood/robinhood_buy_provider.dart b/lib/buy/robinhood/robinhood_buy_provider.dart index a64c9d736..945eb882b 100644 --- a/lib/buy/robinhood/robinhood_buy_provider.dart +++ b/lib/buy/robinhood/robinhood_buy_provider.dart @@ -102,7 +102,7 @@ class RobinhoodBuyProvider extends BuyProvider { required bool isBuyAction, required String cryptoCurrencyAddress, String? countryCode}) async { - if (wallet.isHardwareWallet) { + if (wallet.isLedger) { if (!ledgerVM!.isConnected) { await Navigator.of(context).pushNamed(Routes.connectDevices, arguments: ConnectDevicePageParams( diff --git a/lib/di.dart b/lib/di.dart index 2e6a3e657..949cec445 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -997,12 +997,12 @@ Future setup({ getIt.registerFactory(() => RobinhoodBuyProvider( wallet: getIt.get().wallet!, ledgerVM: - getIt.get().wallet!.isHardwareWallet ? getIt.get() : null)); + getIt.get().wallet!.isLedger ? getIt.get() : null)); getIt.registerFactory(() => DFXBuyProvider( wallet: getIt.get().wallet!, ledgerVM: - getIt.get().wallet!.isHardwareWallet ? getIt.get() : null)); + getIt.get().wallet!.isLedger ? getIt.get() : null)); getIt.registerFactory(() => MoonPayProvider( settingsStore: getIt.get().settingsStore, diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 7003ceafb..f91ce074f 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -393,7 +393,7 @@ class SendPage extends BasePage { return; } - if (sendViewModel.wallet.isHardwareWallet) { + if (sendViewModel.wallet.isLedger) { if (!sendViewModel.ledgerViewModel!.isConnected) { await Navigator.of(context).pushNamed( Routes.connectDevices, diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index fb96b2545..d07afd864 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -389,7 +389,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor try { state = IsExecutingState(); - if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState(); + if (wallet.isLedger) state = IsAwaitingDeviceResponseState(); pendingTransaction = await wallet.createTransaction(_credentials());