Add passphrase support for Eth, Polygon, and Tron (#1719)

* Add passphrase support for Eth, Polygon, and Tron

* move passphrase to advanced settings even for restore
This commit is contained in:
Omar Hatem 2024-10-04 20:01:46 +03:00 committed by GitHub
parent fc14bf4e2b
commit 4b4d8a4840
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 249 additions and 154 deletions

View file

@ -83,7 +83,7 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
unspentCoinsInfo: unspentCoinsInfo, unspentCoinsInfo: unspentCoinsInfo,
initialAddresses: initialAddresses, initialAddresses: initialAddresses,
initialBalance: initialBalance, initialBalance: initialBalance,
seedBytes: await MnemonicBip39.toSeed(mnemonic, passphrase: passphrase), seedBytes: MnemonicBip39.toSeed(mnemonic, passphrase: passphrase),
encryptionFileUtils: encryptionFileUtils, encryptionFileUtils: encryptionFileUtils,
initialRegularAddressIndex: initialRegularAddressIndex, initialRegularAddressIndex: initialRegularAddressIndex,
initialChangeAddressIndex: initialChangeAddressIndex, initialChangeAddressIndex: initialChangeAddressIndex,

View file

@ -36,7 +36,7 @@ class BitcoinCashWalletService extends WalletService<
final strength = credentials.seedPhraseLength == 24 ? 256 : 128; final strength = credentials.seedPhraseLength == 24 ? 256 : 128;
final wallet = await BitcoinCashWalletBase.create( final wallet = await BitcoinCashWalletBase.create(
mnemonic: credentials.mnemonic ?? await MnemonicBip39.generate(strength: strength), mnemonic: credentials.mnemonic ?? MnemonicBip39.generate(strength: strength),
password: credentials.password!, password: credentials.password!,
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
unspentCoinsInfo: unspentCoinsInfoSource, unspentCoinsInfo: unspentCoinsInfoSource,

View file

@ -27,6 +27,7 @@ class EthereumWallet extends EVMChainWallet {
super.initialBalance, super.initialBalance,
super.privateKey, super.privateKey,
required super.encryptionFileUtils, required super.encryptionFileUtils,
super.passphrase,
}) : super(nativeCurrency: CryptoCurrency.eth); }) : super(nativeCurrency: CryptoCurrency.eth);
@override @override
@ -150,8 +151,9 @@ class EthereumWallet extends EVMChainWallet {
if (!hasKeysFile) { if (!hasKeysFile) {
final mnemonic = data!['mnemonic'] as String?; final mnemonic = data!['mnemonic'] as String?;
final privateKey = data['private_key'] as String?; final privateKey = data['private_key'] as String?;
final passphrase = data['passphrase'] as String?;
keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey); keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey, passphrase: passphrase);
} else { } else {
keysData = await WalletKeysFile.readKeysFile( keysData = await WalletKeysFile.readKeysFile(
name, name,
@ -166,6 +168,7 @@ class EthereumWallet extends EVMChainWallet {
password: password, password: password,
mnemonic: keysData.mnemonic, mnemonic: keysData.mnemonic,
privateKey: keysData.privateKey, privateKey: keysData.privateKey,
passphrase: keysData.passphrase,
initialBalance: balance, initialBalance: balance,
client: EthereumClient(), client: EthereumClient(),
encryptionFileUtils: encryptionFileUtils, encryptionFileUtils: encryptionFileUtils,

View file

@ -27,6 +27,7 @@ class EthereumWalletService extends EVMChainWalletService<EthereumWallet> {
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
mnemonic: mnemonic, mnemonic: mnemonic,
password: credentials.password!, password: credentials.password!,
passphrase: credentials.passphrase,
client: client, client: client,
encryptionFileUtils: encryptionFileUtilsFor(isDirect), encryptionFileUtils: encryptionFileUtilsFor(isDirect),
); );
@ -144,6 +145,7 @@ class EthereumWalletService extends EVMChainWalletService<EthereumWallet> {
password: credentials.password!, password: credentials.password!,
mnemonic: credentials.mnemonic, mnemonic: credentials.mnemonic,
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
passphrase: credentials.passphrase,
client: client, client: client,
encryptionFileUtils: encryptionFileUtilsFor(isDirect), encryptionFileUtils: encryptionFileUtilsFor(isDirect),
); );

View file

@ -70,6 +70,7 @@ abstract class EVMChainWalletBase
required String password, required String password,
EVMChainERC20Balance? initialBalance, EVMChainERC20Balance? initialBalance,
required this.encryptionFileUtils, required this.encryptionFileUtils,
this.passphrase,
}) : syncStatus = const NotConnectedSyncStatus(), }) : syncStatus = const NotConnectedSyncStatus(),
_password = password, _password = password,
_mnemonic = mnemonic, _mnemonic = mnemonic,
@ -178,6 +179,7 @@ abstract class EVMChainWalletBase
mnemonic: _mnemonic, mnemonic: _mnemonic,
privateKey: _hexPrivateKey, privateKey: _hexPrivateKey,
password: _password, password: _password,
passphrase: passphrase,
); );
walletAddresses.address = _evmChainPrivateKey.address.hexEip55; walletAddresses.address = _evmChainPrivateKey.address.hexEip55;
} }
@ -545,6 +547,7 @@ abstract class EVMChainWalletBase
'mnemonic': _mnemonic, 'mnemonic': _mnemonic,
'private_key': privateKey, 'private_key': privateKey,
'balance': balance[currency]!.toJSON(), 'balance': balance[currency]!.toJSON(),
'passphrase': passphrase,
}); });
Future<void> _updateBalance() async { Future<void> _updateBalance() async {
@ -574,15 +577,19 @@ abstract class EVMChainWalletBase
} }
} }
Future<EthPrivateKey> getPrivateKey( Future<EthPrivateKey> getPrivateKey({
{String? mnemonic, String? privateKey, required String password}) async { String? mnemonic,
String? privateKey,
required String password,
String? passphrase,
}) async {
assert(mnemonic != null || privateKey != null); assert(mnemonic != null || privateKey != null);
if (privateKey != null) { if (privateKey != null) {
return EthPrivateKey.fromHex(privateKey); return EthPrivateKey.fromHex(privateKey);
} }
final seed = bip39.mnemonicToSeed(mnemonic!); final seed = bip39.mnemonicToSeed(mnemonic!, passphrase: passphrase ?? '');
final root = bip32.BIP32.fromSeed(seed); final root = bip32.BIP32.fromSeed(seed);
@ -716,4 +723,7 @@ abstract class EVMChainWalletBase
@override @override
String get password => _password; String get password => _password;
@override
final String? passphrase;
} }

