mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
fix test E
make it ready
This commit is contained in:
parent
bc504bf238
commit
0dd75083ad
2 changed files with 9 additions and 10 deletions
|
@ -6,6 +6,7 @@ import 'package:cw_monero/api/exceptions/creation_transaction_exception.dart';
|
|||
import 'package:cw_monero/api/monero_output.dart';
|
||||
import 'package:cw_monero/api/structs/pending_transaction.dart';
|
||||
import 'package:cw_monero/api/wallet.dart';
|
||||
import 'package:cw_monero/exceptions/monero_transaction_creation_exception.dart';
|
||||
import 'package:ffi/ffi.dart';
|
||||
import 'package:monero/monero.dart' as monero;
|
||||
import 'package:monero/src/generated_bindings_monero.g.dart' as monero_gen;
|
||||
|
@ -91,6 +92,9 @@ Future<PendingTransactionDescription> createTransactionSync(
|
|||
final address_ = address.toNativeUtf8();
|
||||
final paymentId_ = paymentId.toNativeUtf8();
|
||||
print("inputs: $preferredInputs");
|
||||
if (preferredInputs.isEmpty) {
|
||||
throw MoneroTransactionCreationException("No inputs provided, transaction cannot be constructed");
|
||||
}
|
||||
|
||||
final preferredInputs_ = preferredInputs.join(monero.defaultSeparatorStr).toNativeUtf8();
|
||||
|
||||
|
|
|
@ -275,9 +275,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
'You do not have enough XMR to send this amount.');
|
||||
}
|
||||
|
||||
// if (!spendAllCoins && (allInputsAmount < totalAmount + estimatedFee)) {
|
||||
// throw MoneroTransactionNoInputsException(inputs.length);
|
||||
// }
|
||||
if (inputs.isEmpty) MoneroTransactionCreationException(
|
||||
'No inputs selected');
|
||||
|
||||
final moneroOutputs = outputs.map((output) {
|
||||
final outputAddress =
|
||||
|
@ -313,12 +312,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
|
||||
final estimatedFee =
|
||||
calculateEstimatedFee(_credentials.priority, formattedAmount);
|
||||
// if (!spendAllCoins &&
|
||||
// ((formattedAmount != null &&
|
||||
// allInputsAmount < (formattedAmount + estimatedFee)) ||
|
||||
// formattedAmount == null)) {
|
||||
// throw MoneroTransactionNoInputsException(inputs.length);
|
||||
// }
|
||||
if (inputs.isEmpty) MoneroTransactionCreationException(
|
||||
'No inputs selected');
|
||||
pendingTransactionDescription =
|
||||
await transaction_history.createTransaction(
|
||||
address: address!,
|
||||
|
@ -482,7 +477,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
for (var i = 0; i < coinCount; i++) {
|
||||
final coin = getCoin(i);
|
||||
final coinSpent = monero.CoinsInfo_spent(coin);
|
||||
if (coinSpent == false) {
|
||||
if (coinSpent == false && monero.CoinsInfo_subaddrAccount(coin) == walletAddresses.account!.id) {
|
||||
final unspent = MoneroUnspent(
|
||||
monero.CoinsInfo_address(coin),
|
||||
monero.CoinsInfo_hash(coin),
|
||||
|
|
Loading…
Reference in a new issue