Merge pull request #552 from cypherstack/firo_cleanup

Quick/temp firo fix and some ecash tweaks
This commit is contained in:
julian-CStack 2023-05-25 08:25:49 -06:00 committed by GitHub
commit 3d5e86dc6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 36 deletions

View file

@ -150,6 +150,7 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
String receivingAddress = widget.receivingAddress;
if ((widget.coin == Coin.bitcoincash ||
widget.coin == Coin.eCash ||
widget.coin == Coin.bitcoincashTestnet) &&
receivingAddress.contains(":")) {
// remove cash addr prefix
@ -246,6 +247,7 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
String receivingAddress = widget.receivingAddress;
if ((widget.coin == Coin.bitcoincash ||
widget.coin == Coin.eCash ||
widget.coin == Coin.bitcoincashTestnet) &&
receivingAddress.contains(":")) {
// remove cash addr prefix

View file

@ -150,6 +150,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
case Coin.bitcoincash:
case Coin.litecoin:
case Coin.dogecoin:
case Coin.eCash:
case Coin.firo:
case Coin.namecoin:
case Coin.particl:

View file

@ -1033,6 +1033,7 @@ class _TransactionDetailsViewState
final String height;
if (widget.coin == Coin.bitcoincash ||
widget.coin == Coin.eCash ||
widget.coin == Coin.bitcoincashTestnet) {
height =
"${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}";

View file

@ -47,7 +47,7 @@ import 'package:stackwallet/widgets/crypto_notifications.dart';
import 'package:tuple/tuple.dart';
import 'package:uuid/uuid.dart';
const int MINIMUM_CONFIRMATIONS = 1;
const int MINIMUM_CONFIRMATIONS = 0;
const String GENESIS_HASH_MAINNET =
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
@ -361,9 +361,9 @@ class ECashWallet extends CoinServiceAPI
print("format $format");
}
if (_coin == Coin.bitcoincashTestnet) {
return true;
}
// if (_coin == Coin.bitcoincashTestnet) {
// return true;
// }
if (format == bitbox.Address.formatCashAddr) {
return validateCashAddr(address);
@ -1899,7 +1899,7 @@ class ECashWallet extends CoinServiceAPI
required List<int> satoshiAmounts,
}) async {
final builder = bitbox.Bitbox.transactionBuilder(
testnet: coin == Coin.bitcoincashTestnet,
testnet: false, //coin == Coin.bitcoincashTestnet,
);
// retrieve address' utxos from the rest api

View file

@ -3361,33 +3361,33 @@ class FiroWallet extends CoinServiceAPI
List<Map<String, dynamic>> allTransactions = [];
final currentHeight = await chainHeight;
// final currentHeight = await chainHeight;
for (final txHash in allTxHashes) {
final storedTx = await db
.getTransactions(walletId)
.filter()
.txidEqualTo(txHash["tx_hash"] as String)
.findFirst();
// final storedTx = await db
// .getTransactions(walletId)
// .filter()
// .txidEqualTo(txHash["tx_hash"] as String)
// .findFirst();
if (storedTx == null ||
!storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)) {
final tx = await cachedElectrumXClient.getTransaction(
txHash: txHash["tx_hash"] as String,
verbose: true,
coin: coin,
);
// if (storedTx == null ||
// !storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)) {
final tx = await cachedElectrumXClient.getTransaction(
txHash: txHash["tx_hash"] as String,
verbose: true,
coin: coin,
);
if (!_duplicateTxCheck(allTransactions, tx["txid"] as String)) {
tx["address"] = await db
.getAddresses(walletId)
.filter()
.valueEqualTo(txHash["address"] as String)
.findFirst();
tx["height"] = txHash["height"];
allTransactions.add(tx);
}
if (!_duplicateTxCheck(allTransactions, tx["txid"] as String)) {
tx["address"] = await db
.getAddresses(walletId)
.filter()
.valueEqualTo(txHash["address"] as String)
.findFirst();
tx["height"] = txHash["height"];
allTransactions.add(tx);
}
// }
}
final List<Tuple2<isar_models.Transaction, isar_models.Address?>> txnsData =

View file

@ -1793,6 +1793,18 @@ class LitecoinWallet extends CoinServiceAPI
coin: coin,
);
bool shouldBlock = false;
String? blockReason;
String? label;
final utxoAmount = jsonUTXO["value"] as int;
if (utxoAmount <= 10000) {
shouldBlock = true;
blockReason = "May contain ordinal";
label = "Possible ordinal";
}
final vout = jsonUTXO["tx_pos"] as int;
final outputs = txn["vout"] as List;
@ -1811,10 +1823,10 @@ class LitecoinWallet extends CoinServiceAPI
walletId: walletId,
txid: txn["txid"] as String,
vout: vout,
value: jsonUTXO["value"] as int,
name: "",
isBlocked: false,
blockedReason: null,
value: utxoAmount,
name: label ?? "",
isBlocked: shouldBlock,
blockedReason: blockReason,
isCoinbase: txn["is_coinbase"] as bool? ?? false,
blockHash: txn["blockhash"] as String?,
blockHeight: jsonUTXO["height"] as int?,
@ -1826,16 +1838,20 @@ class LitecoinWallet extends CoinServiceAPI
}
}
Logging.instance
.log('Outputs fetched: $outputArray', level: LogLevel.Info);
Logging.instance.log(
'Outputs fetched: $outputArray',
level: LogLevel.Info,
);
await db.updateUTXOs(walletId, outputArray);
// finally update balance
await _updateBalance();
} catch (e, s) {
Logging.instance
.log("Output fetch unsuccessful: $e\n$s", level: LogLevel.Error);
Logging.instance.log(
"Output fetch unsuccessful: $e\n$s",
level: LogLevel.Error,
);
}
}

View file

@ -62,7 +62,7 @@ extension CoinExt on Coin {
case Coin.epicCash:
return "Epic Cash";
case Coin.eCash:
return "E-Cash";
return "eCash";
case Coin.ethereum:
return "Ethereum";
case Coin.firo: