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

disable wownero 14 word seeds #1044

Merged
merged 2 commits into from
Dec 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import '../../../wallets/isar/models/wallet_info.dart';
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../wallets/wallet/impl/monero_wallet.dart';
import '../../../wallets/wallet/impl/wownero_wallet.dart';
import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
import '../../../wallets/wallet/supporting/epiccash_wallet_info_extension.dart';
import '../../../wallets/wallet/wallet.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
Expand Down Expand Up @@ -369,6 +370,10 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {

await wallet.recover(isRescan: false);

if (wallet is LibMoneroWallet) {
await wallet.exit();
}

// check if state is still active before continuing
if (mounted) {
await wallet.info.setMnemonicVerified(
Expand Down
3 changes: 3 additions & 0 deletions lib/wallets/crypto_currency/coins/monero.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class Monero extends CryptonoteCurrency {

@override
bool validateAddress(String address) {
if (address.contains("111")) {
return false;
}
switch (network) {
case CryptoCurrencyNetwork.main:
return xmr_wallet_ffi.validateAddress(address, 0);
Expand Down
7 changes: 5 additions & 2 deletions lib/wallets/crypto_currency/coins/wownero.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class Wownero extends CryptonoteCurrency {

@override
bool validateAddress(String address) {
if (address.contains("111")) {
return false;
}
switch (network) {
case CryptoCurrencyNetwork.main:
return wow_wallet_ffi.validateAddress(address, 0);
Expand Down Expand Up @@ -82,7 +85,7 @@ class Wownero extends CryptonoteCurrency {
}

@override
int get defaultSeedPhraseLength => 14;
int get defaultSeedPhraseLength => 16; //14;

@override
int get fractionDigits => 11;
Expand All @@ -94,7 +97,7 @@ class Wownero extends CryptonoteCurrency {
bool get hasMnemonicPassphraseSupport => false;

@override
List<int> get possibleMnemonicLengths => [defaultSeedPhraseLength, 16, 25];
List<int> get possibleMnemonicLengths => [defaultSeedPhraseLength, 25];

@override
BigInt get satsPerCoin => BigInt.from(100000000000);
Expand Down
6 changes: 1 addition & 5 deletions lib/wallets/wallet/impl/wownero_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ class WowneroWallet extends LibMoneroWallet {
}) async {
final lib_monero.WowneroSeedType type;
switch (wordCount) {
case 14:
type = lib_monero.WowneroSeedType.fourteen;
break;

case 16:
type = lib_monero.WowneroSeedType.sixteen;
break;
Expand Down Expand Up @@ -171,7 +167,7 @@ class WowneroWallet extends LibMoneroWallet {

@override
void invalidSeedLengthCheck(int length) {
if (!(length == 14 || length == 16 || length == 25)) {
if (!(length == 16 || length == 25)) {
throw Exception("Invalid wownero mnemonic length found: $length");
}
}
Expand Down
4 changes: 4 additions & 0 deletions lib/wallets/wallet/intermediate/lib_monero_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
addressIndex: index,
);

if (address.value.contains("111")) {
throw Exception("111 address found!");
}

final newReceivingAddress = Address(
walletId: walletId,
derivationIndex: index,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ packages:
dependency: "direct main"
description:
name: cs_monero
sha256: b9b9db6602361587b1ce512002f174fd833818ff2a63787c3058e0532fc0d9d8
sha256: "8b2c1451d8eb09fc2a1248ecd652f2332343946a1d622b2f623b74d5f999c8d5"
url: "https://pub.dev"
source: hosted
version: "1.0.0-pre"
version: "1.0.0-pre.1"
cs_monero_flutter_libs:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion scripts/app_config/templates/pubspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ dependencies:
blockchain_utils: ^3.3.0
on_chain: ^4.0.1
cbor: ^6.3.3
cs_monero: 1.0.0-pre
cs_monero: 1.0.0-pre.1
cs_monero_flutter_libs: 1.0.0-pre.0

dev_dependencies:
Expand Down
Loading