mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
Merge remote-tracking branch 'cypherstack/staging' into wownero/v0.11.0.1
This commit is contained in:
commit
b3ae62ebb9
1 changed files with 76 additions and 25 deletions
|
@ -862,6 +862,9 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
Map<String, dynamic>? args}) async {
|
||||
try {
|
||||
int realfee = await nativeFee(satoshiAmount);
|
||||
if (balance.spendable == satoshiAmount) {
|
||||
satoshiAmount = balance.spendable - realfee;
|
||||
}
|
||||
|
||||
Map<String, dynamic> txData = {
|
||||
"fee": realfee,
|
||||
|
@ -906,6 +909,53 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
});
|
||||
debugPrint(transactionFees);
|
||||
dynamic decodeData;
|
||||
|
||||
final available = balance.spendable;
|
||||
|
||||
if (available == satoshiAmount) {
|
||||
if (transactionFees!.contains("Required")) {
|
||||
var splits = transactionFees!.split(" ");
|
||||
Decimal required = Decimal.zero;
|
||||
Decimal available = Decimal.zero;
|
||||
for (int i = 0; i < splits.length; i++) {
|
||||
var word = splits[i];
|
||||
if (word == "Required:") {
|
||||
required = Decimal.parse(splits[i + 1].replaceAll(",", ""));
|
||||
} else if (word == "Available:") {
|
||||
available = Decimal.parse(splits[i + 1].replaceAll(",", ""));
|
||||
}
|
||||
}
|
||||
int largestSatoshiFee =
|
||||
((required - available) * Decimal.fromInt(100000000))
|
||||
.toBigInt()
|
||||
.toInt();
|
||||
var amountSending = satoshiAmount - largestSatoshiFee;
|
||||
|
||||
//Get fees for this new amount
|
||||
await m.protect(() async {
|
||||
ReceivePort receivePort = await getIsolate({
|
||||
"function": "getTransactionFees",
|
||||
"wallet": wallet!,
|
||||
"amount": amountSending,
|
||||
"minimumConfirmations": MINIMUM_CONFIRMATIONS,
|
||||
}, name: walletName);
|
||||
|
||||
var message = await receivePort.first;
|
||||
if (message is String) {
|
||||
Logging.instance
|
||||
.log("this is a string $message", level: LogLevel.Error);
|
||||
stop(receivePort);
|
||||
throw Exception("getTransactionFees isolate failed");
|
||||
}
|
||||
stop(receivePort);
|
||||
Logging.instance.log('Closing getTransactionFees!\n $message',
|
||||
level: LogLevel.Info);
|
||||
// return message;
|
||||
transactionFees = message['result'] as String;
|
||||
});
|
||||
}
|
||||
decodeData = json.decode(transactionFees!);
|
||||
} else {
|
||||
try {
|
||||
decodeData = json.decode(transactionFees!);
|
||||
} catch (e) {
|
||||
|
@ -934,6 +984,7 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
}
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: first problem
|
||||
int realfee = 0;
|
||||
|
@ -1799,7 +1850,7 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
// final chunk = {
|
||||
// "timestamp": txTimeArray[0],
|
||||
// "transactions": [txObject],
|
||||
// };
|
||||
// };sendAll
|
||||
//
|
||||
// // result["dateTimeChunks"].
|
||||
// result["dateTimeChunks"].add(chunk);
|
||||
|
|
Loading…
Reference in a new issue