mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-05 18:39:25 +00:00
fix monero.com builds, make passphrase a getter on WalletBase
This commit is contained in:
parent
6f2ea35b77
commit
d5decd2406
4 changed files with 14 additions and 6 deletions
|
@ -46,6 +46,8 @@ abstract class WalletBase<BalanceType extends Balance, HistoryType extends Trans
|
||||||
|
|
||||||
String? get hexSeed => null;
|
String? get hexSeed => null;
|
||||||
|
|
||||||
|
String get passphrase => "";
|
||||||
|
|
||||||
Object get keys;
|
Object get keys;
|
||||||
|
|
||||||
WalletAddresses get walletAddresses;
|
WalletAddresses get walletAddresses;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:cw_monero/api/account_list.dart';
|
||||||
import 'package:cw_monero/api/exceptions/setup_wallet_exception.dart';
|
import 'package:cw_monero/api/exceptions/setup_wallet_exception.dart';
|
||||||
import 'package:monero/monero.dart' as monero;
|
import 'package:monero/monero.dart' as monero;
|
||||||
import 'package:mutex/mutex.dart';
|
import 'package:mutex/mutex.dart';
|
||||||
|
import 'package:polyseed/polyseed.dart';
|
||||||
|
|
||||||
int getSyncingHeight() {
|
int getSyncingHeight() {
|
||||||
// final height = monero.MONERO_cw_WalletListener_height(getWlptr());
|
// final height = monero.MONERO_cw_WalletListener_height(getWlptr());
|
||||||
|
@ -32,6 +33,13 @@ 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 = getPassphrase();
|
||||||
|
if (cakepassphrase != "") {
|
||||||
|
final lang = PolyseedLang.getByPhrase(cakepassphrase);
|
||||||
|
final coin = PolyseedCoin.POLYSEED_MONERO;
|
||||||
|
final ps = Polyseed.decode(cakepolyseed, lang, coin);
|
||||||
|
if (ps.isEncrypted) return ps.encode(lang, coin);
|
||||||
|
}
|
||||||
if (cakepolyseed != "") {
|
if (cakepolyseed != "") {
|
||||||
return cakepolyseed;
|
return cakepolyseed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,9 +118,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
||||||
@override
|
@override
|
||||||
String get password => _password;
|
String get password => _password;
|
||||||
|
|
||||||
String? passphrase() {
|
@override
|
||||||
return monero_wallet.getPassphrase();
|
String get passphrase => monero_wallet.getPassphrase();
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MoneroWalletKeys get keys => MoneroWalletKeys(
|
MoneroWalletKeys get keys => MoneroWalletKeys(
|
||||||
|
|
|
@ -97,7 +97,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||||
.seedLegacy(lang.nameEnglish)));
|
.seedLegacy(lang.nameEnglish)));
|
||||||
}
|
}
|
||||||
|
|
||||||
final passphrase = (_appStore.wallet as MoneroWalletBase).passphrase();
|
final passphrase = _appStore.wallet?.passphrase;
|
||||||
if (passphrase != null && passphrase != "") {
|
if (passphrase != null && passphrase != "") {
|
||||||
items.add(StandartListItem(
|
items.add(StandartListItem(
|
||||||
title: S.current.passphrase_view_keys,
|
title: S.current.passphrase_view_keys,
|
||||||
|
@ -292,8 +292,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||||
_appStore.wallet!.privateKey != null)
|
_appStore.wallet!.privateKey != null)
|
||||||
'private_key': _appStore.wallet!.privateKey!,
|
'private_key': _appStore.wallet!.privateKey!,
|
||||||
if (restoreHeightResult != null) ...{'height': restoreHeightResult},
|
if (restoreHeightResult != null) ...{'height': restoreHeightResult},
|
||||||
if (_appStore.wallet is MoneroWalletBase) ...{'passphrase': (_appStore.wallet as MoneroWalletBase).passphrase()??''},
|
if ((_appStore.wallet?.passphrase??"") != "") ...{'passphrase': _appStore.wallet?.passphrase??''},
|
||||||
if (_appStore.wallet is WowneroWalletBase) ...{'passphrase': (_appStore.wallet as WowneroWalletBase).passphrase()??''}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue