diff --git a/lib/wallets/crypto_currency/coins/epiccash.dart b/lib/wallets/crypto_currency/coins/epiccash.dart index eb8d50682..81510f15d 100644 --- a/lib/wallets/crypto_currency/coins/epiccash.dart +++ b/lib/wallets/crypto_currency/coins/epiccash.dart @@ -32,4 +32,16 @@ class Epiccash extends Bip39Currency { return LibEpiccash.validateSendAddress(address: address); } + + String getMnemonic() { + return LibEpiccash.getMnemonic(); + } + + Future 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); + } } diff --git a/lib/wallets/example/libepiccash.dart b/lib/wallets/example/libepiccash.dart index 1f7d45e59..2c0b80a76 100644 --- a/lib/wallets/example/libepiccash.dart +++ b/lib/wallets/example/libepiccash.dart @@ -1,4 +1,6 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_libepiccash/epic_cash.dart' as lib_epiccash; +import 'package:tuple/tuple.dart'; /// /// Wrapped up calls to flutter_libepiccash. @@ -18,4 +20,36 @@ abstract class LibEpiccash { return false; } } + + static String getMnemonic() { + return lib_epiccash.walletMnemonic(); + } + + static Future _initializeWalletWrapper( + Tuple4 data) async { + final String initWalletStr = + lib_epiccash.initWallet(data.item1, data.item2, data.item3, data.item4); + return initWalletStr; + } + + static Future 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; + } + + }