mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
Add template wallet detection and removal code
Not enabled as wallet files are not currently being saved; only an empty folder is created and left. TODO clean that up
This commit is contained in:
parent
a3a36d02c3
commit
b6e51cb954
1 changed files with 13 additions and 12 deletions
|
@ -20,6 +20,7 @@ import 'package:cw_core/wallet_info.dart';
|
||||||
import 'package:cw_core/wallet_service.dart';
|
import 'package:cw_core/wallet_service.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:cw_monero/api/wallet.dart';
|
import 'package:cw_monero/api/wallet.dart';
|
||||||
|
import 'package:cw_monero/api/wallet_manager.dart' as monero_wallet_manager;
|
||||||
import 'package:cw_monero/pending_monero_transaction.dart';
|
import 'package:cw_monero/pending_monero_transaction.dart';
|
||||||
import 'package:cw_monero/monero_wallet.dart';
|
import 'package:cw_monero/monero_wallet.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -52,6 +53,8 @@ late WalletCreationService _walletCreationService;
|
||||||
dynamic _walletInfoSource;
|
dynamic _walletInfoSource;
|
||||||
Wallets? walletsService;
|
Wallets? walletsService;
|
||||||
|
|
||||||
|
String path = '';
|
||||||
|
|
||||||
String name = 'namee${Random().nextInt(10000000)}';
|
String name = 'namee${Random().nextInt(10000000)}';
|
||||||
int nettype = 0;
|
int nettype = 0;
|
||||||
WalletType type = WalletType.monero;
|
WalletType type = WalletType.monero;
|
||||||
|
@ -96,7 +99,7 @@ void main() async {
|
||||||
// name = await generateName();
|
// name = await generateName();
|
||||||
// }
|
// }
|
||||||
final dirPath = await pathForWalletDir(name: name, type: type);
|
final dirPath = await pathForWalletDir(name: name, type: type);
|
||||||
final path = await pathForWallet(name: name, type: type);
|
path = await pathForWallet(name: name, type: type);
|
||||||
credentials =
|
credentials =
|
||||||
// // creating a new wallet
|
// // creating a new wallet
|
||||||
// monero.createMoneroNewWalletCredentials(
|
// monero.createMoneroNewWalletCredentials(
|
||||||
|
@ -163,23 +166,21 @@ void main() async {
|
||||||
await walletBase!.getTransactionAddress(1, 2), mainnetTestData[1][2]);
|
await walletBase!.getTransactionAddress(1, 2), mainnetTestData[1][2]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
|
// Not needed; only folder created, wallet files not saved yet. TODO test saving and deleting wallet files and make sure to clean up leftover folder afterwards
|
||||||
group("Mainnet wallet deletion test", () {
|
group("Mainnet wallet deletion test", () {
|
||||||
test("Test mainnet wallet deletion", () async {
|
test("Test mainnet wallet existence", () {
|
||||||
|
expect(monero_wallet_manager.isWalletExistSync(path: path), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Test mainnet wallet deletion", () {
|
||||||
// Remove wallet from wallet service
|
// Remove wallet from wallet service
|
||||||
walletService?.remove(name);
|
walletService?.remove(name);
|
||||||
walletsService?.removeWallet(walletId: name);
|
walletsService?.removeWallet(walletId: name);
|
||||||
|
expect(monero_wallet_manager.isWalletExistSync(path: path), false);
|
||||||
// TODO test deletion, get code from generation for checking if it already exists
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
// wait for widget tree to dispose of any widgets watching the manager
|
|
||||||
await Future<void>.delayed(const Duration(seconds: 1));
|
|
||||||
walletsInstance.removeWallet(walletId: walletId);
|
|
||||||
*/
|
|
||||||
});
|
|
||||||
/*
|
|
||||||
group("Mainnet node tests", () {
|
group("Mainnet node tests", () {
|
||||||
test("Test mainnet node connection", () async {
|
test("Test mainnet node connection", () async {
|
||||||
await walletBase?.connectToNode(
|
await walletBase?.connectToNode(
|
||||||
|
|
Loading…
Reference in a new issue