diff --git a/app/src/main/java/io/horizontalsystems/ethereumkit/sample/core/EthereumBaseAdapter.kt b/app/src/main/java/io/horizontalsystems/ethereumkit/sample/core/EthereumBaseAdapter.kt index ae606b81..6d4e27d1 100644 --- a/app/src/main/java/io/horizontalsystems/ethereumkit/sample/core/EthereumBaseAdapter.kt +++ b/app/src/main/java/io/horizontalsystems/ethereumkit/sample/core/EthereumBaseAdapter.kt @@ -1,6 +1,5 @@ package io.horizontalsystems.ethereumkit.sample.core -import android.util.Log import io.horizontalsystems.ethereumkit.core.EthereumKit import io.horizontalsystems.ethereumkit.core.toHexString import io.horizontalsystems.ethereumkit.models.Address @@ -88,7 +87,6 @@ open class EthereumBaseAdapter(private val ethereumKit: EthereumKit) : IAdapter override fun transactions(fromHash: ByteArray?, limit: Int?): Single> { return ethereumKit.getFullTransactionsAsync(listOf(), fromHash, limit) .map { transactions -> - Log.v("LALALA in app: transactions count: ", "${transactions.size}") transactions.map { transactionRecord(it) } } } diff --git a/app/src/main/java/io/horizontalsystems/ethereumkit/sample/modules/main/MainViewModel.kt b/app/src/main/java/io/horizontalsystems/ethereumkit/sample/modules/main/MainViewModel.kt index 8b857740..c4653ceb 100644 --- a/app/src/main/java/io/horizontalsystems/ethereumkit/sample/modules/main/MainViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/ethereumkit/sample/modules/main/MainViewModel.kt @@ -257,12 +257,10 @@ class MainViewModel : ViewModel() { } private fun updateLastBlockHeight() { - Log.v("LALALA BlockHeight", ethereumKit.lastBlockHeight.toString()) lastBlockHeight.postValue(ethereumKit.lastBlockHeight) } private fun updateState() { - Log.v("LALALA State", ethereumAdapter.syncState.toString()) syncState.postValue(ethereumAdapter.syncState) } @@ -291,7 +289,6 @@ class MainViewModel : ViewModel() { .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe { list: List -> - Log.v("LALALA ETH", list.size.toString()) ethTxs = list updateTransactionList() }.let { @@ -304,7 +301,6 @@ class MainViewModel : ViewModel() { .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe { list: List -> - Log.v("LALALA ERC20", list.size.toString()) erc20Txs = list updateTransactionList() }.let { diff --git a/erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/Eip20TransactionDecorator.kt b/erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/Eip20TransactionDecorator.kt index 35021236..e032e5b3 100644 --- a/erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/Eip20TransactionDecorator.kt +++ b/erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/Eip20TransactionDecorator.kt @@ -39,68 +39,5 @@ class Eip20TransactionDecorator( return null } -// -// override fun decorate(transactionData: TransactionData): ContractMethodDecoration? = -// when (val contractMethod = contractMethodFactories.createMethodFromInput(transactionData.input)) { -// is TransferMethod -> TransferMethodDecoration(contractMethod.to, contractMethod.value) -// is ApproveMethod -> ApproveMethodDecoration(contractMethod.spender, contractMethod.value) -// else -> null -// } -// -// override fun decorate(fullTransaction: FullTransaction, fullRpcTransaction: FullRpcTransaction) { -// decorateMain(fullTransaction) -// decorateLogs(fullTransaction, fullRpcTransaction.rpcReceipt.logs) -// } -// -// override fun decorateTransactions(fullTransactions: Map) { -// for (fullTransaction in fullTransactions.values) { -// decorateMain(fullTransaction) -// } -// -// decorateEvents(fullTransactions) -// } -// -// private fun decorateMain(fullTransaction: FullTransaction) { -// val transactionData = fullTransaction.transactionData ?: return -// val decoration = decorate(transactionData) ?: return -// -// fullTransaction.mainDecoration = decoration -// } -// -// private fun decorateLogs(fullTransaction: FullTransaction, logs: List) { -// val eventDecorations = logs.mapNotNull { log -> -// val event = log.getErc20EventInstance() ?: return@mapNotNull null -// -// when (event) { -// is TransferEventInstance -> { -// if (event.from == userAddress || event.to == userAddress) { -// return@mapNotNull event -// } -// } -// is ApproveEventInstance -> { -// if (event.owner == userAddress || event.spender == userAddress) { -// return@mapNotNull event -// } -// } -// } -// -// return@mapNotNull null -// } -// -// fullTransaction.eventDecorations.addAll(eventDecorations) -// } -// -// private fun decorateEvents(fullTransactions: Map) { -// val erc20Events = if (fullTransactions.size > 100) { -// storage.getEvents() -// } else { -// storage.getEventsByHashes(fullTransactions.values.map { it.transaction.hash }) -// } -// -// for (event in erc20Events) { -// val decoration = TransferEventInstance(event.contractAddress, event.from, event.to, event.value, event.tokenName, event.tokenSymbol, event.tokenDecimal) -// fullTransactions[event.hashString]?.eventDecorations?.add(decoration) -// } -// } } diff --git a/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/decorations/UnknownTransactionDecoration.kt b/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/decorations/UnknownTransactionDecoration.kt index 160b519f..0760c9a4 100644 --- a/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/decorations/UnknownTransactionDecoration.kt +++ b/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/decorations/UnknownTransactionDecoration.kt @@ -6,7 +6,12 @@ import io.horizontalsystems.ethereumkit.models.InternalTransaction import io.horizontalsystems.ethereumkit.models.TransactionTag import java.math.BigInteger -class UnknownTransactionDecoration(private val userAddress: Address, private val value: BigInteger?, val internalTransactions: List, val eventInstances: List) : TransactionDecoration() { +open class UnknownTransactionDecoration( + private val userAddress: Address, + private val value: BigInteger?, + open val internalTransactions: List, + open val eventInstances: List +) : TransactionDecoration() { override fun tags(): List = (tagsFromInternalTransactions + tagsFromEventInstances).toSet().toList() diff --git a/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/transactionsyncers/TransactionSyncManager.kt b/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/transactionsyncers/TransactionSyncManager.kt index 88b164c6..0570ab80 100644 --- a/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/transactionsyncers/TransactionSyncManager.kt +++ b/ethereumkit/src/main/java/io/horizontalsystems/ethereumkit/transactionsyncers/TransactionSyncManager.kt @@ -1,6 +1,5 @@ package io.horizontalsystems.ethereumkit.transactionsyncers -import android.util.Log import io.horizontalsystems.ethereumkit.core.EthereumKit import io.horizontalsystems.ethereumkit.core.ITransactionSyncer import io.horizontalsystems.ethereumkit.core.TransactionManager @@ -79,7 +78,6 @@ class TransactionSyncManager( ) private fun handle(transactions: List) { - Log.v("LALALA Transactions count", transactions.size.toString()) val map: MutableMap = mutableMapOf() for (transaction in transactions) { diff --git a/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchTransactionDecorator.kt b/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchTransactionDecorator.kt index f3f6c7b2..e70862b7 100644 --- a/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchTransactionDecorator.kt +++ b/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchTransactionDecorator.kt @@ -98,7 +98,7 @@ class OneInchTransactionDecorator( } is OneInchV4Method -> { - return OneInchDecoration(to) + return OneInchUnknownDecoration(to, address, value, internalTransactions, eventInstances) } else -> return null diff --git a/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchUnknownDecoration.kt b/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchUnknownDecoration.kt new file mode 100644 index 00000000..f64ab351 --- /dev/null +++ b/oneinchkit/src/main/java/io/horizontalsystems/oneinchkit/decorations/OneInchUnknownDecoration.kt @@ -0,0 +1,26 @@ +package io.horizontalsystems.oneinchkit.decorations + +import io.horizontalsystems.ethereumkit.contracts.ContractEventInstance +import io.horizontalsystems.ethereumkit.decorations.UnknownTransactionDecoration +import io.horizontalsystems.ethereumkit.models.Address +import io.horizontalsystems.ethereumkit.models.InternalTransaction +import java.math.BigInteger + +class OneInchUnknownDecoration( + val contractAddress: Address, + private val userAddress: Address, + val value: BigInteger, + override val internalTransactions: List, + override val eventInstances: List +) : UnknownTransactionDecoration(userAddress, value, internalTransactions, eventInstances) { + + override fun tags(): List { + val tags = super.tags().toMutableList() + + tags.add(contractAddress.hex) + tags.add("swap") + + return tags + } + +}