Agent skill
sui-client
Interact with Sui blockchain using @mysten/sui SDK. Use when building transactions, reading chain data, or managing staking positions on Sui.
Install this agent skill to your Project
npx add-skill https://github.com/RandyPen/sui-eco-skills/tree/main/sui-client
SKILL.md
SuiClient Skill
Use this skill when working with Sui blockchain. JSON-RPC is deprecated - use gRPC or GraphQL.
Quick Start
// gRPC (recommended) - @mysten/sui/grpc
import { SuiGrpcClient } from "@mysten/sui/grpc";
const client = new SuiGrpcClient({ network: "mainnet" });
// GraphQL - @mysten/sui/graphql
import { SuiGraphQLClient } from "@mysten/sui/graphql";
const client = new SuiGraphQLClient({
network: "mainnet",
url: "https://your-graphql-endpoint/graphql",
});
Key Imports
| Feature | Import Path |
|---|---|
| gRPC Client | @mysten/sui/grpc |
| GraphQL Client | @mysten/sui/graphql |
| Transaction | @mysten/sui/transactions |
| Keypairs | @mysten/sui/keypairs/ed25519 |
| JSON-RPC (deprecated) | @mysten/sui/jsonRpc |
API Methods
Objects
// Get single object
const obj = await client.getObject({
id: "0x...",
options: { showType: true, showContent: true },
});
// Get multiple objects
const objs = await client.multiGetObjects({
ids: ["0x...", "0x..."],
options: { showType: true },
});
// List owned objects
const owned = await client.listOwnedObjects({
owner: "0x...",
filter: { StructType: "0x2::coin::Coin" },
});
// Get dynamic field
const field = await client.getDynamicField({
parentId: "0x...",
name: { type: "...", value: "..." },
});
// List dynamic fields
const fields = await client.listDynamicFields({
parentId: "0x...",
limit: 50,
});
Coins & Balances
// List coins (paginated) - NOTE: NOT getCoins
const coins = await client.listCoins({
owner: "0x...",
coinType: "0x2::sui::SUI",
limit: 100,
cursor: "...",
});
// Get balance
const balance = await client.getBalance({
owner: "0x...",
coinType: "0x2::sui::SUI",
});
// List all balances
const balances = await client.listBalances({ owner: "0x..." });
// Get coin metadata
const meta = await client.getCoinMetadata({
coinType: "0x2::sui::SUI",
});
Transactions
import { Transaction } from "@mysten/sui/transactions";
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
const keypair = Ed25519Keypair.fromSecretKey("...");
const tx = new Transaction();
// Build transaction...
tx.moveCall({ target: "0x...::module::function" });
// Execute transaction
const result = await client.signAndExecuteTransaction({
transaction: tx,
signer: keypair,
options: { showEffects: true },
});
// Wait for transaction
const confirmed = await client.waitForTransaction({
digest: result.digest,
options: { showEffects: true },
});
// Simulate transaction (dry run)
const simulated = await client.simulateTransaction({
transaction: tx,
signer: keypair.getPublicKey(),
});
// Get transaction
const txResult = await client.getTransaction({
digest: "...",
options: { showEffects: true, showObjectChanges: true },
});
Network Info
// Get reference gas price
const gasPrice = await client.getReferenceGasPrice();
// Get current system state (NOT getLatestSuiSystemState)
const state = await client.getCurrentSystemState();
// Get chain identifier
const chainId = await client.getChainIdentifier();
// Get protocol config
const config = await client.getProtocolConfig();
// Get current epoch
const epoch = await client.getCurrentEpoch();
Move Package
// Get Move function metadata
const func = await client.getMoveFunction({
package: "0x...",
module: "...",
function: "...",
});
Name Service
// Resolve address to .sui name
const name = await client.defaultNameServiceName({
address: "0x...",
});
zkLogin
// Verify zkLogin signature
const result = await client.verifyZkLoginSignature({
bytes: "...",
signature: "...",
intentScope: "TransactionData",
address: "0x...",
});
gRPC-Specific Features
const client = new SuiGrpcClient({ network: "mainnet" });
// Direct service access
client.transactionExecutionService;
client.ledgerService;
client.stateService;
client.subscriptionService;
client.movePackageService;
client.signatureVerificationService;
client.nameService;
// MVR support (transaction simulation)
client.mvr.resolvePackage({ package: "0x..." });
client.mvr.resolveType({ type: "0x..." });
client.mvr.resolve({ packages: ["0x..."] });
GraphQL-Specific Features
import { graphql } from '@mysten/sui/graphql/schema';
const client = new SuiGraphQLClient({
network: 'mainnet',
url: 'https://.../graphql',
queries: {
myQuery: graphql(`
query getBalance($owner: SuiAddress!) {
address(owner: $owner) {
balance { totalBalance }
}
}
`)
}
});
// Execute predefined query
const result = await client.execute('myQuery', {
variables: { owner: '0x...' }
});
// Execute inline query
const inline = await client.query({
query: graphql(`query { ... }`),
variables: { ... }
});
NOT Available in gRPC/GraphQL (use JSON-RPC for now)
getStakes/getStakesByIds- Staking queriesqueryEvents/subscribeEvent- Event queriesgetCoins- UselistCoinsinstead
Network Endpoints
Contact your RPC provider for current endpoints. JSON-RPC (deprecated):
- mainnet:
https://fullnode.mainnet.sui.io:443 - testnet:
https://fullnode.testnet.sui.io:443 - devnet:
https://fullnode.devnet.sui.io:443
Dependencies
bun add @mysten/sui
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
sui-transaction-building
Helps Claude Code understand Sui blockchain transaction building, providing guidelines and examples for Transaction class, commands, input types, gas configuration, and serialization. Use when building blockchain transactions on Sui or when the user mentions transaction building, Transaction class, or Move calls.
sui-keypair-cryptography
Helps Claude Code understand Sui blockchain keypair and cryptography operations, providing guidelines and examples for key generation, signing, verification, address derivation, and multi-signature scheme support. Use when working with cryptography in Sui development or when the user mentions keypairs, cryptography, signing, or verification.
deepbook-trading
Helps Claude Code understand DeepBook V3 SDK usage for order book trading, flash loans, fund management, and market data queries on Sui blockchain. Use when operating DeepBook DEX, executing trading strategies, or querying market data.
working-with-ferra-dlmm
Helps developers work with the Ferra DLMM SDK for Discrete Liquidity Market Maker operations on Sui blockchain. Provides guidance on SDK initialization, pair creation, liquidity management, token swaps, and position handling. Use when working with DLMM pairs, adding/removing liquidity, creating trading pairs, or performing token swaps in the ferra-sdks monorepo.
deepbook-margin-trading-skill
Guides developers through using DeepBook V3 Margin Trading SDK for leverage trading, borrowing, lending, liquidation operations, and risk management on Sui blockchain. Use when working with DeepBook margin trading, margin pools, margin managers, take profit/stop loss orders, or liquidation functionality.
cetus-dlmm-interface
Enables Claude to effectively work with the Cetus Dynamic Liquidity Market Maker (DLMM) protocol on Sui blockchain. This skill provides comprehensive knowledge of the DLMM architecture, Move smart contracts, Rust SDK, and development workflows. Claude can assist with building, testing, and modifying DLMM contracts, creating swap simulations, implementing new features, and debugging protocol issues. The skill covers all 15 Move modules, multi-bin architecture, reward distribution, ACL system, and flash swap functionality. Trigger contexts include: working with Sui Move smart contracts for decentralized exchanges, implementing dynamic liquidity management, creating multi-bin AMM protocols, building swap simulations with Rust SDK, modifying DLMM protocol parameters, debugging pool operations, implementing reward systems, and working with Cetus DLMM interface codebase.
Didn't find tool you were looking for?