Skip to content

Commit

Permalink
Fix issue with duplicate transactions
Browse files Browse the repository at this point in the history
For EVM blockchains make single transaction source for base coin and its EIP20 tokens.
  • Loading branch information
abdrasulov committed Sep 8, 2023
1 parent 31ac96b commit 846109c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,4 +443,12 @@ val TokenType.isDefault
}

val TokenType.isNative: Boolean
get() = this is TokenType.Native || this is TokenType.Derived || this is TokenType.AddressTyped
get() = this is TokenType.Native || this is TokenType.Derived || this is TokenType.AddressTyped

val TokenType.meta: String?
get() = when (this) {
is TokenType.Derived -> this.derivation.name
is TokenType.AddressTyped -> this.type.name
is TokenType.Bep2 -> this.symbol
else -> null
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.horizontalsystems.bankwallet.entities

import android.os.Parcelable
import io.horizontalsystems.bankwallet.core.badge
import io.horizontalsystems.bankwallet.core.meta
import io.horizontalsystems.bankwallet.modules.transactions.TransactionSource
import io.horizontalsystems.marketkit.models.Token
import kotlinx.parcelize.Parcelize
Expand All @@ -22,7 +23,7 @@ data class Wallet(
val badge
get() = token.badge

val transactionSource get() = TransactionSource(token.blockchain, account, token.type)
val transactionSource get() = TransactionSource(token.blockchain, account, token.type.meta)

override fun equals(other: Any?): Boolean {
if (other is Wallet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import io.horizontalsystems.bankwallet.core.App
import io.horizontalsystems.bankwallet.entities.Account
import io.horizontalsystems.marketkit.models.Blockchain
import io.horizontalsystems.marketkit.models.Token
import io.horizontalsystems.marketkit.models.TokenType
import java.math.BigDecimal
import java.util.*

Expand Down Expand Up @@ -54,5 +53,5 @@ data class TransactionWallet(
data class TransactionSource(
val blockchain: Blockchain,
val account: Account,
val tokenType: TokenType
val meta: String?
)

0 comments on commit 846109c

Please sign in to comment.