mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
Fixes for monero transaction history.
This commit is contained in:
parent
649d6dfb59
commit
2b05eedfc6
9 changed files with 73 additions and 23 deletions
|
@ -0,0 +1,6 @@
|
|||
package com.cakewallet.cake_wallet
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
|
@ -1 +1 @@
|
|||
1ec95e8df881a4b938eb38fddbcc8f19
|
||||
09c81fe0a3d701eb6da3bd2c6fc5ec65
|
|
@ -1,5 +1,5 @@
|
|||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
|
|
@ -117,6 +117,6 @@ SPEC CHECKSUMS:
|
|||
SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699
|
||||
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
|
||||
|
||||
PODFILE CHECKSUM: 6856e7141d486377eb0aa3b6d88e4b952e4ff514
|
||||
PODFILE CHECKSUM: ade2ba43f8c2af4060c025bfd25a553d068ab914
|
||||
|
||||
COCOAPODS: 1.9.3
|
||||
|
|
|
@ -351,7 +351,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
|
@ -439,7 +439,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
|
@ -488,7 +488,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
const platform =
|
||||
const MethodChannel('com.cakewallet.cakewallet/legacy_wallet_migration');
|
||||
|
||||
Future<String> readTradeList(
|
||||
{@required String key, @required String salt}) async =>
|
||||
await platform.invokeMethod('read_trade_list', {'key': key, 'salt': salt});
|
||||
|
||||
Future<String> readEncryptedFile(String url,
|
||||
{@required String key, @required String salt}) async =>
|
||||
await platform.invokeMethod(
|
||||
'read_encrypted_file', {'url': url, 'key': key, 'salt': salt});
|
|
@ -3,7 +3,6 @@ import 'package:mobx/mobx.dart';
|
|||
import 'package:cw_monero/transaction_history.dart'
|
||||
as monero_transaction_history;
|
||||
import 'package:cake_wallet/core/transaction_history.dart';
|
||||
import 'package:cake_wallet/entities/transaction_info.dart';
|
||||
import 'package:cake_wallet/monero/monero_transaction_info.dart';
|
||||
|
||||
part 'monero_transaction_history.g.dart';
|
||||
|
@ -44,5 +43,9 @@ abstract class MoneroTransactionHistoryBase
|
|||
@override
|
||||
void fetchTransactionsAsync(
|
||||
void Function(MoneroTransactionInfo transaction) onTransactionLoaded,
|
||||
{void Function() onFinished}) {}
|
||||
{void Function() onFinished}) async {
|
||||
final transactions = await fetchTransactions();
|
||||
transactions.values.forEach((tx) => onTransactionLoaded(tx));
|
||||
onFinished?.call();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
import 'package:cake_wallet/entities/wallet_info.dart';
|
||||
import 'package:cake_wallet/monero/monero_transaction_creation_credentials.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_monero/wallet.dart';
|
||||
import 'package:cw_monero/wallet.dart' as monero_wallet;
|
||||
import 'package:cw_monero/transaction_history.dart' as transaction_history;
|
||||
import 'package:cake_wallet/monero/monero_transaction_creation_credentials.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_balance.dart';
|
||||
import 'package:cake_wallet/monero/monero_transaction_history.dart';
|
||||
import 'package:cake_wallet/monero/monero_subaddress_list.dart';
|
||||
import 'package:cake_wallet/monero/monero_account_list.dart';
|
||||
import 'package:cake_wallet/core/wallet_base.dart';
|
||||
import 'package:cake_wallet/entities/sync_status.dart';
|
||||
import 'package:cake_wallet/monero/account.dart';
|
||||
import 'package:cake_wallet/monero/subaddress.dart';
|
||||
import 'package:cake_wallet/entities/node.dart';
|
||||
import 'package:cake_wallet/core/pending_transaction.dart';
|
||||
import 'package:cake_wallet/core/wallet_base.dart';
|
||||
import 'package:cake_wallet/entities/sync_status.dart';
|
||||
import 'package:cake_wallet/entities/wallet_info.dart';
|
||||
import 'package:cake_wallet/entities/node.dart';
|
||||
import 'package:cake_wallet/entities/transaction_priority.dart';
|
||||
|
||||
part 'monero_wallet.g.dart';
|
||||
|
@ -134,15 +136,15 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
|||
@override
|
||||
Future<PendingTransaction> createTransaction(Object credentials) async {
|
||||
final _credentials = credentials as MoneroTransactionCreationCredentials;
|
||||
// final transactionDescription = await transaction_history.createTransaction(
|
||||
// address: _credentials.address,
|
||||
// paymentId: _credentials.paymentId,
|
||||
// amount: _credentials.amount,
|
||||
// priorityRaw: _credentials.priority.serialize(),
|
||||
// accountIndex: _account.value.id);
|
||||
final pendingTransactionDescription =
|
||||
await transaction_history.createTransaction(
|
||||
address: _credentials.address,
|
||||
paymentId: _credentials.paymentId,
|
||||
amount: _credentials.amount,
|
||||
priorityRaw: _credentials.priority.serialize(),
|
||||
accountIndex: account.id);
|
||||
|
||||
// return PendingTransaction.fromTransactionDescription(
|
||||
// transactionDescription);
|
||||
return PendingMoneroTransaction(pendingTransactionDescription);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -243,8 +245,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
|||
}
|
||||
}
|
||||
|
||||
void _askForUpdateTransactionHistory() =>
|
||||
null; // await getHistory().update();
|
||||
void _askForUpdateTransactionHistory() => transactionHistory.updateAsync();
|
||||
|
||||
int _getFullBalance() =>
|
||||
monero_wallet.getFullBalance(accountIndex: account.id);
|
||||
|
|
25
lib/monero/pending_monero_transaction.dart
Normal file
25
lib/monero/pending_monero_transaction.dart
Normal file
|
@ -0,0 +1,25 @@
|
|||
import 'package:cw_monero/structs/pending_transaction.dart';
|
||||
import 'package:cw_monero/transaction_history.dart'
|
||||
as monero_transaction_history;
|
||||
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||
import 'package:cake_wallet/core/amount_converter.dart';
|
||||
import 'package:cake_wallet/core/pending_transaction.dart';
|
||||
|
||||
class PendingMoneroTransaction with PendingTransaction {
|
||||
PendingMoneroTransaction(this.pendingTransactionDescription);
|
||||
|
||||
final PendingTransactionDescription pendingTransactionDescription;
|
||||
|
||||
@override
|
||||
String get amountFormatted => AmountConverter.amountIntToString(
|
||||
CryptoCurrency.xmr, pendingTransactionDescription.amount);
|
||||
|
||||
@override
|
||||
String get feeFormatted => AmountConverter.amountIntToString(
|
||||
CryptoCurrency.xmr, pendingTransactionDescription.fee);
|
||||
|
||||
@override
|
||||
Future<void> commit() async =>
|
||||
monero_transaction_history.commitTransactionFromPointerAddress(
|
||||
address: pendingTransactionDescription.pointerAddress);
|
||||
}
|
Loading…
Reference in a new issue