A Kotlin Multiplatform Library for performing JSON-RPC 2.0 commands.
Taken inspiration from SwiftJSONRPC
The library works on the following platforms: Android
, iOS
, JavaScript
.
Create client object with base url:
val client = RPCClient(clientUrl)
Create a subclass of the RPCService object
val service = object : RPCService(client) {
suspend fun sha(): String {
val sha = invoke("web3_sha3", arrayOf("0x68656c6c6f20776f726c64"))
return sha.content
}
}
Invoke the service function call to get the result.
val shaResult = service.sha()
I would recommend you look at the unit tests to get a better idea. I will be working on another library which uses this library, so will link back to here for more inspiration.