Add missing configure for ethereum class

This commit is contained in:
OmarHatem 2023-03-31 00:24:05 +02:00
parent 268a6c3a05
commit 3d8c2af4a2
2 changed files with 59 additions and 55 deletions

View file

@ -130,61 +130,61 @@ abstract class EthereumWalletBase
} }
// if (hasMultiDestination) { if (hasMultiDestination) {
// if (outputs.any((item) => item.sendAll if (outputs.any((item) => item.sendAll
// || (item.formattedCryptoAmount ?? 0) <= 0)) { || (item.formattedCryptoAmount ?? 0) <= 0)) {
// throw EthereumTransactionCreationException(); throw EthereumTransactionCreationException();
// } }
//
// final BigInt totalAmount = outputs.fold(0, (acc, value) => final BigInt totalAmount = outputs.fold(0, (acc, value) =>
// acc + (value.formattedCryptoAmount ?? 0)); acc + (value.formattedCryptoAmount ?? 0));
//
// if (balance.getInWei < EtherAmount.inWei(totalAmount)) { if (balance.getInWei < EtherAmount.inWei(totalAmount)) {
// throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
// } }
//
// final moneroOutputs = outputs.map((output) { final moneroOutputs = outputs.map((output) {
// final outputAddress = output.isParsedAddress final outputAddress = output.isParsedAddress
// ? output.extractedAddress ? output.extractedAddress
// : output.address; : output.address;
//
// return MoneroOutput( return MoneroOutput(
// address: outputAddress!, address: outputAddress!,
// amount: output.cryptoAmount!.replaceAll(',', '.')); amount: output.cryptoAmount!.replaceAll(',', '.'));
// }).toList(); }).toList();
//
// pendingTransactionDescription = pendingTransactionDescription =
// await transaction_history.createTransactionMultDest( await transaction_history.createTransactionMultDest(
// outputs: moneroOutputs, outputs: moneroOutputs,
// priorityRaw: _credentials.priority.serialize(), priorityRaw: _credentials.priority.serialize(),
// accountIndex: walletAddresses.account!.id); accountIndex: walletAddresses.account!.id);
// } else { } else {
// final output = outputs.first; final output = outputs.first;
// final address = output.isParsedAddress final address = output.isParsedAddress
// ? output.extractedAddress ? output.extractedAddress
// : output.address; : output.address;
// final amount = output.sendAll final amount = output.sendAll
// ? null ? null
// : output.cryptoAmount!.replaceAll(',', '.'); : output.cryptoAmount!.replaceAll(',', '.');
// final formattedAmount = output.sendAll final formattedAmount = output.sendAll
// ? null ? null
// : output.formattedCryptoAmount; : output.formattedCryptoAmount;
//
// if ((formattedAmount != null && unlockedBalance < formattedAmount) || if ((formattedAmount != null && unlockedBalance < formattedAmount) ||
// (formattedAmount == null && unlockedBalance <= 0)) { (formattedAmount == null && unlockedBalance <= 0)) {
// final formattedBalance = moneroAmountToString(amount: unlockedBalance); final formattedBalance = moneroAmountToString(amount: unlockedBalance);
//
// throw MoneroTransactionCreationException( throw MoneroTransactionCreationException(
// 'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.'); 'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
// } }
//
// pendingTransactionDescription = pendingTransactionDescription =
// await transaction_history.createTransaction( await transaction_history.createTransaction(
// address: address!, address: address!,
// amount: amount, amount: amount,
// priorityRaw: _credentials.priority.serialize(), priorityRaw: _credentials.priority.serialize(),
// accountIndex: walletAddresses.account!.id); accountIndex: walletAddresses.account!.id);
// } }
return PendingEthereumTransaction( return PendingEthereumTransaction(
client: _client, client: _client,

View file

@ -484,7 +484,9 @@ import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_service.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_mnemonics.dart';
import 'package:cw_ethereum/ethereum_transaction_credentials.dart';
import 'package:cw_ethereum/ethereum_wallet.dart'; import 'package:cw_ethereum/ethereum_wallet.dart';
import 'package:cw_ethereum/ethereum_wallet_creation_credentials.dart'; import 'package:cw_ethereum/ethereum_wallet_creation_credentials.dart';
import 'package:cw_ethereum/ethereum_wallet_service.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 createEthereumTransactionCredentials(List<Output> outputs, {required TransactionPriority priority, int? feeRate});
Object createEthereumTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate}); Object createEthereumTransactionCredentialsRaw(List<OutputInfo> outputs, {TransactionPriority? priority, required int feeRate});
int formatterEthereumParseAmount(String amount);
} }
"""; """;