-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
471 additions
and
423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
object Project { | ||
const val group = "com.github.acurast" | ||
const val version = "0.1.11" | ||
const val version = "0.1.12-beta01" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package acurast.rpc | ||
|
||
import acurast.rpc.engine.RpcEngine | ||
|
||
public interface Rpc { | ||
public val defaultEngine: RpcEngine | ||
} | ||
|
||
internal object JsonRpc { | ||
object Key { | ||
const val RESULT = "result" | ||
const val ERROR = "error" | ||
const val MESSAGE = "message" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package acurast.rpc.engine | ||
|
||
import acurast.rpc.utils.jsonRpcRequest | ||
import org.json.JSONArray | ||
import org.json.JSONObject | ||
import kotlin.random.Random | ||
|
||
public interface RpcEngine { | ||
public val id: String | ||
public suspend fun request(body: JSONObject, timeout: Long? = null): JSONObject | ||
} | ||
|
||
public suspend fun RpcEngine.request( | ||
id: UInt = Random.nextLong().toUInt(), | ||
method: String, | ||
params: JSONArray = JSONArray(), | ||
timeout: Long? = null, | ||
): JSONObject { | ||
val body = jsonRpcRequest(id, method, params) | ||
|
||
return request(body, timeout) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.