diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index b27605856..3543ef5cc 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -216,4 +216,12 @@ class CWBitcoin extends Bitcoin { final bitcoinWallet = wallet as ElectrumWallet; return bitcoinWallet.walletAddresses.silentAddresses; } + + bool isBitcoinReceivePageOption(ReceivePageOption option) { + return option is BitcoinReceivePageOption; + } + + BitcoinAddressType getOptionToType(ReceivePageOption option) { + return (option as BitcoinReceivePageOption).toType(); + } } diff --git a/lib/src/screens/dashboard/pages/address_page.dart b/lib/src/screens/dashboard/pages/address_page.dart index 044866f5c..4d08cde8b 100644 --- a/lib/src/screens/dashboard/pages/address_page.dart +++ b/lib/src/screens/dashboard/pages/address_page.dart @@ -198,8 +198,8 @@ class AddressPage extends BasePage { } reaction((_) => receiveOptionViewModel.selectedReceiveOption, (ReceivePageOption option) { - if (option is BitcoinReceivePageOption) { - addressListViewModel.setAddressType(option.toType()); + if (bitcoin!.isBitcoinReceivePageOption(option)) { + addressListViewModel.setAddressType(bitcoin!.getOptionToType(option)); return; } diff --git a/tool/configure.dart b/tool/configure.dart index 10b573655..6d5d8e7bb 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -149,6 +149,8 @@ abstract class Bitcoin { BitcoinAddressType getBitcoinAddressType(ReceivePageOption option); bool hasSelectedSilentPayments(Object wallet); List getBitcoinReceivePageOptions(); + bool isBitcoinReceivePageOption(ReceivePageOption option); + BitcoinAddressType getOptionToType(ReceivePageOption option); } """;