Skip to content

Reedyuk/jsonrpc-kotlin-client

Repository files navigation

JSON-RPC Kotlin Client

Kotlin badge badge badge

A Kotlin Multiplatform Library for performing JSON-RPC 2.0 commands.

Taken inspiration from SwiftJSONRPC

Running

The library works on the following platforms: Android, iOS, JavaScript.

Usage

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages