11package io.github.hosseinkarami_dev.near.rpc.client
22
3- import io.github.hosseinkarami_dev.near.rpc.models.AccountId
4- import io.github.hosseinkarami_dev.near.rpc.models.BlockId
5- import io.github.hosseinkarami_dev.near.rpc.models.CryptoHash
6- import io.github.hosseinkarami_dev.near.rpc.models.RpcBlockRequest
7- import io.github.hosseinkarami_dev.near.rpc.models.RpcMaintenanceWindowsRequest
8- import io.github.hosseinkarami_dev.near.rpc.models.RpcStateChangesInBlockByTypeRequest
9- import io.github.hosseinkarami_dev.near.rpc.models.RpcTransactionStatusRequest
10- import io.github.hosseinkarami_dev.near.rpc.models.SignedTransaction
113import io.ktor.client.HttpClient
124import io.ktor.client.engine.cio.CIO
135import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
@@ -22,89 +14,13 @@ class NearClientTest {
2214 json()
2315 }
2416 }
25-
26- private val nearClient = NearClient (
27- httpClient = httpClient,
28- baseUrl = " https://rpc.mainnet.near.org"
29- )
17+ //
18+ // private val nearClient = NearClient(
19+ // httpClient = httpClient,
20+ // baseUrl = "https://rpc.mainnet.near.org"
21+ // )
3022
3123 @Test
3224 fun testTransactionStatus () = runTest {
33- // val response = nearClient.query(
34- // RpcQueryRequest.ViewAccessKeyListByFinality(
35- // finality = Finality.FINAL,
36- // accountId = AccountId("neardome2340.near"),
37- // // publicKey = PublicKey("ed25519:EddTahJwZpJjYPPmat7DBm1m2vdrFBzVv7e3T4hzkENd"),
38- // requestType = RpcQueryRequest.ViewAccessKeyListByFinality.RequestType.VIEW_ACCESS_KEY_LIST
39- // )
40- // )
41-
42- val response = nearClient.experimentalTxStatus(
43- RpcTransactionStatusRequest .SignedTxBase64 (
44- SignedTransaction (" Gz2YwFsq12yZDAVmA8M53DZM4ih56z6Ybhwd9QNa8A94" )
45-
46- )
47- // RpcMaintenanceWindowsRequest(
48- // AccountId("neardome2340.near")
49- // )
50- )
51-
52- when (response) {
53- is RpcResponse .Failure -> {
54- println (response.error)
55- println (" hiiiiiiiii" )
56- }
57-
58- is RpcResponse .Success -> {
59- println (response.result)
60- // val accessKeyList = response.getResultOrNull<RpcQueryResponse.AccountView>()
61- // println(accessKeyList)
62- }
63- }
64-
65- // val response = nearClient.experimentalProtocolConfig(
66- // RpcProtocolConfigRequest.Finality(finality = Finality.FINAL)
67- // )
68-
69- // when (response) {
70- // is RpcResponse.Failure -> {
71- // println(response.error)
72- // }
73- //
74- // is RpcResponse.Success<*> -> {
75- // println(response)
76- //
77- // }
78- // }
79-
80-
81- // val response = nearClient.status()
82- // val response = nearClient.changes(
83- // RpcStateChangesInBlockByTypeRequest.DataChangesByFinality(
84- // changesType = RpcStateChangesInBlockByTypeRequest.DataChangesByFinality.ChangesType.DATA_CHANGES,
85- // finality = Finality.FINAL,
86- // accountIds = listOf(AccountId("contract.rpc-examples.testnet")),
87- // keyPrefixBase64 = StoreKey("c29tZV9wcmVmaXg="),
88- // )
89- // )
90- // val response = nearClient.tx(
91- // RpcTransactionStatusRequest.SignedTxBase64(
92- // signedTxBase64 = SignedTransaction("FtzDPgG7BnX3g6WV7w951TZ1UErFahfp6NwQKiTE9dMp"),
93- // waitUntil = null,
94- // // waitUntil = TxExecutionStatus.Final
95- // )
96- // )
97- //
98- // when (response) {
99- // is RpcResponse.Failure -> {
100- // println("Error: ${response.error.code} ${response.error.message}")
101- // assert(false)
102- // }
103- //
104- // is RpcResponse.Success -> {
105- // println("Result: ${response.result}")
106- // assert(true)
107- // }
108- // }
10925 }
11026}
0 commit comments