View file

@ -4,28 +4,25 @@ import 'package:cw_core/wallet_info.dart';
class EVMChainNewWalletCredentials extends WalletCredentials { class EVMChainNewWalletCredentials extends WalletCredentials {
EVMChainNewWalletCredentials({ EVMChainNewWalletCredentials({
required String name, required super.name,
WalletInfo? walletInfo, super.walletInfo,
String? password, super.password,
String? parentAddress, super.parentAddress,
this.mnemonic, this.mnemonic,
}) : super( super.passphrase,
name: name, });
walletInfo: walletInfo,
password: password,
parentAddress: parentAddress,
);
final String? mnemonic; final String? mnemonic;
} }
class EVMChainRestoreWalletFromSeedCredentials extends WalletCredentials { class EVMChainRestoreWalletFromSeedCredentials extends WalletCredentials {
EVMChainRestoreWalletFromSeedCredentials({ EVMChainRestoreWalletFromSeedCredentials({
required String name, required super.name,
required String password, required super.password,
required this.mnemonic, required this.mnemonic,
WalletInfo? walletInfo, super.walletInfo,
}) : super(name: name, password: password, walletInfo: walletInfo); super.passphrase,
});
final String mnemonic; final String mnemonic;
} }

View file

@ -42,6 +42,7 @@ abstract class NanoWalletBase
required String password, required String password,
NanoBalance? initialBalance, NanoBalance? initialBalance,
required EncryptionFileUtils encryptionFileUtils, required EncryptionFileUtils encryptionFileUtils,
this.passphrase,
}) : syncStatus = NotConnectedSyncStatus(), }) : syncStatus = NotConnectedSyncStatus(),
_password = password, _password = password,
_mnemonic = mnemonic, _mnemonic = mnemonic,
@ -548,4 +549,7 @@ abstract class NanoWalletBase
} }
return await NanoSignatures.verifyMessage(message, signature, address); return await NanoSignatures.verifyMessage(message, signature, address);
} }
@override
final String? passphrase;
} }

View file

@ -9,11 +9,13 @@ class NanoNewWalletCredentials extends WalletCredentials {
DerivationType? derivationType, DerivationType? derivationType,
this.mnemonic, this.mnemonic,
String? parentAddress, String? parentAddress,
String? passphrase,
}) : super( }) : super(
name: name, name: name,
password: password, password: password,
walletInfo: walletInfo, walletInfo: walletInfo,
parentAddress: parentAddress, parentAddress: parentAddress,
passphrase: passphrase,
); );
final String? mnemonic; final String? mnemonic;
@ -25,10 +27,12 @@ class NanoRestoreWalletFromSeedCredentials extends WalletCredentials {
required this.mnemonic, required this.mnemonic,
String? password, String? password,
required DerivationType derivationType, required DerivationType derivationType,
String? passphrase,
}) : super( }) : super(
name: name, name: name,
password: password, password: password,
derivationInfo: DerivationInfo(derivationType: derivationType), derivationInfo: DerivationInfo(derivationType: derivationType),
passphrase: passphrase,
); );
final String mnemonic; final String mnemonic;

View file

@ -27,6 +27,7 @@ class PolygonWallet extends EVMChainWallet {
super.privateKey, super.privateKey,
required super.client, required super.client,
required super.encryptionFileUtils, required super.encryptionFileUtils,
super.passphrase,
}) : super(nativeCurrency: CryptoCurrency.maticpoly); }) : super(nativeCurrency: CryptoCurrency.maticpoly);
@override @override
@ -128,8 +129,9 @@ class PolygonWallet extends EVMChainWallet {
if (!hasKeysFile) { if (!hasKeysFile) {
final mnemonic = data!['mnemonic'] as String?; final mnemonic = data!['mnemonic'] as String?;
final privateKey = data['private_key'] as String?; final privateKey = data['private_key'] as String?;
final passphrase = data['passphrase'] as String?;
keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey); keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey, passphrase: passphrase);
} else { } else {
keysData = await WalletKeysFile.readKeysFile( keysData = await WalletKeysFile.readKeysFile(
name, name,
@ -144,6 +146,7 @@ class PolygonWallet extends EVMChainWallet {
password: password, password: password,
mnemonic: keysData.mnemonic, mnemonic: keysData.mnemonic,
privateKey: keysData.privateKey, privateKey: keysData.privateKey,
passphrase: keysData.passphrase,
initialBalance: balance, initialBalance: balance,
client: PolygonClient(), client: PolygonClient(),
encryptionFileUtils: encryptionFileUtils, encryptionFileUtils: encryptionFileUtils,

View file

@ -30,6 +30,7 @@ class PolygonWalletService extends EVMChainWalletService<PolygonWallet> {
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
mnemonic: mnemonic, mnemonic: mnemonic,
password: credentials.password!, password: credentials.password!,
passphrase: credentials.passphrase,
client: client, client: client,
encryptionFileUtils: encryptionFileUtilsFor(isDirect), encryptionFileUtils: encryptionFileUtilsFor(isDirect),
); );
@ -125,6 +126,7 @@ class PolygonWalletService extends EVMChainWalletService<PolygonWallet> {
password: credentials.password!, password: credentials.password!,
mnemonic: credentials.mnemonic, mnemonic: credentials.mnemonic,
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
passphrase: credentials.passphrase,
client: client, client: client,
encryptionFileUtils: encryptionFileUtilsFor(isDirect), encryptionFileUtils: encryptionFileUtilsFor(isDirect),
); );

View file

@ -33,7 +33,6 @@ import 'package:solana/base58.dart';
import 'package:solana/metaplex.dart' as metaplex; import 'package:solana/metaplex.dart' as metaplex;
import 'package:solana/solana.dart'; import 'package:solana/solana.dart';
import 'package:solana/src/crypto/ed25519_hd_keypair.dart'; import 'package:solana/src/crypto/ed25519_hd_keypair.dart';
import 'package:cryptography/cryptography.dart';
part 'solana_wallet.g.dart'; part 'solana_wallet.g.dart';
@ -49,6 +48,7 @@ abstract class SolanaWalletBase
required String password, required String password,
SolanaBalance? initialBalance, SolanaBalance? initialBalance,
required this.encryptionFileUtils, required this.encryptionFileUtils,
this.passphrase,
}) : syncStatus = const NotConnectedSyncStatus(), }) : syncStatus = const NotConnectedSyncStatus(),
_password = password, _password = password,
_mnemonic = mnemonic, _mnemonic = mnemonic,
@ -632,4 +632,7 @@ abstract class SolanaWalletBase
@override @override
String get password => _password; String get password => _password;
@override
final String? passphrase;
} }

