Skip to content

Commit

Permalink
Update SuiClient.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwonhyukjoon authored May 30, 2023
1 parent bf92c00 commit 0fee284
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions suikotlin/src/main/java/io/cosmostation/suikotlin/SuiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ class SuiClient {
val result = ApiService.create().postJsonRpcRequest(request).body()?.result
return Gson().fromJson(Gson().toJson(result), SuiObjectDataResult::class.java).data.map { it.data }
}

suspend fun getMultiObjectDetail(objectIds: List<String>): Any? {
val request = JsonRpcRequest("sui_multiGetObjects", listOf(objectIds, SuiObjectResponseQuery(null, SuiObjectDataOptions(showContent = true))))
return ApiService.create().postJsonRpcRequest(request).body()?.result

suspend fun getMultiObjectsById(objectIds: List<String?>, options: SuiObjectDataOptions? = SuiObjectDataOptions(showContent = true)): List<SuiObjectInfo> {
val request = JsonRpcRequest("sui_multiGetObjects", listOf(objectIds, options))
val result = ApiService.create().postJsonRpcRequest(request).body()
return Gson().fromJson(Gson().toJson(result), SuiMultiObjectInfo::class.java).result.map { it.data }
}

suspend fun getTransactions(transactionQuery: TransactionQuery, nextOffset: String? = null, limit: Int? = null, descending: Boolean = false, options: SuiTransactionBlockResponseOptions? = SuiTransactionBlockResponseOptions(showInput = true, showEffects = true, showBalanceChanges = true)): List<SuiTransaction> {
Expand Down Expand Up @@ -116,4 +117,4 @@ class SuiClient {
val params = mutableListOf(Base64.getEncoder().encodeToString(txBytes), listOf(Base64.getEncoder().encodeToString(byteArrayOf(0x00) + signedBytes + keyPair.publicKey.abyte)), responseOptions, "WaitForLocalExecution")
return ApiService.create().postJsonRpcRequest(JsonRpcRequest("sui_executeTransactionBlock", params)).body()?.result
}
}
}

0 comments on commit 0fee284

Please sign in to comment.