Skip to content

Commit

Permalink
Add info for ZCash pending balance
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrasulov committed Sep 27, 2024
1 parent 31dd0b5 commit eeb1ea8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
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

0 comments on commit eeb1ea8

Please sign in to comment.