mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 13:14:32 +00:00
Added some notes/todos and changed usages of Tuple to using the new built in record type instead
This commit is contained in:
parent
3e889a6d27
commit
8ec22ed389
1 changed files with 34 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/foundation.dart';
|
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';
|
import 'package:mutex/mutex.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Wrapped up calls to flutter_libepiccash.
|
/// Wrapped up calls to flutter_libepiccash.
|
||||||
|
@ -21,35 +21,55 @@ abstract class LibEpiccash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Fetch the mnemonic of (some? current?) wallet
|
||||||
|
///
|
||||||
|
// TODO: ensure the above documentation comment is correct
|
||||||
|
// TODO: ensure this will always return the mnemonic. If not, this function should throw an exception
|
||||||
|
// TODO: probably remove this as we don't use it in stack wallet. We store the mnemonic separately
|
||||||
static String getMnemonic() {
|
static String getMnemonic() {
|
||||||
return lib_epiccash.walletMnemonic();
|
return lib_epiccash.walletMnemonic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Private function wrapper for compute
|
||||||
static Future<String> _initializeWalletWrapper(
|
static Future<String> _initializeWalletWrapper(
|
||||||
Tuple4<String, String, String, String> data) async {
|
({
|
||||||
final String initWalletStr =
|
String config,
|
||||||
lib_epiccash.initWallet(data.item1, data.item2, data.item3, data.item4);
|
String mnemonic,
|
||||||
|
String password,
|
||||||
|
String name,
|
||||||
|
}) data,
|
||||||
|
) async {
|
||||||
|
final String initWalletStr = lib_epiccash.initWallet(
|
||||||
|
data.config,
|
||||||
|
data.mnemonic,
|
||||||
|
data.password,
|
||||||
|
data.name,
|
||||||
|
);
|
||||||
return initWalletStr;
|
return initWalletStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Create and or initialize a new epiccash wallet.
|
||||||
|
///
|
||||||
|
// TODO: Complete/modify the documentation comment above
|
||||||
|
// TODO: Should return a void future. On error this function should throw and exception
|
||||||
static Future<String> initializeNewWallet({
|
static Future<String> initializeNewWallet({
|
||||||
required String config,
|
required String config,
|
||||||
required String mnemonic,
|
required String mnemonic,
|
||||||
required String password,
|
required String password,
|
||||||
required String name}) async {
|
required String name,
|
||||||
|
}) async {
|
||||||
String result = await compute(
|
final String result = await compute(
|
||||||
_initializeWalletWrapper,
|
_initializeWalletWrapper,
|
||||||
Tuple4(
|
(
|
||||||
config,
|
config: config,
|
||||||
mnemonic,
|
mnemonic: mnemonic,
|
||||||
password,
|
password: password,
|
||||||
name,
|
name: name,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue