mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-25 04:49:36 +00:00
WIP: Move Epiccash plugin calls to an abstract class
This commit is contained in:
parent
9e194f2b45
commit
d890662515
2 changed files with 46 additions and 0 deletions
|
@ -32,4 +32,16 @@ class Epiccash extends Bip39Currency {
|
||||||
|
|
||||||
return LibEpiccash.validateSendAddress(address: address);
|
return LibEpiccash.validateSendAddress(address: address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getMnemonic() {
|
||||||
|
return LibEpiccash.getMnemonic();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> initializeNew(({String config, String mnemonic, String password, String name})? data) {
|
||||||
|
return LibEpiccash.initializeNewWallet(
|
||||||
|
config: data!.config,
|
||||||
|
mnemonic: data.mnemonic,
|
||||||
|
password: data.password,
|
||||||
|
name: data.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_libepiccash/epic_cash.dart' as lib_epiccash;
|
import 'package:flutter_libepiccash/epic_cash.dart' as lib_epiccash;
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Wrapped up calls to flutter_libepiccash.
|
/// Wrapped up calls to flutter_libepiccash.
|
||||||
|
@ -18,4 +20,36 @@ abstract class LibEpiccash {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String getMnemonic() {
|
||||||
|
return lib_epiccash.walletMnemonic();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<String> _initializeWalletWrapper(
|
||||||
|
Tuple4<String, String, String, String> data) async {
|
||||||
|
final String initWalletStr =
|
||||||
|
lib_epiccash.initWallet(data.item1, data.item2, data.item3, data.item4);
|
||||||
|
return initWalletStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<String> initializeNewWallet({
|
||||||
|
required String config,
|
||||||
|
required String mnemonic,
|
||||||
|
required String password,
|
||||||
|
required String name}) async {
|
||||||
|
|
||||||
|
String result = await compute(
|
||||||
|
_initializeWalletWrapper,
|
||||||
|
Tuple4(
|
||||||
|
config,
|
||||||
|
mnemonic,
|
||||||
|
password,
|
||||||
|
name,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue