From 9e194f2b453858c772821cded90246957b9725da Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 18 Sep 2023 15:56:57 -0600 Subject: [PATCH] WIP sample epic wrapper --- .../crypto_currency/coins/epiccash.dart | 13 ++---------- lib/wallets/example/libepiccash.dart | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 lib/wallets/example/libepiccash.dart diff --git a/lib/wallets/crypto_currency/coins/epiccash.dart b/lib/wallets/crypto_currency/coins/epiccash.dart index 17066a868..eb8d50682 100644 --- a/lib/wallets/crypto_currency/coins/epiccash.dart +++ b/lib/wallets/crypto_currency/coins/epiccash.dart @@ -1,7 +1,7 @@ -import 'package:flutter_libepiccash/epic_cash.dart' as lib_epiccash; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/wallets/crypto_currency/bip39_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; +import 'package:stackwallet/wallets/example/libepiccash.dart'; class Epiccash extends Bip39Currency { Epiccash(super.network) { @@ -30,15 +30,6 @@ class Epiccash extends Bip39Currency { } } - final String validate = lib_epiccash.validateSendAddress(address); - if (int.parse(validate) == 1) { - // Check if address contains a domain - if (address.contains("@")) { - return true; - } - return false; - } else { - return false; - } + return LibEpiccash.validateSendAddress(address: address); } } diff --git a/lib/wallets/example/libepiccash.dart b/lib/wallets/example/libepiccash.dart new file mode 100644 index 000000000..1f7d45e59 --- /dev/null +++ b/lib/wallets/example/libepiccash.dart @@ -0,0 +1,21 @@ +import 'package:flutter_libepiccash/epic_cash.dart' as lib_epiccash; + +/// +/// Wrapped up calls to flutter_libepiccash. +/// +/// Should all be static calls (no state stored in this class) +/// +abstract class LibEpiccash { + static bool validateSendAddress({required String address}) { + final String validate = lib_epiccash.validateSendAddress(address); + if (int.parse(validate) == 1) { + // Check if address contains a domain + if (address.contains("@")) { + return true; + } + return false; + } else { + return false; + } + } +}