View file

@ -8,22 +8,30 @@ class SolanaNewWalletCredentials extends WalletCredentials {
String? password, String? password,
String? parentAddress, String? parentAddress,
this.mnemonic, this.mnemonic,
String? passphrase,
}) : super( }) : super(
name: name, name: name,
walletInfo: walletInfo, walletInfo: walletInfo,
password: password, password: password,
parentAddress: parentAddress, parentAddress: parentAddress,
passphrase: passphrase,
); );
final String? mnemonic; final String? mnemonic;
} }
class SolanaRestoreWalletFromSeedCredentials extends WalletCredentials { class SolanaRestoreWalletFromSeedCredentials extends WalletCredentials {
SolanaRestoreWalletFromSeedCredentials( SolanaRestoreWalletFromSeedCredentials({
{required String name, required String name,
required String password, required String password,
required this.mnemonic, required this.mnemonic,
WalletInfo? walletInfo}) WalletInfo? walletInfo,
: super(name: name, password: password, walletInfo: walletInfo); String? passphrase,
}) : super(
name: name,
password: password,
walletInfo: walletInfo,
passphrase: passphrase,
);
final String mnemonic; final String mnemonic;
} }

View file

@ -47,6 +47,7 @@ abstract class TronWalletBase
required String password, required String password,
TronBalance? initialBalance, TronBalance? initialBalance,
required this.encryptionFileUtils, required this.encryptionFileUtils,
this.passphrase,
}) : syncStatus = const NotConnectedSyncStatus(), }) : syncStatus = const NotConnectedSyncStatus(),
_password = password, _password = password,
_mnemonic = mnemonic, _mnemonic = mnemonic,
@ -113,6 +114,7 @@ abstract class TronWalletBase
mnemonic: _mnemonic, mnemonic: _mnemonic,
privateKey: _hexPrivateKey, privateKey: _hexPrivateKey,
password: _password, password: _password,
passphrase: passphrase,
); );
_tronPublicKey = _tronPrivateKey.publicKey(); _tronPublicKey = _tronPrivateKey.publicKey();
@ -149,8 +151,9 @@ abstract class TronWalletBase
if (!hasKeysFile) { if (!hasKeysFile) {
final mnemonic = data!['mnemonic'] as String?; final mnemonic = data!['mnemonic'] as String?;
final privateKey = data['private_key'] as String?; final privateKey = data['private_key'] as String?;
final passphrase = data['passphrase'] as String?;
keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey); keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey, passphrase: passphrase);
} else { } else {
keysData = await WalletKeysFile.readKeysFile( keysData = await WalletKeysFile.readKeysFile(
name, name,
@ -165,6 +168,7 @@ abstract class TronWalletBase
password: password, password: password,
mnemonic: keysData.mnemonic, mnemonic: keysData.mnemonic,
privateKey: keysData.privateKey, privateKey: keysData.privateKey,
passphrase: keysData.passphrase,
initialBalance: balance, initialBalance: balance,
encryptionFileUtils: encryptionFileUtils, encryptionFileUtils: encryptionFileUtils,
); );
@ -190,12 +194,13 @@ abstract class TronWalletBase
String? mnemonic, String? mnemonic,
String? privateKey, String? privateKey,
required String password, required String password,
String? passphrase,
}) async { }) async {
assert(mnemonic != null || privateKey != null); assert(mnemonic != null || privateKey != null);
if (privateKey != null) return TronPrivateKey(privateKey); if (privateKey != null) return TronPrivateKey(privateKey);
final seed = bip39.mnemonicToSeed(mnemonic!); final seed = bip39.mnemonicToSeed(mnemonic!, passphrase: passphrase ?? '');
// Derive a TRON private key from the seed // Derive a TRON private key from the seed
final bip44 = Bip44.fromSeed(seed, Bip44Coins.tron); final bip44 = Bip44.fromSeed(seed, Bip44Coins.tron);
@ -463,6 +468,7 @@ abstract class TronWalletBase
'mnemonic': _mnemonic, 'mnemonic': _mnemonic,
'private_key': privateKey, 'private_key': privateKey,
'balance': balance[currency]!.toJSON(), 'balance': balance[currency]!.toJSON(),
'passphrase': passphrase,
}); });
Future<void> _updateBalance() async { Future<void> _updateBalance() async {
@ -607,4 +613,7 @@ abstract class TronWalletBase
@override @override
String get password => _password; String get password => _password;
@override
final String? passphrase;
} }

View file

@ -8,23 +8,31 @@ class TronNewWalletCredentials extends WalletCredentials {
String? password, String? password,
this.mnemonic, this.mnemonic,
String? parentAddress, String? parentAddress,
String? passphrase,
}) : super( }) : super(
name: name, name: name,
walletInfo: walletInfo, walletInfo: walletInfo,
password: password, password: password,
parentAddress: parentAddress, parentAddress: parentAddress,
passphrase: passphrase,
); );
final String? mnemonic; final String? mnemonic;
} }
class TronRestoreWalletFromSeedCredentials extends WalletCredentials { class TronRestoreWalletFromSeedCredentials extends WalletCredentials {
TronRestoreWalletFromSeedCredentials( TronRestoreWalletFromSeedCredentials({
{required String name, required String name,
required String password, required String password,
required this.mnemonic, required this.mnemonic,
WalletInfo? walletInfo}) WalletInfo? walletInfo,
: super(name: name, password: password, walletInfo: walletInfo); String? passphrase,
}) : super(
name: name,
password: password,
walletInfo: walletInfo,
passphrase: passphrase,
);
final String mnemonic; final String mnemonic;
} }

