Skip to content

Commit f1e0c4d

Browse files
committed
Add method pendingTransactions() to Erc20Kit
1 parent 2d9dadd commit f1e0c4d

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/Erc20Kit.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package io.horizontalsystems.erc20kit.core
33
import android.content.Context
44
import io.horizontalsystems.erc20kit.core.Erc20Kit.SyncState.*
55
import io.horizontalsystems.erc20kit.models.Transaction
6-
import io.horizontalsystems.ethereumkit.models.TransactionData
76
import io.horizontalsystems.ethereumkit.core.EthereumKit
87
import io.horizontalsystems.ethereumkit.models.Address
98
import io.horizontalsystems.ethereumkit.models.BloomFilter
109
import io.horizontalsystems.ethereumkit.models.DefaultBlockParameter
10+
import io.horizontalsystems.ethereumkit.models.TransactionData
1111
import io.horizontalsystems.ethereumkit.network.EtherscanService
1212
import io.reactivex.BackpressureStrategy
1313
import io.reactivex.Flowable
@@ -117,6 +117,10 @@ class Erc20Kit(
117117
return transactionManager.getTransactions(fromTransaction, limit)
118118
}
119119

120+
fun pendingTransactions(): List<Transaction> {
121+
return transactionManager.getPendingTransactions()
122+
}
123+
120124
val syncStateFlowable: Flowable<SyncState>
121125
get() = state.syncStateSubject.toFlowable(BackpressureStrategy.LATEST)
122126

@@ -136,7 +140,7 @@ class Erc20Kit(
136140
// ITransactionManagerListener
137141

138142
override fun onSyncStarted() {
139-
state.transactionsSyncState = Syncing
143+
state.transactionsSyncState = Syncing
140144
}
141145

142146
override fun onSyncSuccess(transactions: List<Transaction>) {

erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/Interfaces.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface ITransactionManager {
2323
fun delayedSync(expectTransaction: Boolean)
2424

2525
fun getTransactions(fromTransaction: TransactionKey?, limit: Int?): Single<List<Transaction>>
26+
fun getPendingTransactions(): List<Transaction>
2627
fun send(to: Address, value: BigInteger, gasPrice: Long, gasLimit: Long): Single<Transaction>
2728
fun getTransactionInput(to: Address, value: BigInteger): ByteArray
2829
}

erc20kit/src/main/java/io/horizontalsystems/erc20kit/core/TransactionManager.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ class TransactionManager(
3535
return storage.getTransactions(fromTransaction, limit)
3636
}
3737

38+
override fun getPendingTransactions(): List<Transaction> {
39+
return storage.getPendingTransactions()
40+
}
41+
3842
override fun immediateSync() {
3943
if (syncing.getAndSet(true)) return
4044

0 commit comments

Comments
 (0)