mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-31 15:59:26 +00:00
do not use wownero-seed (wow_seed)
This commit is contained in:
parent
6223df5432
commit
cb83515dbc
3 changed files with 116 additions and 1 deletions
|
@ -1 +1 @@
|
|||
Subproject commit d92fea3e6b915b79697deafbd5710fb4c15bfc76
|
||||
Subproject commit 371443607433a0ec509e2933ee21def29e9ad429
|
|
@ -83,8 +83,10 @@ void main() async {
|
|||
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
|
||||
walletService = wownero.createWowneroWalletService(_walletInfoSource);
|
||||
|
||||
/*
|
||||
group("Wownero 14 word tests", () {
|
||||
setUp(() async {
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
final dirPath = await pathForWalletDir(name: name, type: type);
|
||||
path = await pathForWallet(name: name, type: type);
|
||||
|
@ -113,7 +115,9 @@ void main() async {
|
|||
} catch (e, s) {
|
||||
print(e);
|
||||
print(s);
|
||||
hasThrown = true;
|
||||
}
|
||||
expect(hasThrown, false);
|
||||
});
|
||||
|
||||
test("Test mainnet address generation from 14 word seed", () async {
|
||||
|
@ -147,6 +151,109 @@ void main() async {
|
|||
walletBase?.close();
|
||||
walletBase = wallet as WowneroWalletBase;
|
||||
});
|
||||
|
||||
// TODO delete left over wallet file with name: name
|
||||
});
|
||||
*/
|
||||
|
||||
group("Wownero 25 word tests", () {
|
||||
setUp(() async {
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
final dirPath = await pathForWalletDir(name: name, type: type);
|
||||
path = await pathForWallet(name: name, type: type);
|
||||
credentials = wownero.createWowneroRestoreWalletFromSeedCredentials(
|
||||
name: name, height: 465760, mnemonic: testMnemonic25);
|
||||
|
||||
walletInfo = WalletInfo.external(
|
||||
id: WalletBase.idFor(name, type),
|
||||
name: name,
|
||||
type: type,
|
||||
isRecovery: false,
|
||||
restoreHeight: credentials.height ?? 0,
|
||||
date: DateTime.now(),
|
||||
path: path,
|
||||
address: "",
|
||||
dirPath: dirPath);
|
||||
credentials.walletInfo = walletInfo;
|
||||
|
||||
_walletCreationService = WalletCreationService(
|
||||
secureStorage: storage,
|
||||
sharedPreferences: prefs,
|
||||
walletService: walletService,
|
||||
keyService: keysStorage,
|
||||
);
|
||||
_walletCreationService.changeWalletType();
|
||||
} catch (e, s) {
|
||||
print(e);
|
||||
print(s);
|
||||
hasThrown = true;
|
||||
}
|
||||
expect(hasThrown, false);
|
||||
});
|
||||
|
||||
test("Test mainnet address generation from 25 word seed", () async {
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
name = 'namee${Random().nextInt(10000000)}';
|
||||
final dirPath = await pathForWalletDir(name: name, type: type);
|
||||
path = await pathForWallet(name: name, type: type);
|
||||
try {
|
||||
credentials = wownero.createWowneroRestoreWalletFromSeedCredentials(
|
||||
name: name, height: 465760, mnemonic: testMnemonic25);
|
||||
} catch (e, s) {
|
||||
print(e);
|
||||
print(s);
|
||||
hasThrown = true;
|
||||
}
|
||||
expect(hasThrown, false);
|
||||
|
||||
walletInfo = WalletInfo.external(
|
||||
id: WalletBase.idFor(name, type),
|
||||
name: name,
|
||||
type: type,
|
||||
isRecovery: false,
|
||||
restoreHeight: credentials.height ?? 0,
|
||||
date: DateTime.now(),
|
||||
path: path,
|
||||
address: "",
|
||||
dirPath: dirPath);
|
||||
credentials.walletInfo = walletInfo;
|
||||
|
||||
_walletCreationService = WalletCreationService(
|
||||
secureStorage: storage,
|
||||
sharedPreferences: prefs,
|
||||
walletService: walletService,
|
||||
keyService: keysStorage,
|
||||
);
|
||||
_walletCreationService.changeWalletType();
|
||||
} catch (e, s) {
|
||||
print(e);
|
||||
print(s);
|
||||
hasThrown = true;
|
||||
}
|
||||
expect(hasThrown, false);
|
||||
|
||||
final wallet = await _walletCreationService.restoreFromSeed(credentials);
|
||||
walletInfo.address = wallet.walletAddresses.address;
|
||||
|
||||
hasThrown = false;
|
||||
try {
|
||||
await _walletInfoSource.add(walletInfo);
|
||||
walletBase?.close();
|
||||
walletBase = wallet as WowneroWalletBase;
|
||||
|
||||
expect(walletInfo.address, mainnetTestData25[0][0]);
|
||||
} catch (_) {
|
||||
hasThrown = true;
|
||||
}
|
||||
expect(hasThrown, false);
|
||||
|
||||
walletBase?.close();
|
||||
walletBase = wallet as WowneroWalletBase;
|
||||
});
|
||||
|
||||
// TODO delete left over wallet file with name: name
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,3 +12,11 @@ var mainnetTestData14 = [
|
|||
'WW2KQLLt6gjC9gRsC4NGehbAZX6UPU7sK89UQFwSg3NKj3MXPwnjh5BiJVqYYNQb6JNsfa7oP7eDjLagtLa2H6YP11RhUNQqw'
|
||||
]
|
||||
];
|
||||
|
||||
String testMnemonic25 =
|
||||
'myth byline benches sadness nylon tamper guide giving match angled lurk rally makeup alarms river soapy dolphin woven ticket maul examine public luggage mammal alarms';
|
||||
var mainnetTestData25 = [
|
||||
[
|
||||
'Wo3piMnt1ztjLktFJNsfs9ce6N1tyHk7DB93cNqTGPJ7To3RS7W2q5DdxgQAG5E6RQXQhchQD7ip8WWL3fD8Ww5K2XmAXYxta'
|
||||
]
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue