Skip to content

Commit bc2e14b

Browse files
fixed some bugs
1 parent f46cfcb commit bc2e14b

File tree

1 file changed

+6
-3
lines changed
  • app/src/main/kotlin/io/github/hosseinkarami_dev/near/rpc/client_app

1 file changed

+6
-3
lines changed

app/src/main/kotlin/io/github/hosseinkarami_dev/near/rpc/client_app/MainActivity.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import io.github.hosseinkarami_dev.near.rpc.client.Utils.getResultOrNull
99
import io.github.hosseinkarami_dev.near.rpc.models.BlockId
1010
import io.github.hosseinkarami_dev.near.rpc.models.RpcBlockRequest
1111
import io.github.hosseinkarami_dev.near.rpc.models.RpcBlockResponse
12-
import io.github.hosseinkarami_dev.near.rpc.models.RpcStatusResponse
1312
import io.github.hosseinkarami_dev.near.rpc.models.RpcTransactionStatusRequest
1413
import io.github.hosseinkarami_dev.near.rpc.models.SignedTransaction
1514
import io.github.hosseinkarami_dev.near.rpc.models.TxExecutionStatus
@@ -34,20 +33,24 @@ class MainActivity : ComponentActivity() {
3433
baseUrl = "https://rpc.mainnet.near.org" // or testnet: https://rpc.testnet.near.org
3534
)
3635

36+
lifecycleScope.launch {
3737
lifecycleScope.launch {
38-
val response = nearClient.status()
38+
val response = nearClient.block(
39+
RpcBlockRequest.BlockId(BlockId.BlockHeight(167440515.toULong()))
40+
)
3941

4042
when (response) {
4143
is RpcResponse.Failure -> {
4244
println("Error: ${response.error}")
4345
}
4446

4547
is RpcResponse.Success -> {
46-
val result = response.getResultOrNull<RpcStatusResponse>()
48+
val result = response.getResultOrNull<RpcBlockResponse>()
4749
println("Result: $result")
4850

4951
}
5052
}
53+
}
5154

5255
//
5356
// lifecycleScope.launch {

0 commit comments

Comments
 (0)