mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
cherrypick e41f8088b0
This commit is contained in:
parent
7c3d40782c
commit
48e8501e27
4 changed files with 45 additions and 13 deletions
|
@ -252,7 +252,11 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 40 : 24,
|
height: isDesktop ? 40 : 24,
|
||||||
),
|
),
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash)
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.epicCash ||
|
||||||
|
(coin == Coin.wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
||||||
|
25))
|
||||||
Text(
|
Text(
|
||||||
"Choose start date",
|
"Choose start date",
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
|
@ -264,11 +268,19 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
: STextStyles.smallMed12(context),
|
: STextStyles.smallMed12(context),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash)
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.epicCash ||
|
||||||
|
(coin == Coin.wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
||||||
|
25))
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 16 : 8,
|
height: isDesktop ? 16 : 8,
|
||||||
),
|
),
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash)
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.epicCash ||
|
||||||
|
(coin == Coin.wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
||||||
|
25))
|
||||||
|
|
||||||
// if (!isDesktop)
|
// if (!isDesktop)
|
||||||
RestoreFromDatePicker(
|
RestoreFromDatePicker(
|
||||||
|
@ -278,11 +290,19 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
|
|
||||||
// if (isDesktop)
|
// if (isDesktop)
|
||||||
// // TODO desktop date picker
|
// // TODO desktop date picker
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash)
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.epicCash ||
|
||||||
|
(coin == Coin.wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
||||||
|
25))
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash)
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.epicCash ||
|
||||||
|
(coin == Coin.wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
||||||
|
25))
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -299,7 +319,11 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (coin == Coin.monero || coin == Coin.epicCash)
|
if (coin == Coin.monero ||
|
||||||
|
coin == Coin.epicCash ||
|
||||||
|
(coin == Coin.wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
||||||
|
25))
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 24 : 16,
|
height: isDesktop ? 24 : 16,
|
||||||
),
|
),
|
||||||
|
|
|
@ -149,6 +149,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: check for wownero wordlist?
|
||||||
bool _isValidMnemonicWord(String word) {
|
bool _isValidMnemonicWord(String word) {
|
||||||
// TODO: get the actual language
|
// TODO: get the actual language
|
||||||
if (widget.coin == Coin.monero) {
|
if (widget.coin == Coin.monero) {
|
||||||
|
@ -181,6 +182,10 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
if (widget.coin == Coin.monero) {
|
if (widget.coin == Coin.monero) {
|
||||||
height = monero.getHeigthByDate(date: widget.restoreFromDate);
|
height = monero.getHeigthByDate(date: widget.restoreFromDate);
|
||||||
}
|
}
|
||||||
|
// todo: wait until this implemented
|
||||||
|
// else if (widget.coin == Coin.wownero) {
|
||||||
|
// height = wownero.getHeightByDate(date: widget.restoreFromDate);
|
||||||
|
// }
|
||||||
|
|
||||||
// TODO: make more robust estimate of date maybe using https://explorer.epic.tech/api-index
|
// TODO: make more robust estimate of date maybe using https://explorer.epic.tech/api-index
|
||||||
if (widget.coin == Coin.epicCash) {
|
if (widget.coin == Coin.epicCash) {
|
||||||
|
|
|
@ -948,6 +948,11 @@ class WowneroWallet extends CoinServiceAPI {
|
||||||
required int maxNumberOfIndexesToCheck,
|
required int maxNumberOfIndexesToCheck,
|
||||||
required int height,
|
required int height,
|
||||||
}) async {
|
}) async {
|
||||||
|
final int seedLength = mnemonic.trim().split(" ").length;
|
||||||
|
if (!(seedLength == 14 || seedLength == 25)) {
|
||||||
|
throw Exception("Invalid wownero mnemonic length found: $seedLength");
|
||||||
|
}
|
||||||
|
|
||||||
await _prefs.init();
|
await _prefs.init();
|
||||||
longMutex = true;
|
longMutex = true;
|
||||||
final start = DateTime.now();
|
final start = DateTime.now();
|
||||||
|
@ -975,8 +980,10 @@ class WowneroWallet extends CoinServiceAPI {
|
||||||
await _secureStore.write(
|
await _secureStore.write(
|
||||||
key: '${_walletId}_mnemonic', value: mnemonic.trim());
|
key: '${_walletId}_mnemonic', value: mnemonic.trim());
|
||||||
|
|
||||||
height = 0;
|
// extract seed height from 14 word seed
|
||||||
//height = getSeedHeightSync(mnemonic.trim()); // TODO use an alternative to wow_seed's get_seed_height
|
if (seedLength == 14) {
|
||||||
|
height = getSeedHeightSync(mnemonic.trim());
|
||||||
|
}
|
||||||
|
|
||||||
await DB.instance
|
await DB.instance
|
||||||
.put<dynamic>(boxName: walletId, key: "restoreHeight", value: height);
|
.put<dynamic>(boxName: walletId, key: "restoreHeight", value: height);
|
||||||
|
|
|
@ -35,10 +35,6 @@ abstract class Constants {
|
||||||
|
|
||||||
static const int pinLength = 4;
|
static const int pinLength = 4;
|
||||||
|
|
||||||
// enable testnet
|
|
||||||
// TODO: currently unused
|
|
||||||
static const bool allowTestnets = true;
|
|
||||||
|
|
||||||
// Enable Logger.print statements
|
// Enable Logger.print statements
|
||||||
static const bool disableLogger = false;
|
static const bool disableLogger = false;
|
||||||
|
|
||||||
|
@ -66,7 +62,7 @@ abstract class Constants {
|
||||||
values.addAll([25]);
|
values.addAll([25]);
|
||||||
break;
|
break;
|
||||||
case Coin.wownero:
|
case Coin.wownero:
|
||||||
values.addAll([14]);
|
values.addAll([14, 25]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
|
|
Loading…
Reference in a new issue