show n/x confirms while unconfirmed

This commit is contained in:
julian 2024-07-15 15:19:00 -06:00 committed by julian-CStack
parent 4acfbde791
commit 816eb37477
2 changed files with 25 additions and 12 deletions

View file

@ -192,6 +192,9 @@ class TransactionV2 {
required int currentChainHeight, required int currentChainHeight,
required int minConfirms, required int minConfirms,
}) { }) {
String prettyConfirms() =>
"(${getConfirmations(currentChainHeight)}/$minConfirms)";
if (subType == TransactionSubType.cashFusion || if (subType == TransactionSubType.cashFusion ||
subType == TransactionSubType.mint || subType == TransactionSubType.mint ||
(subType == TransactionSubType.sparkMint && (subType == TransactionSubType.sparkMint &&
@ -199,7 +202,7 @@ class TransactionV2 {
if (isConfirmed(currentChainHeight, minConfirms)) { if (isConfirmed(currentChainHeight, minConfirms)) {
return "Anonymized"; return "Anonymized";
} else { } else {
return "Anonymizing"; return "Anonymizing ${prettyConfirms()}";
} }
} }
@ -219,7 +222,7 @@ class TransactionV2 {
} else if ((numberOfMessages ?? 0) > 1) { } else if ((numberOfMessages ?? 0) > 1) {
return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no) return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no)
} else { } else {
return "Receiving"; return "Receiving ${prettyConfirms()}";
} }
} }
} else if (type == TransactionType.outgoing) { } else if (type == TransactionType.outgoing) {
@ -231,7 +234,7 @@ class TransactionV2 {
} else if ((numberOfMessages ?? 0) > 1) { } else if ((numberOfMessages ?? 0) > 1) {
return "Sending (waiting for confirmations)"; return "Sending (waiting for confirmations)";
} else { } else {
return "Sending"; return "Sending ${prettyConfirms()}";
} }
} }
} }
@ -244,16 +247,20 @@ class TransactionV2 {
if (isConfirmed(currentChainHeight, minConfirms)) { if (isConfirmed(currentChainHeight, minConfirms)) {
return "Received"; return "Received";
} else { } else {
return "Receiving"; return "Receiving ${prettyConfirms()}";
} }
} else if (type == TransactionType.outgoing) { } else if (type == TransactionType.outgoing) {
if (isConfirmed(currentChainHeight, minConfirms)) { if (isConfirmed(currentChainHeight, minConfirms)) {
return "Sent"; return "Sent";
} else { } else {
return "Sending"; return "Sending ${prettyConfirms()}";
} }
} else if (type == TransactionType.sentToSelf) { } else if (type == TransactionType.sentToSelf) {
return "Sent to self"; if (isConfirmed(currentChainHeight, minConfirms)) {
return "Sent to self";
} else {
return "Sent to self ${prettyConfirms()}";
}
} else { } else {
return type.name; return type.name;
} }

View file

@ -134,13 +134,15 @@ class _TransactionDetailsViewState
} }
String whatIsIt(Transaction tx, int height) { String whatIsIt(Transaction tx, int height) {
String prettyConfirms() => "(${tx.getConfirmations(height)}/$minConfirms)";
final type = tx.type; final type = tx.type;
if (coin is Firo) { if (coin is Firo) {
if (tx.subType == TransactionSubType.mint) { if (tx.subType == TransactionSubType.mint) {
if (tx.isConfirmed(height, minConfirms)) { if (tx.isConfirmed(height, minConfirms)) {
return "Minted"; return "Minted";
} else { } else {
return "Minting"; return "Minting ${prettyConfirms()}";
} }
} }
} }
@ -157,7 +159,7 @@ class _TransactionDetailsViewState
} else if ((_transaction.numberOfMessages ?? 0) > 1) { } else if ((_transaction.numberOfMessages ?? 0) > 1) {
return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no) return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no)
} else { } else {
return "Receiving"; return "Receiving ${prettyConfirms()}";
} }
} }
} else if (type == TransactionType.outgoing) { } else if (type == TransactionType.outgoing) {
@ -169,7 +171,7 @@ class _TransactionDetailsViewState
} else if ((_transaction.numberOfMessages ?? 0) > 1) { } else if ((_transaction.numberOfMessages ?? 0) > 1) {
return "Sending (waiting for confirmations)"; return "Sending (waiting for confirmations)";
} else { } else {
return "Sending"; return "Sending ${prettyConfirms()}";
} }
} }
} }
@ -182,16 +184,20 @@ class _TransactionDetailsViewState
if (tx.isConfirmed(height, minConfirms)) { if (tx.isConfirmed(height, minConfirms)) {
return "Received"; return "Received";
} else { } else {
return "Receiving"; return "Receiving ${prettyConfirms()}";
} }
} else if (type == TransactionType.outgoing) { } else if (type == TransactionType.outgoing) {
if (tx.isConfirmed(height, minConfirms)) { if (tx.isConfirmed(height, minConfirms)) {
return "Sent"; return "Sent";
} else { } else {
return "Sending"; return "Sending ${prettyConfirms()}";
} }
} else if (type == TransactionType.sentToSelf) { } else if (type == TransactionType.sentToSelf) {
return "Sent to self"; if (tx.isConfirmed(height, minConfirms)) {
return "Sent to self";
} else {
return "Sent to self ${prettyConfirms()}";
}
} else { } else {
return type.name; return type.name;
} }