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

Hotfix for fetching recipients of an account existing in database #1675

Merged
merged 5 commits into from
Feb 17, 2025
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Synchronizer.getTransactions(accountUuid)` and `Synchronizer.transactions` now internally fill in
`TransactionOverview.blockTimeEpochSeconds` based on the related block time
- `Synchronizer.transactions` has been renamed to `Synchronizer.allTransactions` to emphasize the fact the API
returns transactions for all the wallet accounts
returns transactions for all the wallet accounts
- `Synchronizer.getRecipients` now returns both address and an account existing in database

## [2.2.7] - 2024-12-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cash.z.ecc.android.sdk.internal.db.derived
import androidx.sqlite.db.SupportSQLiteDatabase
import cash.z.ecc.android.sdk.internal.db.queryAndMap
import cash.z.ecc.android.sdk.internal.model.OutputProperties
import cash.z.ecc.android.sdk.model.AccountUuid
import cash.z.ecc.android.sdk.model.FirstClassByteArray
import cash.z.ecc.android.sdk.model.TransactionRecipient
import kotlinx.coroutines.flow.Flow
Expand Down Expand Up @@ -103,11 +104,10 @@ internal class TxOutputsView(private val sqliteDatabase: SupportSQLiteDatabase)
val toAccountIndex = it.getColumnIndex(TxOutputsViewDefinition.COLUMN_BLOB_TO_ACCOUNT)
val toAddressIndex = it.getColumnIndex(TxOutputsViewDefinition.COLUMN_STRING_TO_ADDRESS)

if (!it.isNull(toAccountIndex)) {
TransactionRecipient.RecipientAccount(accountUuid = it.getBlob(toAccountIndex))
} else {
TransactionRecipient.RecipientAddress(addressValue = it.getString(toAddressIndex))
}
TransactionRecipient(
addressValue = if (!it.isNull(toAddressIndex)) it.getString(toAddressIndex) else null,
accountUuid = if (!it.isNull(toAccountIndex)) AccountUuid(it.getBlob(toAccountIndex)) else null
)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,10 @@ data class PendingTransaction internal constructor(
override fun toString() = "PendingTransaction"
}

sealed class TransactionRecipient {
data class RecipientAddress(val addressValue: String) : TransactionRecipient() {
override fun toString() = "TransactionRecipient.RecipientAddress"
}

data class RecipientAccount(val accountUuid: ByteArray) : TransactionRecipient() {
override fun toString() = "TransactionRecipient.RecipientAccount"
}

companion object
}
data class TransactionRecipient(
val addressValue: String?,
val accountUuid: AccountUuid?
)

// Note there are some commented out methods which aren't being removed yet, as they might be needed before the
// Roomoval draft PR is completed
Expand Down
Loading