RPC client
mero.rpc (RpcClient) calls the methods a context’s WASM application exposes,
over the node’s /jsonrpc endpoint. It shares the SDK’s transport, so
authentication, refresh, and the error model apply. A
contract-level failure throws RpcException. See the
executing methods guide for task-oriented examples.
execute
Section titled “execute”suspend inline fun <reified T> execute( contextId: String, method: String, argsJson: JsonObject = JsonObject(emptyMap()), executorPublicKey: String? = null,): TCalls method on the application in contextId and decodes result.output into
T with kotlinx.serialization. A non-reified overload taking an explicit
DeserializationStrategy<T> is also available.
@Serializable data class Post(val id: String, val title: String)
val post: Post = mero.rpc.execute( contextId = contextId, method = "get_post", argsJson = buildJsonObject { put("id", "42") },)executeRaw
Section titled “executeRaw”suspend fun executeRaw( contextId: String, method: String, argsJson: JsonObject = JsonObject(emptyMap()), executorPublicKey: String? = null,): JsonElementReturns the undecoded result.output as a JsonElement — use it when you don’t
have (or don’t want) a typed result.
migrateMyEntries
Section titled “migrateMyEntries”suspend fun migrateMyEntries(contextId: String): MigrateMyEntriesSummary
@Serializable data class MigrateMyEntriesSummary( val converted: Int, // entries re-signed this call val remaining: Int, // still below the target schema)Owner-driven migration: re-signs the caller’s identity-gated entries to the current schema in a single sweep (it does not loop).
countMyPending
Section titled “countMyPending”suspend fun countMyPending(contextId: String): IntRead-only count of the caller’s entries still below the target schema.
if (mero.rpc.countMyPending(contextId) > 0) mero.rpc.migrateMyEntries(contextId)