mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 12:54:38 +00:00
Add missing configure for ethereum class
This commit is contained in:
parent
268a6c3a05
commit
3d8c2af4a2
2 changed files with 59 additions and 55 deletions
|
@ -130,61 +130,61 @@ abstract class EthereumWalletBase
|
|||
}
|
||||
|
||||
|
||||
// if (hasMultiDestination) {
|
||||
// if (outputs.any((item) => item.sendAll
|
||||
// || (item.formattedCryptoAmount ?? 0) <= 0)) {
|
||||
// throw EthereumTransactionCreationException();
|
||||
// }
|
||||
//
|
||||
// final BigInt totalAmount = outputs.fold(0, (acc, value) =>
|
||||
// acc + (value.formattedCryptoAmount ?? 0));
|
||||
//
|
||||
// if (balance.getInWei < EtherAmount.inWei(totalAmount)) {
|
||||
// throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
|
||||
// }
|
||||
//
|
||||
// final moneroOutputs = outputs.map((output) {
|
||||
// final outputAddress = output.isParsedAddress
|
||||
// ? output.extractedAddress
|
||||
// : output.address;
|
||||
//
|
||||
// return MoneroOutput(
|
||||
// address: outputAddress!,
|
||||
// amount: output.cryptoAmount!.replaceAll(',', '.'));
|
||||
// }).toList();
|
||||
//
|
||||
// pendingTransactionDescription =
|
||||
// await transaction_history.createTransactionMultDest(
|
||||
// outputs: moneroOutputs,
|
||||
// priorityRaw: _credentials.priority.serialize(),
|
||||
// accountIndex: walletAddresses.account!.id);
|
||||
// } else {
|
||||
// final output = outputs.first;
|
||||
// final address = output.isParsedAddress
|
||||
// ? output.extractedAddress
|
||||
// : output.address;
|
||||
// final amount = output.sendAll
|
||||
// ? null
|
||||
// : output.cryptoAmount!.replaceAll(',', '.');
|
||||
// final formattedAmount = output.sendAll
|
||||
// ? null
|
||||
// : output.formattedCryptoAmount;
|
||||
//
|
||||
// if ((formattedAmount != null && unlockedBalance < formattedAmount) ||
|
||||
// (formattedAmount == null && unlockedBalance <= 0)) {
|
||||
// final formattedBalance = moneroAmountToString(amount: unlockedBalance);
|
||||
//
|
||||
// throw MoneroTransactionCreationException(
|
||||
// 'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
|
||||
// }
|
||||
//
|
||||
// pendingTransactionDescription =
|
||||
// await transaction_history.createTransaction(
|
||||
// address: address!,
|
||||
// amount: amount,
|
||||
// priorityRaw: _credentials.priority.serialize(),
|
||||
// accountIndex: walletAddresses.account!.id);
|
||||
// }
|
||||
if (hasMultiDestination) {
|
||||
if (outputs.any((item) => item.sendAll
|
||||
|| (item.formattedCryptoAmount ?? 0) <= 0)) {
|
||||
throw EthereumTransactionCreationException();
|
||||
}
|
||||
|
||||
final BigInt totalAmount = outputs.fold(0, (acc, value) =>
|
||||
acc + (value.formattedCryptoAmount ?? 0));
|
||||
|
||||
if (balance.getInWei < EtherAmount.inWei(totalAmount)) {
|
||||
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
|
||||
}
|
||||
|
||||
final moneroOutputs = outputs.map((output) {
|
||||
final outputAddress = output.isParsedAddress
|
||||
? output.extractedAddress
|
||||
: output.address;
|
||||
|
||||
return MoneroOutput(
|
||||
address: outputAddress!,
|
||||
amount: output.cryptoAmount!.replaceAll(',', '.'));
|
||||
}).toList();
|
||||
|
||||
pendingTransactionDescription =
|
||||
await transaction_history.createTransactionMultDest(
|
||||
outputs: moneroOutputs,
|
||||
priorityRaw: _credentials.priority.serialize(),
|
||||
accountIndex: walletAddresses.account!.id);
|
||||
} else {
|
||||
final output = outputs.first;
|
||||
final address = output.isParsedAddress
|
||||
? output.extractedAddress
|
||||
: output.address;
|
||||
final amount = output.sendAll
|
||||
? null
|
||||
: output.cryptoAmount!.replaceAll(',', '.');
|
||||
final formattedAmount = output.sendAll
|
||||
? null
|
||||
: output.formattedCryptoAmount;
|
||||
|
||||
if ((formattedAmount != null && unlockedBalance < formattedAmount) ||
|
||||
(formattedAmount == null && unlockedBalance <= 0)) {
|
||||
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
|
||||
|
||||
throw MoneroTransactionCreationException(
|
||||
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
|
||||
}
|
||||
|
||||
pendingTransactionDescription =
|
||||
await transaction_history.createTransaction(
|
||||
address: address!,
|
||||
amount: amount,
|
||||
priorityRaw: _credentials.priority.serialize(),
|
||||
accountIndex: walletAddresses.account!.id);
|
||||
}
|
||||
|
||||
return PendingEthereumTransaction(
|
||||
client: _client,
|
||||
|
|
|
@ -484,7 +484,9 @@ import 'package:cw_core/wallet_base.dart';
|
|||
import 'package:cw_core/wallet_credentials.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:cw_ethereum/ethereum_formatter.dart';
|
||||
import 'package:cw_ethereum/ethereum_mnemonics.dart';
|
||||
import 'package:cw_ethereum/ethereum_transaction_credentials.dart';
|
||||
import 'package:cw_ethereum/ethereum_wallet.dart';
|
||||
import 'package:cw_ethereum/ethereum_wallet_creation_credentials.dart';
|
||||
import 'package:cw_ethereum/ethereum_wallet_service.dart';
|
||||
|
@ -506,6 +508,8 @@ abstract class Ethereum {
|
|||
|
||||
Object createEthereumTransactionCredentials(List<Output> outputs, {required TransactionPriority priority, int? feeRate});
|
||||
Object createEthereumTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate});
|
||||
|
||||
int formatterEthereumParseAmount(String amount);
|
||||
}
|
||||
""";
|
||||
|
||||
|
|
Loading…
Reference in a new issue