mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-20 10:14:08 +01:00
Merge branch 'refs/heads/dev' into cw-1440-new-buy-sell-flow
This commit is contained in:
@@ -59,6 +59,7 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||
case WalletType.solana:
|
||||
case WalletType.tron:
|
||||
case WalletType.zcash:
|
||||
case WalletType.decred:
|
||||
return true;
|
||||
|
||||
case WalletType.bitcoin:
|
||||
@@ -74,7 +75,6 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||
case WalletType.none:
|
||||
case WalletType.haven:
|
||||
case WalletType.zano:
|
||||
case WalletType.decred:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,8 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
||||
WalletType.zano,
|
||||
WalletType.dogecoin,
|
||||
WalletType.zcash,
|
||||
].contains(type);
|
||||
WalletType.decred,
|
||||
].contains(type);
|
||||
|
||||
@computed
|
||||
bool get addCustomNode => _addCustomNode;
|
||||
|
||||
@@ -96,7 +96,6 @@ abstract class DashboardViewModelBase with Store {
|
||||
isShowFirstYatIntroduction = false,
|
||||
isShowSecondYatIntroduction = false,
|
||||
isShowThirdYatIntroduction = false,
|
||||
isMigratingToIronwood = false,
|
||||
filterItems = [],
|
||||
exchangeFilterItems = [],
|
||||
subname = '',
|
||||
@@ -251,8 +250,6 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
reaction((_) => tradesStore.trades, (_) => tradeMonitor.monitorActiveTrades(wallet.id));
|
||||
|
||||
addZcashMigrationReaction();
|
||||
|
||||
tradeMonitor.monitorActiveTrades(wallet.id);
|
||||
}
|
||||
|
||||
@@ -377,21 +374,9 @@ abstract class DashboardViewModelBase with Store {
|
||||
);
|
||||
}
|
||||
|
||||
@observable
|
||||
ReactionDisposer? zcashMigrationReactionDisposer;
|
||||
|
||||
@action
|
||||
void addZcashMigrationReaction() {
|
||||
zcashMigrationReactionDisposer?.reaction.dispose();
|
||||
zcashMigrationReactionDisposer = null;
|
||||
|
||||
if (wallet.type == WalletType.zcash) {
|
||||
zcashMigrationReactionDisposer = reaction((_) => wallet.balance.values.first, (_) async {
|
||||
isMigratingToIronwood =
|
||||
wallet.type == WalletType.zcash && await zcash!.hasOrchardMigratableBalance(wallet);
|
||||
});
|
||||
}
|
||||
}
|
||||
@computed
|
||||
bool get isMigratingToIronwood =>
|
||||
wallet.type == WalletType.zcash && (zcash?.hasOrchardMigratableBalance(wallet) ?? false);
|
||||
|
||||
@computed
|
||||
bool get isSyncHeavy {
|
||||
@@ -635,7 +620,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
if (settingsStore.mwebAdDismissed) return false;
|
||||
|
||||
return Platform.isAndroid || Platform.isIOS;
|
||||
return (Platform.isAndroid || Platform.isIOS) && !wallet.isHardwareWallet;
|
||||
}
|
||||
|
||||
@action
|
||||
@@ -1289,8 +1274,6 @@ abstract class DashboardViewModelBase with Store {
|
||||
name = wallet.name;
|
||||
loadFilterItems();
|
||||
|
||||
addZcashMigrationReaction();
|
||||
|
||||
if (wallet.type == WalletType.monero) {
|
||||
subname = monero!.getCurrentAccount(wallet).label;
|
||||
|
||||
@@ -1572,9 +1555,6 @@ abstract class DashboardViewModelBase with Store {
|
||||
}
|
||||
}
|
||||
|
||||
@observable
|
||||
bool isMigratingToIronwood;
|
||||
|
||||
String getTransactionType(TransactionInfo tx) {
|
||||
if (wallet.type == WalletType.bitcoin) {
|
||||
if (tx.isReplaced == true) return ' (replaced)';
|
||||
|
||||
@@ -35,7 +35,8 @@ abstract class ReceiveOptionViewModelBase with Store {
|
||||
ReceivePageOption selectedReceiveOption;
|
||||
|
||||
@computed
|
||||
List<ReceivePageOption> get options => _wallet.walletAddresses.receivePageOptions;
|
||||
List<ReceivePageOption> get options =>
|
||||
_wallet.walletAddresses.receivePageOptions.where(_wallet.receiveOptionAvailable).toList();
|
||||
|
||||
String get walletTypeString => walletTypeToString(_wallet.type);
|
||||
|
||||
|
||||
@@ -167,9 +167,10 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
|
||||
bool get isEVMWallet => isEVMCompatibleChain(walletType);
|
||||
|
||||
@action
|
||||
CryptoCurrency _outputCryptoCurrencyHandler([CryptoCurrency? override]) {
|
||||
if (override != null && override != selectedCryptoCurrency) selectedCryptoCurrency = override;
|
||||
if (override != null && override != selectedCryptoCurrency) {
|
||||
runInAction(() => selectedCryptoCurrency = override);
|
||||
}
|
||||
|
||||
return selectedCryptoCurrency;
|
||||
}
|
||||
@@ -335,6 +336,18 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
@observable
|
||||
PendingTransaction? pendingTransaction;
|
||||
|
||||
String? get pendingTransactionAdditionalCostNotice {
|
||||
final additionalCost = pendingTransaction?.additionalCost;
|
||||
|
||||
if (additionalCost == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return S.current.recipient_account_creation_fee(
|
||||
_appStore.amountParsingProxy.asDisplayStringWithSymbol(additionalCost),
|
||||
);
|
||||
}
|
||||
|
||||
@computed
|
||||
String get balance {
|
||||
if (walletType == WalletType.litecoin && coinTypeToSpendFrom == UnspentCoinType.mweb) {
|
||||
@@ -1177,11 +1190,11 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
await sharedPreferences.setString(PreferencesKey.backgroundSyncLastTrigger(wallet.name),
|
||||
DateTime.now().add(Duration(minutes: 1)).toIso8601String());
|
||||
} catch (e) {
|
||||
if (e is JupiterSwapFailedException) {
|
||||
await _updateSolanaTrade(signature: e.signature, isSuccess: false);
|
||||
}
|
||||
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
||||
await _updateSolanaTrade(signature: '', isSuccess: false);
|
||||
|
||||
final failedSignature = e is JupiterSwapFailedException ? e.signature : "";
|
||||
|
||||
await _updateSolanaTrade(signature: failedSignature, isSuccess: false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1507,6 +1520,10 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
return S.current.solana_no_associated_token_account_exception;
|
||||
}
|
||||
|
||||
if (error is AmbiguousTokenSymbolException) {
|
||||
return S.current.ambiguous_token_symbol_exception(error.symbol);
|
||||
}
|
||||
|
||||
if (errorMessage.contains('found no record of a prior credit')) {
|
||||
return S.current.insufficient_funds_for_tx;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||
final SettingsStore _settingsStore;
|
||||
final SendViewModel sendViewModel;
|
||||
|
||||
bool get hasSignVerify => _wallet.canSignMessages;
|
||||
|
||||
@computed
|
||||
TransactionPriority get transactionPriority {
|
||||
final priority = _settingsStore.getPriority(walletType, chainId: chainId);
|
||||
@@ -173,6 +175,10 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||
return null;
|
||||
}
|
||||
|
||||
bool get hasPayjoin => _wallet.hasPayjoinSupport;
|
||||
|
||||
bool get hasLightning => _wallet.hasLightningSupport;
|
||||
|
||||
Future<File?> getLightningLog() async {
|
||||
final path = await pathForWalletDir(name: _wallet.name, type: walletType);
|
||||
final logFile = File("$path/lightning.log");
|
||||
|
||||
@@ -25,7 +25,12 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
bool get isBitcoin => _wallet.type == WalletType.bitcoin;
|
||||
|
||||
@computed
|
||||
bool get hasMWEB => _wallet.type == WalletType.litecoin && (Platform.isIOS || Platform.isAndroid);
|
||||
bool get hasSilentPaymentsScanning => _wallet.hasSilentPaymentsScanning;
|
||||
|
||||
@computed
|
||||
bool get hasMWEB =>
|
||||
_wallet.type == WalletType.litecoin && (Platform.isIOS || Platform.isAndroid) &&
|
||||
!_wallet.isHardwareWallet;
|
||||
|
||||
@computed
|
||||
bool get isAutoGenerateSubaddressesEnabled =>
|
||||
@@ -108,11 +113,10 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
bool get usePayjoin => _settingsStore.usePayjoin;
|
||||
|
||||
@computed
|
||||
bool get canUsePayjoin => _wallet.type == WalletType.bitcoin && DeviceInfo.instance.isMobile;
|
||||
bool get canUsePayjoin => _wallet.hasPayjoinSupport && DeviceInfo.instance.isMobile;
|
||||
|
||||
@computed
|
||||
bool get canUseLightning =>
|
||||
_wallet.type == WalletType.bitcoin && !Platform.isWindows && !Platform.isLinux;
|
||||
bool get canUseLightning => _wallet.hasLightningSupport;
|
||||
|
||||
@computed
|
||||
bool get useLightning => _wallet.type == WalletType.bitcoin && bitcoin!.useLightning(_wallet);
|
||||
|
||||
@@ -179,6 +179,8 @@ abstract class WalletCreationVMBase with Store {
|
||||
);
|
||||
}
|
||||
return bitcoin!.getElectrumDerivations()[DerivationType.electrum]!.first;
|
||||
case WalletType.decred:
|
||||
return DerivationInfo(derivationType: DerivationType.bip39);
|
||||
default:
|
||||
return DerivationInfo(derivationType: DerivationType.unknown);
|
||||
}
|
||||
|
||||
@@ -131,6 +131,10 @@ abstract class WalletGroupsDisplayViewModelBase with Store {
|
||||
bool isNotMoneroBip39Wallet =
|
||||
wallet.type == WalletType.monero && di.derivationType != DerivationType.bip39;
|
||||
|
||||
bool isNotDecredBip39Wallet = wallet.type == WalletType.decred &&
|
||||
di.derivationType != DerivationType.bip39 &&
|
||||
di.derivationType != DerivationType.unknown;
|
||||
|
||||
// Exclude if any of these conditions are true
|
||||
shouldExcludeGroup = shouldExcludeGroup ||
|
||||
isNonBIP39Wallet ||
|
||||
@@ -138,7 +142,8 @@ abstract class WalletGroupsDisplayViewModelBase with Store {
|
||||
isElectrumDerivationType ||
|
||||
isSameTypeAsSelectedWallet ||
|
||||
isNonSeedWallet ||
|
||||
isNotMoneroBip39Wallet;
|
||||
isNotMoneroBip39Wallet ||
|
||||
isNotDecredBip39Wallet;
|
||||
}
|
||||
|
||||
if (shouldExcludeGroup) continue;
|
||||
|
||||
@@ -149,7 +149,11 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
network: zcashNetwork,
|
||||
);
|
||||
case WalletType.decred:
|
||||
return decred!.createDecredNewWalletCredentials(name: name);
|
||||
return decred!.createDecredNewWalletCredentials(
|
||||
name: name,
|
||||
password: walletPassword,
|
||||
passphrase: passphrase,
|
||||
mnemonic: newWalletArguments!.mnemonic);
|
||||
case WalletType.none:
|
||||
case WalletType.haven:
|
||||
throw Exception('Unexpected type: ${type.toString()}');
|
||||
|
||||
@@ -216,6 +216,7 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
|
||||
name: name,
|
||||
mnemonic: seed,
|
||||
password: password,
|
||||
passphrase: passphrase,
|
||||
);
|
||||
case WalletType.zcash:
|
||||
return zcash!.createZcashRestoreWalletFromSeedCredentials(
|
||||
|
||||
Reference in New Issue
Block a user