Merge branch 'main' of https://github.com/cake-tech/cake_wallet into CW-453-bitcoin-silent-payments

 Conflicts:
	cw_monero/lib/monero_wallet_service.dart
	cw_monero/pubspec.lock
	lib/router.dart
	lib/src/screens/new_wallet/advanced_privacy_settings_page.dart
	lib/src/screens/new_wallet/new_wallet_page.dart
	lib/src/screens/restore/wallet_restore_from_seed_form.dart
	res/values/strings_es.arb
	res/values/strings_hr.arb
	res/values/strings_id.arb
	res/values/strings_nl.arb
	res/values/strings_uk.arb
This commit is contained in:
OmarHatem 2023-12-09 03:50:48 +02:00
commit 57f130135c
42 changed files with 189 additions and 92 deletions

View file

@ -13,7 +13,6 @@ import 'package:cw_monero/api/wallet_manager.dart' as monero_wallet_manager;
import 'package:cw_monero/monero_wallet.dart';
import 'package:hive/hive.dart';
import 'package:polyseed/polyseed.dart';
// import 'package:polyseed/src/utils/key_utils.dart';
class MoneroNewWalletCredentials extends WalletCredentials {
MoneroNewWalletCredentials({required String name, required this.language, required this.isPolyseed, String? password})
@ -275,8 +274,7 @@ class MoneroWalletService extends WalletService<
{PolyseedCoin coin = PolyseedCoin.POLYSEED_MONERO, int? overrideHeight}) async {
final height = overrideHeight ?? getMoneroHeigthByDate(
date: DateTime.fromMillisecondsSinceEpoch(polyseed.birthday * 1000));
// final spendKey = keyToHexString(polyseed.generateKey(coin, 32));
final spendKey = "";
final spendKey = polyseed.generateKey(coin, 32).toHexString();
final seed = polyseed.encode(lang, coin);
walletInfo.isRecovery = true;

View file

@ -501,11 +501,10 @@ packages:
polyseed:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: fbb66bb837b63677c6d7f4b92db08776214d990f
url: "https://github.com/cake-tech/polyseed_dart.git"
source: git
name: polyseed
sha256: "9b48ec535b10863f78f6354ec983b4cc0c88ca69ff48fee469d0fd1954b01d4f"
url: "https://pub.dev"
source: hosted
version: "0.0.2"
pool:
dependency: transitive

View file

@ -19,9 +19,7 @@ dependencies:
flutter_mobx: ^2.0.6+1
intl: ^0.18.0
encrypt: ^5.0.1
polyseed:
git:
url: https://github.com/cake-tech/polyseed_dart.git
polyseed: ^0.0.2
cw_core:
path: ../cw_core

View file

@ -90,6 +90,7 @@ import 'package:cake_wallet/view_model/ionia/ionia_purchase_merch_view_model.dar
import 'package:cake_wallet/view_model/nano_account_list/nano_account_edit_or_create_view_model.dart';
import 'package:cake_wallet/view_model/nano_account_list/nano_account_list_view_model.dart';
import 'package:cake_wallet/view_model/node_list/pow_node_list_view_model.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cake_wallet/view_model/set_up_2fa_viewmodel.dart';
import 'package:cake_wallet/view_model/restore/restore_from_qr_vm.dart';
import 'package:cake_wallet/view_model/settings/display_settings_view_model.dart';
@ -723,6 +724,8 @@ Future<void> setup({
getIt.registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet!));
getIt.registerFactory<SeedTypeViewModel>(() => SeedTypeViewModel(getIt.get<AppStore>()));
getIt.registerFactoryParam<WalletSeedPage, bool, void>((bool isWalletCreated, _) =>
WalletSeedPage(getIt.get<WalletSeedViewModel>(), isNewWalletCreated: isWalletCreated));
@ -854,7 +857,7 @@ Future<void> setup({
return ethereum!.createEthereumWalletService(_walletInfoSource);
case WalletType.bitcoinCash:
return bitcoinCash!
.createBitcoinCashWalletService(_walletInfoSource, _unspentCoinsInfoSource!);
.createBitcoinCashWalletService(_walletInfoSource, _unspentCoinsInfoSource);
case WalletType.nano:
return nano!.createNanoWalletService(_walletInfoSource);
case WalletType.polygon:
@ -883,8 +886,8 @@ Future<void> setup({
getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
type: type));
getIt.registerFactoryParam<WalletRestorePage, WalletType, void>(
(type, _) => WalletRestorePage(getIt.get<WalletRestoreViewModel>(param1: type)));
getIt.registerFactoryParam<WalletRestorePage, WalletType, void>((type, _) => WalletRestorePage(
getIt.get<WalletRestoreViewModel>(param1: type), getIt.get<SeedTypeViewModel>()));
getIt.registerFactoryParam<WalletRestoreChooseDerivationViewModel, List<DerivationInfo>, void>(
(derivations, _) => WalletRestoreChooseDerivationViewModel(derivationInfos: derivations));
@ -915,7 +918,7 @@ Future<void> setup({
getIt.registerFactoryParam<PreSeedPage, WalletType, AdvancedPrivacySettingsViewModel>(
(WalletType type, AdvancedPrivacySettingsViewModel advancedPrivacySettingsViewModel) =>
PreSeedPage(type, advancedPrivacySettingsViewModel));
PreSeedPage(type, advancedPrivacySettingsViewModel, getIt.get<SeedTypeViewModel>()));
getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
TradeDetailsViewModel(

View file

@ -6,7 +6,7 @@ class SeedType extends EnumerableItem<int> with Serializable<int> {
static const all = [SeedType.legacy, SeedType.polyseed];
static const defaultSeedType = legacy;
static const defaultSeedType = polyseed;
static const legacy = SeedType(raw: 0, title: 'Legacy (25 words)');
static const polyseed = SeedType(raw: 1, title: 'Polyseed (16 words)');

View file

@ -56,13 +56,13 @@ import 'package:cake_wallet/src/screens/support_other_links/support_other_links_
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_details_page.dart';
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_list_page.dart';
import 'package:cake_wallet/src/screens/wallet_connect/wc_connections_listing_view.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/payment_request.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
import 'package:cake_wallet/view_model/advanced_privacy_settings_view_model.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:cw_core/nano_account.dart';
import 'package:cw_core/wallet_info.dart';
@ -147,9 +147,9 @@ Route<dynamic> createRoute(RouteSettings settings) {
case Routes.newWallet:
final type = settings.arguments as WalletType;
final walletNewVM = getIt.get<WalletNewVM>(param1: type);
final settingsStore = getIt.get<SettingsStore>();
final seedTypeViewModel = getIt.get<SeedTypeViewModel>();
return CupertinoPageRoute<void>(builder: (_) => NewWalletPage(walletNewVM, settingsStore));
return CupertinoPageRoute<void>(builder: (_) => NewWalletPage(walletNewVM, seedTypeViewModel));
case Routes.setupPin:
Function(PinCodeState<PinCodeWidget>, String)? callback;
@ -542,6 +542,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
toggleTestnet,
getIt.get<AdvancedPrivacySettingsViewModel>(param1: type),
getIt.get<NodeCreateOrEditViewModel>(param1: type, param2: false),
getIt.get<SeedTypeViewModel>(),
));
case Routes.anonPayInvoicePage:

View file

@ -10,6 +10,7 @@ import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
import 'package:cake_wallet/view_model/advanced_privacy_settings_view_model.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@ -21,10 +22,11 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
class AdvancedPrivacySettingsPage extends BasePage {
AdvancedPrivacySettingsPage(this.useTestnet, this.toggleUseTestnet,
this.advancedPrivacySettingsViewModel, this.nodeViewModel);
this.advancedPrivacySettingsViewModel, this.nodeViewModel, this.seedTypeViewModel);
final AdvancedPrivacySettingsViewModel advancedPrivacySettingsViewModel;
final NodeCreateOrEditViewModel nodeViewModel;
final SeedTypeViewModel seedTypeViewModel;
@override
String get title => S.current.privacy_settings;
@ -34,17 +36,18 @@ class AdvancedPrivacySettingsPage extends BasePage {
@override
Widget body(BuildContext context) => AdvancedPrivacySettingsBody(
useTestnet, toggleUseTestnet, advancedPrivacySettingsViewModel, nodeViewModel);
useTestnet, toggleUseTestnet, advancedPrivacySettingsViewModel, nodeViewModel, seedTypeViewModel);
}
class AdvancedPrivacySettingsBody extends StatefulWidget {
const AdvancedPrivacySettingsBody(
this.useTestnet, this.toggleUseTestnet, this.privacySettingsViewModel, this.nodeViewModel,
const AdvancedPrivacySettingsBody(this.useTestnet, this.toggleUseTestnet,
this.privacySettingsViewModel, this.nodeViewModel, this.seedTypeViewModel,
{Key? key})
: super(key: key);
final AdvancedPrivacySettingsViewModel privacySettingsViewModel;
final NodeCreateOrEditViewModel nodeViewModel;
final SeedTypeViewModel seedTypeViewModel;
final bool? useTestnet;
final Function(bool? val) toggleUseTestnet;
@ -75,7 +78,7 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
Observer(builder: (_) {
return SettingsChoicesCell(
ChoicesListItem<FiatApiMode>(
title: S.current.disable_fiat,
title: S.current.fiat_api,
items: FiatApiMode.all,
selectedItem: widget.privacySettingsViewModel.fiatApiMode,
onItemSelected: (FiatApiMode mode) =>
@ -130,8 +133,8 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
ChoicesListItem<SeedType>(
title: S.current.seedtype,
items: SeedType.all,
selectedItem: widget.privacySettingsViewModel.seedType,
onItemSelected: widget.privacySettingsViewModel.setSeedType,
selectedItem: widget.seedTypeViewModel.moneroSeedType,
onItemSelected: widget.seedTypeViewModel.setMoneroSeedType,
),
);
}),

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:mobx/mobx.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart';
@ -24,13 +25,12 @@ import 'package:cake_wallet/view_model/wallet_new_vm.dart';
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/store/settings_store.dart';
class NewWalletPage extends BasePage {
NewWalletPage(this._walletNewVM, this._settingsStore);
NewWalletPage(this._walletNewVM, this._seedTypeViewModel);
final WalletNewVM _walletNewVM;
final SettingsStore _settingsStore;
final SeedTypeViewModel _seedTypeViewModel;
final walletNameImage = Image.asset('assets/images/wallet_name.png');
@ -40,16 +40,18 @@ class NewWalletPage extends BasePage {
String get title => S.current.new_wallet;
@override
Widget body(BuildContext context) => WalletNameForm(_walletNewVM,
currentTheme.type == ThemeType.dark ? walletNameImage : walletNameLightImage, _settingsStore);
Widget body(BuildContext context) => WalletNameForm(
_walletNewVM,
currentTheme.type == ThemeType.dark ? walletNameImage : walletNameLightImage,
_seedTypeViewModel);
}
class WalletNameForm extends StatefulWidget {
WalletNameForm(this._walletNewVM, this.walletImage, this._settingsStore);
WalletNameForm(this._walletNewVM, this.walletImage, this._seedTypeViewModel);
final WalletNewVM _walletNewVM;
final Image walletImage;
final SettingsStore _settingsStore;
final SeedTypeViewModel _seedTypeViewModel;
@override
_WalletNameFormState createState() => _WalletNameFormState(_walletNewVM);
@ -194,7 +196,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
builder: (BuildContext build) => Padding(
padding: EdgeInsets.only(top: 24),
child: SelectButton(
text: widget._settingsStore.moneroSeedType.title,
text: widget._seedTypeViewModel.moneroSeedType.title,
onTap: () async {
await showPopUp<void>(
context: context,
@ -217,7 +219,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
key: _languageSelectorKey,
initialSelected: defaultSeedLanguage,
seedType: _walletNewVM.hasSeedType
? widget._settingsStore.moneroSeedType
? widget._seedTypeViewModel.moneroSeedType
: SeedType.legacy,
),
),
@ -280,10 +282,10 @@ class _WalletNameFormState extends State<WalletNameForm> {
}
}
bool get isPolyseed => widget._settingsStore.moneroSeedType == SeedType.polyseed;
bool get isPolyseed => widget._seedTypeViewModel.moneroSeedType == SeedType.polyseed;
void _setSeedType(SeedType item) {
widget._settingsStore.moneroSeedType = item;
widget._seedTypeViewModel.setMoneroSeedType(item);
_languageSelectorKey.currentState?.selected = defaultSeedLanguage; // Reset Seed language
}
}

View file

@ -11,6 +11,13 @@ import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/src/widgets/seed_language_picker.dart';
import 'package:cake_wallet/src/widgets/seed_widget.dart';
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart';
import 'package:mobx/mobx.dart';
import 'package:polyseed/polyseed.dart';
class WalletRestoreFromSeedForm extends StatefulWidget {
@ -19,6 +26,7 @@ class WalletRestoreFromSeedForm extends StatefulWidget {
required this.displayLanguageSelector,
required this.displayBlockHeightSelector,
required this.type,
required this.seedTypeViewModel,
this.blockHeightFocusNode,
this.onHeightOrDateEntered,
this.onSeedChange,
@ -28,6 +36,7 @@ class WalletRestoreFromSeedForm extends StatefulWidget {
final WalletType type;
final bool displayLanguageSelector;
final bool displayBlockHeightSelector;
final SeedTypeViewModel seedTypeViewModel;
final FocusNode? blockHeightFocusNode;
final Function(bool)? onHeightOrDateEntered;
final void Function(String)? onSeedChange;
@ -52,16 +61,28 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
final TextEditingController nameTextEditingController;
final TextEditingController seedTypeController;
final GlobalKey<FormState> formKey;
late ReactionDisposer moneroSeedTypeReaction;
String language;
bool isPolyseed = false;
@override
void initState() {
_setSeedType(widget.seedTypeViewModel.moneroSeedType);
_setLanguageLabel(language);
_setSeedType(SeedType.defaultSeedType);
moneroSeedTypeReaction =
reaction((_) => widget.seedTypeViewModel.moneroSeedType, (SeedType item) {
_setSeedType(item);
_changeLanguage('English');
});
super.initState();
}
@override
void dispose() {
super.dispose();
moneroSeedTypeReaction();
}
void onSeedChange(String seed) {
if (widget.type == WalletType.monero && Polyseed.isValidSeed(seed)) {
final lang = PolyseedLang.getByPhrase(seed);
@ -181,6 +202,8 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
]));
}
bool get isPolyseed => widget.seedTypeViewModel.moneroSeedType == SeedType.polyseed;
Widget get expandIcon => Container(
padding: EdgeInsets.all(18),
width: 24,
@ -208,10 +231,10 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
void _changeSeedType(SeedType item) {
_setSeedType(item);
_changeLanguage('English');
widget.seedTypeViewModel.setMoneroSeedType(item);
}
void _setSeedType(SeedType item) {
setState(() => isPolyseed = item == SeedType.polyseed);
seedTypeController.text = item.toString();
}
}

View file

@ -15,6 +15,7 @@ import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/restore/restore_mode.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cake_wallet/view_model/wallet_restore_view_model.dart';
import 'package:cw_core/nano_account_info_response.dart';
import 'package:cw_core/wallet_info.dart';
@ -27,7 +28,7 @@ import 'package:polyseed/polyseed.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
class WalletRestorePage extends BasePage {
WalletRestorePage(this.walletRestoreViewModel)
WalletRestorePage(this.walletRestoreViewModel, this.seedTypeViewModel)
: walletRestoreFromSeedFormKey = GlobalKey<WalletRestoreFromSeedFormState>(),
walletRestoreFromKeysFormKey = GlobalKey<WalletRestoreFromKeysFromState>(),
_pages = [],
@ -37,6 +38,7 @@ class WalletRestorePage extends BasePage {
switch (mode) {
case WalletRestoreMode.seed:
_pages.add(WalletRestoreFromSeedForm(
seedTypeViewModel: seedTypeViewModel,
displayBlockHeightSelector:
walletRestoreViewModel.hasBlockchainHeightLanguageSelector,
displayLanguageSelector: walletRestoreViewModel.hasSeedLanguageSelector,
@ -91,6 +93,7 @@ class WalletRestorePage extends BasePage {
));
final WalletRestoreViewModel walletRestoreViewModel;
final SeedTypeViewModel seedTypeViewModel;
final PageController _controller;
final List<Widget> _pages;
final GlobalKey<WalletRestoreFromSeedFormState> walletRestoreFromSeedFormKey;

View file

@ -1,6 +1,8 @@
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/view_model/advanced_privacy_settings_view_model.dart';
import 'package:cake_wallet/view_model/seed_type_view_model.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -10,19 +12,21 @@ import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/material.dart';
class PreSeedPage extends BasePage {
PreSeedPage(this.type, this.advancedPrivacySettingsViewModel)
PreSeedPage(this.type, this.advancedPrivacySettingsViewModel, this.seedTypeViewModel)
: imageLight = Image.asset('assets/images/pre_seed_light.png'),
imageDark = Image.asset('assets/images/pre_seed_dark.png'),
seedPhraseLength =
advancedPrivacySettingsViewModel.seedPhraseLength.value {
wordsCount = _wordsCount(type, seedPhraseLength);
seedPhraseLength = advancedPrivacySettingsViewModel.seedPhraseLength.value,
moneroSeedType = seedTypeViewModel.moneroSeedType {
wordsCount = _wordsCount(type, seedPhraseLength, moneroSeedType);
}
final Image imageDark;
final Image imageLight;
final WalletType type;
final AdvancedPrivacySettingsViewModel advancedPrivacySettingsViewModel;
final SeedTypeViewModel seedTypeViewModel;
final int seedPhraseLength;
final SeedType moneroSeedType;
late final int wordsCount;
@override
@ -76,9 +80,11 @@ class PreSeedPage extends BasePage {
));
}
static int _wordsCount(WalletType type, int seedPhraseLength) {
static int _wordsCount(WalletType type, int seedPhraseLength, SeedType moneroSeedType) {
switch (type) {
case WalletType.monero:
if (moneroSeedType == SeedType.polyseed)
return 16;
return 25;
case WalletType.ethereum:
case WalletType.bitcoinCash:

View file

@ -877,7 +877,7 @@ abstract class SettingsStoreBase with Store {
}
final savedSyncMode = SyncMode.all.firstWhere((element) {
return element.type.index == (sharedPreferences.getInt(PreferencesKey.syncModeKey) ?? 1);
return element.type.index == (sharedPreferences.getInt(PreferencesKey.syncModeKey) ?? 0);
});
final savedSyncAll = sharedPreferences.getBool(PreferencesKey.syncAllKey) ?? true;

View file

@ -1,7 +1,6 @@
import 'package:cake_wallet/entities/exchange_api_mode.dart';
import 'package:cake_wallet/entities/fiat_api_mode.dart';
import 'package:cake_wallet/entities/seed_phrase_length.dart';
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:mobx/mobx.dart';
@ -20,9 +19,6 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
@computed
FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode;
@computed
SeedType get seedType => _settingsStore.moneroSeedType;
@observable
bool _addCustomNode = false;
@ -44,9 +40,6 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
@action
void setFiatApiMode(FiatApiMode fiatApiMode) => _settingsStore.fiatApiMode = fiatApiMode;
@action
void setSeedType(SeedType seedType) => _settingsStore.moneroSeedType = seedType;
@action
void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;

View file

@ -0,0 +1,19 @@
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:mobx/mobx.dart';
part 'seed_type_view_model.g.dart';
class SeedTypeViewModel = SeedTypeViewModelBase with _$SeedTypeViewModel;
abstract class SeedTypeViewModelBase with Store {
SeedTypeViewModelBase(this._appStore);
@computed
SeedType get moneroSeedType => _appStore.settingsStore.moneroSeedType;
@action
void setMoneroSeedType(SeedType seedType) => _appStore.settingsStore.moneroSeedType = seedType;
final AppStore _appStore;
}

View file

@ -10,6 +10,7 @@ import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.d
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/haven/haven.dart';
import 'package:cw_monero/api/wallet.dart' as monero_wallet;
import 'package:polyseed/polyseed.dart';
part 'wallet_keys_view_model.g.dart';
@ -74,6 +75,15 @@ abstract class WalletKeysViewModelBase with Store {
StandartListItem(title: S.current.view_key_private, value: keys['privateViewKey']!),
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
]);
if (_appStore.wallet?.seed != null && Polyseed.isValidSeed(_appStore.wallet!.seed!)) {
final lang = PolyseedLang.getByPhrase(_appStore.wallet!.seed!);
final legacyLang = _getLegacySeedLang(lang);
final legacySeed =
Polyseed.decode(_appStore.wallet!.seed!, lang, PolyseedCoin.POLYSEED_MONERO)
.toLegacySeed(legacyLang);
items.add(StandartListItem(title: S.current.wallet_seed_legacy, value: legacySeed));
}
}
if (_appStore.wallet!.type == WalletType.haven) {
@ -207,4 +217,23 @@ abstract class WalletKeysViewModelBase with Store {
}
String getRoundedRestoreHeight(int height) => ((height / 1000).floor() * 1000).toString();
LegacySeedLang _getLegacySeedLang(PolyseedLang lang) {
switch (lang.nameEnglish) {
case "Spanish":
return LegacySeedLang.getByEnglishName("Spanish");
case "French":
return LegacySeedLang.getByEnglishName("French");
case "Italian":
return LegacySeedLang.getByEnglishName("Italian");
case "Japanese":
return LegacySeedLang.getByEnglishName("Japanese");
case "Portuguese":
return LegacySeedLang.getByEnglishName("Portuguese");
case "Chinese (Simplified)":
return LegacySeedLang.getByEnglishName("Chinese (simplified)");
default:
return LegacySeedLang.getByEnglishName("English");
}
}
}

View file

@ -104,9 +104,7 @@ dependencies:
# ref: main
socks5_proxy: ^1.0.4
flutter_svg: ^2.0.9
polyseed:
git:
url: https://github.com/cake-tech/polyseed_dart.git
polyseed: ^0.0.2
dev_dependencies:
flutter_test:

View file

@ -756,5 +756,6 @@
"bitcoin_legacy": "إرث البيتكوين",
"primary_silent_address": "العنوان الصامت الأساسي",
"dfx_option_description": "ﺎﺑﻭﺭﻭﺃ ﻲﻓ ﺕﺎﻛﺮﺸﻟﺍﻭ ﺔﺋﺰﺠﺘﻟﺍ ءﻼﻤﻌﻟ .ﻲﻓﺎﺿﺇ KYC ﻥﻭﺪﺑ ﻭﺭﻮﻳ 990 ﻰﻟﺇ ﻞﺼﻳ ﺎﻣ .ﻱﺮﺴﻳﻮﺴﻟﺍ",
"polygonscan_history": "ﻥﺎﻜﺴﻧﻮﺠﻴﻟﻮﺑ ﺦﻳﺭﺎﺗ"
"polygonscan_history": "ﻥﺎﻜﺴﻧﻮﺠﻴﻟﻮﺑ ﺦﻳﺭﺎﺗ",
"wallet_seed_legacy": "بذرة محفظة قديمة"
}

View file

@ -752,5 +752,6 @@
"bitcoin_legacy": "Legacy Bitcoin",
"primary_silent_address": "Първичен безшумен адрес",
"dfx_option_description": "Купете крипто с EUR и CHF. До 990 € без допълнителен KYC. За клиенти на дребно и корпоративни клиенти в Европа",
"polygonscan_history": "История на PolygonScan"
"polygonscan_history": "История на PolygonScan",
"wallet_seed_legacy": "Наследено портфейл семе"
}

View file

@ -752,5 +752,6 @@
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Primární tichá adresa",
"dfx_option_description": "Nakupujte kryptoměny za EUR a CHF. Až 990 € bez dalších KYC. Pro maloobchodní a firemní zákazníky v Evropě",
"polygonscan_history": "Historie PolygonScan"
"polygonscan_history": "Historie PolygonScan",
"wallet_seed_legacy": "Starší semeno peněženky"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "Bitcoin -Erbe",
"primary_silent_address": "Primäre stille Adresse",
"dfx_option_description": "Krypto mit EUR und CHF kaufen. Bis zu 990€ ohne zusätzliches KYC. Für Privat- und Firmenkunden in Europa",
"polygonscan_history": "PolygonScan-Verlauf"
"polygonscan_history": "PolygonScan-Verlauf",
"wallet_seed_legacy": "Legacy Wallet Seed"
}

View file

@ -761,5 +761,6 @@
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Primary Silent Address",
"dfx_option_description": "Buy crypto with EUR & CHF. Up to 990€ without additional KYC. For retail and corporate customers in Europe",
"polygonscan_history": "PolygonScan history"
"polygonscan_history": "PolygonScan history",
"wallet_seed_legacy": "Legacy wallet seed"
}

View file

@ -752,7 +752,6 @@
"seedtype_polyseed": "Polieta (16 palabras)",
"seed_language_czech": "checo",
"seed_language_korean": "coreano",
"seed_language_chinese_traditional": "Chino tradicional)",
"dfx_option_description": "Compre criptomonedas con EUR y CHF. Hasta 990€ sin KYC adicional. Para clientes minoristas y corporativos en Europa",
"seed_language_chinese_traditional": "Chino (tradicional)",
"mainnet": "Red",
@ -761,5 +760,6 @@
"bitcoin_silent_payments": "Pagos silenciosos de Bitcoin",
"bitcoin_legacy": "Legado de bitcoin",
"primary_silent_address": "Dirección silenciosa primaria",
"polygonscan_history": "Historial de PolygonScan"
}
"polygonscan_history": "Historial de PolygonScan",
"wallet_seed_legacy": "Semilla de billetera heredada"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Adresse silencieuse primaire",
"dfx_option_description": "Achetez des crypto-monnaies avec EUR et CHF. Jusqu'à 990€ sans KYC supplémentaire. Pour les clients particuliers et entreprises en Europe",
"polygonscan_history": "Historique de PolygonScan"
"polygonscan_history": "Historique de PolygonScan",
"wallet_seed_legacy": "Graine de portefeuille hérité"
}

View file

@ -738,5 +738,6 @@
"bitcoin_legacy": "Gado bitcoin",
"primary_silent_address": "Adireshin Silent na farko",
"dfx_option_description": "Sayi crypto tare da EUR & CHF. Har zuwa € 990 ba tare da ƙarin KYC ba. Don 'yan kasuwa da abokan ciniki na kamfanoni a Turai",
"polygonscan_history": "PolygonScan tarihin kowane zamani"
"polygonscan_history": "PolygonScan tarihin kowane zamani",
"wallet_seed_legacy": "Tallarin walat walat"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "बिटकॉइन विरासत",
"primary_silent_address": "प्राथमिक मूक पता",
"dfx_option_description": "EUR और CHF के साथ क्रिप्टो खरीदें। अतिरिक्त केवाईसी के बिना 990€ तक। यूरोप में खुदरा और कॉर्पोरेट ग्राहकों के लिए",
"polygonscan_history": "पॉलीगॉनस्कैन इतिहास"
"polygonscan_history": "पॉलीगॉनस्कैन इतिहास",
"wallet_seed_legacy": "विरासत बटुए बीज"
}

View file

@ -750,7 +750,6 @@
"seedtype_polyseed": "Poliseed (16 riječi)",
"seed_language_czech": "češki",
"seed_language_korean": "korejski",
"seed_language_chinese_traditional": "Kinesko tradicionalno)",
"dfx_option_description": "Kupujte kripto s EUR i CHF. Do 990 € bez dodatnog KYC-a. Za maloprodajne i poslovne korisnike u Europi",
"seed_language_chinese_traditional": "Kinesko (tradicionalno)",
"mainnet": "Mainnet",
@ -759,5 +758,6 @@
"bitcoin_silent_payments": "Bitcoin tiha plaćanja",
"bitcoin_legacy": "Nasljeđe bitcoina",
"primary_silent_address": "Primarna tiha adresa",
"polygonscan_history": "Povijest PolygonScan"
}
"polygonscan_history": "Povijest PolygonScan",
"wallet_seed_legacy": "Sjeme naslijeđenog novčanika"
}

View file

@ -740,7 +740,6 @@
"seedtype_polyseed": "Polyseed (16 kata)",
"seed_language_czech": "Ceko",
"seed_language_korean": "Korea",
"seed_language_chinese_traditional": "Cina tradisional)",
"dfx_option_description": "Beli kripto dengan EUR & CHF. Hingga 990€ tanpa KYC tambahan. Untuk pelanggan ritel dan korporat di Eropa",
"seed_language_chinese_traditional": "Cina (tradisional)",
"mainnet": "Mainnet",
@ -749,5 +748,6 @@
"bitcoin_silent_payments": "Bitcoin pembayaran diam",
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Alamat diam primer",
"polygonscan_history": "Sejarah PolygonScan"
}
"polygonscan_history": "Sejarah PolygonScan",
"wallet_seed_legacy": "Biji dompet warisan"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Indirizzo silenzioso primario",
"dfx_option_description": "Acquista criptovalute con EUR e CHF. Fino a 990€ senza KYC aggiuntivi. Per clienti al dettaglio e aziendali in Europa",
"polygonscan_history": "Cronologia PolygonScan"
"polygonscan_history": "Cronologia PolygonScan",
"wallet_seed_legacy": "Seme di portafoglio legacy"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "ビットコインレガシー",
"primary_silent_address": "主なサイレントアドレス",
"dfx_option_description": "EUR と CHF で暗号通貨を購入します。追加のKYCなしで最大990ユーロ。ヨーロッパの小売および法人顧客向け",
"polygonscan_history": "ポリゴンスキャン履歴"
"polygonscan_history": "ポリゴンスキャン履歴",
"wallet_seed_legacy": "レガシーウォレットシード"
}

View file

@ -758,5 +758,6 @@
"bitcoin_legacy": "비트 코인 유산",
"primary_silent_address": "기본 조용한 주소",
"dfx_option_description": "EUR 및 CHF로 암호화폐를 구매하세요. 추가 KYC 없이 최대 990€. 유럽의 소매 및 기업 고객용",
"polygonscan_history": "다각형 스캔 기록"
"polygonscan_history": "다각형 스캔 기록",
"wallet_seed_legacy": "레거시 지갑 시드"
}

View file

@ -758,5 +758,6 @@
"bitcoin_legacy": "Bitcoin အမွေ",
"primary_silent_address": "မူလအသံတိတ်လိပ်စာ",
"dfx_option_description": "EUR & CHF ဖြင့် crypto ကိုဝယ်ပါ။ အပို KYC မပါဘဲ 990€ အထိ။ ဥရောပရှိ လက်လီရောင်းချသူများနှင့် ကော်ပိုရိတ်ဖောက်သည်များအတွက်",
"polygonscan_history": "PolygonScan မှတ်တမ်း"
"polygonscan_history": "PolygonScan မှတ်တမ်း",
"wallet_seed_legacy": "အမွေအနှစ်ပိုက်ဆံအိတ်မျိုးစေ့"
}

View file

@ -752,7 +752,6 @@
"seedtype_polyseed": "Polyseed (16 woorden)",
"seed_language_czech": "Tsjechisch",
"seed_language_korean": "Koreaans",
"seed_language_chinese_traditional": "Chinese traditionele)",
"dfx_option_description": "Koop crypto met EUR & CHF. Tot 990€ zonder extra KYC. Voor particuliere en zakelijke klanten in Europa",
"seed_language_chinese_traditional": "Chinese (traditionele)",
"mainnet": "Maimet",
@ -761,5 +760,6 @@
"bitcoin_silent_payments": "Bitcoin stille betalingen",
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Primair stil adres",
"polygonscan_history": "PolygonScan-geschiedenis"
}
"polygonscan_history": "PolygonScan-geschiedenis",
"wallet_seed_legacy": "Legacy portemonnee zaad"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "Dziedzictwo bitcoinowe",
"primary_silent_address": "Podstawowy cichy adres",
"dfx_option_description": "Kupuj kryptowaluty za EUR i CHF. Do 990 € bez dodatkowego KYC. Dla klientów detalicznych i korporacyjnych w Europie",
"polygonscan_history": "Historia PolygonScan"
"polygonscan_history": "Historia PolygonScan",
"wallet_seed_legacy": "Dziedziczne ziarno portfela"
}

