mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
CW-1174: Add warning for sending to contract addresses (#2463)
* feat: add warning for sending to contract addresses * feat: Add wallet type icon to full screen qr page
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/monero/monero.dart';
|
||||
import 'package:cake_wallet/polygon/polygon.dart';
|
||||
import 'package:cake_wallet/reactions/wallet_utils.dart';
|
||||
import 'package:cake_wallet/solana/solana.dart';
|
||||
import 'package:cake_wallet/decred/decred.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
@@ -322,15 +323,12 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
WalletAddressListItem(address: wallet.walletAddresses.address, isPrimary: false);
|
||||
|
||||
@computed
|
||||
String get payjoinEndpoint => wallet.type == WalletType.bitcoin
|
||||
? bitcoin!.getPayjoinEndpoint(wallet)
|
||||
: "";
|
||||
String get payjoinEndpoint =>
|
||||
wallet.type == WalletType.bitcoin ? bitcoin!.getPayjoinEndpoint(wallet) : "";
|
||||
|
||||
@computed
|
||||
bool get isPayjoinUnavailable =>
|
||||
wallet.type == WalletType.bitcoin &&
|
||||
_settingsStore.usePayjoin &&
|
||||
payjoinEndpoint.isEmpty;
|
||||
wallet.type == WalletType.bitcoin && _settingsStore.usePayjoin && payjoinEndpoint.isEmpty;
|
||||
|
||||
@computed
|
||||
PaymentURI get uri {
|
||||
@@ -340,10 +338,7 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
case WalletType.haven:
|
||||
return HavenURI(amount: amount, address: address.address);
|
||||
case WalletType.bitcoin:
|
||||
return BitcoinURI(
|
||||
amount: amount,
|
||||
address: address.address,
|
||||
pjUri: payjoinEndpoint);
|
||||
return BitcoinURI(amount: amount, address: address.address, pjUri: payjoinEndpoint);
|
||||
case WalletType.litecoin:
|
||||
return LitecoinURI(amount: amount, address: address.address);
|
||||
case WalletType.ethereum:
|
||||
@@ -363,7 +358,7 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
case WalletType.wownero:
|
||||
return WowneroURI(amount: amount, address: address.address);
|
||||
case WalletType.zano:
|
||||
return ZanoURI(amount: amount, address: address.address);
|
||||
return ZanoURI(amount: amount, address: address.address);
|
||||
case WalletType.decred:
|
||||
return DecredURI(amount: amount, address: address.address);
|
||||
case WalletType.dogecoin:
|
||||
@@ -511,8 +506,8 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
if (wallet.type == WalletType.decred) {
|
||||
final addrInfos = decred!.getAddressInfos(wallet);
|
||||
addrInfos.forEach((info) {
|
||||
addressList.add(new WalletAddressListItem(isPrimary: false, address: info.address,
|
||||
name: info.label));
|
||||
addressList.add(
|
||||
new WalletAddressListItem(isPrimary: false, address: info.address, name: info.label));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -596,6 +591,12 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
return '';
|
||||
}
|
||||
|
||||
@computed
|
||||
bool get hasTokensList => hasTokens(type);
|
||||
|
||||
@computed
|
||||
String get walletTypeName => walletTypeToString(type);
|
||||
|
||||
@computed
|
||||
bool get hasAddressList => [
|
||||
WalletType.monero,
|
||||
@@ -609,8 +610,92 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
].contains(wallet.type);
|
||||
|
||||
@computed
|
||||
bool get isElectrumWallet =>
|
||||
[WalletType.bitcoin, WalletType.litecoin, WalletType.bitcoinCash, WalletType.dogecoin].contains(wallet.type);
|
||||
bool get isElectrumWallet => [
|
||||
WalletType.bitcoin,
|
||||
WalletType.litecoin,
|
||||
WalletType.bitcoinCash,
|
||||
WalletType.dogecoin
|
||||
].contains(wallet.type);
|
||||
|
||||
@computed
|
||||
List<String> get walletImages {
|
||||
switch (wallet.type) {
|
||||
case WalletType.ethereum:
|
||||
return [
|
||||
'assets/images/eth_icon.png',
|
||||
'assets/images/usdc_icon.png',
|
||||
'assets/images/usdt_wallet_icon.png',
|
||||
'assets/images/deuro_icon.png',
|
||||
'assets/images/more_tokens.png',
|
||||
];
|
||||
case WalletType.solana:
|
||||
return [
|
||||
'assets/images/sol_icon.png',
|
||||
'assets/images/usdc_icon.png',
|
||||
'assets/images/usdt_wallet_icon.png',
|
||||
'assets/images/more_tokens.png',
|
||||
];
|
||||
case WalletType.polygon:
|
||||
return [
|
||||
'assets/images/pol_icon.png',
|
||||
'assets/images/eth_pol_icon.png',
|
||||
'assets/images/usdc_icon.png',
|
||||
'assets/images/usdt_wallet_icon.png',
|
||||
'assets/images/more_tokens.png',
|
||||
];
|
||||
case WalletType.tron:
|
||||
return [
|
||||
'assets/images/trx_icon.png',
|
||||
'assets/images/usdc_icon.png',
|
||||
'assets/images/usdt_wallet_icon.png',
|
||||
'assets/images/more_tokens.png',
|
||||
];
|
||||
case WalletType.zano:
|
||||
return [
|
||||
'assets/images/zano_bg_icon.png',
|
||||
'assets/images/more_tokens.png',
|
||||
];
|
||||
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@computed
|
||||
String get qrImage {
|
||||
switch (type) {
|
||||
case WalletType.ethereum:
|
||||
return 'assets/images/eth_chain_qr.png';
|
||||
case WalletType.solana:
|
||||
return 'assets/images/sol_chain_qr.png';
|
||||
case WalletType.polygon:
|
||||
return 'assets/images/pol_chain_qr.png';
|
||||
case WalletType.tron:
|
||||
return 'assets/images/trx_chain_qr.png';
|
||||
case WalletType.zano:
|
||||
return 'assets/images/zano_chain_qr.png';
|
||||
default:
|
||||
return 'assets/images/qr-cake.png';
|
||||
}
|
||||
}
|
||||
|
||||
@computed
|
||||
String get monoImage {
|
||||
switch (type) {
|
||||
case WalletType.ethereum:
|
||||
return 'assets/images/eth_chain_mono.png';
|
||||
case WalletType.solana:
|
||||
return 'assets/images/sol_chain_mono.png';
|
||||
case WalletType.polygon:
|
||||
return 'assets/images/pol_chain_mono.png';
|
||||
case WalletType.tron:
|
||||
return 'assets/images/trx_chain_mono.png';
|
||||
case WalletType.zano:
|
||||
return 'assets/images/zano_chain_mono.png';
|
||||
default:
|
||||
return 'assets/images/eth_chain_mono.png';
|
||||
}
|
||||
}
|
||||
|
||||
@computed
|
||||
bool get isBalanceAvailable => isElectrumWallet;
|
||||
|
||||
Reference in New Issue
Block a user