Skip to content

Commit

Permalink
Transaction fields propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan-Cerovsky committed Feb 21, 2025
1 parent c78afc7 commit f413066
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ object TransactionOverviewFixture {
memoCount = memoCount,
blockTimeEpochSeconds = blockTimeEpochSeconds,
transactionState = transactionState,
isShielding = isShielding
isShielding = isShielding,
totalSpent = NET_VALUE,
totalReceived = NET_VALUE
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ internal class AllTransactionView(
val expiryHeightIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_INTEGER_EXPIRY_HEIGHT)
val rawIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_BLOB_RAW)
val netValueIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_LONG_ACCOUNT_BALANCE_DELTA)
val totalSpentIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_LONG_TOTAL_SPENT)
val totalReceivedIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_LONG_TOTAL_RECEIVED)
val feePaidIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_LONG_FEE_PAID)
val isChangeIndex = cursor.getColumnIndex(AllTransactionViewDefinition.COLUMN_BOOLEAN_IS_CHANGE)
val receivedNoteCountIndex =
Expand Down Expand Up @@ -146,13 +148,15 @@ internal class AllTransactionView(
raw = cursor.getBlobOrNull(rawIndex)?.let { FirstClassByteArray(it) },
isSentTransaction = isSent,
netValue = Zatoshi(netValueLong.absoluteValue),
totalSpent = Zatoshi(cursor.getLong(totalSpentIndex)),
totalReceived = Zatoshi(cursor.getLong(totalReceivedIndex)),
feePaid = cursor.getLongOrNull(feePaidIndex)?.let { Zatoshi(it) },
isChange = cursor.getInt(isChangeIndex) != 0,
receivedNoteCount = cursor.getInt(receivedNoteCountIndex),
sentNoteCount = cursor.getInt(sentNoteCountIndex),
memoCount = cursor.getInt(memoCountIndex),
blockTimeEpochSeconds = cursor.getLongOrNull(blockTimeIndex),
isShielding = cursor.getIntOrNull(isShielding) == 1
isShielding = cursor.getIntOrNull(isShielding) == 1,
)
}

Expand Down Expand Up @@ -234,6 +238,10 @@ internal object AllTransactionViewDefinition {

const val COLUMN_LONG_ACCOUNT_BALANCE_DELTA = "account_balance_delta" // $NON-NLS

const val COLUMN_LONG_TOTAL_SPENT = "total_spent" // $NON-NLS

const val COLUMN_LONG_TOTAL_RECEIVED = "total_received" // $NON-NLS

const val COLUMN_LONG_FEE_PAID = "fee_paid" // $NON-NLS

const val COLUMN_BOOLEAN_IS_CHANGE = "has_change" // $NON-NLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ internal data class DbTransactionOverview internal constructor(
val raw: FirstClassByteArray?,
val isSentTransaction: Boolean,
val netValue: Zatoshi,
val totalSpent: Zatoshi,
val totalReceived: Zatoshi,
val feePaid: Zatoshi?,
val isChange: Boolean,
val receivedNoteCount: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ data class TransactionOverview internal constructor(
val raw: FirstClassByteArray?,
val isSentTransaction: Boolean,
val netValue: Zatoshi,
val totalSpent: Zatoshi,
val totalReceived: Zatoshi,
val feePaid: Zatoshi?,
val isChange: Boolean,
val receivedNoteCount: Int,
Expand Down Expand Up @@ -57,7 +59,9 @@ data class TransactionOverview internal constructor(
dbTransactionOverview.minedHeight,
dbTransactionOverview.expiryHeight
),
isShielding = dbTransactionOverview.isShielding
isShielding = dbTransactionOverview.isShielding,
totalSpent = dbTransactionOverview.totalSpent,
totalReceived = dbTransactionOverview.totalReceived
)
}
}
Expand Down

0 comments on commit f413066

Please sign in to comment.