View file

@ -33,10 +33,7 @@ class TronWalletService extends WalletService<
WalletType getType() => WalletType.tron; WalletType getType() => WalletType.tron;
@override @override
Future<TronWallet> create( Future<TronWallet> create(TronNewWalletCredentials credentials, {bool? isTestnet}) async {
TronNewWalletCredentials credentials, {
bool? isTestnet,
}) async {
final strength = credentials.seedPhraseLength == 24 ? 256 : 128; final strength = credentials.seedPhraseLength == 24 ? 256 : 128;
final mnemonic = credentials.mnemonic ?? bip39.generateMnemonic(strength: strength); final mnemonic = credentials.mnemonic ?? bip39.generateMnemonic(strength: strength);
@ -45,6 +42,7 @@ class TronWalletService extends WalletService<
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
mnemonic: mnemonic, mnemonic: mnemonic,
password: credentials.password!, password: credentials.password!,
passphrase: credentials.passphrase,
encryptionFileUtils: encryptionFileUtilsFor(isDirect), encryptionFileUtils: encryptionFileUtilsFor(isDirect),
); );
@ -120,6 +118,7 @@ class TronWalletService extends WalletService<
password: credentials.password!, password: credentials.password!,
mnemonic: credentials.mnemonic, mnemonic: credentials.mnemonic,
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
passphrase: credentials.passphrase,
encryptionFileUtils: encryptionFileUtilsFor(isDirect), encryptionFileUtils: encryptionFileUtilsFor(isDirect),
); );

View file

@ -1,10 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
const channel = MethodChannel('com.cake_wallet/native_utils');
Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async { Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async {
var address = ''; var address = '';

View file

@ -14,6 +14,7 @@ class CWEthereum extends Ethereum {
String? parentAddress, String? parentAddress,
WalletInfo? walletInfo, WalletInfo? walletInfo,
String? password, String? password,
String? passphrase,
}) => }) =>
EVMChainNewWalletCredentials( EVMChainNewWalletCredentials(
name: name, name: name,
@ -21,6 +22,7 @@ class CWEthereum extends Ethereum {
password: password, password: password,
parentAddress: parentAddress, parentAddress: parentAddress,
mnemonic: mnemonic, mnemonic: mnemonic,
passphrase: passphrase,
); );
@override @override
@ -28,8 +30,14 @@ class CWEthereum extends Ethereum {
required String name, required String name,
required String mnemonic, required String mnemonic,
required String password, required String password,
String? passphrase,
}) => }) =>
EVMChainRestoreWalletFromSeedCredentials(name: name, password: password, mnemonic: mnemonic); EVMChainRestoreWalletFromSeedCredentials(
name: name,
password: password,
mnemonic: mnemonic,
passphrase: passphrase,
);
@override @override
WalletCredentials createEthereumRestoreWalletFromPrivateKey({ WalletCredentials createEthereumRestoreWalletFromPrivateKey({

View file

@ -95,6 +95,7 @@ class CWNano extends Nano {
String? password, String? password,
String? mnemonic, String? mnemonic,
String? parentAddress, String? parentAddress,
String? passphrase,
}) => }) =>
NanoNewWalletCredentials( NanoNewWalletCredentials(
name: name, name: name,
@ -102,6 +103,7 @@ class CWNano extends Nano {
mnemonic: mnemonic, mnemonic: mnemonic,
parentAddress: parentAddress, parentAddress: parentAddress,
walletInfo: walletInfo, walletInfo: walletInfo,
passphrase: passphrase,
); );
@override @override
@ -110,6 +112,7 @@ class CWNano extends Nano {
required String password, required String password,
required String mnemonic, required String mnemonic,
required DerivationType derivationType, required DerivationType derivationType,
String? passphrase,
}) { }) {
if (mnemonic.split(" ").length == 12 && derivationType != DerivationType.bip39) { if (mnemonic.split(" ").length == 12 && derivationType != DerivationType.bip39) {
throw Exception("Invalid mnemonic for derivation type!"); throw Exception("Invalid mnemonic for derivation type!");
@ -120,6 +123,7 @@ class CWNano extends Nano {
password: password, password: password,
mnemonic: mnemonic, mnemonic: mnemonic,
derivationType: derivationType, derivationType: derivationType,
passphrase: passphrase,
); );
} }

View file