View file

@ -759,5 +759,6 @@
"bitcoin_legacy": "Bitcoin Legado",
"primary_silent_address": "Endereço silencioso primário",
"dfx_option_description": "Compre criptografia com EUR e CHF. Até 990€ sem KYC adicional. Para clientes de varejo e corporativos na Europa",
"polygonscan_history": "História do PolygonScan"
"polygonscan_history": "História do PolygonScan",
"wallet_seed_legacy": "Semente de carteira herdada"
}

View file

@ -760,5 +760,6 @@
"bitcoin_legacy": "Биткойн наследие",
"primary_silent_address": "Основной тихий адрес",
"dfx_option_description": "Покупайте криптовалюту за EUR и CHF. До 990€ без дополнительного KYC. Для розничных и корпоративных клиентов в Европе",
"polygonscan_history": "История PolygonScan"
"polygonscan_history": "История PolygonScan",
"wallet_seed_legacy": "Наследие семя кошелька"
}

View file

@ -758,5 +758,6 @@
"bitcoin_legacy": "มรดก Bitcoin",
"primary_silent_address": "ที่อยู่เงียบหลัก",
"dfx_option_description": "ซื้อ crypto ด้วย EUR และ CHF สูงถึง 990€ โดยไม่มี KYC เพิ่มเติม สำหรับลูกค้ารายย่อยและลูกค้าองค์กรในยุโรป",
"polygonscan_history": "ประวัติ PolygonScan"
"polygonscan_history": "ประวัติ PolygonScan",
"wallet_seed_legacy": "เมล็ดกระเป๋าเงินมรดก"
}

