Add Recovery Height to Wallet seed page for monero (#1470)

Konstantin Ullrich committed Jun 18, 2024 at 02:00 UTC 5b3161fb2958b6dd0fae0249a35b3979999367f3
30 files changed +48 -8
cw_monero/lib/monero_wallet.dart
+2
@@ -108,6 +108,8 @@ abstract class MoneroWalletBase
108 publicSpendKey: monero_wallet.getPublicSpendKey(),
109 publicViewKey: monero_wallet.getPublicViewKey());
110
111 + int? get restoreHeight => transactionHistory.transactions.values.firstOrNull?.height;
112 +
113 monero_wallet.SyncListener? _listener;
114 ReactionDisposer? _onAccountChangeReaction;
115 bool _isTransactionUpdating;
lib/monero/cw_monero.dart
+6
@@ -244,6 +244,12 @@ class CWMonero extends Monero {
244 };
245 }
246
247 + @override
248 + int? getRestoreHeight(Object wallet) {
249 + final moneroWallet = wallet as MoneroWallet;
250 + return moneroWallet.restoreHeight;
251 + }
252 +
253 @override
254 Object createMoneroTransactionCreationCredentials(
255 {required List<Output> outputs, required TransactionPriority priority}) =>
lib/view_model/wallet_keys_view_model.dart
+12 -7
@@ -1,16 +1,15 @@
1 -import 'package:cake_wallet/bitcoin/bitcoin.dart';
1 +import 'package:cake_wallet/generated/i18n.dart';
2 +import 'package:cake_wallet/haven/haven.dart';
3 +import 'package:cake_wallet/monero/monero.dart';
4 import 'package:cake_wallet/reactions/wallet_connect.dart';
5 +import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
6 import 'package:cake_wallet/store/app_store.dart';
7 import 'package:cw_core/transaction_direction.dart';
8 import 'package:cw_core/transaction_info.dart';
6 -import 'package:cw_core/wallet_type.dart';
7 -import 'package:mobx/mobx.dart';
8 -import 'package:cake_wallet/generated/i18n.dart';
9 import 'package:cw_core/wallet_base.dart';
10 -import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
11 -import 'package:cake_wallet/monero/monero.dart';
12 -import 'package:cake_wallet/haven/haven.dart';
10 +import 'package:cw_core/wallet_type.dart';
11 import 'package:cw_monero/api/wallet.dart' as monero_wallet;
12 +import 'package:mobx/mobx.dart';
13 import 'package:polyseed/polyseed.dart';
14
15 part 'wallet_keys_view_model.g.dart';
@@ -83,6 +82,12 @@ abstract class WalletKeysViewModelBase with Store {
82 .toLegacySeed(legacyLang);
83 items.add(StandartListItem(title: S.current.wallet_seed_legacy, value: legacySeed));
84 }
85 +
86 + final restoreHeight = monero!.getRestoreHeight(_appStore.wallet!);
87 + if (restoreHeight != null) {
88 + items.add(StandartListItem(
89 + title: S.current.wallet_recovery_height, value: restoreHeight.toString()));
90 + }
91 }
92
93 if (_appStore.wallet!.type == WalletType.haven) {
res/values/strings_ar.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "قائمة",
835 "wallet_name": "اسم المحفظة",
836 "wallet_name_exists": "توجد بالفعل محفظة بهذا الاسم. الرجاء اختيار اسم مختلف أو إعادة تسمية المحفظة الأخرى أولاً.",
837 + "wallet_recovery_height": "ارتفاع الاسترداد",
838 "wallet_restoration_store_incorrect_seed_length": "طول السييد غير صحيح",
839 "wallet_seed": "سييد المحفظة",
840 "wallet_seed_legacy": "بذرة محفظة قديمة",
res/values/strings_bg.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Меню",
835 "wallet_name": "Име на портфейл",
836 "wallet_name_exists": "Вече има портфейл с това име. Моля, изберете друго име или преименувайте другия портфейл.",
837 + "wallet_recovery_height": "Височина на възстановяване",
838 "wallet_restoration_store_incorrect_seed_length": "Грешна дължина на seed-а",
839 "wallet_seed": "Seed на портфейла",
840 "wallet_seed_legacy": "Наследено портфейл семе",
res/values/strings_cs.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Menu",
835 "wallet_name": "Název peněženky",
836 "wallet_name_exists": "Peněženka s tímto názvem už existuje. Prosím zvolte si jiný název, nebo nejprve přejmenujte nejprve druhou peněženku.",
837 + "wallet_recovery_height": "Výška zotavení",
838 "wallet_restoration_store_incorrect_seed_length": "Nesprávná délka seedu",
839 "wallet_seed": "Seed peněženky",
840 "wallet_seed_legacy": "Starší semeno peněženky",
res/values/strings_de.arb
+2 -1
@@ -837,6 +837,7 @@
837 "wallet_menu": "Wallet-Menü",
838 "wallet_name": "Walletname",
839 "wallet_name_exists": "Wallet mit diesem Namen existiert bereits",
840 + "wallet_recovery_height": "Erstellungshöhe",
841 "wallet_restoration_store_incorrect_seed_length": "Falsche Seed-Länge",
842 "wallet_seed": "Wallet-Seed",
843 "wallet_seed_legacy": "Legacy Wallet Seed",
@@ -875,4 +876,4 @@
876 "you_will_get": "Konvertieren zu",
877 "you_will_send": "Konvertieren von",
878 "yy": "YY"
878 -}
\ No newline at end of file
879 +}
res/values/strings_en.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Menu",
835 "wallet_name": "Wallet name",
836 "wallet_name_exists": "A wallet with that name already exists. Please choose a different name or rename the other wallet first.",
837 + "wallet_recovery_height": "Recovery Height",
838 "wallet_restoration_store_incorrect_seed_length": "Incorrect seed length",
839 "wallet_seed": "Wallet seed",
840 "wallet_seed_legacy": "Legacy wallet seed",
res/values/strings_es.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "Menú de billetera",
836 "wallet_name": "Nombre de la billetera",
837 "wallet_name_exists": "Wallet con ese nombre ya ha existido",
838 + "wallet_recovery_height": "Altura de recuperación",
839 "wallet_restoration_store_incorrect_seed_length": "Longitud de semilla incorrecta",
840 "wallet_seed": "Semilla de billetera",
841 "wallet_seed_legacy": "Semilla de billetera heredada",
res/values/strings_fr.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Menu",
835 "wallet_name": "Nom du Portefeuille (Wallet)",
836 "wallet_name_exists": "Un portefeuille (wallet) portant ce nom existe déjà",
837 + "wallet_recovery_height": "Hauteur de récupération",
838 "wallet_restoration_store_incorrect_seed_length": "Longueur de phrase secrète (seed) incorrecte",
839 "wallet_seed": "Phrase secrète (seed) du portefeuille (wallet)",
840 "wallet_seed_legacy": "Graine de portefeuille hérité",
res/values/strings_ha.arb
+1
@@ -836,6 +836,7 @@
836 "wallet_menu": "Menu",
837 "wallet_name": "Sunan walat",
838 "wallet_name_exists": "Wallet mai wannan sunan ya riga ya wanzu. Da fatan za a zaɓi wani suna daban ko sake suna ɗayan walat tukuna.",
839 + "wallet_recovery_height": "Mai Tsaro",
840 "wallet_restoration_store_incorrect_seed_length": "kalmar sirrin iri ba daidai ba",
841 "wallet_seed": "kalmar sirri na walat",
842 "wallet_seed_legacy": "Tallarin walat walat",
res/values/strings_hi.arb
+1
@@ -836,6 +836,7 @@
836 "wallet_menu": "बटुआ मेनू",
837 "wallet_name": "बटुए का नाम",
838 "wallet_name_exists": "उस नाम वाला वॉलेट पहले से मौजूद है",
839 + "wallet_recovery_height": "वसूली ऊंचाई",
840 "wallet_restoration_store_incorrect_seed_length": "गलत बीज की लंबाई",
841 "wallet_seed": "बटुआ का बीज",
842 "wallet_seed_legacy": "विरासत बटुए बीज",
res/values/strings_hr.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Izbornik",
835 "wallet_name": "Ime novčanika",
836 "wallet_name_exists": "Novčanik s tim nazivom već postoji",
837 + "wallet_recovery_height": "Visina oporavka",
838 "wallet_restoration_store_incorrect_seed_length": "Netočna dužina pristupnog izraza",
839 "wallet_seed": "Pristupni izraz novčanika",
840 "wallet_seed_legacy": "Sjeme naslijeđenog novčanika",
res/values/strings_id.arb
+1
@@ -837,6 +837,7 @@
837 "wallet_menu": "Menu",
838 "wallet_name": "Nama Dompet",
839 "wallet_name_exists": "Nama dompet sudah ada. Silakan pilih nama yang berbeda atau ganti nama dompet yang lain terlebih dahulu.",
840 + "wallet_recovery_height": "Tinggi pemulihan",
841 "wallet_restoration_store_incorrect_seed_length": "Panjang seed yang salah",
842 "wallet_seed": "Seed dompet",
843 "wallet_seed_legacy": "Biji dompet warisan",
res/values/strings_it.arb
+1
@@ -837,6 +837,7 @@
837 "wallet_menu": "Menù",
838 "wallet_name": "Nome del Portafoglio",
839 "wallet_name_exists": "Il portafoglio con quel nome è già esistito",
840 + "wallet_recovery_height": "Altezza di recupero",
841 "wallet_restoration_store_incorrect_seed_length": "Lunghezza seme non corretta",
842 "wallet_seed": "Seme Portafoglio",
843 "wallet_seed_legacy": "Seme di portafoglio legacy",
res/values/strings_ja.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "ウォレットメニュー",
836 "wallet_name": "ウォレット名",
837 "wallet_name_exists": "その名前のウォレットはすでに存在しています",
838 + "wallet_recovery_height": "回復の高さ",
839 "wallet_restoration_store_incorrect_seed_length": "誤ったシード長s",
840 "wallet_seed": "ウォレットシード",
841 "wallet_seed_legacy": "レガシーウォレットシード",
res/values/strings_ko.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "월렛 메뉴",
836 "wallet_name": "지갑 이름",
837 "wallet_name_exists": "해당 이름의 지갑이 이미 존재합니다.",
838 + "wallet_recovery_height": "복구 높이",
839 "wallet_restoration_store_incorrect_seed_length": "시드 길이가 잘못되었습니다",
840 "wallet_seed": "지갑 시드",
841 "wallet_seed_legacy": "레거시 지갑 시드",
res/values/strings_my.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "မီနူး",
835 "wallet_name": "ပိုက်ဆံအိတ်နာမည",
836 "wallet_name_exists": "ထိုအမည်ဖြင့် ပိုက်ဆံအိတ်တစ်ခု ရှိနှင့်ပြီးဖြစ်သည်။ အခြားအမည်တစ်ခုကို ရွေးပါ သို့မဟုတ် အခြားပိုက်ဆံအိတ်ကို ဦးစွာ အမည်ပြောင်းပါ။",
837 + "wallet_recovery_height": "ပြန်လည်ထူထောင်ရေးအမြင့်",
838 "wallet_restoration_store_incorrect_seed_length": "မျိုးစေ့အရှည် မမှန်ပါ။",
839 "wallet_seed": "ပိုက်ဆံအိတ်စေ့",
840 "wallet_seed_legacy": "အမွေအနှစ်ပိုက်ဆံအိတ်မျိုးစေ့",
res/values/strings_nl.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "Portemonnee-menu",
836 "wallet_name": "Portemonnee naam",
837 "wallet_name_exists": "Portemonnee met die naam bestaat al",
838 + "wallet_recovery_height": "Herstelhoogte",
839 "wallet_restoration_store_incorrect_seed_length": "Onjuiste zaadlengte",
840 "wallet_seed": "Portemonnee zaad",
841 "wallet_seed_legacy": "Legacy portemonnee zaad",
res/values/strings_pl.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Menu portfela",
835 "wallet_name": "Nazwa portfela",
836 "wallet_name_exists": "Portfel o tej nazwie już istnieje",
837 + "wallet_recovery_height": "Wysokość odzysku",
838 "wallet_restoration_store_incorrect_seed_length": "Nieprawidłowa długość frazy seed",
839 "wallet_seed": "Seed portfela",
840 "wallet_seed_legacy": "Dziedziczne ziarno portfela",
res/values/strings_pt.arb
+1
@@ -837,6 +837,7 @@
837 "wallet_menu": "Menu",
838 "wallet_name": "Nome da carteira",
839 "wallet_name_exists": "A carteira com esse nome já existe",
840 + "wallet_recovery_height": "Altura de recuperação",
841 "wallet_restoration_store_incorrect_seed_length": "Comprimento de semente incorreto",
842 "wallet_seed": "Semente de carteira",
843 "wallet_seed_legacy": "Semente de carteira herdada",
res/values/strings_ru.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "Меню кошелька",
836 "wallet_name": "Имя кошелька",
837 "wallet_name_exists": "Кошелек с таким именем уже существует",
838 + "wallet_recovery_height": "Высота восстановления",
839 "wallet_restoration_store_incorrect_seed_length": "Неверная длина мнемонической фразы",
840 "wallet_seed": "Мнемоническая фраза кошелька",
841 "wallet_seed_legacy": "Наследие семя кошелька",
res/values/strings_th.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "เมนู",
835 "wallet_name": "ชื่อกระเป๋า",
836 "wallet_name_exists": "กระเป๋าที่มีชื่อนี้มีอยู่แล้ว โปรดเลือกชื่ออื่นหรือเปลี่ยนชื่อกระเป๋าอื่นก่อน",
837 + "wallet_recovery_height": "ความสูงของการกู้คืน",
838 "wallet_restoration_store_incorrect_seed_length": "ความยาวของซีดไม่ถูกต้อง",
839 "wallet_seed": "ซีดของกระเป๋า",
840 "wallet_seed_legacy": "เมล็ดกระเป๋าเงินมรดก",
res/values/strings_tl.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Menu",
835 "wallet_name": "Pangalan ng Wallet",
836 "wallet_name_exists": "Ang isang pitaka na may pangalang iyon ay mayroon na. Mangyaring pumili ng ibang pangalan o palitan muna ang iba pang pitaka.",
837 + "wallet_recovery_height": "Taas ng pagbawi",
838 "wallet_restoration_store_incorrect_seed_length": "Maling haba ng binhi",
839 "wallet_seed": "SEED ng Wallet",
840 "wallet_seed_legacy": "Legacy wallet seed",
res/values/strings_tr.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "Menü",
835 "wallet_name": "Cüzdan ismi",
836 "wallet_name_exists": "Bu isimde bir cüzdan zaten mevcut. Lütfen farklı bir isim seç veya önce diğer cüzdanı yeniden adlandır.",
837 + "wallet_recovery_height": "Kurtarma Yüksekliği",
838 "wallet_restoration_store_incorrect_seed_length": "Yanlış tohum uzunluğu",
839 "wallet_seed": "Cüzdan tohumu",
840 "wallet_seed_legacy": "Eski cüzdan tohumu",
res/values/strings_uk.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "Меню гаманця",
836 "wallet_name": "Ім'я гаманця",
837 "wallet_name_exists": "Гаманець з такою назвою вже існує",
838 + "wallet_recovery_height": "Висота відновлення",
839 "wallet_restoration_store_incorrect_seed_length": "Невірна довжина мнемонічної фрази",
840 "wallet_seed": "Мнемонічна фраза гаманця",
841 "wallet_seed_legacy": "Спадець насіння гаманця",
res/values/strings_ur.arb
+1
@@ -836,6 +836,7 @@
836 "wallet_menu": "مینو",
837 "wallet_name": "بٹوے کا نام",
838 "wallet_name_exists": "اس نام کا پرس پہلے سے موجود ہے۔ براہ کرم ایک مختلف نام منتخب کریں یا پہلے دوسرے بٹوے کا نام تبدیل کریں۔",
839 + "wallet_recovery_height": "بحالی کی اونچائی",
840 "wallet_restoration_store_incorrect_seed_length": "غلط بیج کی لمبائی",
841 "wallet_seed": "بٹوے کا بیج",
842 "wallet_seed_legacy": "میراثی پرس کا بیج",
res/values/strings_yo.arb
+1
@@ -835,6 +835,7 @@
835 "wallet_menu": "Mẹ́nù",
836 "wallet_name": "Orúkọ àpamọ́wọ́",
837 "wallet_name_exists": "Ẹ ti ní àpamọ́wọ́ pẹ̀lú orúkọ̀ yẹn. Ẹ jọ̀wọ́ yàn orúkọ̀ tó yàtọ̀ tàbí pààrọ̀ orúkọ ti àpamọ́wọ́ tẹ́lẹ̀.",
838 + "wallet_recovery_height": "Iga Imularada",
839 "wallet_restoration_store_incorrect_seed_length": "Gígùn hóró tí a máa ń lò kọ́ ni èyí",
840 "wallet_seed": "Hóró àpamọ́wọ́",
841 "wallet_seed_legacy": "Irugbin akole",
res/values/strings_zh.arb
+1
@@ -834,6 +834,7 @@
834 "wallet_menu": "钱包菜单",
835 "wallet_name": "钱包名称",
836 "wallet_name_exists": "同名的钱包已经存在",
837 + "wallet_recovery_height": "恢复高度",
838 "wallet_restoration_store_incorrect_seed_length": "种子长度错误",
839 "wallet_seed": "钱包种子",
840 "wallet_seed_legacy": "旧的钱包种子",
tool/configure.dart
+1
@@ -363,6 +363,7 @@ abstract class Monero {
363 WalletCredentials createMoneroRestoreWalletFromSeedCredentials({required String name, required String password, required int height, required String mnemonic});
364 WalletCredentials createMoneroNewWalletCredentials({required String name, required String language, required bool isPolyseed, String password});
365 Map<String, String> getKeys(Object wallet);
366 + int? getRestoreHeight(Object wallet);
367 Object createMoneroTransactionCreationCredentials({required List<Output> outputs, required TransactionPriority priority});
368 Object createMoneroTransactionCreationCredentialsRaw({required List<OutputInfo> outputs, required TransactionPriority priority});
369 String formatterMoneroAmountToString({required int amount});