@ -8,18 +8,21 @@ class CWPolygon extends Polygon {
PolygonWalletService(walletInfoSource, isDirect, client: PolygonClient()); PolygonWalletService(walletInfoSource, isDirect, client: PolygonClient());
@override @override
WalletCredentials createPolygonNewWalletCredentials( WalletCredentials createPolygonNewWalletCredentials({
{required String name, required String name,
String? mnemonic, String? mnemonic,
String? parentAddress, String? parentAddress,
WalletInfo? walletInfo, WalletInfo? walletInfo,
String? password}) => String? password,
String? passphrase,
}) =>
EVMChainNewWalletCredentials( EVMChainNewWalletCredentials(
name: name, name: name,
walletInfo: walletInfo, walletInfo: walletInfo,
password: password, password: password,
mnemonic: mnemonic, mnemonic: mnemonic,
parentAddress: parentAddress, parentAddress: parentAddress,
passphrase: passphrase,
); );
@override @override
@ -27,8 +30,14 @@ class CWPolygon extends Polygon {
required String name, required String name,
required String mnemonic, required String mnemonic,
required String password, required String password,
String? passphrase,
}) => }) =>
EVMChainRestoreWalletFromSeedCredentials(name: name, password: password, mnemonic: mnemonic); EVMChainRestoreWalletFromSeedCredentials(
name: name,
password: password,
mnemonic: mnemonic,
passphrase: passphrase,
);
@override @override
WalletCredentials createPolygonRestoreWalletFromPrivateKey({ WalletCredentials createPolygonRestoreWalletFromPrivateKey({

View file

@ -14,6 +14,7 @@ class CWSolana extends Solana {
String? parentAddress, String? parentAddress,
WalletInfo? walletInfo, WalletInfo? walletInfo,
String? password, String? password,
String? passphrase,
}) => }) =>
SolanaNewWalletCredentials( SolanaNewWalletCredentials(
name: name, name: name,
@ -21,6 +22,7 @@ class CWSolana extends Solana {
password: password, password: password,
mnemonic: mnemonic, mnemonic: mnemonic,
parentAddress: parentAddress, parentAddress: parentAddress,
passphrase: passphrase,
); );
@override @override
@ -28,8 +30,14 @@ class CWSolana extends Solana {
required String name, required String name,
required String mnemonic, required String mnemonic,
required String password, required String password,
String? passphrase,
}) => }) =>
SolanaRestoreWalletFromSeedCredentials(name: name, password: password, mnemonic: mnemonic); SolanaRestoreWalletFromSeedCredentials(
name: name,
password: password,
mnemonic: mnemonic,
passphrase: passphrase,
);
@override @override
WalletCredentials createSolanaRestoreWalletFromPrivateKey({ WalletCredentials createSolanaRestoreWalletFromPrivateKey({

View file

@ -189,7 +189,7 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
), ),
); );
}), }),
if (!widget.isFromRestore) ...[ if (!widget.isFromRestore)
Observer(builder: (_) { Observer(builder: (_) {
if (widget.privacySettingsViewModel.hasSeedPhraseLengthOption) if (widget.privacySettingsViewModel.hasSeedPhraseLengthOption)
return SettingsPickerCell<SeedPhraseLength>( return SettingsPickerCell<SeedPhraseLength>(
@ -202,54 +202,53 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
); );
return Container(); return Container();
}), }),
if (widget.privacySettingsViewModel.hasPassphraseOption) if (widget.privacySettingsViewModel.hasPassphraseOption)
Padding( Padding(
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
child: Form( child: Form(
key: _passphraseFormKey, key: _passphraseFormKey,
child: Column( child: Column(
children: [ children: [
BaseTextFormField( BaseTextFormField(
hintText: S.of(context).passphrase, hintText: S.of(context).passphrase,
controller: passphraseController, controller: passphraseController,
obscureText: obscurePassphrase, obscureText: obscurePassphrase,
suffixIcon: GestureDetector( suffixIcon: GestureDetector(
onTap: () => setState(() { onTap: () => setState(() {
obscurePassphrase = !obscurePassphrase; obscurePassphrase = !obscurePassphrase;
}), }),
child: Icon( child: Icon(
Icons.remove_red_eye, Icons.remove_red_eye,
color: obscurePassphrase ? Colors.black54 : Colors.black26, color: obscurePassphrase ? Colors.black54 : Colors.black26,
),
), ),
), ),
const SizedBox(height: 10), ),
BaseTextFormField( const SizedBox(height: 10),
hintText: S.of(context).confirm_passphrase, BaseTextFormField(
controller: confirmPassphraseController, hintText: S.of(context).confirm_passphrase,
obscureText: obscurePassphrase, controller: confirmPassphraseController,
validator: (text) { obscureText: obscurePassphrase,
if (text == passphraseController.text) { validator: (text) {
return null; if (text == passphraseController.text) {
} return null;
}
return S.of(context).passphrases_doesnt_match; return S.of(context).passphrases_doesnt_match;
}, },
suffixIcon: GestureDetector( suffixIcon: GestureDetector(
onTap: () => setState(() { onTap: () => setState(() {
obscurePassphrase = !obscurePassphrase; obscurePassphrase = !obscurePassphrase;
}), }),
child: Icon( child: Icon(
Icons.remove_red_eye, Icons.remove_red_eye,
color: obscurePassphrase ? Colors.black54 : Colors.black26, color: obscurePassphrase ? Colors.black54 : Colors.black26,
),
), ),
), ),
], ),
), ],
), ),
), ),
], ),
Observer(builder: (_) { Observer(builder: (_) {
return Column( return Column(
children: [ children: [
@ -311,13 +310,14 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
widget.nodeViewModel.save(); widget.nodeViewModel.save();
} }
if (passphraseController.text.isNotEmpty) { if (passphraseController.text.isNotEmpty) {
if (_passphraseFormKey.currentState != null && !_passphraseFormKey.currentState!.validate()) { if (_passphraseFormKey.currentState != null &&
!_passphraseFormKey.currentState!.validate()) {
return; return;
} }
widget.seedTypeViewModel.setPassphrase(passphraseController.text);
} }
widget.seedTypeViewModel.setPassphrase(passphraseController.text);
Navigator.pop(context); Navigator.pop(context);
}, },
text: S.of(context).continue_text, text: S.of(context).continue_text,

View file

@ -19,7 +19,6 @@ class WalletRestoreFromSeedForm extends StatefulWidget {
WalletRestoreFromSeedForm({Key? key, WalletRestoreFromSeedForm({Key? key,
required this.displayLanguageSelector, required this.displayLanguageSelector,
required this.displayBlockHeightSelector, required this.displayBlockHeightSelector,
required this.displayPassphrase,
required this.type, required this.type,
required this.displayWalletPassword, required this.displayWalletPassword,
required this.seedSettingsViewModel, required this.seedSettingsViewModel,
@ -35,7 +34,6 @@ class WalletRestoreFromSeedForm extends StatefulWidget {
final bool displayLanguageSelector; final bool displayLanguageSelector;
final bool displayBlockHeightSelector; final bool displayBlockHeightSelector;
final bool displayWalletPassword; final bool displayWalletPassword;
final bool displayPassphrase;
final SeedSettingsViewModel seedSettingsViewModel; final SeedSettingsViewModel seedSettingsViewModel;
final FocusNode? blockHeightFocusNode; final FocusNode? blockHeightFocusNode;
final Function(bool)? onHeightOrDateEntered; final Function(bool)? onHeightOrDateEntered;
@ -60,7 +58,6 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
repeatedPasswordTextEditingController = displayWalletPassword repeatedPasswordTextEditingController = displayWalletPassword
? TextEditingController() ? TextEditingController()
: null, : null,
passphraseController = TextEditingController(),
seedTypeController = TextEditingController(); seedTypeController = TextEditingController();
final GlobalKey<SeedWidgetState> seedWidgetStateKey; final GlobalKey<SeedWidgetState> seedWidgetStateKey;
@ -70,15 +67,11 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
final TextEditingController? passwordTextEditingController; final TextEditingController? passwordTextEditingController;
final TextEditingController? repeatedPasswordTextEditingController; final TextEditingController? repeatedPasswordTextEditingController;
final TextEditingController seedTypeController; final TextEditingController seedTypeController;
final TextEditingController passphraseController;
final GlobalKey<FormState> formKey; final GlobalKey<FormState> formKey;
late ReactionDisposer moneroSeedTypeReaction; late ReactionDisposer moneroSeedTypeReaction;
String language; String language;
void Function()? passwordListener; void Function()? passwordListener;
void Function()? repeatedPasswordListener; void Function()? repeatedPasswordListener;
void Function()? passphraseListener;
bool obscurePassphrase = true;
@override @override
void initState() { void initState() {
@ -96,9 +89,6 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
repeatedPasswordTextEditingController?.addListener(repeatedPasswordListener!); repeatedPasswordTextEditingController?.addListener(repeatedPasswordListener!);
} }
passphraseListener = () => widget.seedSettingsViewModel.setPassphrase(passphraseController.text);
passphraseController.addListener(passphraseListener!);
moneroSeedTypeReaction = moneroSeedTypeReaction =
reaction((_) => widget.seedSettingsViewModel.moneroSeedType, (MoneroSeedType item) { reaction((_) => widget.seedSettingsViewModel.moneroSeedType, (MoneroSeedType item) {
_setSeedType(item); _setSeedType(item);
@ -120,8 +110,6 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
repeatedPasswordTextEditingController?.removeListener(repeatedPasswordListener!); repeatedPasswordTextEditingController?.removeListener(repeatedPasswordListener!);
} }
passphraseController.removeListener(passphraseListener!);
super.dispose(); super.dispose();
} }
@ -280,23 +268,6 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
hasDatePicker: widget.type == WalletType.monero || widget.type == WalletType.wownero, hasDatePicker: widget.type == WalletType.monero || widget.type == WalletType.wownero,
walletType: widget.type, walletType: widget.type,
), ),
if (widget.displayPassphrase) ...[
const SizedBox(height: 10),
BaseTextFormField(
hintText: S.current.passphrase,
controller: passphraseController,
obscureText: obscurePassphrase,
suffixIcon: GestureDetector(
onTap: () => setState(() {
obscurePassphrase = !obscurePassphrase;
}),
child: Icon(
Icons.remove_red_eye,
color: obscurePassphrase ? Colors.black54 : Colors.black26,
),
),
),
]
])); ]));
} }

