keep wallet functionality outside currency class

This commit is contained in:
julian 2023-10-06 09:15:11 -06:00
parent 4973447703
commit a572c1d5e3
2 changed files with 2 additions and 199 deletions

View file

@ -32,201 +32,4 @@ class Epiccash extends Bip39Currency {
return LibEpiccash.validateSendAddress(address: address);
}
String getMnemonic() {
return LibEpiccash.getMnemonic();
}
Future<String?> createNewWallet(
({
String config,
String mnemonic,
String password,
String name,
})? data) async {
String result = await LibEpiccash.initializeNewWallet(
config: data!.config,
mnemonic: data.mnemonic,
password: data.password,
name: data.name);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<({double awaitingFinalization, double pending, double spendable, double total})>
getWalletInfo(
({
String wallet,
int refreshFromNode,
})? data) async {
var result = await LibEpiccash.getWalletBalances(
wallet: data!.wallet,
refreshFromNode: data.refreshFromNode,
minimumConfirmations: minConfirms);
return result;
}
Future<String?> scanOutputs(
({String wallet, int startHeight, int numberOfBlocks})? data) async {
var result = await LibEpiccash.scanOutputs(
wallet: data!.wallet,
startHeight: data.startHeight,
numberOfBlocks: data.numberOfBlocks,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<String?> createTransaction(
({
String wallet,
int amount,
String address,
int secretKey,
String epicboxConfig,
String note,
})? data) async {
var result = await LibEpiccash.createTransaction(
wallet: data!.wallet,
amount: data.amount,
address: data.address,
secretKey: data.secretKey,
epicboxConfig: data.epicboxConfig,
minimumConfirmations: minConfirms,
note: data.note,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<String?> getTransaction(
({
String wallet,
int refreshFromNode,
})? data) async {
var result = await LibEpiccash.getTransaction(
wallet: data!.wallet,
refreshFromNode: data.refreshFromNode,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<String?> cancelTransaction(
({
String wallet,
String transactionId,
})? data) async {
var result = await LibEpiccash.cancelTransaction(
wallet: data!.wallet,
transactionId: data.transactionId,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<String?> getAddressInfo(
({
String wallet,
int index,
String epicboxConfig,
})? data) async {
var result = await LibEpiccash.getAddressInfo(
wallet: data!.wallet,
index: data.index,
epicboxConfig: data.epicboxConfig,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<({int fee, bool strategyUseAll, int total})> transactionFees(
({
String wallet,
int amount,
int availableAmount,
})? data,
) async {
var result = await LibEpiccash.getTransactionFees(
wallet: data!.wallet,
amount: data.amount,
minimumConfirmations: minConfirms,
available: data.availableAmount,
);
return result;
}
Future<String?> deleteWallet(
({
String wallet,
String config,
})? data,
) async {
var result = await LibEpiccash.deleteWallet(
wallet: data!.wallet,
config: data.config,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<String?> openWallet(
({
String config,
String password,
})? data,
) async {
var result = await LibEpiccash.openWallet(
config: data!.config,
password: data.password,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
Future<String?> txHttpSend(
({
String wallet,
int selectionStrategyIsAll,
int minimumConfirmations,
String message,
int amount,
String address,
})? data,
) async {
var result = await LibEpiccash.txHttpSend(
wallet: data!.wallet,
selectionStrategyIsAll: data.selectionStrategyIsAll,
minimumConfirmations: data.minimumConfirmations,
message: data.message,
amount: data.amount,
address: data.address,
);
if (result.isNotEmpty) {
return result;
}
return null;
}
}

View file

@ -1656,8 +1656,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
resolved-ref: c8b97bc118c7bbfe1027d0442cfadea44dc285aa
ref: "0a6888282f4e98401051a396e9d2293bd55ac2c2"
resolved-ref: "0a6888282f4e98401051a396e9d2293bd55ac2c2"
url: "https://github.com/cypherstack/tor.git"
source: git
version: "0.0.1"