mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
cea3084bb3
* replace qr scanner with fast_scanner * bump java version * fix qr code scanning * add flashlight and camera switch * airgap work * commitTransactionUR * bump fast_scanner, fix configure script * add option to restore wallet from NERO qr format * fixes to the flow and logic use gsed or otherwise it fails? * remove Expanded() to fix URQR on release builds * cache key to allow app updates * rename cache key * [skip ci] cache key.jks in cache_dependencies * update fast_scanner to work on ios, with light mlkit dependency * ui fixes * error handling fix * update fast_scanner to drop iOS dependency * changes from review * Update lib/entities/qr_scanner.dart * changes from review * remove useless commit * don't set state multiple times remove return Container() for non monero wallets * return on fail don't handle empty qr codes * set node as trusted display primary address in seed screen * fix wow and haven * migrate node to trusted * - update trusted node for existing users - update locales - fix conflicts - move menu item --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
58 lines
1.7 KiB
Dart
58 lines
1.7 KiB
Dart
import 'package:cw_wownero/api/structs/pending_transaction.dart';
|
|
import 'package:cw_wownero/api/transaction_history.dart'
|
|
as wownero_transaction_history;
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
import 'package:cw_core/amount_converter.dart';
|
|
|
|
import 'package:cw_core/pending_transaction.dart';
|
|
|
|
class DoubleSpendException implements Exception {
|
|
DoubleSpendException();
|
|
|
|
@override
|
|
String toString() =>
|
|
'This transaction cannot be committed. This can be due to many reasons including the wallet not being synced, there is not enough WOW in your available balance, or previous transactions are not yet fully processed.';
|
|
}
|
|
|
|
class PendingWowneroTransaction with PendingTransaction {
|
|
PendingWowneroTransaction(this.pendingTransactionDescription);
|
|
|
|
final PendingTransactionDescription pendingTransactionDescription;
|
|
|
|
@override
|
|
String get id => pendingTransactionDescription.hash;
|
|
|
|
@override
|
|
String get hex => pendingTransactionDescription.hex;
|
|
|
|
String get txKey => pendingTransactionDescription.txKey;
|
|
|
|
@override
|
|
String get amountFormatted =>
|
|
AmountConverter.amountIntToString(CryptoCurrency.wow, pendingTransactionDescription.amount);
|
|
|
|
@override
|
|
String get feeFormatted =>
|
|
AmountConverter.amountIntToString(CryptoCurrency.wow, pendingTransactionDescription.fee);
|
|
|
|
@override
|
|
Future<void> commit() async {
|
|
try {
|
|
wownero_transaction_history.commitTransactionFromPointerAddress(
|
|
address: pendingTransactionDescription.pointerAddress);
|
|
} catch (e) {
|
|
final message = e.toString();
|
|
|
|
if (message.contains('Reason: double spend')) {
|
|
throw DoubleSpendException();
|
|
}
|
|
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Future<String?> commitUR() {
|
|
throw UnimplementedError();
|
|
}
|
|
}
|