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
| Name | Type | Description |
|---|---|---|
rpc_url | const char* | Null-terminated RPC endpoint URL (e.g. "https://host:443/"). |
Returns
MicroSuiClientstruct type.
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
| Name | Type | Description |
|---|---|---|
self | MicroSuiClient * | Pointer to client instance (must contain a valid rpc_url) |
kp | MicroSuiEd25519 | Keypair used to sign the transaction bytes |
tx | MicroSuiTransaction | Transaction holding raw bytes to be signed/executed |
Returns
SuiTransactionBlockResponsestruct type.
Example usage
Given:
- A valid client instance
client:MicroSuiClienttype. - A valid keypair instance
keypair:MicroSuiEd25519type. - A valid transaction instance
transaction:MicroSuiTransactiontype.
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
| Name | Type | Description |
|---|---|---|
self | MicroSuiClient * | Pointer to client instance (must contain a valid rpc_url) |
txBytes | TransactionBytes | Transaction bytes of the transaction to execute |
signature | SuiSignature | Signature of the transaction to execute |
Returns
SuiTransactionBlockResponsestruct type.
Example usage
Given:
- A valid client instance
client:MicroSuiClienttype. - A valid transaction bytes instance
transaction_bytes:TransactionBytestype. - A valid signtaure instance
signature:SuiSignaturetype.
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