diff --git a/lib/view_model/send/output.dart b/lib/view_model/send/output.dart index 2e696e16f..fb06cc0f2 100644 --- a/lib/view_model/send/output.dart +++ b/lib/view_model/send/output.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/entities/parse_address_from_domain.dart'; import 'package:cake_wallet/entities/parsed_address.dart'; import 'package:cake_wallet/ethereum/ethereum.dart'; import 'package:cake_wallet/haven/haven.dart'; +import 'package:bitbox/bitbox.dart' as bitbox; import 'package:cake_wallet/src/screens/send/widgets/extract_address_from_parsed.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:flutter/material.dart'; @@ -259,7 +260,10 @@ abstract class OutputBase with Store { void loadContact(ContactBase contact) { address = contact.name; - parsedAddress = ParsedAddress.fetchContactAddress(address: contact.address, name: contact.name); + final cantactAddress = _wallet.type == WalletType.bitcoinCash + ? bitbox.Address.toCashAddress(contact.address) + : contact.address; + parsedAddress = ParsedAddress.fetchContactAddress(address: cantactAddress, name: contact.name); extractedAddress = parsedAddress.addresses.first; note = parsedAddress.description; } diff --git a/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart b/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart index d594367fb..7df74a77c 100644 --- a/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart +++ b/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart @@ -3,7 +3,7 @@ import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cw_core/unspent_transaction_output.dart'; import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_item.dart'; -import 'package:cw_bitcoin/bitcoin_wallet.dart'; +import 'package:bitbox/bitbox.dart' as bitbox; import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_type.dart'; @@ -29,11 +29,13 @@ abstract class UnspentCoinsListViewModelBase with Store { ObservableList get items => ObservableList.of(_getUnspents().map((elem) { final amount = formatAmountToString(elem.value) + ' ${wallet.currency.title}'; + final address = wallet.type == WalletType.bitcoinCash + ? bitbox.Address.toCashAddress(elem.address) : elem.address; - final info = getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage); + final info = getUnspentCoinInfo(elem.hash, address, elem.value, elem.vout, elem.keyImage); return UnspentCoinsItem( - address: elem.address, + address: address, amount: amount, hash: elem.hash, isFrozen: info?.isFrozen ?? false, diff --git a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart index 9aacd2f8f..684ae71e0 100644 --- a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart +++ b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/ethereum/ethereum.dart'; +import 'package:bitbox/bitbox.dart' as bitbox; import 'package:cake_wallet/entities/fiat_currency.dart'; import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart'; import 'package:cake_wallet/store/yat/yat_store.dart'; @@ -165,8 +166,13 @@ abstract class WalletAddressListViewModelBase with Store { WalletType get type => _wallet.type; @computed - WalletAddressListItem get address => - WalletAddressListItem(address: _wallet.walletAddresses.address, isPrimary: false); + WalletAddressListItem get address { + final address = _wallet.type == WalletType.bitcoinCash ? + bitbox.Address.toCashAddress(_wallet.walletAddresses.address) : + _wallet.walletAddresses.address; + return WalletAddressListItem(address: address, isPrimary: false); + } + @computed PaymentURI get uri {