Skip to content

Commit

Permalink
Updated gRPC query to use query field instead of events field (#523)
Browse files Browse the repository at this point in the history
* update tx grpc query to use new structure

* fix lint

* add change log entry

* remove empty line

* fix lint
  • Loading branch information
nullpointer0x00 authored Jul 9, 2024
1 parent 7abdd12 commit b476b5f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
## Unreleased

* Updated Prov Protos to 1.19.0-rc2 [#522](https://github.com/provenance-io/explorer-service/pull/522)
* Updated gRPC query to use `query` field instead of `events` field [#523](https://github.com/provenance-io/explorer-service/pull/523)

## [v5.10.0](https://github.com/provenance-io/explorer-service/releases/tag/v5.10.0) - 2024-06-11
### Release Name: Fridtjof Nansen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TransactionGrpcClient(channelUri: URI) {
do {
txClient.getTxsEvent(
getTxsEventRequest {
this.events.add("tx.height=$height")
this.query = "tx.height=$height"
this.limit = limit.toLong()
this.page = page.toLong()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.provenance.explorer.grpc.v1

import cosmos.tx.v1beta1.ServiceOuterClass
import io.provenance.explorer.domain.exceptions.TendermintApiException
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import java.net.URI

class TransactionGrpcClientTest {

@Test
@Disabled("Test was used to manually call the endpoint")
fun `test getTxsByHeight success`() = runBlocking {
val uri = URI("grpcs://grpc.test.provenance.io:443")
val transactionGrpcClient = TransactionGrpcClient(uri)

try {
val height = 23440770
val total = 1

val txResponses: List<ServiceOuterClass.GetTxResponse> = transactionGrpcClient.getTxsByHeight(height, total)

txResponses.forEach { txResponse ->
println("TxResponse: ${txResponse.txResponse}")
println("Tx: ${txResponse.tx}")
}
} catch (e: TendermintApiException) {
println("Error occurred: ${e.message}")
}
}
}

0 comments on commit b476b5f

Please sign in to comment.