View file

@ -37,7 +37,6 @@ class WalletRestorePage extends BasePage {
displayBlockHeightSelector: displayBlockHeightSelector:
walletRestoreViewModel.hasBlockchainHeightLanguageSelector, walletRestoreViewModel.hasBlockchainHeightLanguageSelector,
displayLanguageSelector: walletRestoreViewModel.hasSeedLanguageSelector, displayLanguageSelector: walletRestoreViewModel.hasSeedLanguageSelector,
displayPassphrase: walletRestoreViewModel.hasPassphrase,
type: walletRestoreViewModel.type, type: walletRestoreViewModel.type,
key: walletRestoreFromSeedFormKey, key: walletRestoreFromSeedFormKey,
blockHeightFocusNode: _blockHeightFocusNode, blockHeightFocusNode: _blockHeightFocusNode,
@ -320,9 +319,7 @@ class WalletRestorePage extends BasePage {
-1; -1;
} }
if (walletRestoreViewModel.hasPassphrase) { credentials['passphrase'] = seedSettingsViewModel.passphrase;
credentials['passphrase'] = seedSettingsViewModel.passphrase;
}
credentials['name'] = credentials['name'] =
walletRestoreFromSeedFormKey.currentState!.nameTextEditingController.text; walletRestoreFromSeedFormKey.currentState!.nameTextEditingController.text;

View file

