Skip to main content

Client

MicroSui Object-style RPC client for interacting with a Sui full node.

Provides a small OO-like API (struct + function pointers) to talk to a Sui RPC endpoint over HTTP(S).
The current focus is submitting transactions, but this module is designed to expand into a general-purpose blockchain client for data queries as well.

Client capabilities: RPC binding, keypair TX sign-execute, and execution of pre-signed transactions.

IMPORTANT NOTE:
Compatibility & Support: This class is fully supported and production-stable (as of this documentation release) on:
      - ESP32 series — including all existing and future variants within the family
      - Desktop platforms — Windows, macOS, Linux, and Unix-based operating systems
⚠️ Support for additional embedded architectures may be added in upcoming releases.

Inspired by the Mysten Labs TypeScript SDK, adapted for embedded C.


File Location

Defined in microsui-lib/src/Client.c


Indexs

Constructors

Methods


Constructors

SuiClient_newClient

SuiClient_newClient(const char* rpc_url): MicroSuiClient

Create a new MicroSuiClient bound to an RPC URL.

Initializes the client struct, safely copies the provided URL into an internal buffer, and assigns method pointers.

Parameters

NameTypeDescription
rpc_urlconst char*Null-terminated RPC endpoint URL (e.g. "https://host:443/").

Returns

Example usage

const char* rpc_url = "https://fullnode.testnet.sui.io:443/"; // Sui Testnet fullnode RPC URL

MicroSuiClient client = SuiClient_newClient(rpc_url);

if (client.rpc_url != NULL)
// client created successfully

Methods

signAndExecuteTransaction

signAndExecuteTransaction(MicroSuiClient *self, MicroSuiEd25519 kp, MicroSuiTransaction tx): SuiTransactionBlockResponse

Sign a transaction and execute it via the Sui RPC.

Converts transaction bytes to hex, asks the keypair to sign the message, builds the JSON RPC request, performs the HTTP POST, and decodes the JSON response into the provided response structure.

Parameters

NameTypeDescription
selfMicroSuiClient *Pointer to client instance (must contain a valid rpc_url)
kpMicroSuiEd25519Keypair used to sign the transaction bytes
txMicroSuiTransactionTransaction holding raw bytes to be signed/executed

Returns

Example usage

Given:

We can execute the transaction with the following function:

SuiTransactionBlockResponse res = client.signAndExecuteTransaction(&client, keypair, transaction);

if (res.digest != NULL)
// Transaction submited successfully to the Sui Netwrok

executeTransactionBlock

executeTransactionBlock(MicroSuiClient *self, TransactionBytes txBytes, SuiSignature signature): SuiTransactionBlockResponse

Sign a transaction and execute it via the Sui RPC.

Receive the Transaction bytes and the Signature and generate the json to send to the Sui API Node.

Parameters

NameTypeDescription
selfMicroSuiClient *Pointer to client instance (must contain a valid rpc_url)
txBytesTransactionBytesTransaction bytes of the transaction to execute
signatureSuiSignatureSignature of the transaction to execute

Returns

Example usage

Given:

We can execute the transaction with the following function:

SuiTransactionBlockResponse res = client.executeTransactionBlock(&client, transaction_bytes, signature);

if (res.digest != NULL)
// Transaction submited successfully to the Sui Netwrok