mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
zec ironwood (#3425)
* initial * wip * ironwood detection, migration * dev: zec address validation on rt * fix: ironwood spend * ironwood regressions * fix: tx history * bump: zkool2 * fix: tx amounts on pending fix: ironwood pending balance fix: orchard->ironwood migration fix: orchard->any pre ironwood txs fix: ironwood -> any txs fix: WrongSpendAuthorizingKey fix: tx history fix: autoshield to ironwood fix: zkool to latest version break: my sleep schedule :sweating: :worksonmymachine: * thx fable * downgrade frb to 2.11.1 * fix: tx amounts in history * Migating... / migration label for O->I txs
This commit is contained in:
@@ -538,10 +538,16 @@ abstract class DashboardViewModelBase with Store {
|
||||
.map((item) => _txIdentityString(item.transaction.txHash, item.transaction.direction))
|
||||
.toSet();
|
||||
|
||||
transactions.removeWhere(
|
||||
(item) => newKeys
|
||||
.contains(_txIdentityString(item.transaction.txHash, item.transaction.direction)),
|
||||
);
|
||||
transactions.removeWhere((item) {
|
||||
if (wallet.type == WalletType.zcash) {
|
||||
return newTransactions.any(
|
||||
(n) => n.transaction.txHash == item.transaction.txHash,
|
||||
);
|
||||
}
|
||||
return newKeys.contains(
|
||||
_txIdentityString(item.transaction.txHash, item.transaction.direction),
|
||||
);
|
||||
});
|
||||
|
||||
transactions.addAll(newTransactions);
|
||||
// transactions.clear();
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:cake_wallet/zcash/zcash.dart';
|
||||
import 'package:cw_core/receive_page_option.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cw_zcash/cw_zcash.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'receive_option_view_model.g.dart';
|
||||
@@ -18,7 +19,14 @@ abstract class ReceiveOptionViewModelBase with Store {
|
||||
? ReceivePageOption.testnet
|
||||
: _wallet.type == WalletType.zcash
|
||||
? zcash!.getSelectedAddressType(_wallet)
|
||||
: ReceivePageOption.mainnet);
|
||||
: ReceivePageOption.mainnet) {
|
||||
if (_wallet.type == WalletType.zcash) {
|
||||
reaction<bool>(
|
||||
(_) => (_wallet.walletAddresses as ZcashWalletAddresses).ironwoodActive,
|
||||
(_) => _syncZcashShieldedLabel(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final WalletBase _wallet;
|
||||
|
||||
@@ -27,10 +35,21 @@ abstract class ReceiveOptionViewModelBase with Store {
|
||||
@observable
|
||||
ReceivePageOption selectedReceiveOption;
|
||||
|
||||
@computed
|
||||
List<ReceivePageOption> get options => _wallet.walletAddresses.receivePageOptions;
|
||||
|
||||
String get walletTypeString => walletTypeToString(_wallet.type);
|
||||
|
||||
@action
|
||||
void selectReceiveOption(ReceivePageOption option) => selectedReceiveOption = option;
|
||||
|
||||
@action
|
||||
void _syncZcashShieldedLabel() {
|
||||
for (final option in options) {
|
||||
if (option.value == selectedReceiveOption.value) {
|
||||
selectedReceiveOption = option;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,9 @@ class TransactionListItem extends ActionListItem with Keyable {
|
||||
return 'Transaction has missing data';
|
||||
}
|
||||
|
||||
if (transaction.additionalInfo['isIronwoodMigration'] == true) {
|
||||
return 'Migration';
|
||||
}
|
||||
if (transaction.additionalInfo['isAutoShield'] == true) {
|
||||
if (transaction.isPending) {
|
||||
final status = formattedStatus;
|
||||
|
||||
@@ -48,8 +48,11 @@ abstract class SendTemplateViewModelBase with Store {
|
||||
amountParsingProxy: _appStore.amountParsingProxy,
|
||||
);
|
||||
|
||||
AddressValidator get addressValidator =>
|
||||
AddressValidator(type: _wallet.currency, isTestnet: _wallet.isTestnet);
|
||||
AddressValidator get addressValidator => AddressValidator(
|
||||
type: _wallet.currency,
|
||||
isTestnet: _wallet.isTestnet,
|
||||
network: _wallet.walletInfo.network,
|
||||
);
|
||||
|
||||
TemplateValidator get templateValidator => TemplateValidator();
|
||||
|
||||
|
||||
@@ -190,7 +190,10 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
|
||||
// Check if the address is valid for the current currency (except for Zano, which can use handles as addresses)
|
||||
if (selectedCryptoCurrency != CryptoCurrency.zano) {
|
||||
final isValidAddress = AddressValidator(type: selectedCryptoCurrency).isValid(query);
|
||||
final isValidAddress = AddressValidator(
|
||||
type: selectedCryptoCurrency,
|
||||
network: wallet.walletInfo.network,
|
||||
).isValid(query);
|
||||
if (isValidAddress) return null;
|
||||
}
|
||||
|
||||
@@ -317,8 +320,11 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
|
||||
Validator<String> get allAmountValidator => AllAmountValidator();
|
||||
|
||||
Validator<String> get addressValidator =>
|
||||
AddressValidator(type: selectedCryptoCurrency, isTestnet: wallet.isTestnet);
|
||||
Validator<String> get addressValidator => AddressValidator(
|
||||
type: selectedCryptoCurrency,
|
||||
isTestnet: wallet.isTestnet,
|
||||
network: wallet.walletInfo.network,
|
||||
);
|
||||
|
||||
Validator<String> get textValidator => TextValidator();
|
||||
|
||||
|
||||
@@ -428,6 +428,9 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
}
|
||||
|
||||
String get formattedTitle {
|
||||
if (transactionInfo.additionalInfo['isIronwoodMigration'] == true) {
|
||||
return 'Migration';
|
||||
}
|
||||
if (transactionInfo.additionalInfo['isAutoShield'] == true) {
|
||||
return S.current.shielding;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_credentials.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cake_wallet/zcash/zcash_network_type.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:polyseed/polyseed.dart';
|
||||
|
||||
@@ -33,9 +34,13 @@ abstract class WalletCreationVMBase with Store {
|
||||
@observable
|
||||
bool _useTestnet = false;
|
||||
|
||||
int _zcashNetwork = ZcashNetworkType.mainnet;
|
||||
|
||||
@computed
|
||||
bool get useTestnet => _useTestnet;
|
||||
|
||||
int get zcashNetwork => _zcashNetwork;
|
||||
|
||||
@observable
|
||||
String name;
|
||||
|
||||
@@ -252,4 +257,8 @@ abstract class WalletCreationVMBase with Store {
|
||||
void toggleUseTestnet(bool? value) {
|
||||
_useTestnet = value ?? !_useTestnet;
|
||||
}
|
||||
|
||||
void setZcashNetwork(int network) {
|
||||
_zcashNetwork = network;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
password: walletPassword,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
passphrase: passphrase,
|
||||
network: zcashNetwork,
|
||||
);
|
||||
case WalletType.decred:
|
||||
return decred!.createDecredNewWalletCredentials(name: name);
|
||||
|
||||
@@ -224,6 +224,7 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
|
||||
password: password,
|
||||
passphrase: passphrase,
|
||||
height: height,
|
||||
network: zcashNetwork,
|
||||
);
|
||||
case WalletType.none:
|
||||
case WalletType.haven:
|
||||
|
||||
Reference in New Issue
Block a user