@ -15,12 +15,14 @@ class CWTron extends Tron {
String? password, String? password,
String? mnemonic, String? mnemonic,
String? parentAddress, String? parentAddress,
String? passphrase,
}) => }) =>
TronNewWalletCredentials( TronNewWalletCredentials(
name: name, name: name,
walletInfo: walletInfo, walletInfo: walletInfo,
password: password, password: password,
mnemonic: mnemonic, mnemonic: mnemonic,
passphrase: passphrase,
parentAddress: parentAddress); parentAddress: parentAddress);
@override @override
@ -28,8 +30,14 @@ class CWTron extends Tron {
required String name, required String name,
required String mnemonic, required String mnemonic,
required String password, required String password,
String? passphrase,
}) => }) =>
TronRestoreWalletFromSeedCredentials(name: name, password: password, mnemonic: mnemonic); TronRestoreWalletFromSeedCredentials(
name: name,
password: password,
mnemonic: mnemonic,
passphrase: passphrase,
);
@override @override
WalletCredentials createTronRestoreWalletFromPrivateKey({ WalletCredentials createTronRestoreWalletFromPrivateKey({

View file

@ -75,6 +75,9 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
WalletType.bitcoin, WalletType.bitcoin,
WalletType.litecoin, WalletType.litecoin,
WalletType.bitcoinCash, WalletType.bitcoinCash,
WalletType.ethereum,
WalletType.polygon,
WalletType.tron,
].contains(type); ].contains(type);
@computed @computed

View file

@ -26,14 +26,19 @@ part 'restore_from_qr_vm.g.dart';
class WalletRestorationFromQRVM = WalletRestorationFromQRVMBase with _$WalletRestorationFromQRVM; class WalletRestorationFromQRVM = WalletRestorationFromQRVMBase with _$WalletRestorationFromQRVM;
abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store { abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store {
WalletRestorationFromQRVMBase(AppStore appStore, WalletCreationService walletCreationService, WalletRestorationFromQRVMBase(
Box<WalletInfo> walletInfoSource, WalletType type, SeedSettingsViewModel seedSettingsViewModel) AppStore appStore,
WalletCreationService walletCreationService,
Box<WalletInfo> walletInfoSource,
WalletType type,
SeedSettingsViewModel seedSettingsViewModel)
: height = 0, : height = 0,
viewKey = '', viewKey = '',
spendKey = '', spendKey = '',
wif = '', wif = '',
address = '', address = '',
super(appStore, walletInfoSource, walletCreationService, seedSettingsViewModel, type: type, isRecovery: true); super(appStore, walletInfoSource, walletCreationService, seedSettingsViewModel,
type: type, isRecovery: true);
@observable @observable
int height; int height;
@ -124,26 +129,44 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
name: name, name: name,
mnemonic: restoreWallet.mnemonicSeed ?? '', mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password, password: password,
passphrase: restoreWallet.passphrase,
); );
case WalletType.ethereum: case WalletType.ethereum:
return ethereum!.createEthereumRestoreWalletFromSeedCredentials( return ethereum!.createEthereumRestoreWalletFromSeedCredentials(
name: name, mnemonic: restoreWallet.mnemonicSeed ?? '', password: password); name: name,
mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password,
passphrase: restoreWallet.passphrase,
);
case WalletType.nano: case WalletType.nano:
return nano!.createNanoRestoreWalletFromSeedCredentials( return nano!.createNanoRestoreWalletFromSeedCredentials(
name: name, name: name,
mnemonic: restoreWallet.mnemonicSeed ?? '', mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password, password: password,
derivationType: derivationInfo!.derivationType!, derivationType: derivationInfo!.derivationType!,
passphrase: restoreWallet.passphrase,
); );
case WalletType.polygon: case WalletType.polygon:
return polygon!.createPolygonRestoreWalletFromSeedCredentials( return polygon!.createPolygonRestoreWalletFromSeedCredentials(
name: name, mnemonic: restoreWallet.mnemonicSeed ?? '', password: password); name: name,
mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password,
passphrase: restoreWallet.passphrase,
);
case WalletType.solana: case WalletType.solana:
return solana!.createSolanaRestoreWalletFromSeedCredentials( return solana!.createSolanaRestoreWalletFromSeedCredentials(
name: name, mnemonic: restoreWallet.mnemonicSeed ?? '', password: password); name: name,
mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password,
passphrase: restoreWallet.passphrase,
);
case WalletType.tron: case WalletType.tron:
return tron!.createTronRestoreWalletFromSeedCredentials( return tron!.createTronRestoreWalletFromSeedCredentials(
name: name, mnemonic: restoreWallet.mnemonicSeed ?? '', password: password); name: name,
mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password,
passphrase: restoreWallet.passphrase,
);
case WalletType.wownero: case WalletType.wownero:
return wownero!.createWowneroRestoreWalletFromSeedCredentials( return wownero!.createWowneroRestoreWalletFromSeedCredentials(
name: name, name: name,

View file

@ -106,6 +106,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
password: walletPassword, password: walletPassword,
mnemonic: newWalletArguments!.mnemonic, mnemonic: newWalletArguments!.mnemonic,
parentAddress: newWalletArguments!.parentAddress, parentAddress: newWalletArguments!.parentAddress,
passphrase: passphrase,
); );
case WalletType.bitcoinCash: case WalletType.bitcoinCash:
return bitcoinCash!.createBitcoinCashNewWalletCredentials( return bitcoinCash!.createBitcoinCashNewWalletCredentials(
@ -122,6 +123,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
password: walletPassword, password: walletPassword,
mnemonic: newWalletArguments!.mnemonic, mnemonic: newWalletArguments!.mnemonic,
parentAddress: newWalletArguments!.parentAddress, parentAddress: newWalletArguments!.parentAddress,
passphrase: passphrase,
); );
case WalletType.polygon: case WalletType.polygon:
return polygon!.createPolygonNewWalletCredentials( return polygon!.createPolygonNewWalletCredentials(
@ -129,6 +131,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
password: walletPassword, password: walletPassword,
mnemonic: newWalletArguments!.mnemonic, mnemonic: newWalletArguments!.mnemonic,
parentAddress: newWalletArguments!.parentAddress, parentAddress: newWalletArguments!.parentAddress,
passphrase: passphrase,
); );
case WalletType.solana: case WalletType.solana:
return solana!.createSolanaNewWalletCredentials( return solana!.createSolanaNewWalletCredentials(
@ -136,6 +139,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
password: walletPassword, password: walletPassword,
mnemonic: newWalletArguments!.mnemonic, mnemonic: newWalletArguments!.mnemonic,
parentAddress: newWalletArguments!.parentAddress, parentAddress: newWalletArguments!.parentAddress,
passphrase: passphrase,
); );
case WalletType.tron: case WalletType.tron:
return tron!.createTronNewWalletCredentials( return tron!.createTronNewWalletCredentials(
@ -143,6 +147,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
password: walletPassword, password: walletPassword,
mnemonic: newWalletArguments!.mnemonic, mnemonic: newWalletArguments!.mnemonic,
parentAddress: newWalletArguments!.parentAddress, parentAddress: newWalletArguments!.parentAddress,
passphrase: passphrase,
); );
case WalletType.wownero: case WalletType.wownero:
return wownero!.createWowneroNewWalletCredentials( return wownero!.createWowneroNewWalletCredentials(

View file

@ -78,9 +78,6 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
final bool hasBlockchainHeightLanguageSelector; final bool hasBlockchainHeightLanguageSelector;
final bool hasRestoreFromPrivateKey; final bool hasRestoreFromPrivateKey;
bool get hasPassphrase =>
[WalletType.bitcoin, WalletType.litecoin, WalletType.bitcoinCash].contains(type);
@observable @observable
WalletRestoreMode mode; WalletRestoreMode mode;
@ -116,10 +113,18 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
name: name, height: height, mnemonic: seed, password: password); name: name, height: height, mnemonic: seed, password: password);
case WalletType.ethereum: case WalletType.ethereum:
return ethereum!.createEthereumRestoreWalletFromSeedCredentials( return ethereum!.createEthereumRestoreWalletFromSeedCredentials(
name: name, mnemonic: seed, password: password); name: name,
mnemonic: seed,
password: password,
passphrase: passphrase,
);
case WalletType.bitcoinCash: case WalletType.bitcoinCash:
return bitcoinCash!.createBitcoinCashRestoreWalletFromSeedCredentials( return bitcoinCash!.createBitcoinCashRestoreWalletFromSeedCredentials(
name: name, mnemonic: seed, password: password); name: name,
mnemonic: seed,
password: password,
passphrase: passphrase,
);
case WalletType.nano: case WalletType.nano:
case WalletType.banano: case WalletType.banano:
return nano!.createNanoRestoreWalletFromSeedCredentials( return nano!.createNanoRestoreWalletFromSeedCredentials(
@ -127,24 +132,28 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
mnemonic: seed, mnemonic: seed,
password: password, password: password,
derivationType: derivationInfo!.derivationType!, derivationType: derivationInfo!.derivationType!,
passphrase: passphrase,
); );
case WalletType.polygon: case WalletType.polygon:
return polygon!.createPolygonRestoreWalletFromSeedCredentials( return polygon!.createPolygonRestoreWalletFromSeedCredentials(
name: name, name: name,
mnemonic: seed, mnemonic: seed,
password: password, password: password,
passphrase: passphrase,
); );
case WalletType.solana: case WalletType.solana:
return solana!.createSolanaRestoreWalletFromSeedCredentials( return solana!.createSolanaRestoreWalletFromSeedCredentials(
name: name, name: name,
mnemonic: seed, mnemonic: seed,
password: password, password: password,
passphrase: passphrase,
); );
case WalletType.tron: case WalletType.tron:
return tron!.createTronRestoreWalletFromSeedCredentials( return tron!.createTronRestoreWalletFromSeedCredentials(
name: name, name: name,
mnemonic: seed, mnemonic: seed,
password: password, password: password,
passphrase: passphrase,
); );
case WalletType.wownero: case WalletType.wownero:
return wownero!.createWowneroRestoreWalletFromSeedCredentials( return wownero!.createWowneroRestoreWalletFromSeedCredentials(

View file

@ -843,8 +843,8 @@ import 'package:eth_sig_util/util/utils.dart';
abstract class Ethereum { abstract class Ethereum {
List<String> getEthereumWordList(String language); List<String> getEthereumWordList(String language);
WalletService createEthereumWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); WalletService createEthereumWalletService(Box<WalletInfo> walletInfoSource, bool isDirect);
WalletCredentials createEthereumNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress}); WalletCredentials createEthereumNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase});
WalletCredentials createEthereumRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password}); WalletCredentials createEthereumRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password, String? passphrase});
WalletCredentials createEthereumRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password}); WalletCredentials createEthereumRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
WalletCredentials createEthereumHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo}); WalletCredentials createEthereumHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo});
String getAddress(WalletBase wallet); String getAddress(WalletBase wallet);
@ -947,8 +947,8 @@ import 'package:eth_sig_util/util/utils.dart';
abstract class Polygon { abstract class Polygon {
List<String> getPolygonWordList(String language); List<String> getPolygonWordList(String language);
WalletService createPolygonWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); WalletService createPolygonWalletService(Box<WalletInfo> walletInfoSource, bool isDirect);
WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress}); WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase});
WalletCredentials createPolygonRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password}); WalletCredentials createPolygonRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password, String? passphrase});
WalletCredentials createPolygonRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password}); WalletCredentials createPolygonRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
WalletCredentials createPolygonHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo}); WalletCredentials createPolygonHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo});
String getAddress(WalletBase wallet); String getAddress(WalletBase wallet);
@ -1119,6 +1119,7 @@ abstract class Nano {
String? mnemonic, String? mnemonic,
String? parentAddress, String? parentAddress,
WalletInfo? walletInfo, WalletInfo? walletInfo,
String? passphrase,
}); });
WalletCredentials createNanoRestoreWalletFromSeedCredentials({ WalletCredentials createNanoRestoreWalletFromSeedCredentials({
@ -1126,6 +1127,7 @@ abstract class Nano {
required String password, required String password,
required String mnemonic, required String mnemonic,
required DerivationType derivationType, required DerivationType derivationType,
String? passphrase,
}); });
WalletCredentials createNanoRestoreWalletFromKeysCredentials({ WalletCredentials createNanoRestoreWalletFromKeysCredentials({
@ -1234,9 +1236,9 @@ abstract class Solana {
List<String> getSolanaWordList(String language); List<String> getSolanaWordList(String language);
WalletService createSolanaWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); WalletService createSolanaWalletService(Box<WalletInfo> walletInfoSource, bool isDirect);
WalletCredentials createSolanaNewWalletCredentials( WalletCredentials createSolanaNewWalletCredentials(
{required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress,}); {required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase});
WalletCredentials createSolanaRestoreWalletFromSeedCredentials( WalletCredentials createSolanaRestoreWalletFromSeedCredentials(
{required String name, required String mnemonic, required String password}); {required String name, required String mnemonic, required String password, String? passphrase});
WalletCredentials createSolanaRestoreWalletFromPrivateKey( WalletCredentials createSolanaRestoreWalletFromPrivateKey(
{required String name, required String privateKey, required String password}); {required String name, required String privateKey, required String password});
@ -1320,9 +1322,8 @@ import 'package:cw_tron/tron_wallet_service.dart';
abstract class Tron { abstract class Tron {
List<String> getTronWordList(String language); List<String> getTronWordList(String language);
WalletService createTronWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); WalletService createTronWalletService(Box<WalletInfo> walletInfoSource, bool isDirect);
WalletCredentials createTronNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, WalletCredentials createTronNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase});
String? parentAddress}); WalletCredentials createTronRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password, String? passphrase});
WalletCredentials createTronRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password});
WalletCredentials createTronRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password}); WalletCredentials createTronRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password});
String getAddress(WalletBase wallet); String getAddress(WalletBase wallet);