mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
Fixes.
This commit is contained in:
parent
93049b4aa1
commit
f5e19a13ab
4 changed files with 25 additions and 13 deletions
|
@ -240,16 +240,16 @@ class SyncListener {
|
||||||
_initialSyncHeight = 0;
|
_initialSyncHeight = 0;
|
||||||
_updateSyncInfoTimer ??=
|
_updateSyncInfoTimer ??=
|
||||||
Timer.periodic(Duration(milliseconds: 1200), (_) async {
|
Timer.periodic(Duration(milliseconds: 1200), (_) async {
|
||||||
final _isNeededToRefresh = isNeededToRefresh();
|
// final _isNeededToRefresh = isNeededToRefresh();
|
||||||
print('isNeededToRefresh $_isNeededToRefresh');
|
// print('isNeededToRefresh $_isNeededToRefresh');
|
||||||
|
|
||||||
if (isNewTransactionExist() || _isNeededToRefresh) {
|
if (isNewTransactionExist()) {
|
||||||
onNewTransaction?.call();
|
onNewTransaction?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
var syncHeight = getSyncingHeight();
|
var syncHeight = getSyncingHeight();
|
||||||
|
|
||||||
print('syncHeight $syncHeight');
|
// print('syncHeight $syncHeight');
|
||||||
|
|
||||||
if (syncHeight <= 0) {
|
if (syncHeight <= 0) {
|
||||||
syncHeight = getCurrentHeight();
|
syncHeight = getCurrentHeight();
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:cw_monero/transaction_history.dart';
|
||||||
|
|
||||||
class MoneroTransactionInfo extends TransactionInfo {
|
class MoneroTransactionInfo extends TransactionInfo {
|
||||||
MoneroTransactionInfo(this.id, this.height, this.direction, this.date,
|
MoneroTransactionInfo(this.id, this.height, this.direction, this.date,
|
||||||
this.isPending, this.amount, this.accountIndex);
|
this.isPending, this.amount, this.accountIndex, this.fee);
|
||||||
|
|
||||||
MoneroTransactionInfo.fromMap(Map map)
|
MoneroTransactionInfo.fromMap(Map map)
|
||||||
: id = (map['hash'] ?? '') as String,
|
: id = (map['hash'] ?? '') as String,
|
||||||
|
@ -21,7 +21,8 @@ class MoneroTransactionInfo extends TransactionInfo {
|
||||||
isPending = parseBoolFromString(map['isPending'] as String),
|
isPending = parseBoolFromString(map['isPending'] as String),
|
||||||
amount = map['amount'] as int,
|
amount = map['amount'] as int,
|
||||||
accountIndex = int.parse(map['accountIndex'] as String),
|
accountIndex = int.parse(map['accountIndex'] as String),
|
||||||
key = getTxKey((map['hash'] ?? '') as String);
|
key = getTxKey((map['hash'] ?? '') as String),
|
||||||
|
fee = map['fee'] as int ?? 0;
|
||||||
|
|
||||||
MoneroTransactionInfo.fromRow(TransactionInfoRow row)
|
MoneroTransactionInfo.fromRow(TransactionInfoRow row)
|
||||||
: id = row.getHash(),
|
: id = row.getHash(),
|
||||||
|
@ -32,7 +33,8 @@ class MoneroTransactionInfo extends TransactionInfo {
|
||||||
isPending = row.isPending != 0,
|
isPending = row.isPending != 0,
|
||||||
amount = row.getAmount(),
|
amount = row.getAmount(),
|
||||||
accountIndex = row.subaddrAccount,
|
accountIndex = row.subaddrAccount,
|
||||||
key = getTxKey(row.getHash());
|
key = getTxKey(row.getHash()),
|
||||||
|
fee = row.fee;
|
||||||
|
|
||||||
final String id;
|
final String id;
|
||||||
final int height;
|
final int height;
|
||||||
|
@ -41,17 +43,22 @@ class MoneroTransactionInfo extends TransactionInfo {
|
||||||
final int accountIndex;
|
final int accountIndex;
|
||||||
final bool isPending;
|
final bool isPending;
|
||||||
final int amount;
|
final int amount;
|
||||||
|
final int fee;
|
||||||
String recipientAddress;
|
String recipientAddress;
|
||||||
String key;
|
String key;
|
||||||
|
|
||||||
String _fiatAmount;
|
String _fiatAmount;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String amountFormatted() => '${formatAmount(moneroAmountToString(amount: amount))} XMR';
|
String amountFormatted() =>
|
||||||
|
'${formatAmount(moneroAmountToString(amount: amount))} XMR';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String fiatAmount() => _fiatAmount ?? '';
|
String fiatAmount() => _fiatAmount ?? '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void changeFiatAmount(String amount) => _fiatAmount = formatAmount(amount);
|
void changeFiatAmount(String amount) => _fiatAmount = formatAmount(amount);
|
||||||
|
|
||||||
|
String feeFormatted() =>
|
||||||
|
'${formatAmount(moneroAmountToString(amount: fee))} XMR';
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||||
balance = MoneroBalance(
|
balance = MoneroBalance(
|
||||||
fullBalance: monero_wallet.getFullBalance(accountIndex: account.id),
|
fullBalance: monero_wallet.getFullBalance(accountIndex: account.id),
|
||||||
unlockedBalance:
|
unlockedBalance:
|
||||||
monero_wallet.getFullBalance(accountIndex: account.id));
|
monero_wallet.getUnlockedBalance(accountIndex: account.id));
|
||||||
address = subaddress.address;
|
address = subaddress.address;
|
||||||
_setListeners();
|
_setListeners();
|
||||||
await transactionHistory.update();
|
await transactionHistory.update();
|
||||||
|
@ -186,8 +186,10 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||||
|
|
||||||
if ((amount != null && unlockedBalance < amount) ||
|
if ((amount != null && unlockedBalance < amount) ||
|
||||||
(amount == null && unlockedBalance <= 0)) {
|
(amount == null && unlockedBalance <= 0)) {
|
||||||
|
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
|
||||||
|
|
||||||
throw MoneroTransactionCreationException(
|
throw MoneroTransactionCreationException(
|
||||||
'Incorrect unlocked balance. Unlocked: $unlockedBalance. Transaction amount: ${_credentials.amount}.');
|
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${_credentials.amount}.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(syncStatus is SyncedSyncStatus)) {
|
if (!(syncStatus is SyncedSyncStatus)) {
|
||||||
|
@ -363,11 +365,11 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||||
print('_onNewBlock called');
|
print('_onNewBlock called');
|
||||||
if (walletInfo.isRecovery) {
|
if (walletInfo.isRecovery) {
|
||||||
_askForUpdateTransactionHistory();
|
_askForUpdateTransactionHistory();
|
||||||
|
_askForUpdateBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
_askForUpdateBalance();
|
|
||||||
|
|
||||||
if (blocksLeft < 100) {
|
if (blocksLeft < 100) {
|
||||||
|
_askForUpdateBalance();
|
||||||
syncStatus = SyncedSyncStatus();
|
syncStatus = SyncedSyncStatus();
|
||||||
await _afterSyncSave();
|
await _afterSyncSave();
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@ class TransactionDetailsPage extends BasePage {
|
||||||
title: S.current.transaction_details_height, value: '${tx.height}'),
|
title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||||
StandartListItem(
|
StandartListItem(
|
||||||
title: S.current.transaction_details_amount,
|
title: S.current.transaction_details_amount,
|
||||||
value: tx.amountFormatted())
|
value: tx.amountFormatted()),
|
||||||
|
StandartListItem(
|
||||||
|
title: S.current.send_fee,
|
||||||
|
value: tx.feeFormatted())
|
||||||
];
|
];
|
||||||
|
|
||||||
if (showRecipientAddress) {
|
if (showRecipientAddress) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue