Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info for ZCash pending balance #7681

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,10 @@ interface IBalanceAdapter {
data class BalanceData(
val available: BigDecimal,
val timeLocked: BigDecimal = BigDecimal.ZERO,
val notRelayed: BigDecimal = BigDecimal.ZERO
val notRelayed: BigDecimal = BigDecimal.ZERO,
val pending: BigDecimal = BigDecimal.ZERO,
) {
val total get() = available + timeLocked + notRelayed
val total get() = available + timeLocked + notRelayed + pending
}

interface IReceiveAdapter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ZcashAdapter(
get() = adapterStateUpdatedSubject.toFlowable(BackpressureStrategy.BUFFER)

override val balanceData: BalanceData
get() = BalanceData(balance, balanceLocked)
get() = BalanceData(balance, pending = balancePending)

val statusInfo: Map<String, Any>
get() {
Expand All @@ -173,7 +173,7 @@ class ZcashAdapter(
return walletBalance.available.convertZatoshiToZec(decimalCount)
}

private val balanceLocked: BigDecimal
private val balancePending: BigDecimal
get() {
val walletBalance = synchronizer.saplingBalances.value ?: return BigDecimal.ZERO
return walletBalance.pending.convertZatoshiToZec(decimalCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,24 @@ class BalanceViewItemFactory {
LockedValue(
title = TranslatableString.ResString(R.string.Balance_LockedAmount_Title),
infoTitle = TranslatableString.ResString(R.string.Info_LockTime_Title),
info = TranslatableString.ResString(R.string.Info_LockTime_Description_Static),
info = TranslatableString.ResString(R.string.Info_ProcessingBalance_Description),
coinValue = it
)
)
}

lockedCoinValue(
state,
item.balanceData.pending,
hideBalance,
wallet.decimal,
wallet.token
)?.let {
add(
LockedValue(
title = TranslatableString.ResString(R.string.Balance_ProcessingBalance_Title),
infoTitle = TranslatableString.ResString(R.string.Info_ProcessingBalance_Title),
info = TranslatableString.ResString(R.string.Info_ProcessingBalance_Description),
coinValue = it
)
)
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@
<string name="Balance_Receive_SetAmount">Set Amount</string>
<string name="Balance_Receive_AddressType">Address type</string>
<string name="Balance_LockedAmount_Title">Locked</string>
<string name="Balance_ProcessingBalance_Title">Processing</string>
<string name="Balance_NotRelayedAmount_Title">Broadcasting</string>
<string name="Balance_Receive_Memo">Memo (Tag)</string>
<string name="Balance_Error_InvalidQrCode">Can\'t recognize</string>
Expand Down Expand Up @@ -932,6 +933,9 @@
<string name="Info_NotRelayed_Title">Broadcast</string>
<string name="Info_NotRelayed_Description">The transaction holding this amount is broadcasted but not yet accepted by the network.</string>

<string name="Info_ProcessingBalance_Title">Processing amount</string>
<string name="Info_ProcessingBalance_Description">Transactions with this amount still syncing. And when they are confirmed, these tokens will be available for spending</string>

<string name="Info_DoubleSpend_Title">Double Spend</string>
<string name="Info_DoubleSpend_Description">Double Spend Risk! There is another transaction on the blockchain that is trying to spend inputs used in this transaction. Only one transaction will be accepted by the network</string>
<string name="Info_DoubleSpend_ThisTx">This Tx</string>
Expand Down
Loading