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

AND-5238 Fixed ETHPow transaction parsing #372

Merged
merged 1 commit into from
Nov 13, 2023
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 @@ -142,7 +142,7 @@ internal class EthereumTransactionHistoryProvider(
.equals(walletAddress, ignoreCase = true)

is TransactionHistoryRequest.FilterType.Contract -> transaction.tokenTransfers
.firstOrNull { filterType.address.equals(it.contract, true) }
.firstOrNull { filterType.address.equals(it.contract, true) || filterType.address.equals(it.token, ignoreCase = true) }
?.from.equals(walletAddress, ignoreCase = true)
}
}
Expand Down Expand Up @@ -171,7 +171,7 @@ internal class EthereumTransactionHistoryProvider(

is TransactionHistoryRequest.FilterType.Contract -> {
val transfer = tx.tokenTransfers
.firstOrNull { filterType.address.equals(it.contract, ignoreCase = true) }
.firstOrNull { filterType.address.equals(it.contract, ignoreCase = true) || filterType.address.equals(it.token, ignoreCase = true) }
.guard { return null }
val isOutgoing = transfer.from == walletAddress
TransactionHistoryItem.DestinationType.Single(
Expand Down Expand Up @@ -207,13 +207,13 @@ internal class EthereumTransactionHistoryProvider(

is TransactionHistoryRequest.FilterType.Contract -> {
val transfer = tx.tokenTransfers
.firstOrNull { filterType.address.equals(it.contract, ignoreCase = true) }
.firstOrNull { filterType.address.equals(it.contract, ignoreCase = true) || filterType.address.equals(it.token, ignoreCase = true) }
.guard { return null }
val transferValue = transfer.value ?: "0"
val token = Token(
name = transfer.name.orEmpty(),
symbol = transfer.symbol.orEmpty(),
contractAddress = transfer.contract,
contractAddress = transfer.contract ?: transfer.token ?: "",
decimals = transfer.decimals,
)
Amount(value = BigDecimal(transferValue).movePointLeft(transfer.decimals), token = token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ data class GetAddressResponse(
@Json(name = "type") val type: String?,
@Json(name = "from") val from: String,
@Json(name = "to") val to: String,
@Json(name = "contract") val contract: String,
@Json(name = "contract") val contract: String?,
@Json(name = "token") val token: String?,
@Json(name = "name") val name: String?,
@Json(name = "symbol") val symbol: String?,
@Json(name = "decimals") val decimals: Int,
Expand Down