Skip to content

Commit

Permalink
improve generic bounds on LogFilter to avoid casting
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialPB committed Dec 25, 2023
1 parent cbff8ea commit ad4f24a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ethers-core/src/main/kotlin/io/ethers/core/types/LogFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class LogFilter {
/**
* Filter logs matching any of provided topic0 [hashes].
*/
fun topic0(vararg hashes: Hash): LogFilter = topic0(Topic.Array(hashes as Array<Hash>))
fun topic0(vararg hashes: Hash): LogFilter = topic0(Topic.Array(hashes))

/**
* Filter logs matching provided topic0 [topic].
Expand All @@ -112,7 +112,7 @@ class LogFilter {
/**
* Filter logs matching any of provided topic1 [hashes].
*/
fun topic1(vararg hashes: Hash): LogFilter = topic1(Topic.Array(hashes as Array<Hash>))
fun topic1(vararg hashes: Hash): LogFilter = topic1(Topic.Array(hashes))

/**
* Filter logs matching provided topic1 [topic].
Expand All @@ -123,14 +123,14 @@ class LogFilter {
}

/**
* Filter logs matching provided topic2 [hash].
* Filter logs matching provided topic2 [hashes].
*/
fun topic2(hashes: Hash): LogFilter = topic2(Topic.Single(hashes))

/**
* Filter logs matching any of provided topic2 [hashes].
*/
fun topic2(vararg hashes: Hash): LogFilter = topic2(Topic.Array(hashes as Array<Hash>))
fun topic2(vararg hashes: Hash): LogFilter = topic2(Topic.Array(hashes))

/**
* Filter logs matching provided topic2 [topic].
Expand All @@ -148,7 +148,7 @@ class LogFilter {
/**
* Filter logs matching any of provided topic3 [hashes].
*/
fun topic3(vararg hashes: Hash): LogFilter = topic3(Topic.Array(hashes as Array<Hash>))
fun topic3(vararg hashes: Hash): LogFilter = topic3(Topic.Array(hashes))

/**
* Filter logs matching provided topic3 [topic].
Expand Down Expand Up @@ -222,7 +222,7 @@ sealed interface BlockSelector {
sealed interface Topic {
data class Single(val hash: Hash) : Topic

class Array(val hashes: kotlin.Array<Hash>) : Topic {
class Array(val hashes: kotlin.Array<out Hash>) : Topic {
constructor(value: List<Hash>) : this(value.toTypedArray())

override fun equals(other: Any?): Boolean {
Expand Down

0 comments on commit ad4f24a

Please sign in to comment.