Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix legacy seeds not being displayed when polyseed is not supported #1608

Merged
merged 2 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cw_monero/lib/api/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,23 @@ String getSeed() {

String getSeedLegacy(String? language) {
var legacy = monero.Wallet_seed(wptr!, seedOffset: '');
switch (language) {
case "Chinese (Traditional)": language = "Chinese (simplified)"; break;
case "Chinese (Simplified)": language = "Chinese (simplified)"; break;
case "Korean": language = "English"; break;
case "Czech": language = "English"; break;
case "Japanese": language = "English"; break;
}
if (monero.Wallet_status(wptr!) != 0) {
monero.Wallet_setSeedLanguage(wptr!, language: language ?? "English");
legacy = monero.Wallet_seed(wptr!, seedOffset: '');
}
if (monero.Wallet_status(wptr!) != 0) {
return monero.Wallet_errorString(wptr!);
final err = monero.Wallet_errorString(wptr!);
if (legacy.isNotEmpty) {
return "$err\n\n$legacy";
}
return err;
}
return legacy;
}
Expand Down
9 changes: 5 additions & 4 deletions cw_monero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,11 @@ packages:
polyseed:
dependency: "direct main"
description:
name: polyseed
sha256: edf28042e7b0b28f97a0469aa98e6e4015937cef6b9340cd6ad2822139c95217
url: "https://pub.dev"
source: hosted
path: "."
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
resolved-ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
url: "https://github.com/mrcyjanek/polyseed_dart"
source: git
version: "0.0.5"
pool:
dependency: transitive
Expand Down
5 changes: 4 additions & 1 deletion cw_monero/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ dependencies:
flutter_mobx: ^2.0.6+1
intl: ^0.18.0
encrypt: ^5.0.1
polyseed: ^0.0.5
polyseed:
git:
url: https://github.com/mrcyjanek/polyseed_dart
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
cw_core:
path: ../cw_core
monero:
Expand Down
13 changes: 12 additions & 1 deletion cw_wownero/lib/api/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,23 @@ String getSeed() {

String getSeedLegacy(String? language) {
var legacy = wownero.Wallet_seed(wptr!, seedOffset: '');
switch (language) {
case "Chinese (Traditional)": language = "Chinese (simplified)"; break;
case "Chinese (Simplified)": language = "Chinese (simplified)"; break;
case "Korean": language = "English"; break;
case "Czech": language = "English"; break;
case "Japanese": language = "English"; break;
}
if (wownero.Wallet_status(wptr!) != 0) {
wownero.Wallet_setSeedLanguage(wptr!, language: language ?? "English");
legacy = wownero.Wallet_seed(wptr!, seedOffset: '');
}
if (wownero.Wallet_status(wptr!) != 0) {
return wownero.Wallet_errorString(wptr!);
final err = wownero.Wallet_errorString(wptr!);
if (legacy.isNotEmpty) {
return "$err\n\n$legacy";
}
return err;
}
return legacy;
}
Expand Down
9 changes: 5 additions & 4 deletions cw_wownero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,11 @@ packages:
polyseed:
dependency: "direct main"
description:
name: polyseed
sha256: edf28042e7b0b28f97a0469aa98e6e4015937cef6b9340cd6ad2822139c95217
url: "https://pub.dev"
source: hosted
path: "."
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
resolved-ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
url: "https://github.com/mrcyjanek/polyseed_dart"
source: git
version: "0.0.5"
pool:
dependency: transitive
Expand Down
5 changes: 4 additions & 1 deletion cw_wownero/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ dependencies:
flutter_mobx: ^2.0.6+1
intl: ^0.18.0
encrypt: ^5.0.1
polyseed: ^0.0.5
polyseed:
git:
url: https://github.com/mrcyjanek/polyseed_dart
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
cw_core:
path: ../cw_core
monero:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/seed_language_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SeedLanguagePickerOption {
final List<SeedLanguagePickerOption> seedLanguages = [
SeedLanguagePickerOption('English', S.current.seed_language_english,
Image.asset('assets/images/flags/usa.png'), [SeedType.legacy, SeedType.polyseed]),
SeedLanguagePickerOption('Chinese (simplified)', S.current.seed_language_chinese,
SeedLanguagePickerOption('Chinese (Simplified)', S.current.seed_language_chinese,
Image.asset('assets/images/flags/chn.png'), [SeedType.legacy, SeedType.polyseed]),
SeedLanguagePickerOption('Chinese (Traditional)', S.current.seed_language_chinese_traditional,
Image.asset('assets/images/flags/chn.png'), [SeedType.polyseed]),
Expand Down
5 changes: 4 additions & 1 deletion pubspec_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ dependencies:
# ref: main
socks5_proxy: ^1.0.4
flutter_svg: ^2.0.9
polyseed: ^0.0.5
polyseed:
git:
url: https://github.com/mrcyjanek/polyseed_dart
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
nostr_tools: ^1.0.9
solana: ^0.30.1
bitcoin_base:
Expand Down
Loading