mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-25 08:39:06 +00:00
Merge pull request #181 from cake-tech/CAKE-345-batch-sending
Cake 345 batch sending
This commit is contained in:
commit
cd45a2af7f
44 changed files with 1909 additions and 1168 deletions
|
@ -495,6 +495,48 @@ extern "C"
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool transaction_create_mult_dest(char **addresses, char *payment_id, char **amounts, uint32_t size,
|
||||||
|
uint8_t priority_raw, uint32_t subaddr_account, Utf8Box &error, PendingTransactionRaw &pendingTransaction)
|
||||||
|
{
|
||||||
|
nice(19);
|
||||||
|
|
||||||
|
std::vector<std::string> _addresses;
|
||||||
|
std::vector<uint64_t> _amounts;
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
_addresses.push_back(std::string(*addresses));
|
||||||
|
_amounts.push_back(Monero::Wallet::amountFromString(std::string(*amounts)));
|
||||||
|
addresses++;
|
||||||
|
amounts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto priority = static_cast<Monero::PendingTransaction::Priority>(priority_raw);
|
||||||
|
std::string _payment_id;
|
||||||
|
Monero::PendingTransaction *transaction;
|
||||||
|
|
||||||
|
if (payment_id != nullptr)
|
||||||
|
{
|
||||||
|
_payment_id = std::string(payment_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction = m_wallet->createTransactionMultDest(_addresses, _payment_id, _amounts, m_wallet->defaultMixin(), priority, subaddr_account);
|
||||||
|
|
||||||
|
int status = transaction->status();
|
||||||
|
|
||||||
|
if (status == Monero::PendingTransaction::Status::Status_Error || status == Monero::PendingTransaction::Status::Status_Critical)
|
||||||
|
{
|
||||||
|
error = Utf8Box(strdup(transaction->errorString().c_str()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_listener != nullptr) {
|
||||||
|
m_listener->m_new_transaction = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingTransaction = PendingTransactionRaw(transaction);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool transaction_commit(PendingTransactionRaw *transaction, Utf8Box &error)
|
bool transaction_commit(PendingTransactionRaw *transaction, Utf8Box &error)
|
||||||
{
|
{
|
||||||
bool committed = transaction->transaction->commit();
|
bool committed = transaction->transaction->commit();
|
||||||
|
|
8
cw_monero/lib/monero_output.dart
Normal file
8
cw_monero/lib/monero_output.dart
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
class MoneroOutput {
|
||||||
|
MoneroOutput({@required this.address, @required this.amount});
|
||||||
|
|
||||||
|
final String address;
|
||||||
|
final String amount;
|
||||||
|
}
|
|
@ -95,6 +95,16 @@ typedef transaction_create = Int8 Function(
|
||||||
Pointer<Utf8Box> error,
|
Pointer<Utf8Box> error,
|
||||||
Pointer<PendingTransactionRaw> pendingTransaction);
|
Pointer<PendingTransactionRaw> pendingTransaction);
|
||||||
|
|
||||||
|
typedef transaction_create_mult_dest = Int8 Function(
|
||||||
|
Pointer<Pointer<Utf8>> addresses,
|
||||||
|
Pointer<Utf8> paymentId,
|
||||||
|
Pointer<Pointer<Utf8>> amounts,
|
||||||
|
Int32 size,
|
||||||
|
Int8 priorityRaw,
|
||||||
|
Int32 subaddrAccount,
|
||||||
|
Pointer<Utf8Box> error,
|
||||||
|
Pointer<PendingTransactionRaw> pendingTransaction);
|
||||||
|
|
||||||
typedef transaction_commit = Int8 Function(Pointer<PendingTransactionRaw>, Pointer<Utf8Box>);
|
typedef transaction_commit = Int8 Function(Pointer<PendingTransactionRaw>, Pointer<Utf8Box>);
|
||||||
|
|
||||||
typedef secret_view_key = Pointer<Utf8> Function();
|
typedef secret_view_key = Pointer<Utf8> Function();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
import 'package:cw_monero/convert_utf8_to_string.dart';
|
import 'package:cw_monero/convert_utf8_to_string.dart';
|
||||||
|
import 'package:cw_monero/monero_output.dart';
|
||||||
import 'package:cw_monero/structs/ut8_box.dart';
|
import 'package:cw_monero/structs/ut8_box.dart';
|
||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
@ -26,6 +27,10 @@ final transactionCreateNative = moneroApi
|
||||||
.lookup<NativeFunction<transaction_create>>('transaction_create')
|
.lookup<NativeFunction<transaction_create>>('transaction_create')
|
||||||
.asFunction<TransactionCreate>();
|
.asFunction<TransactionCreate>();
|
||||||
|
|
||||||
|
final transactionCreateMultDestNative = moneroApi
|
||||||
|
.lookup<NativeFunction<transaction_create_mult_dest>>('transaction_create_mult_dest')
|
||||||
|
.asFunction<TransactionCreateMultDest>();
|
||||||
|
|
||||||
final transactionCommitNative = moneroApi
|
final transactionCommitNative = moneroApi
|
||||||
.lookup<NativeFunction<transaction_commit>>('transaction_commit')
|
.lookup<NativeFunction<transaction_commit>>('transaction_commit')
|
||||||
.asFunction<TransactionCommit>();
|
.asFunction<TransactionCommit>();
|
||||||
|
@ -102,6 +107,59 @@ PendingTransactionDescription createTransactionSync(
|
||||||
pointerAddress: pendingTransactionRawPointer.address);
|
pointerAddress: pendingTransactionRawPointer.address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PendingTransactionDescription createTransactionMultDestSync(
|
||||||
|
{List<MoneroOutput> outputs,
|
||||||
|
String paymentId,
|
||||||
|
int priorityRaw,
|
||||||
|
int accountIndex = 0}) {
|
||||||
|
final int size = outputs.length;
|
||||||
|
final List<Pointer<Utf8>> addressesPointers = outputs.map((output) =>
|
||||||
|
Utf8.toUtf8(output.address)).toList();
|
||||||
|
final Pointer<Pointer<Utf8>> addressesPointerPointer = allocate(count: size);
|
||||||
|
final List<Pointer<Utf8>> amountsPointers = outputs.map((output) =>
|
||||||
|
Utf8.toUtf8(output.amount)).toList();
|
||||||
|
final Pointer<Pointer<Utf8>> amountsPointerPointer = allocate(count: size);
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
addressesPointerPointer[i] = addressesPointers[i];
|
||||||
|
amountsPointerPointer[i] = amountsPointers[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
final paymentIdPointer = Utf8.toUtf8(paymentId);
|
||||||
|
final errorMessagePointer = allocate<Utf8Box>();
|
||||||
|
final pendingTransactionRawPointer = allocate<PendingTransactionRaw>();
|
||||||
|
final created = transactionCreateMultDestNative(
|
||||||
|
addressesPointerPointer,
|
||||||
|
paymentIdPointer,
|
||||||
|
amountsPointerPointer,
|
||||||
|
size,
|
||||||
|
priorityRaw,
|
||||||
|
accountIndex,
|
||||||
|
errorMessagePointer,
|
||||||
|
pendingTransactionRawPointer) !=
|
||||||
|
0;
|
||||||
|
|
||||||
|
free(addressesPointerPointer);
|
||||||
|
free(amountsPointerPointer);
|
||||||
|
|
||||||
|
addressesPointers.forEach((element) => free(element));
|
||||||
|
amountsPointers.forEach((element) => free(element));
|
||||||
|
|
||||||
|
free(paymentIdPointer);
|
||||||
|
|
||||||
|
if (!created) {
|
||||||
|
final message = errorMessagePointer.ref.getValue();
|
||||||
|
free(errorMessagePointer);
|
||||||
|
throw CreationTransactionException(message: message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PendingTransactionDescription(
|
||||||
|
amount: pendingTransactionRawPointer.ref.amount,
|
||||||
|
fee: pendingTransactionRawPointer.ref.fee,
|
||||||
|
hash: pendingTransactionRawPointer.ref.getHash(),
|
||||||
|
pointerAddress: pendingTransactionRawPointer.address);
|
||||||
|
}
|
||||||
|
|
||||||
void commitTransactionFromPointerAddress({int address}) => commitTransaction(
|
void commitTransactionFromPointerAddress({int address}) => commitTransaction(
|
||||||
transactionPointer: Pointer<PendingTransactionRaw>.fromAddress(address));
|
transactionPointer: Pointer<PendingTransactionRaw>.fromAddress(address));
|
||||||
|
|
||||||
|
@ -132,9 +190,22 @@ PendingTransactionDescription _createTransactionSync(Map args) {
|
||||||
accountIndex: accountIndex);
|
accountIndex: accountIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PendingTransactionDescription _createTransactionMultDestSync(Map args) {
|
||||||
|
final outputs = args['outputs'] as List<MoneroOutput>;
|
||||||
|
final paymentId = args['paymentId'] as String;
|
||||||
|
final priorityRaw = args['priorityRaw'] as int;
|
||||||
|
final accountIndex = args['accountIndex'] as int;
|
||||||
|
|
||||||
|
return createTransactionMultDestSync(
|
||||||
|
outputs: outputs,
|
||||||
|
paymentId: paymentId,
|
||||||
|
priorityRaw: priorityRaw,
|
||||||
|
accountIndex: accountIndex);
|
||||||
|
}
|
||||||
|
|
||||||
Future<PendingTransactionDescription> createTransaction(
|
Future<PendingTransactionDescription> createTransaction(
|
||||||
{String address,
|
{String address,
|
||||||
String paymentId,
|
String paymentId = '',
|
||||||
String amount,
|
String amount,
|
||||||
int priorityRaw,
|
int priorityRaw,
|
||||||
int accountIndex = 0}) =>
|
int accountIndex = 0}) =>
|
||||||
|
@ -145,3 +216,15 @@ Future<PendingTransactionDescription> createTransaction(
|
||||||
'priorityRaw': priorityRaw,
|
'priorityRaw': priorityRaw,
|
||||||
'accountIndex': accountIndex
|
'accountIndex': accountIndex
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Future<PendingTransactionDescription> createTransactionMultDest(
|
||||||
|
{List<MoneroOutput> outputs,
|
||||||
|
String paymentId = '',
|
||||||
|
int priorityRaw,
|
||||||
|
int accountIndex = 0}) =>
|
||||||
|
compute(_createTransactionMultDestSync, {
|
||||||
|
'outputs': outputs,
|
||||||
|
'paymentId': paymentId,
|
||||||
|
'priorityRaw': priorityRaw,
|
||||||
|
'accountIndex': accountIndex
|
||||||
|
});
|
||||||
|
|
|
@ -93,6 +93,16 @@ typedef TransactionCreate = int Function(
|
||||||
Pointer<Utf8Box> error,
|
Pointer<Utf8Box> error,
|
||||||
Pointer<PendingTransactionRaw> pendingTransaction);
|
Pointer<PendingTransactionRaw> pendingTransaction);
|
||||||
|
|
||||||
|
typedef TransactionCreateMultDest = int Function(
|
||||||
|
Pointer<Pointer<Utf8>> addresses,
|
||||||
|
Pointer<Utf8> paymentId,
|
||||||
|
Pointer<Pointer<Utf8>> amounts,
|
||||||
|
int size,
|
||||||
|
int priorityRaw,
|
||||||
|
int subaddrAccount,
|
||||||
|
Pointer<Utf8Box> error,
|
||||||
|
Pointer<PendingTransactionRaw> pendingTransaction);
|
||||||
|
|
||||||
typedef TransactionCommit = int Function(Pointer<PendingTransactionRaw>, Pointer<Utf8Box>);
|
typedef TransactionCommit = int Function(Pointer<PendingTransactionRaw>, Pointer<Utf8Box>);
|
||||||
|
|
||||||
typedef SecretViewKey = Pointer<Utf8> Function();
|
typedef SecretViewKey = Pointer<Utf8> Function();
|
||||||
|
|
|
@ -16,24 +16,12 @@ double bitcoinAmountToDouble({int amount}) =>
|
||||||
cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider);
|
cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider);
|
||||||
|
|
||||||
int stringDoubleToBitcoinAmount(String amount) {
|
int stringDoubleToBitcoinAmount(String amount) {
|
||||||
final splitted = amount.split('');
|
|
||||||
final dotIndex = amount.indexOf('.');
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
for (var i = 0; i < splitted.length; i++) {
|
result = (double.parse(amount) * bitcoinAmountDivider).toInt();
|
||||||
try {
|
} catch (e) {
|
||||||
if (dotIndex == i) {
|
result = 0;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final char = splitted[i];
|
|
||||||
final multiplier = dotIndex < i
|
|
||||||
? bitcoinAmountDivider ~/ pow(10, (i - dotIndex))
|
|
||||||
: (bitcoinAmountDivider * pow(10, (dotIndex - i -1))).toInt();
|
|
||||||
final num = int.parse(char) * multiplier;
|
|
||||||
result += num;
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import 'package:cake_wallet/bitcoin/bitcoin_transaction_priority.dart';
|
import 'package:cake_wallet/bitcoin/bitcoin_transaction_priority.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/output.dart';
|
||||||
|
|
||||||
class BitcoinTransactionCredentials {
|
class BitcoinTransactionCredentials {
|
||||||
BitcoinTransactionCredentials(this.address, this.amount, this.priority);
|
BitcoinTransactionCredentials(this.outputs, this.priority);
|
||||||
|
|
||||||
final String address;
|
final List<Output> outputs;
|
||||||
final String amount;
|
|
||||||
BitcoinTransactionPriority priority;
|
BitcoinTransactionPriority priority;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,9 +158,8 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
||||||
const minAmount = 546;
|
const minAmount = 546;
|
||||||
final transactionCredentials = credentials as BitcoinTransactionCredentials;
|
final transactionCredentials = credentials as BitcoinTransactionCredentials;
|
||||||
final inputs = <BitcoinUnspent>[];
|
final inputs = <BitcoinUnspent>[];
|
||||||
final credentialsAmount = transactionCredentials.amount != null
|
final outputs = transactionCredentials.outputs;
|
||||||
? stringDoubleToBitcoinAmount(transactionCredentials.amount)
|
final hasMultiDestination = outputs.length > 1;
|
||||||
: 0;
|
|
||||||
var allInputsAmount = 0;
|
var allInputsAmount = 0;
|
||||||
|
|
||||||
if (unspentCoins.isEmpty) {
|
if (unspentCoins.isEmpty) {
|
||||||
|
@ -174,28 +173,60 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.isEmpty ||
|
if (inputs.isEmpty) {
|
||||||
(credentialsAmount > 0 && allInputsAmount < credentialsAmount)) {
|
|
||||||
throw BitcoinTransactionNoInputsException();
|
throw BitcoinTransactionNoInputsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final allAmountFee =
|
final allAmountFee = feeAmountForPriority(
|
||||||
feeAmountForPriority(transactionCredentials.priority, inputs.length, 1);
|
transactionCredentials.priority, inputs.length, outputs.length);
|
||||||
final allAmount = allInputsAmount - allAmountFee;
|
final allAmount = allInputsAmount - allAmountFee;
|
||||||
|
|
||||||
final amount = transactionCredentials.amount == null ||
|
var credentialsAmount = 0;
|
||||||
allAmount - credentialsAmount < minAmount
|
var amount = 0;
|
||||||
? allAmount
|
var fee = 0;
|
||||||
: credentialsAmount;
|
|
||||||
final fee = transactionCredentials.amount == null || amount == allAmount
|
if (hasMultiDestination) {
|
||||||
? allAmountFee
|
if (outputs.any((item) => item.sendAll
|
||||||
: calculateEstimatedFee(transactionCredentials.priority, amount);
|
|| item.formattedCryptoAmount <= 0)) {
|
||||||
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
credentialsAmount = outputs.fold(0, (acc, value) =>
|
||||||
|
acc + value.formattedCryptoAmount);
|
||||||
|
|
||||||
|
if (allAmount - credentialsAmount < minAmount) {
|
||||||
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
amount = credentialsAmount;
|
||||||
|
|
||||||
|
fee = calculateEstimatedFee(transactionCredentials.priority, amount,
|
||||||
|
outputsCount: outputs.length + 1);
|
||||||
|
} else {
|
||||||
|
final output = outputs.first;
|
||||||
|
|
||||||
|
credentialsAmount = !output.sendAll
|
||||||
|
? output.formattedCryptoAmount
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
if (credentialsAmount > allAmount) {
|
||||||
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
amount = output.sendAll || allAmount - credentialsAmount < minAmount
|
||||||
|
? allAmount
|
||||||
|
: credentialsAmount;
|
||||||
|
|
||||||
|
fee = output.sendAll || amount == allAmount
|
||||||
|
? allAmountFee
|
||||||
|
: calculateEstimatedFee(transactionCredentials.priority, amount);
|
||||||
|
}
|
||||||
|
|
||||||
if (fee == 0) {
|
if (fee == 0) {
|
||||||
throw BitcoinTransactionWrongBalanceException(currency);
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
final totalAmount = amount + fee;
|
final totalAmount = amount + fee;
|
||||||
|
|
||||||
if (totalAmount > balance.confirmed || totalAmount > allInputsAmount) {
|
if (totalAmount > balance.confirmed || totalAmount > allInputsAmount) {
|
||||||
throw BitcoinTransactionWrongBalanceException(currency);
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
|
@ -234,8 +265,8 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
||||||
if (input.isP2wpkh) {
|
if (input.isP2wpkh) {
|
||||||
final p2wpkh = bitcoin
|
final p2wpkh = bitcoin
|
||||||
.P2WPKH(
|
.P2WPKH(
|
||||||
data: generatePaymentData(hd: hd, index: input.address.index),
|
data: generatePaymentData(hd: hd, index: input.address.index),
|
||||||
network: networkType)
|
network: networkType)
|
||||||
.data;
|
.data;
|
||||||
|
|
||||||
txb.addInput(input.hash, input.vout, null, p2wpkh.output);
|
txb.addInput(input.hash, input.vout, null, p2wpkh.output);
|
||||||
|
@ -244,11 +275,18 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
txb.addOutput(
|
outputs.forEach((item) {
|
||||||
addressToOutputScript(transactionCredentials.address, networkType),
|
final outputAmount = hasMultiDestination
|
||||||
amount);
|
? item.formattedCryptoAmount
|
||||||
|
: amount;
|
||||||
|
|
||||||
final estimatedSize = estimatedTransactionSize(inputs.length, 2);
|
txb.addOutput(
|
||||||
|
addressToOutputScript(item.address, networkType),
|
||||||
|
outputAmount);
|
||||||
|
});
|
||||||
|
|
||||||
|
final estimatedSize =
|
||||||
|
estimatedTransactionSize(inputs.length, outputs.length + 1);
|
||||||
final feeAmount = feeRate(transactionCredentials.priority) * estimatedSize;
|
final feeAmount = feeRate(transactionCredentials.priority) * estimatedSize;
|
||||||
final changeValue = totalInputAmount - amount - feeAmount;
|
final changeValue = totalInputAmount - amount - feeAmount;
|
||||||
|
|
||||||
|
@ -293,7 +331,8 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
||||||
feeRate(priority) * estimatedTransactionSize(inputsCount, outputsCount);
|
feeRate(priority) * estimatedTransactionSize(inputsCount, outputsCount);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int calculateEstimatedFee(TransactionPriority priority, int amount) {
|
int calculateEstimatedFee(TransactionPriority priority, int amount,
|
||||||
|
{int outputsCount}) {
|
||||||
if (priority is BitcoinTransactionPriority) {
|
if (priority is BitcoinTransactionPriority) {
|
||||||
int inputsCount = 0;
|
int inputsCount = 0;
|
||||||
|
|
||||||
|
@ -321,8 +360,10 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
|
||||||
}
|
}
|
||||||
|
|
||||||
// If send all, then we have no change value
|
// If send all, then we have no change value
|
||||||
|
final _outputsCount = outputsCount ?? (amount != null ? 2 : 1);
|
||||||
|
|
||||||
return feeAmountForPriority(
|
return feeAmountForPriority(
|
||||||
priority, inputsCount, amount != null ? 2 : 1);
|
priority, inputsCount, _outputsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
13
lib/di.dart
13
lib/di.dart
|
@ -75,6 +75,7 @@ import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.
|
||||||
import 'package:cake_wallet/view_model/order_details_view_model.dart';
|
import 'package:cake_wallet/view_model/order_details_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/rescan_view_model.dart';
|
import 'package:cake_wallet/view_model/rescan_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/restore_from_backup_view_model.dart';
|
import 'package:cake_wallet/view_model/restore_from_backup_view_model.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart';
|
import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/support_view_model.dart';
|
import 'package:cake_wallet/view_model/support_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
|
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
|
||||||
|
@ -316,10 +317,17 @@ Future setup(
|
||||||
addressEditOrCreateViewModel:
|
addressEditOrCreateViewModel:
|
||||||
getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
|
getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
|
||||||
|
|
||||||
getIt.registerFactory<SendViewModel>(() => SendViewModel(
|
getIt.registerFactory<SendTemplateViewModel>(() => SendTemplateViewModel(
|
||||||
getIt.get<AppStore>().wallet,
|
getIt.get<AppStore>().wallet,
|
||||||
getIt.get<AppStore>().settingsStore,
|
getIt.get<AppStore>().settingsStore,
|
||||||
getIt.get<SendTemplateStore>(),
|
getIt.get<SendTemplateStore>(),
|
||||||
|
getIt.get<FiatConversionStore>()
|
||||||
|
));
|
||||||
|
|
||||||
|
getIt.registerFactory<SendViewModel>(() => SendViewModel(
|
||||||
|
getIt.get<AppStore>().wallet,
|
||||||
|
getIt.get<AppStore>().settingsStore,
|
||||||
|
getIt.get<SendTemplateViewModel>(),
|
||||||
getIt.get<FiatConversionStore>(),
|
getIt.get<FiatConversionStore>(),
|
||||||
_transactionDescriptionBox));
|
_transactionDescriptionBox));
|
||||||
|
|
||||||
|
@ -327,7 +335,8 @@ Future setup(
|
||||||
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(
|
||||||
() => SendTemplatePage(sendViewModel: getIt.get<SendViewModel>()));
|
() => SendTemplatePage(
|
||||||
|
sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => WalletListViewModel(
|
getIt.registerFactory(() => WalletListViewModel(
|
||||||
_walletInfoSource,
|
_walletInfoSource,
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import 'package:cake_wallet/entities/transaction_creation_credentials.dart';
|
import 'package:cake_wallet/entities/transaction_creation_credentials.dart';
|
||||||
import 'package:cake_wallet/entities/monero_transaction_priority.dart';
|
import 'package:cake_wallet/entities/monero_transaction_priority.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/output.dart';
|
||||||
|
|
||||||
class MoneroTransactionCreationCredentials
|
class MoneroTransactionCreationCredentials
|
||||||
extends TransactionCreationCredentials {
|
extends TransactionCreationCredentials {
|
||||||
MoneroTransactionCreationCredentials(
|
MoneroTransactionCreationCredentials({this.outputs, this.priority});
|
||||||
{this.address, this.paymentId, this.priority, this.amount});
|
|
||||||
|
|
||||||
final String address;
|
final List<Output> outputs;
|
||||||
final String paymentId;
|
|
||||||
final String amount;
|
|
||||||
final MoneroTransactionPriority priority;
|
final MoneroTransactionPriority priority;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:cake_wallet/monero/monero_transaction_creation_exception.dart';
|
||||||
import 'package:cake_wallet/monero/monero_transaction_info.dart';
|
import 'package:cake_wallet/monero/monero_transaction_info.dart';
|
||||||
import 'package:cake_wallet/monero/monero_wallet_addresses.dart';
|
import 'package:cake_wallet/monero/monero_wallet_addresses.dart';
|
||||||
import 'package:cake_wallet/monero/monero_wallet_utils.dart';
|
import 'package:cake_wallet/monero/monero_wallet_utils.dart';
|
||||||
|
import 'package:cw_monero/structs/pending_transaction.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cw_monero/transaction_history.dart'
|
import 'package:cw_monero/transaction_history.dart'
|
||||||
|
@ -12,6 +13,7 @@ import 'package:cw_monero/transaction_history.dart'
|
||||||
import 'package:cw_monero/wallet.dart';
|
import 'package:cw_monero/wallet.dart';
|
||||||
import 'package:cw_monero/wallet.dart' as monero_wallet;
|
import 'package:cw_monero/wallet.dart' as monero_wallet;
|
||||||
import 'package:cw_monero/transaction_history.dart' as transaction_history;
|
import 'package:cw_monero/transaction_history.dart' as transaction_history;
|
||||||
|
import 'package:cw_monero/monero_output.dart';
|
||||||
import 'package:cake_wallet/monero/monero_transaction_creation_credentials.dart';
|
import 'package:cake_wallet/monero/monero_transaction_creation_credentials.dart';
|
||||||
import 'package:cake_wallet/monero/pending_monero_transaction.dart';
|
import 'package:cake_wallet/monero/pending_monero_transaction.dart';
|
||||||
import 'package:cake_wallet/monero/monero_wallet_keys.dart';
|
import 'package:cake_wallet/monero/monero_wallet_keys.dart';
|
||||||
|
@ -149,31 +151,66 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
||||||
@override
|
@override
|
||||||
Future<PendingTransaction> createTransaction(Object credentials) async {
|
Future<PendingTransaction> createTransaction(Object credentials) async {
|
||||||
final _credentials = credentials as MoneroTransactionCreationCredentials;
|
final _credentials = credentials as MoneroTransactionCreationCredentials;
|
||||||
final amount = _credentials.amount != null
|
final outputs = _credentials.outputs;
|
||||||
? moneroParseAmount(amount: _credentials.amount)
|
final hasMultiDestination = outputs.length > 1;
|
||||||
: null;
|
|
||||||
final unlockedBalance =
|
final unlockedBalance =
|
||||||
monero_wallet.getUnlockedBalance(accountIndex: walletAddresses.account.id);
|
monero_wallet.getUnlockedBalance(accountIndex: walletAddresses.account.id);
|
||||||
|
|
||||||
if ((amount != null && unlockedBalance < amount) ||
|
PendingTransactionDescription pendingTransactionDescription;
|
||||||
(amount == null && unlockedBalance <= 0)) {
|
|
||||||
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
|
|
||||||
|
|
||||||
throw MoneroTransactionCreationException(
|
|
||||||
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${_credentials.amount}.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(syncStatus is SyncedSyncStatus)) {
|
if (!(syncStatus is SyncedSyncStatus)) {
|
||||||
throw MoneroTransactionCreationException('The wallet is not synced.');
|
throw MoneroTransactionCreationException('The wallet is not synced.');
|
||||||
}
|
}
|
||||||
|
|
||||||
final pendingTransactionDescription =
|
if (hasMultiDestination) {
|
||||||
await transaction_history.createTransaction(
|
if (outputs.any((item) => item.sendAll
|
||||||
address: _credentials.address,
|
|| item.formattedCryptoAmount <= 0)) {
|
||||||
paymentId: _credentials.paymentId,
|
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
|
||||||
amount: _credentials.amount,
|
}
|
||||||
priorityRaw: _credentials.priority.serialize(),
|
|
||||||
accountIndex: walletAddresses.account.id);
|
final int totalAmount = outputs.fold(0, (acc, value) =>
|
||||||
|
acc + value.formattedCryptoAmount);
|
||||||
|
|
||||||
|
if (unlockedBalance < totalAmount) {
|
||||||
|
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
|
||||||
|
}
|
||||||
|
|
||||||
|
final moneroOutputs = outputs.map((output) =>
|
||||||
|
MoneroOutput(
|
||||||
|
address: output.address,
|
||||||
|
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.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 PendingMoneroTransaction(pendingTransactionDescription);
|
return PendingMoneroTransaction(pendingTransactionDescription);
|
||||||
}
|
}
|
||||||
|
|
|
@ -786,22 +786,7 @@ class ExchangePage extends BasePage {
|
||||||
BuildContext context, String domain, String ticker) async {
|
BuildContext context, String domain, String ticker) async {
|
||||||
final parsedAddress = await parseAddressFromDomain(domain, ticker);
|
final parsedAddress = await parseAddressFromDomain(domain, ticker);
|
||||||
|
|
||||||
switch (parsedAddress.parseFrom) {
|
showAddressAlert(context, parsedAddress);
|
||||||
case ParseFrom.unstoppableDomains:
|
|
||||||
showAddressAlert(
|
|
||||||
context,
|
|
||||||
S.of(context).address_detected,
|
|
||||||
S.of(context).address_from_domain(parsedAddress.name));
|
|
||||||
break;
|
|
||||||
case ParseFrom.openAlias:
|
|
||||||
showAddressAlert(
|
|
||||||
context,
|
|
||||||
S.of(context).openalias_alert_title,
|
|
||||||
S.of(context).openalias_alert_content(parsedAddress.name));
|
|
||||||
break;
|
|
||||||
case ParseFrom.notParsed:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parsedAddress.address;
|
return parsedAddress.address;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,11 +165,9 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
signed: false, decimal: true),
|
signed: false, decimal: true),
|
||||||
// inputFormatters: [
|
inputFormatters: [
|
||||||
// LengthLimitingTextInputFormatter(15),
|
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
||||||
// BlacklistingTextInputFormatter(
|
],
|
||||||
// RegExp('[\\-|\\ |\\,]'))
|
|
||||||
// ],
|
|
||||||
hintText: '0.0000',
|
hintText: '0.0000',
|
||||||
borderColor: widget.borderColor,
|
borderColor: widget.borderColor,
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
|
|
|
@ -385,9 +385,8 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||||
.pendingTransactionFiatAmount +
|
.pendingTransactionFiatAmount +
|
||||||
' ' +
|
' ' +
|
||||||
widget.exchangeTradeViewModel.sendViewModel.fiat.title,
|
widget.exchangeTradeViewModel.sendViewModel.fiat.title,
|
||||||
recipientTitle: S.of(context).recipient_address,
|
outputs: widget.exchangeTradeViewModel.sendViewModel
|
||||||
recipientAddress:
|
.outputs);
|
||||||
widget.exchangeTradeViewModel.sendViewModel.address);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,11 +2,10 @@ import 'package:mobx/mobx.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
||||||
import 'package:keyboard_actions/keyboard_actions.dart';
|
import 'package:keyboard_actions/keyboard_actions.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
|
||||||
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||||
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||||
|
@ -14,9 +13,11 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
|
|
||||||
class SendTemplatePage extends BasePage {
|
class SendTemplatePage extends BasePage {
|
||||||
SendTemplatePage({@required this.sendViewModel});
|
SendTemplatePage({@required this.sendTemplateViewModel}) {
|
||||||
|
sendTemplateViewModel.output.reset();
|
||||||
|
}
|
||||||
|
|
||||||
final SendViewModel sendViewModel;
|
final SendTemplateViewModel sendTemplateViewModel;
|
||||||
final _addressController = TextEditingController();
|
final _addressController = TextEditingController();
|
||||||
final _cryptoAmountController = TextEditingController();
|
final _cryptoAmountController = TextEditingController();
|
||||||
final _fiatAmountController = TextEditingController();
|
final _fiatAmountController = TextEditingController();
|
||||||
|
@ -100,7 +101,7 @@ class SendTemplatePage extends BasePage {
|
||||||
.decorationColor,
|
.decorationColor,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: 14),
|
fontSize: 14),
|
||||||
validator: sendViewModel.templateValidator,
|
validator: sendTemplateViewModel.templateValidator,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 20),
|
padding: EdgeInsets.only(top: 20),
|
||||||
|
@ -145,49 +146,47 @@ class SendTemplatePage extends BasePage {
|
||||||
.primaryTextTheme
|
.primaryTextTheme
|
||||||
.headline
|
.headline
|
||||||
.decorationColor),
|
.decorationColor),
|
||||||
//validator: sendViewModel.addressValidator,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Observer(builder: (_) {
|
Padding(
|
||||||
return Padding(
|
padding: const EdgeInsets.only(top: 20),
|
||||||
padding: const EdgeInsets.only(top: 20),
|
child: BaseTextFormField(
|
||||||
child: BaseTextFormField(
|
focusNode: _cryptoAmountFocus,
|
||||||
focusNode: _cryptoAmountFocus,
|
controller: _cryptoAmountController,
|
||||||
controller: _cryptoAmountController,
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
signed: false, decimal: true),
|
||||||
signed: false, decimal: true),
|
inputFormatters: [
|
||||||
inputFormatters: [
|
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
||||||
BlacklistingTextInputFormatter(
|
],
|
||||||
RegExp('[\\-|\\ ]'))
|
prefixIcon: Padding(
|
||||||
],
|
padding: EdgeInsets.only(top: 9),
|
||||||
prefixIcon: Padding(
|
child:
|
||||||
padding: EdgeInsets.only(top: 9),
|
Text(sendTemplateViewModel
|
||||||
child:
|
.currency.title + ':',
|
||||||
Text(sendViewModel.currency.title + ':',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 16,
|
||||||
fontSize: 16,
|
fontWeight: FontWeight.w600,
|
||||||
fontWeight: FontWeight.w600,
|
color: Colors.white,
|
||||||
color: Colors.white,
|
)),
|
||||||
)),
|
),
|
||||||
),
|
hintText: '0.0000',
|
||||||
hintText: '0.0000',
|
borderColor: Theme.of(context)
|
||||||
borderColor: Theme.of(context)
|
.primaryTextTheme
|
||||||
.primaryTextTheme
|
.headline
|
||||||
.headline
|
.color,
|
||||||
.color,
|
textStyle: TextStyle(
|
||||||
textStyle: TextStyle(
|
fontSize: 14,
|
||||||
fontSize: 14,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
color: Colors.white),
|
||||||
color: Colors.white),
|
placeholderTextStyle: TextStyle(
|
||||||
placeholderTextStyle: TextStyle(
|
color: Theme.of(context)
|
||||||
color: Theme.of(context)
|
.primaryTextTheme
|
||||||
.primaryTextTheme
|
.headline
|
||||||
.headline
|
.decorationColor,
|
||||||
.decorationColor,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
fontSize: 14),
|
||||||
fontSize: 14),
|
validator: sendTemplateViewModel
|
||||||
validator: sendViewModel.amountValidator));
|
.amountValidator)),
|
||||||
}),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 20),
|
padding: const EdgeInsets.only(top: 20),
|
||||||
child: BaseTextFormField(
|
child: BaseTextFormField(
|
||||||
|
@ -196,12 +195,12 @@ class SendTemplatePage extends BasePage {
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
signed: false, decimal: true),
|
signed: false, decimal: true),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
BlacklistingTextInputFormatter(
|
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
||||||
RegExp('[\\-|\\ ]'))
|
|
||||||
],
|
],
|
||||||
prefixIcon: Padding(
|
prefixIcon: Padding(
|
||||||
padding: EdgeInsets.only(top: 9),
|
padding: EdgeInsets.only(top: 9),
|
||||||
child: Text(sendViewModel.fiat.title + ':',
|
child: Text(sendTemplateViewModel
|
||||||
|
.fiat.title + ':',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
@ -236,12 +235,11 @@ class SendTemplatePage extends BasePage {
|
||||||
bottomSection: PrimaryButton(
|
bottomSection: PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState.validate()) {
|
if (_formKey.currentState.validate()) {
|
||||||
sendViewModel.addTemplate(
|
sendTemplateViewModel.addTemplate(
|
||||||
name: _nameController.text,
|
name: _nameController.text,
|
||||||
address: _addressController.text,
|
address: _addressController.text,
|
||||||
cryptoCurrency: sendViewModel.currency.title,
|
cryptoCurrency: sendTemplateViewModel.currency.title,
|
||||||
amount: _cryptoAmountController.text);
|
amount: _cryptoAmountController.text);
|
||||||
sendViewModel.updateTemplate();
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -258,19 +256,21 @@ class SendTemplatePage extends BasePage {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
reaction((_) => sendViewModel.fiatAmount, (String amount) {
|
final output = sendTemplateViewModel.output;
|
||||||
|
|
||||||
|
reaction((_) => output.fiatAmount, (String amount) {
|
||||||
if (amount != _fiatAmountController.text) {
|
if (amount != _fiatAmountController.text) {
|
||||||
_fiatAmountController.text = amount;
|
_fiatAmountController.text = amount;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
reaction((_) => sendViewModel.cryptoAmount, (String amount) {
|
reaction((_) => output.cryptoAmount, (String amount) {
|
||||||
if (amount != _cryptoAmountController.text) {
|
if (amount != _cryptoAmountController.text) {
|
||||||
_cryptoAmountController.text = amount;
|
_cryptoAmountController.text = amount;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
reaction((_) => sendViewModel.address, (String address) {
|
reaction((_) => output.address, (String address) {
|
||||||
if (address != _addressController.text) {
|
if (address != _addressController.text) {
|
||||||
_addressController.text = address;
|
_addressController.text = address;
|
||||||
}
|
}
|
||||||
|
@ -279,24 +279,24 @@ class SendTemplatePage extends BasePage {
|
||||||
_cryptoAmountController.addListener(() {
|
_cryptoAmountController.addListener(() {
|
||||||
final amount = _cryptoAmountController.text;
|
final amount = _cryptoAmountController.text;
|
||||||
|
|
||||||
if (amount != sendViewModel.cryptoAmount) {
|
if (amount != output.cryptoAmount) {
|
||||||
sendViewModel.setCryptoAmount(amount);
|
output.setCryptoAmount(amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_fiatAmountController.addListener(() {
|
_fiatAmountController.addListener(() {
|
||||||
final amount = _fiatAmountController.text;
|
final amount = _fiatAmountController.text;
|
||||||
|
|
||||||
if (amount != sendViewModel.fiatAmount) {
|
if (amount != output.fiatAmount) {
|
||||||
sendViewModel.setFiatAmount(amount);
|
output.setFiatAmount(amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_addressController.addListener(() {
|
_addressController.addListener(() {
|
||||||
final address = _addressController.text;
|
final address = _addressController.text;
|
||||||
|
|
||||||
if (sendViewModel.address != address) {
|
if (output.address != address) {
|
||||||
sendViewModel.address = address;
|
output.address = address;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/output.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
|
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
|
||||||
|
|
||||||
class ConfirmSendingAlert extends BaseAlertDialog {
|
class ConfirmSendingAlert extends BaseAlertDialog {
|
||||||
ConfirmSendingAlert({
|
ConfirmSendingAlert({
|
||||||
|
@ -11,14 +14,12 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
||||||
@required this.fee,
|
@required this.fee,
|
||||||
@required this.feeValue,
|
@required this.feeValue,
|
||||||
@required this.feeFiatAmount,
|
@required this.feeFiatAmount,
|
||||||
@required this.recipientTitle,
|
@required this.outputs,
|
||||||
@required this.recipientAddress,
|
|
||||||
@required this.leftButtonText,
|
@required this.leftButtonText,
|
||||||
@required this.rightButtonText,
|
@required this.rightButtonText,
|
||||||
@required this.actionLeftButton,
|
@required this.actionLeftButton,
|
||||||
@required this.actionRightButton,
|
@required this.actionRightButton,
|
||||||
this.alertBarrierDismissible = true
|
this.alertBarrierDismissible = true});
|
||||||
});
|
|
||||||
|
|
||||||
final String alertTitle;
|
final String alertTitle;
|
||||||
final String amount;
|
final String amount;
|
||||||
|
@ -27,8 +28,7 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
||||||
final String fee;
|
final String fee;
|
||||||
final String feeValue;
|
final String feeValue;
|
||||||
final String feeFiatAmount;
|
final String feeFiatAmount;
|
||||||
final String recipientTitle;
|
final List<Output> outputs;
|
||||||
final String recipientAddress;
|
|
||||||
final String leftButtonText;
|
final String leftButtonText;
|
||||||
final String rightButtonText;
|
final String rightButtonText;
|
||||||
final VoidCallback actionLeftButton;
|
final VoidCallback actionLeftButton;
|
||||||
|
@ -57,128 +57,290 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
||||||
bool get barrierDismissible => alertBarrierDismissible;
|
bool get barrierDismissible => alertBarrierDismissible;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget content(BuildContext context) {
|
Widget content(BuildContext context) => ConfirmSendingAlertContent(
|
||||||
return Column(
|
amount: amount,
|
||||||
children: <Widget>[
|
amountValue: amountValue,
|
||||||
Row(
|
fiatAmountValue: fiatAmountValue,
|
||||||
mainAxisSize: MainAxisSize.max,
|
fee: fee,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
feeValue: feeValue,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
feeFiatAmount: feeFiatAmount,
|
||||||
children: <Widget>[
|
outputs: outputs
|
||||||
Text(
|
);
|
||||||
amount,
|
}
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
class ConfirmSendingAlertContent extends StatefulWidget {
|
||||||
fontWeight: FontWeight.normal,
|
ConfirmSendingAlertContent({
|
||||||
fontFamily: 'Lato',
|
@required this.amount,
|
||||||
color: Theme.of(context).primaryTextTheme.title.color,
|
@required this.amountValue,
|
||||||
decoration: TextDecoration.none,
|
@required this.fiatAmountValue,
|
||||||
),
|
@required this.fee,
|
||||||
),
|
@required this.feeValue,
|
||||||
Column(
|
@required this.feeFiatAmount,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
@required this.outputs});
|
||||||
children: [
|
|
||||||
Text(
|
final String amount;
|
||||||
amountValue,
|
final String amountValue;
|
||||||
style: TextStyle(
|
final String fiatAmountValue;
|
||||||
fontSize: 18,
|
final String fee;
|
||||||
fontWeight: FontWeight.w600,
|
final String feeValue;
|
||||||
fontFamily: 'Lato',
|
final String feeFiatAmount;
|
||||||
color: Theme.of(context).primaryTextTheme.title.color,
|
final List<Output> outputs;
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
@override
|
||||||
),
|
ConfirmSendingAlertContentState createState() => ConfirmSendingAlertContentState(
|
||||||
Text(
|
amount: amount,
|
||||||
fiatAmountValue,
|
amountValue: amountValue,
|
||||||
style: TextStyle(
|
fiatAmountValue: fiatAmountValue,
|
||||||
fontSize: 12,
|
fee: fee,
|
||||||
fontWeight: FontWeight.w600,
|
feeValue: feeValue,
|
||||||
fontFamily: 'Lato',
|
feeFiatAmount: feeFiatAmount,
|
||||||
color: PaletteDark.pigeonBlue,
|
outputs: outputs
|
||||||
decoration: TextDecoration.none,
|
);
|
||||||
),
|
}
|
||||||
|
|
||||||
|
class ConfirmSendingAlertContentState extends State<ConfirmSendingAlertContent> {
|
||||||
|
ConfirmSendingAlertContentState({
|
||||||
|
@required this.amount,
|
||||||
|
@required this.amountValue,
|
||||||
|
@required this.fiatAmountValue,
|
||||||
|
@required this.fee,
|
||||||
|
@required this.feeValue,
|
||||||
|
@required this.feeFiatAmount,
|
||||||
|
@required this.outputs}) {
|
||||||
|
|
||||||
|
itemCount = outputs.length;
|
||||||
|
recipientTitle = itemCount > 1
|
||||||
|
? S.current.transaction_details_recipient_address
|
||||||
|
: S.current.recipient_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String amount;
|
||||||
|
final String amountValue;
|
||||||
|
final String fiatAmountValue;
|
||||||
|
final String fee;
|
||||||
|
final String feeValue;
|
||||||
|
final String feeFiatAmount;
|
||||||
|
final List<Output> outputs;
|
||||||
|
|
||||||
|
final double backgroundHeight = 160;
|
||||||
|
final double thumbHeight = 72;
|
||||||
|
ScrollController controller = ScrollController();
|
||||||
|
double fromTop = 0;
|
||||||
|
String recipientTitle;
|
||||||
|
int itemCount;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
controller.addListener(() {
|
||||||
|
fromTop = controller.hasClients
|
||||||
|
? (controller.offset / controller.position.maxScrollExtent *
|
||||||
|
(backgroundHeight - thumbHeight))
|
||||||
|
: 0;
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 200,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: controller,
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
amount,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
amountValue,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
fiatAmountValue,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: PaletteDark.pigeonBlue,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 16),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
fee,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
feeValue,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
feeFiatAmount,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: PaletteDark.pigeonBlue,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'$recipientTitle:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
itemCount > 1
|
||||||
|
? ListView.builder(
|
||||||
|
padding: EdgeInsets.only(top: 0),
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: itemCount,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final item = outputs[index];
|
||||||
|
final _address = item.address;
|
||||||
|
final _amount =
|
||||||
|
item.cryptoAmount.replaceAll(',', '.');
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 8),
|
||||||
|
child: Text(
|
||||||
|
_address,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: PaletteDark.pigeonBlue,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
_amount,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: PaletteDark.pigeonBlue,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
})
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.only(top: 8),
|
||||||
|
child: Text(
|
||||||
|
outputs.first.address,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: PaletteDark.pigeonBlue,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
)
|
)
|
||||||
],
|
|
||||||
)
|
)
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Padding(
|
if (itemCount > 1) CakeScrollbar(
|
||||||
padding: EdgeInsets.only(top: 16),
|
backgroundHeight: backgroundHeight,
|
||||||
child: Row(
|
thumbHeight: thumbHeight,
|
||||||
mainAxisSize: MainAxisSize.max,
|
fromTop: fromTop,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
rightOffset: -15
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
fee,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
fontFamily: 'Lato',
|
|
||||||
color: Theme.of(context).primaryTextTheme.title.color,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
feeValue,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontFamily: 'Lato',
|
|
||||||
color: Theme.of(context).primaryTextTheme.title.color,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
feeFiatAmount,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontFamily: 'Lato',
|
|
||||||
color: PaletteDark.pigeonBlue,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
),
|
]
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(0, 16, 0, 0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'$recipientTitle:',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
fontFamily: 'Lato',
|
|
||||||
color: Theme.of(context).primaryTextTheme.title.color,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 8),
|
|
||||||
child: Text(
|
|
||||||
recipientAddress,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontFamily: 'Lato',
|
|
||||||
color: PaletteDark.pigeonBlue,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,26 @@
|
||||||
|
import 'package:cake_wallet/entities/parsed_address.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
|
||||||
void showAddressAlert(BuildContext context, String title, String content) async {
|
void showAddressAlert(BuildContext context, ParsedAddress parsedAddress) async {
|
||||||
|
var title = '';
|
||||||
|
var content = '';
|
||||||
|
|
||||||
|
switch (parsedAddress.parseFrom) {
|
||||||
|
case ParseFrom.unstoppableDomains:
|
||||||
|
title = S.of(context).address_detected;
|
||||||
|
content = S.of(context).address_from_domain(parsedAddress.name);
|
||||||
|
break;
|
||||||
|
case ParseFrom.openAlias:
|
||||||
|
title = S.of(context).openalias_alert_title;
|
||||||
|
content = S.of(context).openalias_alert_content(parsedAddress.name);
|
||||||
|
break;
|
||||||
|
case ParseFrom.notParsed:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await showPopUp<void>(
|
await showPopUp<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
|
561
lib/src/screens/send/widgets/send_card.dart
Normal file
561
lib/src/screens/send/widgets/send_card.dart
Normal file
|
@ -0,0 +1,561 @@
|
||||||
|
import 'dart:ui';
|
||||||
|
import 'package:cake_wallet/entities/transaction_priority.dart';
|
||||||
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/send/widgets/parse_address_from_domain_alert.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/output.dart';
|
||||||
|
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
import 'package:mobx/mobx.dart';
|
||||||
|
import 'package:keyboard_actions/keyboard_actions.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
||||||
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||||
|
|
||||||
|
class SendCard extends StatefulWidget {
|
||||||
|
SendCard({Key key, @required this.output, @required this.sendViewModel}) : super(key: key);
|
||||||
|
|
||||||
|
final Output output;
|
||||||
|
final SendViewModel sendViewModel;
|
||||||
|
|
||||||
|
@override
|
||||||
|
SendCardState createState() => SendCardState(
|
||||||
|
output: output,
|
||||||
|
sendViewModel: sendViewModel
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class SendCardState extends State<SendCard>
|
||||||
|
with AutomaticKeepAliveClientMixin<SendCard> {
|
||||||
|
SendCardState({@required this.output, @required this.sendViewModel})
|
||||||
|
: addressController = TextEditingController(),
|
||||||
|
cryptoAmountController = TextEditingController(),
|
||||||
|
fiatAmountController = TextEditingController(),
|
||||||
|
noteController = TextEditingController(),
|
||||||
|
cryptoAmountFocus = FocusNode(),
|
||||||
|
fiatAmountFocus = FocusNode(),
|
||||||
|
addressFocusNode = FocusNode();
|
||||||
|
|
||||||
|
static const prefixIconWidth = 34.0;
|
||||||
|
static const prefixIconHeight = 34.0;
|
||||||
|
|
||||||
|
final Output output;
|
||||||
|
final SendViewModel sendViewModel;
|
||||||
|
|
||||||
|
final TextEditingController addressController;
|
||||||
|
final TextEditingController cryptoAmountController;
|
||||||
|
final TextEditingController fiatAmountController;
|
||||||
|
final TextEditingController noteController;
|
||||||
|
final FocusNode cryptoAmountFocus;
|
||||||
|
final FocusNode fiatAmountFocus;
|
||||||
|
final FocusNode addressFocusNode;
|
||||||
|
|
||||||
|
bool _effectsInstalled = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
|
_setEffects(context);
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
KeyboardActions(
|
||||||
|
config: KeyboardActionsConfig(
|
||||||
|
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||||
|
keyboardBarColor: Theme.of(context).accentTextTheme.body2
|
||||||
|
.backgroundColor,
|
||||||
|
nextFocus: false,
|
||||||
|
actions: [
|
||||||
|
KeyboardActionsItem(
|
||||||
|
focusNode: cryptoAmountFocus,
|
||||||
|
toolbarButtons: [(_) => KeyboardDoneButton()],
|
||||||
|
),
|
||||||
|
KeyboardActionsItem(
|
||||||
|
focusNode: fiatAmountFocus,
|
||||||
|
toolbarButtons: [(_) => KeyboardDoneButton()],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
child: Container(
|
||||||
|
height: 0,
|
||||||
|
color: Colors.transparent,
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(24),
|
||||||
|
bottomRight: Radius.circular(24)),
|
||||||
|
gradient: LinearGradient(colors: [
|
||||||
|
Theme.of(context).primaryTextTheme.subhead.color,
|
||||||
|
Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.subhead
|
||||||
|
.decorationColor,
|
||||||
|
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(24, 100, 24, 32),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
AddressTextField(
|
||||||
|
focusNode: addressFocusNode,
|
||||||
|
controller: addressController,
|
||||||
|
onURIScanned: (uri) {
|
||||||
|
var address = '';
|
||||||
|
var amount = '';
|
||||||
|
|
||||||
|
if (uri != null) {
|
||||||
|
address = uri.path;
|
||||||
|
amount = uri.queryParameters['tx_amount'] ??
|
||||||
|
uri.queryParameters['amount'];
|
||||||
|
} else {
|
||||||
|
address = uri.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
addressController.text = address;
|
||||||
|
cryptoAmountController.text = amount;
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
AddressTextFieldOption.paste,
|
||||||
|
AddressTextFieldOption.qrCode,
|
||||||
|
AddressTextFieldOption.addressBook
|
||||||
|
],
|
||||||
|
buttonColor: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.color,
|
||||||
|
borderColor: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.color,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white),
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor),
|
||||||
|
onPushPasteButton: (context) async {
|
||||||
|
final parsedAddress =
|
||||||
|
await output.applyOpenaliasOrUnstoppableDomains();
|
||||||
|
showAddressAlert(context, parsedAddress);
|
||||||
|
},
|
||||||
|
validator: sendViewModel.addressValidator,
|
||||||
|
),
|
||||||
|
Observer(
|
||||||
|
builder: (_) => Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 20),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
BaseTextFormField(
|
||||||
|
focusNode: cryptoAmountFocus,
|
||||||
|
controller: cryptoAmountController,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.numberWithOptions(
|
||||||
|
signed: false, decimal: true),
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
||||||
|
],
|
||||||
|
prefixIcon: Padding(
|
||||||
|
padding: EdgeInsets.only(top: 9),
|
||||||
|
child: Text(
|
||||||
|
sendViewModel.currency.title +
|
||||||
|
':',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Colors.white,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
suffixIcon: SizedBox(
|
||||||
|
width: prefixIconWidth,
|
||||||
|
),
|
||||||
|
hintText: '0.0000',
|
||||||
|
borderColor: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.color,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white),
|
||||||
|
placeholderTextStyle: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 14),
|
||||||
|
validator: output.sendAll
|
||||||
|
? sendViewModel.allAmountValidator
|
||||||
|
: sendViewModel
|
||||||
|
.amountValidator),
|
||||||
|
if (!sendViewModel.isBatchSending) Positioned(
|
||||||
|
top: 2,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
width: prefixIconWidth,
|
||||||
|
height: prefixIconHeight,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async =>
|
||||||
|
output.setSendAll(),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.color,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(
|
||||||
|
Radius.circular(6))),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
S.of(context).all,
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
color:
|
||||||
|
Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.display1
|
||||||
|
.decorationColor))),
|
||||||
|
))))])
|
||||||
|
)),
|
||||||
|
Observer(
|
||||||
|
builder: (_) => Padding(
|
||||||
|
padding: EdgeInsets.only(top: 10),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
S.of(context).available_balance +
|
||||||
|
':',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor),
|
||||||
|
)),
|
||||||
|
Text(
|
||||||
|
sendViewModel.balance,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 20),
|
||||||
|
child: BaseTextFormField(
|
||||||
|
focusNode: fiatAmountFocus,
|
||||||
|
controller: fiatAmountController,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.numberWithOptions(
|
||||||
|
signed: false, decimal: true),
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
|
||||||
|
],
|
||||||
|
prefixIcon: Padding(
|
||||||
|
padding: EdgeInsets.only(top: 9),
|
||||||
|
child:
|
||||||
|
Text(sendViewModel.fiat.title + ':',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Colors.white,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
hintText: '0.00',
|
||||||
|
borderColor: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.color,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white),
|
||||||
|
placeholderTextStyle: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 14),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 20),
|
||||||
|
child: BaseTextFormField(
|
||||||
|
controller: noteController,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
maxLines: null,
|
||||||
|
borderColor: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.color,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white),
|
||||||
|
hintText: S.of(context).note_optional,
|
||||||
|
placeholderTextStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Observer(
|
||||||
|
builder: (_) => GestureDetector(
|
||||||
|
onTap: () =>
|
||||||
|
_setTransactionPriority(context),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(top: 24),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
S
|
||||||
|
.of(context)
|
||||||
|
.send_estimated_fee,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w500,
|
||||||
|
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||||
|
color: Colors.white)),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
output
|
||||||
|
.estimatedFee
|
||||||
|
.toString() +
|
||||||
|
' ' +
|
||||||
|
sendViewModel
|
||||||
|
.currency.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||||
|
color:
|
||||||
|
Colors.white)),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(top: 5),
|
||||||
|
child: Text(
|
||||||
|
output
|
||||||
|
.estimatedFeeFiatAmount
|
||||||
|
+ ' ' +
|
||||||
|
sendViewModel
|
||||||
|
.fiat.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
|
color: Theme
|
||||||
|
.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor))
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 2,
|
||||||
|
left: 5),
|
||||||
|
child: Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
size: 12,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
if (sendViewModel.isElectrumWallet) Padding(
|
||||||
|
padding: EdgeInsets.only(top: 6),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => Navigator.of(context)
|
||||||
|
.pushNamed(Routes.unspentCoinsList),
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
S.of(context).coin_control,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Colors.white)),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
size: 12,
|
||||||
|
color: Colors.white,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _setEffects(BuildContext context) {
|
||||||
|
addressController.text = output.address;
|
||||||
|
cryptoAmountController.text = output.cryptoAmount;
|
||||||
|
fiatAmountController.text = output.fiatAmount;
|
||||||
|
noteController.text = output.note;
|
||||||
|
|
||||||
|
if (_effectsInstalled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cryptoAmountController.addListener(() {
|
||||||
|
final amount = cryptoAmountController.text;
|
||||||
|
|
||||||
|
if (output.sendAll && amount != S.current.all) {
|
||||||
|
output.sendAll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount != output.cryptoAmount) {
|
||||||
|
output.setCryptoAmount(amount);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fiatAmountController.addListener(() {
|
||||||
|
final amount = fiatAmountController.text;
|
||||||
|
|
||||||
|
if (amount != output.fiatAmount) {
|
||||||
|
output.sendAll = false;
|
||||||
|
output.setFiatAmount(amount);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
noteController.addListener(() {
|
||||||
|
final note = noteController.text ?? '';
|
||||||
|
|
||||||
|
if (note != output.note) {
|
||||||
|
output.note = note;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reaction((_) => output.sendAll, (bool all) {
|
||||||
|
if (all) {
|
||||||
|
cryptoAmountController.text = S.current.all;
|
||||||
|
fiatAmountController.text = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reaction((_) => output.fiatAmount, (String amount) {
|
||||||
|
if (amount != fiatAmountController.text) {
|
||||||
|
fiatAmountController.text = amount;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reaction((_) => output.cryptoAmount, (String amount) {
|
||||||
|
if (output.sendAll && amount != S.current.all) {
|
||||||
|
output.sendAll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount != cryptoAmountController.text) {
|
||||||
|
cryptoAmountController.text = amount;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reaction((_) => output.address, (String address) {
|
||||||
|
if (address != addressController.text) {
|
||||||
|
addressController.text = address;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addressController.addListener(() {
|
||||||
|
final address = addressController.text;
|
||||||
|
|
||||||
|
if (output.address != address) {
|
||||||
|
output.address = address;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
reaction((_) => output.note, (String note) {
|
||||||
|
if (note != noteController.text) {
|
||||||
|
noteController.text = note;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addressFocusNode.addListener(() async {
|
||||||
|
if (!addressFocusNode.hasFocus && addressController.text.isNotEmpty) {
|
||||||
|
final parsedAddress = await output.applyOpenaliasOrUnstoppableDomains();
|
||||||
|
showAddressAlert(context, parsedAddress);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_effectsInstalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _setTransactionPriority(BuildContext context) async {
|
||||||
|
final items = priorityForWalletType(sendViewModel.walletType);
|
||||||
|
final selectedItem = items.indexOf(sendViewModel.transactionPriority);
|
||||||
|
|
||||||
|
await showPopUp<void>(
|
||||||
|
builder: (_) => Picker(
|
||||||
|
items: items,
|
||||||
|
displayItem: sendViewModel.displayFeeRate,
|
||||||
|
selectedAtIndex: selectedItem,
|
||||||
|
title: S.of(context).please_select,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
onItemSelected: (TransactionPriority priority) =>
|
||||||
|
sendViewModel.setTransactionPriority(priority),
|
||||||
|
),
|
||||||
|
context: context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
}
|
|
@ -4,17 +4,19 @@ class CakeScrollbar extends StatelessWidget {
|
||||||
CakeScrollbar({
|
CakeScrollbar({
|
||||||
@required this.backgroundHeight,
|
@required this.backgroundHeight,
|
||||||
@required this.thumbHeight,
|
@required this.thumbHeight,
|
||||||
@required this.fromTop
|
@required this.fromTop,
|
||||||
|
this.rightOffset = 6
|
||||||
});
|
});
|
||||||
|
|
||||||
final double backgroundHeight;
|
final double backgroundHeight;
|
||||||
final double thumbHeight;
|
final double thumbHeight;
|
||||||
final double fromTop;
|
final double fromTop;
|
||||||
|
final double rightOffset;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
right: 6,
|
right: rightOffset,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: backgroundHeight,
|
height: backgroundHeight,
|
||||||
width: 6,
|
width: 6,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:dotted_border/dotted_border.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
@ -8,18 +9,22 @@ class PrimaryButton extends StatelessWidget {
|
||||||
@required this.color,
|
@required this.color,
|
||||||
@required this.textColor,
|
@required this.textColor,
|
||||||
this.isDisabled = false,
|
this.isDisabled = false,
|
||||||
|
this.isDottedBorder = false,
|
||||||
|
this.borderColor = Colors.black,
|
||||||
this.onDisabledPressed});
|
this.onDisabledPressed});
|
||||||
|
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
final VoidCallback onDisabledPressed;
|
final VoidCallback onDisabledPressed;
|
||||||
final Color color;
|
final Color color;
|
||||||
final Color textColor;
|
final Color textColor;
|
||||||
|
final Color borderColor;
|
||||||
final String text;
|
final String text;
|
||||||
final bool isDisabled;
|
final bool isDisabled;
|
||||||
|
final bool isDottedBorder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ButtonTheme(
|
final content = ButtonTheme(
|
||||||
minWidth: double.infinity,
|
minWidth: double.infinity,
|
||||||
height: 52.0,
|
height: 52.0,
|
||||||
child: FlatButton(
|
child: FlatButton(
|
||||||
|
@ -27,6 +32,8 @@ class PrimaryButton extends StatelessWidget {
|
||||||
? (onDisabledPressed != null ? onDisabledPressed : null)
|
? (onDisabledPressed != null ? onDisabledPressed : null)
|
||||||
: onPressed,
|
: onPressed,
|
||||||
color: isDisabled ? color.withOpacity(0.5) : color,
|
color: isDisabled ? color.withOpacity(0.5) : color,
|
||||||
|
splashColor: Colors.transparent,
|
||||||
|
highlightColor: Colors.transparent,
|
||||||
disabledColor: color.withOpacity(0.5),
|
disabledColor: color.withOpacity(0.5),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(26.0),
|
borderRadius: BorderRadius.circular(26.0),
|
||||||
|
@ -40,6 +47,16 @@ class PrimaryButton extends StatelessWidget {
|
||||||
? textColor.withOpacity(0.5)
|
? textColor.withOpacity(0.5)
|
||||||
: textColor)),
|
: textColor)),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
return isDottedBorder
|
||||||
|
? DottedBorder(
|
||||||
|
borderType: BorderType.RRect,
|
||||||
|
dashPattern: [6, 4],
|
||||||
|
color: borderColor,
|
||||||
|
strokeWidth: 2,
|
||||||
|
radius: Radius.circular(26),
|
||||||
|
child: content)
|
||||||
|
: content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,12 @@ class BrightTheme extends ThemeBase {
|
||||||
),
|
),
|
||||||
display2: TextStyle(
|
display2: TextStyle(
|
||||||
color: Colors.white.withOpacity(0.5), // estimated fee (send page)
|
color: Colors.white.withOpacity(0.5), // estimated fee (send page)
|
||||||
|
backgroundColor: PaletteDark.darkCyanBlue.withOpacity(0.67), // dot color for indicator on send page
|
||||||
decorationColor: Palette.shadowWhite // template dotted border (send page)
|
decorationColor: Palette.shadowWhite // template dotted border (send page)
|
||||||
),
|
),
|
||||||
display3: TextStyle(
|
display3: TextStyle(
|
||||||
color: Palette.darkBlueCraiola, // template new text (send page)
|
color: Palette.darkBlueCraiola, // template new text (send page)
|
||||||
|
backgroundColor: PaletteDark.darkNightBlue, // active dot color for indicator on send page
|
||||||
decorationColor: Palette.shadowWhite // template background color (send page)
|
decorationColor: Palette.shadowWhite // template background color (send page)
|
||||||
),
|
),
|
||||||
display4: TextStyle(
|
display4: TextStyle(
|
||||||
|
|
|
@ -104,10 +104,12 @@ class DarkTheme extends ThemeBase {
|
||||||
),
|
),
|
||||||
display2: TextStyle(
|
display2: TextStyle(
|
||||||
color: Colors.white, // estimated fee (send page)
|
color: Colors.white, // estimated fee (send page)
|
||||||
|
backgroundColor: PaletteDark.cyanBlue, // dot color for indicator on send page
|
||||||
decorationColor: PaletteDark.darkCyanBlue // template dotted border (send page)
|
decorationColor: PaletteDark.darkCyanBlue // template dotted border (send page)
|
||||||
),
|
),
|
||||||
display3: TextStyle(
|
display3: TextStyle(
|
||||||
color: PaletteDark.darkCyanBlue, // template new text (send page)
|
color: PaletteDark.darkCyanBlue, // template new text (send page)
|
||||||
|
backgroundColor: Colors.white, // active dot color for indicator on send page
|
||||||
decorationColor: PaletteDark.darkVioletBlue // template background color (send page)
|
decorationColor: PaletteDark.darkVioletBlue // template background color (send page)
|
||||||
),
|
),
|
||||||
display4: TextStyle(
|
display4: TextStyle(
|
||||||
|
|
|
@ -105,10 +105,12 @@ class LightTheme extends ThemeBase {
|
||||||
),
|
),
|
||||||
display2: TextStyle(
|
display2: TextStyle(
|
||||||
color: Colors.white.withOpacity(0.5), // estimated fee (send page)
|
color: Colors.white.withOpacity(0.5), // estimated fee (send page)
|
||||||
|
backgroundColor: PaletteDark.darkCyanBlue.withOpacity(0.67), // dot color for indicator on send page
|
||||||
decorationColor: Palette.moderateLavender // template dotted border (send page)
|
decorationColor: Palette.moderateLavender // template dotted border (send page)
|
||||||
),
|
),
|
||||||
display3: TextStyle(
|
display3: TextStyle(
|
||||||
color: Palette.darkBlueCraiola, // template new text (send page)
|
color: Palette.darkBlueCraiola, // template new text (send page)
|
||||||
|
backgroundColor: PaletteDark.darkNightBlue, // active dot color for indicator on send page
|
||||||
decorationColor: Palette.blueAlice // template background color (send page)
|
decorationColor: Palette.blueAlice // template background color (send page)
|
||||||
),
|
),
|
||||||
display4: TextStyle(
|
display4: TextStyle(
|
||||||
|
|
|
@ -79,8 +79,11 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendViewModel.address = trade.inputAddress;
|
sendViewModel.clearOutputs();
|
||||||
sendViewModel.setCryptoAmount(trade.amount);
|
final output = sendViewModel.outputs.first;
|
||||||
|
|
||||||
|
output.address = trade.inputAddress;
|
||||||
|
output.setCryptoAmount(trade.amount);
|
||||||
await sendViewModel.createTransaction();
|
await sendViewModel.createTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
206
lib/view_model/send/output.dart
Normal file
206
lib/view_model/send/output.dart
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart';
|
||||||
|
import 'package:cake_wallet/bitcoin/electrum_wallet.dart';
|
||||||
|
import 'package:cake_wallet/entities/calculate_fiat_amount_raw.dart';
|
||||||
|
import 'package:cake_wallet/entities/parse_address_from_domain.dart';
|
||||||
|
import 'package:cake_wallet/entities/parsed_address.dart';
|
||||||
|
import 'package:cake_wallet/monero/monero_amount_format.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:mobx/mobx.dart';
|
||||||
|
import 'package:cake_wallet/core/wallet_base.dart';
|
||||||
|
import 'package:cake_wallet/monero/monero_wallet.dart';
|
||||||
|
import 'package:cake_wallet/entities/calculate_fiat_amount.dart';
|
||||||
|
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||||
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||||
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
|
||||||
|
part 'output.g.dart';
|
||||||
|
|
||||||
|
const String cryptoNumberPattern = '0.0';
|
||||||
|
|
||||||
|
class Output = OutputBase with _$Output;
|
||||||
|
|
||||||
|
abstract class OutputBase with Store {
|
||||||
|
OutputBase(this._wallet, this._settingsStore, this._fiatConversationStore)
|
||||||
|
:_cryptoNumberFormat = NumberFormat(cryptoNumberPattern) {
|
||||||
|
reset();
|
||||||
|
_setCryptoNumMaximumFractionDigits();
|
||||||
|
key = UniqueKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
Key key;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
String fiatAmount;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
String cryptoAmount;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
String address;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
String note;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
bool sendAll;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
int get formattedCryptoAmount {
|
||||||
|
int amount = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (cryptoAmount?.isNotEmpty ?? false) {
|
||||||
|
final _cryptoAmount = cryptoAmount.replaceAll(',', '.');
|
||||||
|
int _amount = 0;
|
||||||
|
switch (walletType) {
|
||||||
|
case WalletType.monero:
|
||||||
|
_amount = moneroParseAmount(amount: _cryptoAmount);
|
||||||
|
break;
|
||||||
|
case WalletType.bitcoin:
|
||||||
|
_amount = stringDoubleToBitcoinAmount(_cryptoAmount);
|
||||||
|
break;
|
||||||
|
case WalletType.litecoin:
|
||||||
|
_amount = stringDoubleToBitcoinAmount(_cryptoAmount);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_amount > 0) {
|
||||||
|
amount = _amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
amount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed
|
||||||
|
double get estimatedFee {
|
||||||
|
try {
|
||||||
|
final fee = _wallet.calculateEstimatedFee(
|
||||||
|
_settingsStore.priority[_wallet.type], formattedCryptoAmount);
|
||||||
|
|
||||||
|
if (_wallet is ElectrumWallet) {
|
||||||
|
return bitcoinAmountToDouble(amount: fee);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_wallet is MoneroWallet) {
|
||||||
|
return moneroAmountToDouble(amount: fee);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed
|
||||||
|
String get estimatedFeeFiatAmount {
|
||||||
|
try {
|
||||||
|
final fiat = calculateFiatAmountRaw(
|
||||||
|
price: _fiatConversationStore.prices[_wallet.currency],
|
||||||
|
cryptoAmount: estimatedFee);
|
||||||
|
return fiat;
|
||||||
|
} catch (_) {
|
||||||
|
return '0.00';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WalletType get walletType => _wallet.type;
|
||||||
|
final WalletBase _wallet;
|
||||||
|
final SettingsStore _settingsStore;
|
||||||
|
final FiatConversionStore _fiatConversationStore;
|
||||||
|
final NumberFormat _cryptoNumberFormat;
|
||||||
|
|
||||||
|
@action
|
||||||
|
void setSendAll() => sendAll = true;
|
||||||
|
|
||||||
|
@action
|
||||||
|
void reset() {
|
||||||
|
sendAll = false;
|
||||||
|
cryptoAmount = '';
|
||||||
|
fiatAmount = '';
|
||||||
|
address = '';
|
||||||
|
note = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
void setCryptoAmount(String amount) {
|
||||||
|
if (amount.toUpperCase() != S.current.all) {
|
||||||
|
sendAll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cryptoAmount = amount;
|
||||||
|
_updateFiatAmount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
void setFiatAmount(String amount) {
|
||||||
|
fiatAmount = amount;
|
||||||
|
_updateCryptoAmount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
void _updateFiatAmount() {
|
||||||
|
try {
|
||||||
|
final fiat = calculateFiatAmount(
|
||||||
|
price: _fiatConversationStore.prices[_wallet.currency],
|
||||||
|
cryptoAmount: cryptoAmount.replaceAll(',', '.'));
|
||||||
|
if (fiatAmount != fiat) {
|
||||||
|
fiatAmount = fiat;
|
||||||
|
}
|
||||||
|
} catch (_) {
|
||||||
|
fiatAmount = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
void _updateCryptoAmount() {
|
||||||
|
try {
|
||||||
|
final crypto = double.parse(fiatAmount.replaceAll(',', '.')) /
|
||||||
|
_fiatConversationStore.prices[_wallet.currency];
|
||||||
|
final cryptoAmountTmp = _cryptoNumberFormat.format(crypto);
|
||||||
|
|
||||||
|
if (cryptoAmount != cryptoAmountTmp) {
|
||||||
|
cryptoAmount = cryptoAmountTmp;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
cryptoAmount = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _setCryptoNumMaximumFractionDigits() {
|
||||||
|
var maximumFractionDigits = 0;
|
||||||
|
|
||||||
|
switch (_wallet.type) {
|
||||||
|
case WalletType.monero:
|
||||||
|
maximumFractionDigits = 12;
|
||||||
|
break;
|
||||||
|
case WalletType.bitcoin:
|
||||||
|
maximumFractionDigits = 8;
|
||||||
|
break;
|
||||||
|
case WalletType.litecoin:
|
||||||
|
maximumFractionDigits = 8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cryptoNumberFormat.maximumFractionDigits = maximumFractionDigits;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ParsedAddress> applyOpenaliasOrUnstoppableDomains() async {
|
||||||
|
final domain = address;
|
||||||
|
final ticker = _wallet.currency.title.toLowerCase();
|
||||||
|
final parsedAddress = await parseAddressFromDomain(domain, ticker);
|
||||||
|
|
||||||
|
address = parsedAddress.address;
|
||||||
|
|
||||||
|
return parsedAddress;
|
||||||
|
}
|
||||||
|
}
|
66
lib/view_model/send/send_template_view_model.dart
Normal file
66
lib/view_model/send/send_template_view_model.dart
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
import 'package:cake_wallet/view_model/send/output.dart';
|
||||||
|
import 'package:mobx/mobx.dart';
|
||||||
|
import 'package:cake_wallet/entities/template.dart';
|
||||||
|
import 'package:cake_wallet/store/templates/send_template_store.dart';
|
||||||
|
import 'package:cake_wallet/core/template_validator.dart';
|
||||||
|
import 'package:cake_wallet/core/address_validator.dart';
|
||||||
|
import 'package:cake_wallet/core/amount_validator.dart';
|
||||||
|
import 'package:cake_wallet/core/validator.dart';
|
||||||
|
import 'package:cake_wallet/core/wallet_base.dart';
|
||||||
|
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||||
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||||
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||||
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
|
||||||
|
part 'send_template_view_model.g.dart';
|
||||||
|
|
||||||
|
class SendTemplateViewModel = SendTemplateViewModelBase
|
||||||
|
with _$SendTemplateViewModel;
|
||||||
|
|
||||||
|
abstract class SendTemplateViewModelBase with Store {
|
||||||
|
SendTemplateViewModelBase(this._wallet, this._settingsStore,
|
||||||
|
this._sendTemplateStore, this._fiatConversationStore) {
|
||||||
|
|
||||||
|
output = Output(_wallet, _settingsStore, _fiatConversationStore);
|
||||||
|
}
|
||||||
|
|
||||||
|
Output output;
|
||||||
|
|
||||||
|
Validator get amountValidator => AmountValidator(type: _wallet.type);
|
||||||
|
|
||||||
|
Validator get addressValidator => AddressValidator(type: _wallet.currency);
|
||||||
|
|
||||||
|
Validator get templateValidator => TemplateValidator();
|
||||||
|
|
||||||
|
CryptoCurrency get currency => _wallet.currency;
|
||||||
|
|
||||||
|
FiatCurrency get fiat => _settingsStore.fiatCurrency;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
ObservableList<Template> get templates => _sendTemplateStore.templates;
|
||||||
|
|
||||||
|
final WalletBase _wallet;
|
||||||
|
final SettingsStore _settingsStore;
|
||||||
|
final SendTemplateStore _sendTemplateStore;
|
||||||
|
final FiatConversionStore _fiatConversationStore;
|
||||||
|
|
||||||
|
void updateTemplate() => _sendTemplateStore.update();
|
||||||
|
|
||||||
|
void addTemplate(
|
||||||
|
{String name,
|
||||||
|
String address,
|
||||||
|
String cryptoCurrency,
|
||||||
|
String amount}) {
|
||||||
|
_sendTemplateStore.addTemplate(
|
||||||
|
name: name,
|
||||||
|
address: address,
|
||||||
|
cryptoCurrency: cryptoCurrency,
|
||||||
|
amount: amount);
|
||||||
|
updateTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeTemplate({Template template}) {
|
||||||
|
_sendTemplateStore.remove(template: template);
|
||||||
|
updateTemplate();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,13 @@
|
||||||
import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart';
|
|
||||||
import 'package:cake_wallet/bitcoin/bitcoin_transaction_priority.dart';
|
import 'package:cake_wallet/bitcoin/bitcoin_transaction_priority.dart';
|
||||||
import 'package:cake_wallet/bitcoin/electrum_wallet.dart';
|
import 'package:cake_wallet/bitcoin/electrum_wallet.dart';
|
||||||
import 'package:cake_wallet/entities/calculate_fiat_amount_raw.dart';
|
|
||||||
import 'package:cake_wallet/entities/transaction_description.dart';
|
import 'package:cake_wallet/entities/transaction_description.dart';
|
||||||
import 'package:cake_wallet/entities/transaction_priority.dart';
|
import 'package:cake_wallet/entities/transaction_priority.dart';
|
||||||
import 'package:cake_wallet/monero/monero_amount_format.dart';
|
import 'package:cake_wallet/view_model/send/output.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/entities/template.dart';
|
import 'package:cake_wallet/entities/template.dart';
|
||||||
import 'package:cake_wallet/store/templates/send_template_store.dart';
|
|
||||||
import 'package:cake_wallet/core/template_validator.dart';
|
|
||||||
import 'package:cake_wallet/core/address_validator.dart';
|
import 'package:cake_wallet/core/address_validator.dart';
|
||||||
import 'package:cake_wallet/core/amount_validator.dart';
|
import 'package:cake_wallet/core/amount_validator.dart';
|
||||||
import 'package:cake_wallet/core/pending_transaction.dart';
|
import 'package:cake_wallet/core/pending_transaction.dart';
|
||||||
|
@ -19,7 +15,6 @@ import 'package:cake_wallet/core/validator.dart';
|
||||||
import 'package:cake_wallet/core/wallet_base.dart';
|
import 'package:cake_wallet/core/wallet_base.dart';
|
||||||
import 'package:cake_wallet/core/execution_state.dart';
|
import 'package:cake_wallet/core/execution_state.dart';
|
||||||
import 'package:cake_wallet/bitcoin/bitcoin_transaction_credentials.dart';
|
import 'package:cake_wallet/bitcoin/bitcoin_transaction_credentials.dart';
|
||||||
import 'package:cake_wallet/monero/monero_wallet.dart';
|
|
||||||
import 'package:cake_wallet/monero/monero_transaction_creation_credentials.dart';
|
import 'package:cake_wallet/monero/monero_transaction_creation_credentials.dart';
|
||||||
import 'package:cake_wallet/entities/sync_status.dart';
|
import 'package:cake_wallet/entities/sync_status.dart';
|
||||||
import 'package:cake_wallet/entities/crypto_currency.dart';
|
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||||
|
@ -30,21 +25,16 @@ import 'package:cake_wallet/entities/wallet_type.dart';
|
||||||
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
|
||||||
|
|
||||||
part 'send_view_model.g.dart';
|
part 'send_view_model.g.dart';
|
||||||
|
|
||||||
const String cryptoNumberPattern = '0.0';
|
|
||||||
|
|
||||||
class SendViewModel = SendViewModelBase with _$SendViewModel;
|
class SendViewModel = SendViewModelBase with _$SendViewModel;
|
||||||
|
|
||||||
abstract class SendViewModelBase with Store {
|
abstract class SendViewModelBase with Store {
|
||||||
SendViewModelBase(this._wallet, this._settingsStore, this._sendTemplateStore,
|
SendViewModelBase(this._wallet, this._settingsStore,
|
||||||
this._fiatConversationStore, this.transactionDescriptionBox)
|
this.sendTemplateViewModel, this._fiatConversationStore,
|
||||||
: state = InitialExecutionState(),
|
this.transactionDescriptionBox)
|
||||||
_cryptoNumberFormat = NumberFormat(cryptoNumberPattern),
|
: state = InitialExecutionState() {
|
||||||
note = '',
|
|
||||||
sendAll = false {
|
|
||||||
final priority = _settingsStore.priority[_wallet.type];
|
final priority = _settingsStore.priority[_wallet.type];
|
||||||
final priorities = priorityForWalletType(_wallet.type);
|
final priorities = priorityForWalletType(_wallet.type);
|
||||||
|
|
||||||
|
@ -52,84 +42,35 @@ abstract class SendViewModelBase with Store {
|
||||||
_settingsStore.priority[_wallet.type] = priorities.first;
|
_settingsStore.priority[_wallet.type] = priorities.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
isElectrumWallet = _wallet is ElectrumWallet;
|
outputs = ObservableList<Output>()
|
||||||
|
..add(Output(_wallet, _settingsStore, _fiatConversationStore));
|
||||||
_setCryptoNumMaximumFractionDigits();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
ExecutionState state;
|
ExecutionState state;
|
||||||
|
|
||||||
@observable
|
ObservableList<Output> outputs;
|
||||||
String fiatAmount;
|
|
||||||
|
|
||||||
@observable
|
@action
|
||||||
String cryptoAmount;
|
void addOutput() {
|
||||||
|
outputs.add(Output(_wallet, _settingsStore, _fiatConversationStore));
|
||||||
|
}
|
||||||
|
|
||||||
@observable
|
@action
|
||||||
String address;
|
void removeOutput(Output output) {
|
||||||
|
if (isBatchSending) {
|
||||||
@observable
|
outputs.remove(output);
|
||||||
String note;
|
|
||||||
|
|
||||||
@observable
|
|
||||||
bool sendAll;
|
|
||||||
|
|
||||||
@computed
|
|
||||||
double get estimatedFee {
|
|
||||||
int amount;
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (cryptoAmount?.isNotEmpty ?? false) {
|
|
||||||
final _cryptoAmount = cryptoAmount.replaceAll(',', '.');
|
|
||||||
int _amount = 0;
|
|
||||||
switch (walletType) {
|
|
||||||
case WalletType.monero:
|
|
||||||
_amount = moneroParseAmount(amount: _cryptoAmount);
|
|
||||||
break;
|
|
||||||
case WalletType.bitcoin:
|
|
||||||
_amount = stringDoubleToBitcoinAmount(_cryptoAmount);
|
|
||||||
break;
|
|
||||||
case WalletType.litecoin:
|
|
||||||
_amount = stringDoubleToBitcoinAmount(_cryptoAmount);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_amount > 0) {
|
|
||||||
amount = _amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final fee = _wallet.calculateEstimatedFee(
|
|
||||||
_settingsStore.priority[_wallet.type], amount);
|
|
||||||
|
|
||||||
if (_wallet is ElectrumWallet) {
|
|
||||||
return bitcoinAmountToDouble(amount: fee);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_wallet is MoneroWallet) {
|
|
||||||
return moneroAmountToDouble(amount: fee);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
print(e.toString());
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
@action
|
||||||
|
void clearOutputs() {
|
||||||
|
outputs.clear();
|
||||||
|
addOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
String get estimatedFeeFiatAmount {
|
bool get isBatchSending => outputs.length > 1;
|
||||||
try {
|
|
||||||
final fiat = calculateFiatAmountRaw(
|
|
||||||
price: _fiatConversationStore.prices[_wallet.currency],
|
|
||||||
cryptoAmount: estimatedFee);
|
|
||||||
return fiat;
|
|
||||||
} catch (_) {
|
|
||||||
return '0.00';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
String get pendingTransactionFiatAmount {
|
String get pendingTransactionFiatAmount {
|
||||||
|
@ -176,14 +117,9 @@ abstract class SendViewModelBase with Store {
|
||||||
|
|
||||||
Validator get addressValidator => AddressValidator(type: _wallet.currency);
|
Validator get addressValidator => AddressValidator(type: _wallet.currency);
|
||||||
|
|
||||||
Validator get templateValidator => TemplateValidator();
|
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
PendingTransaction pendingTransaction;
|
PendingTransaction pendingTransaction;
|
||||||
|
|
||||||
@observable
|
|
||||||
bool isElectrumWallet;
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
String get balance => _wallet.balance.formattedAvailableBalance ?? '0.0';
|
String get balance => _wallet.balance.formattedAvailableBalance ?? '0.0';
|
||||||
|
|
||||||
|
@ -191,28 +127,18 @@ abstract class SendViewModelBase with Store {
|
||||||
bool get isReadyForSend => _wallet.syncStatus is SyncedSyncStatus;
|
bool get isReadyForSend => _wallet.syncStatus is SyncedSyncStatus;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
ObservableList<Template> get templates => _sendTemplateStore.templates;
|
ObservableList<Template> get templates => sendTemplateViewModel.templates;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
bool get isElectrumWallet => _wallet is ElectrumWallet;
|
||||||
|
|
||||||
WalletType get walletType => _wallet.type;
|
WalletType get walletType => _wallet.type;
|
||||||
final WalletBase _wallet;
|
final WalletBase _wallet;
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
final SendTemplateStore _sendTemplateStore;
|
final SendTemplateViewModel sendTemplateViewModel;
|
||||||
final FiatConversionStore _fiatConversationStore;
|
final FiatConversionStore _fiatConversationStore;
|
||||||
final NumberFormat _cryptoNumberFormat;
|
|
||||||
final Box<TransactionDescription> transactionDescriptionBox;
|
final Box<TransactionDescription> transactionDescriptionBox;
|
||||||
|
|
||||||
@action
|
|
||||||
void setSendAll() => sendAll = true;
|
|
||||||
|
|
||||||
@action
|
|
||||||
void reset() {
|
|
||||||
sendAll = false;
|
|
||||||
cryptoAmount = '';
|
|
||||||
fiatAmount = '';
|
|
||||||
address = '';
|
|
||||||
note = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<void> createTransaction() async {
|
Future<void> createTransaction() async {
|
||||||
try {
|
try {
|
||||||
|
@ -226,6 +152,18 @@ abstract class SendViewModelBase with Store {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<void> commitTransaction() async {
|
Future<void> commitTransaction() async {
|
||||||
|
String address = outputs.fold('', (acc, value) {
|
||||||
|
return acc + value.address + '\n\n';
|
||||||
|
});
|
||||||
|
|
||||||
|
address = address.trim();
|
||||||
|
|
||||||
|
String note = outputs.fold('', (acc, value) {
|
||||||
|
return acc + value.note + '\n';
|
||||||
|
});
|
||||||
|
|
||||||
|
note = note.trim();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
state = TransactionCommitting();
|
state = TransactionCommitting();
|
||||||
await pendingTransaction.commit();
|
await pendingTransaction.commit();
|
||||||
|
@ -246,121 +184,33 @@ abstract class SendViewModelBase with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
|
||||||
void setCryptoAmount(String amount) {
|
|
||||||
if (amount.toUpperCase() != S.current.all) {
|
|
||||||
sendAll = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cryptoAmount = amount;
|
|
||||||
_updateFiatAmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
|
||||||
void setFiatAmount(String amount) {
|
|
||||||
fiatAmount = amount;
|
|
||||||
_updateCryptoAmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setTransactionPriority(TransactionPriority priority) =>
|
void setTransactionPriority(TransactionPriority priority) =>
|
||||||
_settingsStore.priority[_wallet.type] = priority;
|
_settingsStore.priority[_wallet.type] = priority;
|
||||||
|
|
||||||
@action
|
|
||||||
void _updateFiatAmount() {
|
|
||||||
try {
|
|
||||||
final fiat = calculateFiatAmount(
|
|
||||||
price: _fiatConversationStore.prices[_wallet.currency],
|
|
||||||
cryptoAmount: cryptoAmount.replaceAll(',', '.'));
|
|
||||||
if (fiatAmount != fiat) {
|
|
||||||
fiatAmount = fiat;
|
|
||||||
}
|
|
||||||
} catch (_) {
|
|
||||||
fiatAmount = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
|
||||||
void _updateCryptoAmount() {
|
|
||||||
try {
|
|
||||||
final crypto = double.parse(fiatAmount.replaceAll(',', '.')) /
|
|
||||||
_fiatConversationStore.prices[_wallet.currency];
|
|
||||||
final cryptoAmountTmp = _cryptoNumberFormat.format(crypto);
|
|
||||||
|
|
||||||
if (cryptoAmount != cryptoAmountTmp) {
|
|
||||||
cryptoAmount = cryptoAmountTmp;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
cryptoAmount = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object _credentials() {
|
Object _credentials() {
|
||||||
final _amount = cryptoAmount.replaceAll(',', '.');
|
|
||||||
|
|
||||||
switch (_wallet.type) {
|
switch (_wallet.type) {
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
final amount = !sendAll ? _amount : null;
|
|
||||||
final priority = _settingsStore.priority[_wallet.type];
|
final priority = _settingsStore.priority[_wallet.type];
|
||||||
|
|
||||||
return BitcoinTransactionCredentials(
|
return BitcoinTransactionCredentials(
|
||||||
address, amount, priority as BitcoinTransactionPriority);
|
outputs, priority as BitcoinTransactionPriority);
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
final amount = !sendAll ? _amount : null;
|
|
||||||
final priority = _settingsStore.priority[_wallet.type];
|
final priority = _settingsStore.priority[_wallet.type];
|
||||||
|
|
||||||
return BitcoinTransactionCredentials(
|
return BitcoinTransactionCredentials(
|
||||||
address, amount, priority as BitcoinTransactionPriority);
|
outputs, priority as BitcoinTransactionPriority);
|
||||||
case WalletType.monero:
|
case WalletType.monero:
|
||||||
final amount = !sendAll ? _amount : null;
|
|
||||||
final priority = _settingsStore.priority[_wallet.type];
|
final priority = _settingsStore.priority[_wallet.type];
|
||||||
|
|
||||||
return MoneroTransactionCreationCredentials(
|
return MoneroTransactionCreationCredentials(
|
||||||
address: address,
|
outputs: outputs,
|
||||||
paymentId: '',
|
priority: priority as MoneroTransactionPriority);
|
||||||
priority: priority as MoneroTransactionPriority,
|
|
||||||
amount: amount);
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setCryptoNumMaximumFractionDigits() {
|
|
||||||
var maximumFractionDigits = 0;
|
|
||||||
|
|
||||||
switch (_wallet.type) {
|
|
||||||
case WalletType.monero:
|
|
||||||
maximumFractionDigits = 12;
|
|
||||||
break;
|
|
||||||
case WalletType.bitcoin:
|
|
||||||
maximumFractionDigits = 8;
|
|
||||||
break;
|
|
||||||
case WalletType.litecoin:
|
|
||||||
maximumFractionDigits = 8;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_cryptoNumberFormat.maximumFractionDigits = maximumFractionDigits;
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateTemplate() => _sendTemplateStore.update();
|
|
||||||
|
|
||||||
void addTemplate(
|
|
||||||
{String name,
|
|
||||||
String address,
|
|
||||||
String cryptoCurrency,
|
|
||||||
String amount}) =>
|
|
||||||
_sendTemplateStore.addTemplate(
|
|
||||||
name: name,
|
|
||||||
address: address,
|
|
||||||
cryptoCurrency: cryptoCurrency,
|
|
||||||
amount: amount);
|
|
||||||
|
|
||||||
void removeTemplate({Template template}) =>
|
|
||||||
_sendTemplateStore.remove(template: template);
|
|
||||||
|
|
||||||
String displayFeeRate(dynamic priority) {
|
String displayFeeRate(dynamic priority) {
|
||||||
final _priority = priority as TransactionPriority;
|
final _priority = priority as TransactionPriority;
|
||||||
final wallet = _wallet;
|
final wallet = _wallet;
|
||||||
|
|
|
@ -30,6 +30,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
this.settingsStore})
|
this.settingsStore})
|
||||||
: items = [] {
|
: items = [] {
|
||||||
showRecipientAddress = settingsStore?.shouldSaveRecipientAddress ?? false;
|
showRecipientAddress = settingsStore?.shouldSaveRecipientAddress ?? false;
|
||||||
|
isRecipientAddressShown = false;
|
||||||
|
|
||||||
final dateFormat = DateFormatter.withCurrentLocal();
|
final dateFormat = DateFormatter.withCurrentLocal();
|
||||||
final tx = transactionInfo;
|
final tx = transactionInfo;
|
||||||
|
@ -64,6 +65,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
final address =
|
final address =
|
||||||
_wallet.getTransactionAddress(accountIndex, addressIndex);
|
_wallet.getTransactionAddress(accountIndex, addressIndex);
|
||||||
if (address?.isNotEmpty ?? false) {
|
if (address?.isNotEmpty ?? false) {
|
||||||
|
isRecipientAddressShown = true;
|
||||||
_items.add(
|
_items.add(
|
||||||
StandartListItem(
|
StandartListItem(
|
||||||
title: S.current.transaction_details_recipient_address,
|
title: S.current.transaction_details_recipient_address,
|
||||||
|
@ -101,7 +103,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
items.addAll(_items);
|
items.addAll(_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showRecipientAddress) {
|
if (showRecipientAddress && !isRecipientAddressShown) {
|
||||||
final recipientAddress = transactionDescriptionBox.values
|
final recipientAddress = transactionDescriptionBox.values
|
||||||
.firstWhere((val) => val.id == transactionInfo.id, orElse: () => null)
|
.firstWhere((val) => val.id == transactionInfo.id, orElse: () => null)
|
||||||
?.recipientAddress;
|
?.recipientAddress;
|
||||||
|
@ -151,6 +153,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
|
|
||||||
final List<TransactionDetailsListItem> items;
|
final List<TransactionDetailsListItem> items;
|
||||||
bool showRecipientAddress;
|
bool showRecipientAddress;
|
||||||
|
bool isRecipientAddressShown;
|
||||||
|
|
||||||
String _explorerUrl(WalletType type, String txId) {
|
String _explorerUrl(WalletType type, String txId) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ description: Cake Wallet.
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 4.2.3+53
|
version: 4.2.4+57
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Betrag",
|
"transaction_details_amount" : "Betrag",
|
||||||
"transaction_details_fee" : "Gebühr",
|
"transaction_details_fee" : "Gebühr",
|
||||||
"transaction_details_copied" : "${title} in die Zwischenablage kopiert",
|
"transaction_details_copied" : "${title} in die Zwischenablage kopiert",
|
||||||
"transaction_details_recipient_address" : "Empfängeradresse",
|
"transaction_details_recipient_address" : "Empfängeradressen",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero-Wallet",
|
"wallet_list_title" : "Monero-Wallet",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Münzkontrolle (optional)",
|
"coin_control" : "Münzkontrolle (optional)",
|
||||||
|
|
||||||
"address_detected" : "Adresse erkannt",
|
"address_detected" : "Adresse erkannt",
|
||||||
"address_from_domain" : "Sie haben die Adresse von der unaufhaltsamen Domain ${domain} erhalten"
|
"address_from_domain" : "Diese Adresse ist von ${domain} auf Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Fügen Sie einen weiteren Empfänger hinzu (optional)"
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Amount",
|
"transaction_details_amount" : "Amount",
|
||||||
"transaction_details_fee" : "Fee",
|
"transaction_details_fee" : "Fee",
|
||||||
"transaction_details_copied" : "${title} copied to Clipboard",
|
"transaction_details_copied" : "${title} copied to Clipboard",
|
||||||
"transaction_details_recipient_address" : "Recipient address",
|
"transaction_details_recipient_address" : "Recipient addresses",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero Wallet",
|
"wallet_list_title" : "Monero Wallet",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Coin control (optional)",
|
"coin_control" : "Coin control (optional)",
|
||||||
|
|
||||||
"address_detected" : "Address detected",
|
"address_detected" : "Address detected",
|
||||||
"address_from_domain" : "You got address from unstoppable domain ${domain}"
|
"address_from_domain" : "This address is from ${domain} on Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Add another receiver (optional)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Cantidad",
|
"transaction_details_amount" : "Cantidad",
|
||||||
"transaction_details_fee" : "Cuota",
|
"transaction_details_fee" : "Cuota",
|
||||||
"transaction_details_copied" : "${title} Copiado al portapapeles",
|
"transaction_details_copied" : "${title} Copiado al portapapeles",
|
||||||
"transaction_details_recipient_address" : "Dirección del receptor",
|
"transaction_details_recipient_address" : "Direcciones de destinatarios",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monedero Monero",
|
"wallet_list_title" : "Monedero Monero",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Control de monedas (opcional)",
|
"coin_control" : "Control de monedas (opcional)",
|
||||||
|
|
||||||
"address_detected" : "Dirección detectada",
|
"address_detected" : "Dirección detectada",
|
||||||
"address_from_domain" : "Tienes la dirección de unstoppable domain ${domain}"
|
"address_from_domain" : "Esta dirección es de ${domain} en Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Agregar otro receptor (opcional)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "रकम",
|
"transaction_details_amount" : "रकम",
|
||||||
"transaction_details_fee" : "शुल्क",
|
"transaction_details_fee" : "शुल्क",
|
||||||
"transaction_details_copied" : "${title} क्लिपबोर्ड पर नकल",
|
"transaction_details_copied" : "${title} क्लिपबोर्ड पर नकल",
|
||||||
"transaction_details_recipient_address" : "प्राप्तकर्ता का पता",
|
"transaction_details_recipient_address" : "प्राप्तकर्ता के पते",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero बटुआ",
|
"wallet_list_title" : "Monero बटुआ",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "सिक्का नियंत्रण (वैकल्पिक)",
|
"coin_control" : "सिक्का नियंत्रण (वैकल्पिक)",
|
||||||
|
|
||||||
"address_detected" : "पता लग गया",
|
"address_detected" : "पता लग गया",
|
||||||
"address_from_domain" : "आपको अजेय डोमेन ${domain} से पता मिला है"
|
"address_from_domain" : "यह पता ${domain} से है Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "एक और रिसीवर जोड़ें (वैकल्पिक)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Iznos",
|
"transaction_details_amount" : "Iznos",
|
||||||
"transaction_details_fee" : "Naknada",
|
"transaction_details_fee" : "Naknada",
|
||||||
"transaction_details_copied" : "${title} kopiran u međuspremnik",
|
"transaction_details_copied" : "${title} kopiran u međuspremnik",
|
||||||
"transaction_details_recipient_address" : "Primateljeva adresa",
|
"transaction_details_recipient_address" : "Adrese primatelja",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero novčanik",
|
"wallet_list_title" : "Monero novčanik",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Kontrola novca (nije obavezno)",
|
"coin_control" : "Kontrola novca (nije obavezno)",
|
||||||
|
|
||||||
"address_detected" : "Adresa je otkrivena",
|
"address_detected" : "Adresa je otkrivena",
|
||||||
"address_from_domain" : "Dobili ste adresu od unstoppable domain ${domain}"
|
"address_from_domain" : "To je adresa od ${domain} na Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Dodajte drugi prijemnik (izborno)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Ammontare",
|
"transaction_details_amount" : "Ammontare",
|
||||||
"transaction_details_fee" : "Commissione",
|
"transaction_details_fee" : "Commissione",
|
||||||
"transaction_details_copied" : "${title} copiati negli Appunti",
|
"transaction_details_copied" : "${title} copiati negli Appunti",
|
||||||
"transaction_details_recipient_address" : "Indirizzo destinatario",
|
"transaction_details_recipient_address" : "Indirizzi dei destinatari",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Portafoglio Monero",
|
"wallet_list_title" : "Portafoglio Monero",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Controllo monete (opzionale)",
|
"coin_control" : "Controllo monete (opzionale)",
|
||||||
|
|
||||||
"address_detected" : "Indirizzo rilevato",
|
"address_detected" : "Indirizzo rilevato",
|
||||||
"address_from_domain" : "Hai l'indirizzo da unstoppable domain ${domain}"
|
"address_from_domain" : "Questo indirizzo è da ${domain} in poi Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Aggiungi un altro ricevitore (opzionale)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "量",
|
"transaction_details_amount" : "量",
|
||||||
"transaction_details_fee" : "費用",
|
"transaction_details_fee" : "費用",
|
||||||
"transaction_details_copied" : "${title} クリップボードにコピーしました",
|
"transaction_details_copied" : "${title} クリップボードにコピーしました",
|
||||||
"transaction_details_recipient_address" : "受取人の住所",
|
"transaction_details_recipient_address" : "受信者のアドレス",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero 財布",
|
"wallet_list_title" : "Monero 財布",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "コインコントロール(オプション)",
|
"coin_control" : "コインコントロール(オプション)",
|
||||||
|
|
||||||
"address_detected" : "アドレスが検出されました",
|
"address_detected" : "アドレスが検出されました",
|
||||||
"address_from_domain" : "あなたはからアドレスを得ました unstoppable domain ${domain}"
|
"address_from_domain" : "このアドレスは ${domain} からのものです Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "別のレシーバーを追加します(オプション)"
|
||||||
}
|
}
|
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "코인 제어 (옵션)",
|
"coin_control" : "코인 제어 (옵션)",
|
||||||
|
|
||||||
"address_detected" : "주소 감지",
|
"address_detected" : "주소 감지",
|
||||||
"address_from_domain" : "주소는 unstoppable domain ${domain}"
|
"address_from_domain" : "이 주소는 ${domain} 의 주소입니다 Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "다른 수신기 추가(선택 사항)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Bedrag",
|
"transaction_details_amount" : "Bedrag",
|
||||||
"transaction_details_fee" : "Vergoeding",
|
"transaction_details_fee" : "Vergoeding",
|
||||||
"transaction_details_copied" : "${title} gekopieerd naar het klembord",
|
"transaction_details_copied" : "${title} gekopieerd naar het klembord",
|
||||||
"transaction_details_recipient_address" : "Adres van de ontvanger",
|
"transaction_details_recipient_address" : "Adressen van ontvangers",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero portemonnee",
|
"wallet_list_title" : "Monero portemonnee",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Muntcontrole (optioneel)",
|
"coin_control" : "Muntcontrole (optioneel)",
|
||||||
|
|
||||||
"address_detected" : "Adres gedetecteerd",
|
"address_detected" : "Adres gedetecteerd",
|
||||||
"address_from_domain" : "Je adres is van unstoppable domain ${domain}"
|
"address_from_domain" : "Dit adres is van ${domain} op Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Nog een ontvanger toevoegen (optioneel)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Ilość",
|
"transaction_details_amount" : "Ilość",
|
||||||
"transaction_details_fee" : "Opłata",
|
"transaction_details_fee" : "Opłata",
|
||||||
"transaction_details_copied" : "${title} skopiowane do schowka",
|
"transaction_details_copied" : "${title} skopiowane do schowka",
|
||||||
"transaction_details_recipient_address" : "Adres odbiorcy",
|
"transaction_details_recipient_address" : "Adresy odbiorców",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Portfel Monero",
|
"wallet_list_title" : "Portfel Monero",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Kontrola monet (opcjonalnie)",
|
"coin_control" : "Kontrola monet (opcjonalnie)",
|
||||||
|
|
||||||
"address_detected" : "Wykryto adres",
|
"address_detected" : "Wykryto adres",
|
||||||
"address_from_domain" : "Dostałeś adres od unstoppable domain ${domain}"
|
"address_from_domain" : "Ten adres jest od ${domain} na Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Dodaj kolejny odbiornik (opcjonalnie)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Quantia",
|
"transaction_details_amount" : "Quantia",
|
||||||
"transaction_details_fee" : "Taxa",
|
"transaction_details_fee" : "Taxa",
|
||||||
"transaction_details_copied" : "${title} copiados para a área de transferência",
|
"transaction_details_copied" : "${title} copiados para a área de transferência",
|
||||||
"transaction_details_recipient_address" : "Endereço do destinatário",
|
"transaction_details_recipient_address" : "Endereços de destinatários",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Carteira Monero",
|
"wallet_list_title" : "Carteira Monero",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Controle de moedas (opcional)",
|
"coin_control" : "Controle de moedas (opcional)",
|
||||||
|
|
||||||
"address_detected" : "Endereço detectado",
|
"address_detected" : "Endereço detectado",
|
||||||
"address_from_domain" : "Você obteve o endereço de unstoppable domain ${domain}"
|
"address_from_domain" : "Este endereço é de ${domain} em Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Adicione outro receptor (opcional)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Сумма",
|
"transaction_details_amount" : "Сумма",
|
||||||
"transaction_details_fee" : "Комиссия",
|
"transaction_details_fee" : "Комиссия",
|
||||||
"transaction_details_copied" : "${title} скопировано в буфер обмена",
|
"transaction_details_copied" : "${title} скопировано в буфер обмена",
|
||||||
"transaction_details_recipient_address" : "Адрес получателя",
|
"transaction_details_recipient_address" : "Адреса получателей",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero Кошелёк",
|
"wallet_list_title" : "Monero Кошелёк",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Контроль монет (необязательно)",
|
"coin_control" : "Контроль монет (необязательно)",
|
||||||
|
|
||||||
"address_detected" : "Обнаружен адрес",
|
"address_detected" : "Обнаружен адрес",
|
||||||
"address_from_domain" : "Вы получили адрес из unstoppable domain ${domain}"
|
"address_from_domain" : "Этот адрес от ${domain} на Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Добавить получателя (необязательно)"
|
||||||
}
|
}
|
|
@ -284,7 +284,7 @@
|
||||||
"transaction_details_amount" : "Сума",
|
"transaction_details_amount" : "Сума",
|
||||||
"transaction_details_fee" : "Комісія",
|
"transaction_details_fee" : "Комісія",
|
||||||
"transaction_details_copied" : "${title} скопійовано в буфер обміну",
|
"transaction_details_copied" : "${title} скопійовано в буфер обміну",
|
||||||
"transaction_details_recipient_address" : "Адреса отримувача",
|
"transaction_details_recipient_address" : "Адреси одержувачів",
|
||||||
|
|
||||||
|
|
||||||
"wallet_list_title" : "Monero Гаманець",
|
"wallet_list_title" : "Monero Гаманець",
|
||||||
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "Контроль монет (необов’язково)",
|
"coin_control" : "Контроль монет (необов’язково)",
|
||||||
|
|
||||||
"address_detected" : "Виявлено адресу",
|
"address_detected" : "Виявлено адресу",
|
||||||
"address_from_domain" : "Ви отримали адресу від unstoppable domain ${domain}"
|
"address_from_domain" : "Ця адреса від ${domain} на Unstoppable Domains",
|
||||||
|
|
||||||
|
"add_receiver" : "Додати одержувача (необов'язково)"
|
||||||
}
|
}
|
|
@ -492,5 +492,7 @@
|
||||||
"coin_control" : "硬幣控制(可選)",
|
"coin_control" : "硬幣控制(可選)",
|
||||||
|
|
||||||
"address_detected" : "檢測到地址",
|
"address_detected" : "檢測到地址",
|
||||||
"address_from_domain" : "您有以下地址 unstoppable domain ${domain}"
|
"address_from_domain" : "此地址來自 Unstoppable Domains 上的 ${domain}",
|
||||||
|
|
||||||
|
"add_receiver" : "添加另一個接收器(可選)"
|
||||||
}
|
}
|
Loading…
Reference in a new issue