View file

@ -754,5 +754,6 @@
"bitcoin_legacy": "Pamana ng Bitcoin",
"primary_silent_address": "Pangunahing tahimik na address",
"dfx_option_description": "Bumili ng crypto gamit ang EUR at CHF. Hanggang 990€ nang walang karagdagang KYC. Para sa retail at corporate na mga customer sa Europe",
"polygonscan_history": "Kasaysayan ng PolygonScan"
"polygonscan_history": "Kasaysayan ng PolygonScan",
"wallet_seed_legacy": "Legacy wallet seed"
}

View file

@ -758,5 +758,6 @@
"bitcoin_legacy": "Bitcoin Mirası",
"primary_silent_address": "Birincil sessiz adres",
"dfx_option_description": "EUR ve CHF ile kripto satın alın. Ek KYC olmadan 990 €'ya kadar. Avrupa'daki perakende ve kurumsal müşteriler için",
"polygonscan_history": "PolygonScan geçmişi"
"polygonscan_history": "PolygonScan geçmişi",
"wallet_seed_legacy": "Eski cüzdan tohumu"
}

View file

@ -760,5 +760,6 @@
"bitcoin_silent_payments": "Біткойн мовчазні платежі",
"bitcoin_legacy": "Bitcoin Legacy",
"primary_silent_address": "Первинна мовчазна адреса",
"polygonscan_history": "Історія PolygonScan"
}
"polygonscan_history": "Історія PolygonScan",
"wallet_seed_legacy": "Спадець насіння гаманця"
}

