This commit is contained in:
fosse 2023-08-21 09:26:45 -04:00
parent ea2b6dbdb1
commit 9ac3ae9ae0
6 changed files with 62 additions and 37 deletions

View file

@ -28,7 +28,6 @@ import 'dart:async';
import 'package:cw_nano/nano_wallet_addresses.dart'; import 'package:cw_nano/nano_wallet_addresses.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:nanodart/nanodart.dart'; import 'package:nanodart/nanodart.dart';
import 'package:web3dart/web3dart.dart';
import 'package:bip39/bip39.dart' as bip39; import 'package:bip39/bip39.dart' as bip39;
part 'nano_wallet.g.dart'; part 'nano_wallet.g.dart';
@ -410,10 +409,6 @@ abstract class NanoWalletBase
Future<void>? updateBalance() async => await _updateBalance(); Future<void>? updateBalance() async => await _updateBalance();
void _onNewTransaction(FilterEvent event) {
throw UnimplementedError();
}
@override @override
Future<void> renameWalletFiles(String newWalletName) async { Future<void> renameWalletFiles(String newWalletName) async {
final currentWalletPath = await pathForWallet(name: walletInfo.name, type: type); final currentWalletPath = await pathForWallet(name: walletInfo.name, type: type);

View file

@ -22,6 +22,8 @@ class OnRamperBuyProvider {
return "LTC_LITECOIN"; return "LTC_LITECOIN";
case CryptoCurrency.xmr: case CryptoCurrency.xmr:
return "XMR_MONERO"; return "XMR_MONERO";
case CryptoCurrency.nano:
return "XNO_NANO";
default: default:
return _wallet.currency.title; return _wallet.currency.title;
} }

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/view_model/wallet_restore_choose_derivation_view_model.dart'; import 'package:cake_wallet/view_model/wallet_restore_choose_derivation_view_model.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -62,10 +63,11 @@ class WalletRestoreChooseDerivationPage extends BasePage {
title: Center( title: Center(
child: Text( child: Text(
"${derivation.derivationType.toString().split('.').last}", "${derivation.derivationType.toString().split('.').last}",
style: Theme.of(context) style: Theme.of(context).primaryTextTheme.labelMedium!.copyWith(
.primaryTextTheme fontSize: 18,
.labelMedium! fontWeight: FontWeight.w800,
.copyWith(fontSize: 18), color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
), ),
), ),
subtitle: Column( subtitle: Column(
@ -73,24 +75,33 @@ class WalletRestoreChooseDerivationPage extends BasePage {
children: [ children: [
Text( Text(
derivation.address, derivation.address,
style: Theme.of(context) style: Theme.of(context).primaryTextTheme.labelMedium!.copyWith(
.primaryTextTheme fontSize: 16,
.labelMedium! fontWeight: FontWeight.w500,
.copyWith(fontSize: 16), color: Theme.of(context)
.extension<CakeTextTheme>()!
.secondaryTextColor,
),
), ),
Text( Text(
"${S.current.confirmed}: ${derivation.balance}", "${S.current.confirmed}: ${derivation.balance}",
style: Theme.of(context) style: Theme.of(context).primaryTextTheme.labelMedium!.copyWith(
.primaryTextTheme fontSize: 16,
.labelMedium! fontWeight: FontWeight.w500,
.copyWith(fontSize: 16), color: Theme.of(context)
.extension<CakeTextTheme>()!
.secondaryTextColor,
),
), ),
Text( Text(
"${S.current.transactions}: ${derivation.height}", "${S.current.transactions}: ${derivation.height}",
style: Theme.of(context) style: Theme.of(context).primaryTextTheme.labelMedium!.copyWith(
.primaryTextTheme fontSize: 16,
.labelMedium! fontWeight: FontWeight.w500,
.copyWith(fontSize: 16), color: Theme.of(context)
.extension<CakeTextTheme>()!
.secondaryTextColor,
),
), ),
], ],
), ),

View file

@ -47,6 +47,9 @@ abstract class TransactionDetailsViewModelBase with Store {
case WalletType.ethereum: case WalletType.ethereum:
_addEthereumListItems(tx, dateFormat); _addEthereumListItems(tx, dateFormat);
break; break;
case WalletType.nano:
_addNanoListItems(tx, dateFormat);
break;
default: default:
break; break;
} }
@ -227,4 +230,18 @@ abstract class TransactionDetailsViewModelBase with Store {
items.addAll(_items); items.addAll(_items);
} }
void _addNanoListItems(TransactionInfo tx, DateFormat dateFormat) {
final _items = [
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.id),
StandartListItem(
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
// StandartListItem(title: S.current.confirmed, value: (tx.confirmations > 0).toString()),
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
];
items.addAll(_items);
}
} }

View file

@ -51,18 +51,18 @@ abstract class WalletListViewModelBase with Store {
@action @action
void updateList() { void updateList() {
wallets.clear(); wallets.clear();
wallets.addAll( // wallets.addAll(
_walletInfoSource.values.map( // _walletInfoSource.values.map(
(info) => WalletListItem( // (info) => WalletListItem(
name: info.name, // name: info.name,
type: info.type, // type: info.type,
key: info.key, // key: info.key,
isCurrent: info.name == _appStore.wallet?.name && // isCurrent: info.name == _appStore.wallet?.name &&
info.type == _appStore.wallet?.type, // info.type == _appStore.wallet?.type,
isEnabled: availableWalletTypes.contains(info.type), // isEnabled: availableWalletTypes.contains(info.type),
), // ),
), // ),
); // );
} }
bool checkIfAuthRequired() { bool checkIfAuthRequired() {

View file

@ -780,10 +780,6 @@ Future<void> generateWalletTypes({
outputContent += '\tWalletType.litecoin,\n'; outputContent += '\tWalletType.litecoin,\n';
} }
if (hasHaven) {
outputContent += '\tWalletType.haven,\n';
}
if (hasNano) { if (hasNano) {
outputContent += '\tWalletType.nano,\n'; outputContent += '\tWalletType.nano,\n';
} }
@ -792,6 +788,10 @@ Future<void> generateWalletTypes({
outputContent += '\tWalletType.banano,\n'; outputContent += '\tWalletType.banano,\n';
} }
if (hasHaven) {
outputContent += '\tWalletType.haven,\n';
}
outputContent += '];\n'; outputContent += '];\n';
await walletTypesFile.writeAsString(outputContent); await walletTypesFile.writeAsString(outputContent);
} }