changes from review

This commit is contained in:
Czarek Nakamoto 2024-08-21 09:37:49 +02:00
parent b1b886dc40
commit 75c2bf2db9
5 changed files with 11 additions and 25 deletions

View file

@ -32,8 +32,7 @@ String getSeed() {
// monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed); // monero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed);
final cakepolyseed = final cakepolyseed =
monero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.seed"); monero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.seed");
final cakepassphrase = final cakepassphrase = getPassphrase();
monero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
if (cakepolyseed != "") { if (cakepolyseed != "") {
return cakepolyseed; return cakepolyseed;
} }
@ -46,8 +45,7 @@ String getSeed() {
} }
String getSeedLegacy(String? language) { String getSeedLegacy(String? language) {
final cakepassphrase = final cakepassphrase = getPassphrase();
monero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
var legacy = monero.Wallet_seed(wptr!, seedOffset: cakepassphrase); var legacy = monero.Wallet_seed(wptr!, seedOffset: cakepassphrase);
switch (language) { switch (language) {
case "Chinese (Traditional)": language = "Chinese (simplified)"; break; case "Chinese (Traditional)": language = "Chinese (simplified)"; break;
@ -70,11 +68,8 @@ String getSeedLegacy(String? language) {
return legacy; return legacy;
} }
String? getPassphrase() { String getPassphrase() {
final cakepassphrase = return monero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
monero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
if (cakepassphrase == "") return null;
return cakepassphrase;
} }
String getAddress({int accountIndex = 0, int addressIndex = 0}) => String getAddress({int accountIndex = 0, int addressIndex = 0}) =>

View file

@ -34,8 +34,7 @@ String getSeed() {
// wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed); // wownero.Wallet_setCacheAttribute(wptr!, key: "cakewallet.seed", value: seed);
final cakepolyseed = final cakepolyseed =
wownero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.seed"); wownero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.seed");
final cakepassphrase = final cakepassphrase = getPassphrase();
wownero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
if (cakepolyseed != "") { if (cakepolyseed != "") {
return cakepolyseed; return cakepolyseed;
} }
@ -48,8 +47,7 @@ String getSeed() {
} }
String getSeedLegacy(String? language) { String getSeedLegacy(String? language) {
final cakepassphrase = final cakepassphrase = getPassphrase();
wownero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
var legacy = wownero.Wallet_seed(wptr!, seedOffset: cakepassphrase); var legacy = wownero.Wallet_seed(wptr!, seedOffset: cakepassphrase);
switch (language) { switch (language) {
case "Chinese (Traditional)": language = "Chinese (simplified)"; break; case "Chinese (Traditional)": language = "Chinese (simplified)"; break;
@ -72,11 +70,8 @@ String getSeedLegacy(String? language) {
return legacy; return legacy;
} }
String? getPassphrase() { String getPassphrase() {
final cakepassphrase = return wownero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
wownero.Wallet_getCacheAttribute(wptr!, key: "cakewallet.passphrase");
if (cakepassphrase == "") return null;
return cakepassphrase;
} }
String getAddress({int accountIndex = 0, int addressIndex = 1}) => String getAddress({int accountIndex = 0, int addressIndex = 1}) =>

View file

@ -111,7 +111,7 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
height: restoreWallet.height ?? 0, height: restoreWallet.height ?? 0,
mnemonic: restoreWallet.mnemonicSeed ?? '', mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password, password: password,
passphrase: '', passphrase: passphrase ?? '',
); );
case WalletType.bitcoin: case WalletType.bitcoin:
case WalletType.litecoin: case WalletType.litecoin:

View file

@ -48,12 +48,14 @@ class RestoredWallet {
final height = json['height'] as String?; final height = json['height'] as String?;
final mnemonic_seed = json['mnemonic_seed'] as String?; final mnemonic_seed = json['mnemonic_seed'] as String?;
final seed = json['seed'] as String? ?? json['hexSeed'] as String?; final seed = json['seed'] as String? ?? json['hexSeed'] as String?;
final passphrase = json['passphrase'] as String?;
return RestoredWallet( return RestoredWallet(
restoreMode: json['mode'] as WalletRestoreMode, restoreMode: json['mode'] as WalletRestoreMode,
type: json['type'] as WalletType, type: json['type'] as WalletType,
address: json['address'] as String?, address: json['address'] as String?,
mnemonicSeed: mnemonic_seed ?? seed, mnemonicSeed: mnemonic_seed ?? seed,
height: height != null ? int.parse(height) : 0, height: height != null ? int.parse(height) : 0,
passphrase: passphrase
); );
} }

View file

@ -102,12 +102,6 @@ abstract class WalletKeysViewModelBase with Store {
title: S.current.wallet_recovery_height, title: S.current.wallet_recovery_height,
value: restoreHeight.toString())); value: restoreHeight.toString()));
} }
final passphrase = (_appStore.wallet as MoneroWalletBase).passphrase();
if (passphrase != null) {
items.add(StandartListItem(
title: S.current.passphrase,
value: passphrase.toString()));
}
} }
if (_appStore.wallet!.type == WalletType.haven) { if (_appStore.wallet!.type == WalletType.haven) {