View file

@ -752,5 +752,6 @@
"bitcoin_legacy": "بٹ کوائن میراث",
"primary_silent_address": "بنیادی خاموش پتہ",
"dfx_option_description": "EUR ﺭﻭﺍ CHF ﯽﻓﺎﺿﺍ ۔ﮟﯾﺪﯾﺮﺧ ﻮﭩﭘﺮﮐ ﮫﺗﺎﺳ ﮯﮐ KYC ﮯﯿﻟ ﮯﮐ ﻦﯿﻓﺭﺎﺻ ﭧﯾﺭﻮﭘﺭﺎﮐ ﺭﻭﺍ ﮦﺩﺭﻮﺧ ﮟ",
"polygonscan_history": "ﺦﯾﺭﺎﺗ ﯽﮐ ﻦﯿﮑﺳﺍ ﻥﻮﮔ ﯽﻟﻮﭘ"
"polygonscan_history": "ﺦﯾﺭﺎﺗ ﯽﮐ ﻦﯿﮑﺳﺍ ﻥﻮﮔ ﯽﻟﻮﭘ",
"wallet_seed_legacy": "میراثی پرس کا بیج"
}

View file

@ -754,5 +754,6 @@
"bitcoin_legacy": "Olokan Bitcoin",
"primary_silent_address": "Adirẹsi ipalọlọ akọkọ",
"dfx_option_description": "Ra crypto pẹlu EUR & CHF. Titi di 990 € laisi afikun KYC. Fun soobu ati awọn onibara ile-iṣẹ ni Yuroopu",
"polygonscan_history": "PolygonScan itan"
"polygonscan_history": "PolygonScan itan",
"wallet_seed_legacy": "Irugbin akole"
}

View file

@ -759,5 +759,6 @@
"bitcoin_legacy": "比特币遗产",
"primary_silent_address": "主要无声地址",
"dfx_option_description": "用欧元和瑞士法郎购买加密货币。高达 990 欧元,无需额外 KYC。对于欧洲的零售和企业客户",
"polygonscan_history": "多边形扫描历史"
"polygonscan_history": "多边形扫描历史",
"wallet_seed_legacy": "旧的钱包种子"
}