Move abstract class and epic_transaction to libbepiccash

This commit is contained in:
likho 2023-10-10 16:41:18 +02:00
parent 4c66bbaa41
commit 8f9285ce56
2 changed files with 10 additions and 9 deletions

@ -1 +1 @@
Subproject commit 2de3fa0459ac29361d65a86883e1d0648e6a4b1a Subproject commit a56297f99bc7cd8b98ec5450a4fda4c72cd98be7

View file

@ -17,6 +17,7 @@ import 'dart:isolate';
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_libepiccash/epic_cash.dart'; import 'package:flutter_libepiccash/epic_cash.dart';
import 'package:flutter_libepiccash/models/transaction.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:mutex/mutex.dart'; import 'package:mutex/mutex.dart';
import 'package:stack_wallet_backup/generate_password.dart'; import 'package:stack_wallet_backup/generate_password.dart';
@ -49,7 +50,7 @@ import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/prefs.dart'; import 'package:stackwallet/utilities/prefs.dart';
import 'package:stackwallet/utilities/stack_file_system.dart'; import 'package:stackwallet/utilities/stack_file_system.dart';
import 'package:stackwallet/utilities/test_epic_box_connection.dart'; import 'package:stackwallet/utilities/test_epic_box_connection.dart';
import 'package:stackwallet/wallets/example/libepiccash.dart' as epiccash; import 'package:flutter_libepiccash/lib.dart' as epiccash;
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:websocket_universal/websocket_universal.dart'; import 'package:websocket_universal/websocket_universal.dart';
@ -1242,8 +1243,8 @@ class EpicCashWallet extends CoinServiceAPI
final isConfirmed = tx.confirmed; final isConfirmed = tx.confirmed;
int amt = 0; int amt = 0;
if (tx.txType == EpicTransactionType.TxReceived || if (tx.txType == TransactionType.TxReceived ||
tx.txType == EpicTransactionType.TxReceivedCancelled) { tx.txType == TransactionType.TxReceivedCancelled) {
amt = int.parse(tx.amountCredited); amt = int.parse(tx.amountCredited);
} else { } else {
int debit = int.parse(tx.amountDebited); int debit = int.parse(tx.amountDebited);
@ -1256,7 +1257,7 @@ class EpicCashWallet extends CoinServiceAPI
String? slateId = tx.txSlateId; String? slateId = tx.txSlateId;
String address = slatesToCommits[slateId] String address = slatesToCommits[slateId]
?[tx.txType == EpicTransactionType.TxReceived ? "from" : "to"] ?[tx.txType == TransactionType.TxReceived ? "from" : "to"]
as String? ?? as String? ??
""; "";
String? commitId = slatesToCommits[slateId]?['commitId'] as String?; String? commitId = slatesToCommits[slateId]?['commitId'] as String?;
@ -1271,8 +1272,8 @@ class EpicCashWallet extends CoinServiceAPI
height = null; height = null;
} }
final isIncoming = (tx.txType == EpicTransactionType.TxReceived || final isIncoming = (tx.txType == TransactionType.TxReceived ||
tx.txType == EpicTransactionType.TxReceivedCancelled); tx.txType == TransactionType.TxReceivedCancelled);
final txn = isar_models.Transaction( final txn = isar_models.Transaction(
walletId: walletId, walletId: walletId,
txid: commitId ?? tx.id.toString(), txid: commitId ?? tx.id.toString(),
@ -1288,8 +1289,8 @@ class EpicCashWallet extends CoinServiceAPI
).toJsonString(), ).toJsonString(),
fee: (tx.fee == "null") ? 0 : int.parse(tx.fee!), fee: (tx.fee == "null") ? 0 : int.parse(tx.fee!),
height: height, height: height,
isCancelled: tx.txType == EpicTransactionType.TxSentCancelled || isCancelled: tx.txType == TransactionType.TxSentCancelled ||
tx.txType == EpicTransactionType.TxReceivedCancelled, tx.txType == TransactionType.TxReceivedCancelled,
isLelantus: false, isLelantus: false,
slateId: slateId, slateId: slateId,
nonce: null, nonce: null,