Generic fixes (#1304)

* fix mobx no element error

* fix mobx issue

* Remove unused code

* Enhance error handling for monero sync failure case

* Separate litecoin mnemonic exception from bitcoin

* - Enable onramper for polygon
- Add Kaspa validation

* Set null as the default length of address validation

* Modify EVM fee text [skip ci]

* Add seed length option to polygon

* Add digibyte

* Update configure_cake_wallet.sh and fix conflicts

* Pin bottom section

* Fix Solana missing isTestnet param
This commit is contained in:
Omar Hatem
2024-02-23 19:09:24 +02:00
committed by GitHub
parent a3a35f05e1
commit cbc0c3afd6
20 changed files with 84 additions and 70 deletions
-6
View File
@@ -1,12 +1,6 @@
part of 'bitcoin_cash.dart';
class CWBitcoinCash extends BitcoinCash {
@override
String getMnemonic(int? strength) => Mnemonic.generate();
@override
Uint8List getSeedFromMnemonic(String seed) => Mnemonic.toSeed(seed);
@override
String getCashAddrFormat(String address) => AddressUtils.getCashAddrFormat(address);
+2 -2
View File
@@ -257,9 +257,9 @@ class AddressValidator extends TextValidator {
case CryptoCurrency.near:
return [64];
case CryptoCurrency.btcln:
return null;
case CryptoCurrency.kaspa:
default:
return [];
return null;
}
}
+2 -2
View File
@@ -66,7 +66,7 @@ class ProvidersHelper {
case WalletType.bitcoinCash:
return [ProviderType.askEachTime, ProviderType.onramper, ProviderType.robinhood];
case WalletType.polygon:
return [ProviderType.askEachTime, ProviderType.dfx];
return [ProviderType.askEachTime, ProviderType.onramper, ProviderType.dfx];
case WalletType.solana:
return [ProviderType.askEachTime, ProviderType.onramper, ProviderType.robinhood];
case WalletType.none:
@@ -89,7 +89,7 @@ class ProvidersHelper {
case WalletType.bitcoinCash:
return [ProviderType.askEachTime, ProviderType.moonpaySell];
case WalletType.polygon:
return [ProviderType.askEachTime, ProviderType.dfx];
return [ProviderType.askEachTime, ProviderType.onramper, ProviderType.dfx];
case WalletType.solana:
return [
ProviderType.askEachTime,
+4 -1
View File
@@ -1,6 +1,7 @@
import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/entities/template.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
import 'package:cake_wallet/src/screens/send/widgets/send_card.dart';
import 'package:cake_wallet/src/widgets/add_template_button.dart';
@@ -420,7 +421,9 @@ class SendPage extends BasePage {
amount: S.of(_dialogContext).send_amount,
amountValue: sendViewModel.pendingTransaction!.amountFormatted,
fiatAmountValue: sendViewModel.pendingTransactionFiatAmountFormatted,
fee: S.of(_dialogContext).send_fee,
fee: isEVMCompatibleChain(sendViewModel.walletType)
? S.of(_dialogContext).send_estimated_fee
: S.of(_dialogContext).send_fee,
feeValue: sendViewModel.pendingTransaction!.feeFormatted,
feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmountFormatted,
outputs: sendViewModel.outputs,
@@ -14,37 +14,28 @@ class ScrollableWithBottomSection extends StatefulWidget {
final EdgeInsets? bottomSectionPadding;
@override
ScrollableWithBottomSectionState createState() =>
ScrollableWithBottomSectionState();
ScrollableWithBottomSectionState createState() => ScrollableWithBottomSectionState();
}
class ScrollableWithBottomSectionState
extends State<ScrollableWithBottomSection> {
class ScrollableWithBottomSectionState extends State<ScrollableWithBottomSection> {
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
return SingleChildScrollView(
// physics:
// const AlwaysScrollableScrollPhysics(), // const NeverScrollableScrollPhysics(), //
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.heightConstraints().maxHeight),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: widget.contentPadding ??
EdgeInsets.only(left: 20, right: 20),
child: widget.content,
),
Padding(
padding: widget.bottomSectionPadding ??
EdgeInsets.only(bottom: 20, right: 20, left: 20),
child: widget.bottomSection)
],
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: widget.contentPadding ?? EdgeInsets.only(left: 20, right: 20),
child: widget.content,
),
),
),
);
});
Padding(
padding: widget.bottomSectionPadding?.copyWith(top: 10) ??
EdgeInsets.only(top: 10, bottom: 20, right: 20, left: 20),
child: widget.bottomSection,
),
],
);
}
}
@@ -27,11 +27,25 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
final SettingsStore _settingsStore;
bool get hasSeedPhraseLengthOption =>
type == WalletType.bitcoinCash ||
type == WalletType.ethereum ||
type == WalletType.polygon ||
type == WalletType.solana;
bool get hasSeedPhraseLengthOption {
// convert to switch case so that it give a syntax error when adding a new wallet type
// thus we don't forget about it
switch (type) {
case WalletType.ethereum:
case WalletType.bitcoinCash:
case WalletType.polygon:
case WalletType.solana:
return true;
case WalletType.monero:
case WalletType.none:
case WalletType.bitcoin:
case WalletType.litecoin:
case WalletType.haven:
case WalletType.nano:
case WalletType.banano:
return false;
}
}
bool get hasSeedTypeOption => type == WalletType.monero;
@@ -15,7 +15,8 @@ class UnspentCoinsListViewModel = UnspentCoinsListViewModelBase with _$UnspentCo
abstract class UnspentCoinsListViewModelBase with Store {
UnspentCoinsListViewModelBase(
{required this.wallet, required Box<UnspentCoinsInfo> unspentCoinsInfo})
: _unspentCoinsInfo = unspentCoinsInfo {
: _unspentCoinsInfo = unspentCoinsInfo,
_items = ObservableList<UnspentCoinsItem>() {
_updateUnspentCoinsInfo();
_updateUnspents();
}
@@ -23,7 +24,8 @@ abstract class UnspentCoinsListViewModelBase with Store {
WalletBase wallet;
final Box<UnspentCoinsInfo> _unspentCoinsInfo;
final ObservableList<UnspentCoinsItem> _items = ObservableList();
@observable
ObservableList<UnspentCoinsItem> _items;
@computed
ObservableList<UnspentCoinsItem> get items => _items;
+1 -3
View File
@@ -20,9 +20,7 @@ abstract class WalletKeysViewModelBase with Store {
WalletKeysViewModelBase(this._appStore)
: title = _appStore.wallet!.type == WalletType.bitcoin ||
_appStore.wallet!.type == WalletType.litecoin ||
_appStore.wallet!.type == WalletType.bitcoinCash ||
_appStore.wallet!.type == WalletType.ethereum ||
_appStore.wallet!.type == WalletType.polygon
_appStore.wallet!.type == WalletType.bitcoinCash
? S.current.wallet_seed
: S.current.wallet_keys,
_restoreHeight = _appStore.wallet!.walletInfo.restoreHeight,