mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
Clean up
This commit is contained in:
parent
5c726a639c
commit
807fc677d7
1 changed files with 6 additions and 53 deletions
|
@ -233,28 +233,12 @@ Future<String> deleteEpicWallet({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> _initWalletWrapper(
|
//TODO - remove and use one from abstract class
|
||||||
Tuple4<String, String, String, String> data) async {
|
|
||||||
final String initWalletStr =
|
|
||||||
initWallet(data.item1, data.item2, data.item3, data.item4);
|
|
||||||
return initWalletStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> _walletMnemonicWrapper(int throwaway) async {
|
Future<String> _walletMnemonicWrapper(int throwaway) async {
|
||||||
final String mnemonic = walletMnemonic();
|
final String mnemonic = walletMnemonic();
|
||||||
return mnemonic;
|
return mnemonic;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> _recoverWrapper(
|
|
||||||
Tuple4<String, String, String, String> data) async {
|
|
||||||
return recoverWallet(data.item1, data.item2, data.item3, data.item4);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> _getChainHeightWrapper(String config) async {
|
|
||||||
final int chainHeight = getChainHeight(config);
|
|
||||||
return chainHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
class EpicCashWallet extends CoinServiceAPI
|
class EpicCashWallet extends CoinServiceAPI
|
||||||
with WalletCache, WalletDB, EpicCashHive {
|
with WalletCache, WalletDB, EpicCashHive {
|
||||||
EpicCashWallet({
|
EpicCashWallet({
|
||||||
|
@ -521,14 +505,8 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
final wallet = await _secureStore.read(key: '${_walletId}_wallet');
|
final wallet = await _secureStore.read(key: '${_walletId}_wallet');
|
||||||
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
|
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
|
||||||
|
|
||||||
({String wallet, int index, String epicboxConfig}) data = (
|
|
||||||
wallet: wallet!,
|
|
||||||
index: index,
|
|
||||||
epicboxConfig: epicboxConfig.toString()
|
|
||||||
);
|
|
||||||
|
|
||||||
String? walletAddress = await epiccash.LibEpiccash.getAddressInfo(
|
String? walletAddress = await epiccash.LibEpiccash.getAddressInfo(
|
||||||
wallet: wallet,
|
wallet: wallet!,
|
||||||
index: index,
|
index: index,
|
||||||
epicboxConfig: epicboxConfig.toString(),
|
epicboxConfig: epicboxConfig.toString(),
|
||||||
);
|
);
|
||||||
|
@ -679,13 +657,8 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
Logging.instance.log("This index is $index", level: LogLevel.Info);
|
Logging.instance.log("This index is $index", level: LogLevel.Info);
|
||||||
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
|
EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig();
|
||||||
|
|
||||||
({String wallet, int index, String epicboxConfig}) data = (
|
|
||||||
wallet: wallet!,
|
|
||||||
index: index,
|
|
||||||
epicboxConfig: epicboxConfig.toString()
|
|
||||||
);
|
|
||||||
String? walletAddress = await epiccash.LibEpiccash.getAddressInfo(
|
String? walletAddress = await epiccash.LibEpiccash.getAddressInfo(
|
||||||
wallet: wallet,
|
wallet: wallet!,
|
||||||
index: index,
|
index: index,
|
||||||
epicboxConfig: epicboxConfig.toString(),
|
epicboxConfig: epicboxConfig.toString(),
|
||||||
);
|
);
|
||||||
|
@ -735,17 +708,6 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
|
|
||||||
String name = _walletId;
|
String name = _walletId;
|
||||||
|
|
||||||
({
|
|
||||||
String config,
|
|
||||||
String mnemonic,
|
|
||||||
String password,
|
|
||||||
String name,
|
|
||||||
}) walletData = (
|
|
||||||
config: stringConfig,
|
|
||||||
mnemonic: mnemonicString,
|
|
||||||
password: password,
|
|
||||||
name: name
|
|
||||||
);
|
|
||||||
await epiccash.LibEpiccash.initializeNewWallet(
|
await epiccash.LibEpiccash.initializeNewWallet(
|
||||||
config: stringConfig,
|
config: stringConfig,
|
||||||
mnemonic: mnemonicString,
|
mnemonic: mnemonicString,
|
||||||
|
@ -854,10 +816,9 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
final wallet = await _secureStore.read(key: '${_walletId}_wallet');
|
final wallet = await _secureStore.read(key: '${_walletId}_wallet');
|
||||||
try {
|
try {
|
||||||
final available = balance.spendable.raw.toInt();
|
final available = balance.spendable.raw.toInt();
|
||||||
({String wallet, int amount, int availableAmount}) data =
|
|
||||||
(wallet: wallet!, amount: satoshiAmount, availableAmount: available);
|
|
||||||
var transactionFees = await epiccash.LibEpiccash.getTransactionFees(
|
var transactionFees = await epiccash.LibEpiccash.getTransactionFees(
|
||||||
wallet: wallet,
|
wallet: wallet!,
|
||||||
amount: satoshiAmount,
|
amount: satoshiAmount,
|
||||||
// todo: double check
|
// todo: double check
|
||||||
minimumConfirmations: MINIMUM_CONFIRMATIONS,
|
minimumConfirmations: MINIMUM_CONFIRMATIONS,
|
||||||
|
@ -1163,15 +1124,7 @@ class EpicCashWallet extends CoinServiceAPI
|
||||||
await _secureStore.write(
|
await _secureStore.write(
|
||||||
key: '${_walletId}_epicboxConfig', value: epicboxConfig.toString());
|
key: '${_walletId}_epicboxConfig', value: epicboxConfig.toString());
|
||||||
|
|
||||||
await compute(
|
await epiccash.LibEpiccash.recoverWallet(config: stringConfig, password: password, mnemonic: mnemonic, name: name);
|
||||||
_recoverWrapper,
|
|
||||||
Tuple4(
|
|
||||||
stringConfig,
|
|
||||||
password,
|
|
||||||
mnemonic,
|
|
||||||
name,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
epicUpdateRestoreHeight(height),
|
epicUpdateRestoreHeight(height),
|
||||||
|
|
Loading…
Reference in a new issue