mirror of
https://github.com/mollyim/monero-wallet-sdk.git
synced 2025-01-11 23:49:31 -05:00
lib: rename transactions to transactionById in Ledger
This commit is contained in:
parent
c28b40899d
commit
6cc43d2502
@ -61,7 +61,7 @@ class WalletRepository(
|
||||
}
|
||||
|
||||
fun getTransaction(walletId: Long, txId: String): Flow<Transaction?> =
|
||||
getLedger(walletId).map { it.transactions[txId] }
|
||||
getLedger(walletId).map { it.transactionById[txId] }
|
||||
|
||||
suspend fun addWallet(
|
||||
moneroNetwork: MoneroNetwork,
|
||||
|
@ -79,13 +79,13 @@ private fun walletUiState(
|
||||
group.sortedBy { it.subAddressIndex }.mapIndexed { index, address ->
|
||||
WalletAddress(
|
||||
address = address,
|
||||
used = address.isAddressUsed(ledger.transactions.values),
|
||||
used = address.isAddressUsed(ledger.transactions),
|
||||
isLastForAccount = index == group.size - 1,
|
||||
)
|
||||
}
|
||||
}
|
||||
val transactions =
|
||||
ledger.transactions.map { WalletTransaction(config.id, it.value) }
|
||||
ledger.transactions.map { WalletTransaction(config.id, it) }
|
||||
.sortedByDescending { it.transaction.blockTimestamp ?: Instant.MAX }
|
||||
WalletUiState.Loaded(
|
||||
config = config,
|
||||
|
@ -41,7 +41,7 @@ object PreviewParameterData {
|
||||
val ledger = Ledger(
|
||||
publicAddress = PublicAddress.parse("4AYjQM9HoAFNUeC3cvSfgeAN89oMMpMqiByvunzSzhn97cj726rJj3x8hCbH58UnMqQJShczCxbpWRiCJQ3HCUDHLiKuo4T"),
|
||||
accountAddresses = emptySet(),
|
||||
transactions = transactions.associateBy { it.txId },
|
||||
transactionById = transactions.associateBy { it.txId },
|
||||
enotes = emptySet(),
|
||||
checkedAt = BlockchainTime(blockHeader = blockHeader, network = network),
|
||||
)
|
||||
|
@ -5,10 +5,12 @@ package im.molly.monero
|
||||
data class Ledger(
|
||||
val publicAddress: PublicAddress,
|
||||
val accountAddresses: Set<AccountAddress>,
|
||||
val transactions: Map<String, Transaction>,
|
||||
val transactionById: Map<String, Transaction>,
|
||||
val enotes: Set<TimeLocked<Enote>>,
|
||||
val checkedAt: BlockchainTime,
|
||||
) {
|
||||
val transactions get() = transactionById.values
|
||||
|
||||
val balance: Balance = enotes.calculateBalance()
|
||||
|
||||
// companion object {
|
||||
|
@ -96,7 +96,7 @@ class MoneroWallet internal constructor(
|
||||
val ledger = Ledger(
|
||||
publicAddress = publicAddress,
|
||||
accountAddresses = accountAddresses,
|
||||
transactions = txById,
|
||||
transactionById = txById,
|
||||
enotes = enotes,
|
||||
checkedAt = blockchainTime,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user