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.

Stars 5
Forks 1

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

typescript
// 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

typescript
// 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

typescript
// 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

typescript
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

typescript
// 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

typescript
// Get Move function metadata
const func = await client.getMoveFunction({
  package: "0x...",
  module: "...",
  function: "...",
});

Name Service

typescript
// Resolve address to .sui name
const name = await client.defaultNameServiceName({
  address: "0x...",
});

zkLogin

typescript
// Verify zkLogin signature
const result = await client.verifyZkLoginSignature({
  bytes: "...",
  signature: "...",
  intentScope: "TransactionData",
  address: "0x...",
});

gRPC-Specific Features

typescript
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

typescript
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 queries
  • queryEvents / subscribeEvent - Event queries
  • getCoins - Use listCoins instead

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

bash
bun add @mysten/sui

Expand your agent's capabilities with these related and highly-rated skills.

RandyPen/sui-eco-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.

5 1
Explore
RandyPen/sui-eco-skills

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.

5 1
Explore
RandyPen/sui-eco-skills

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.

5 1
Explore
RandyPen/sui-eco-skills

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.

5 1
Explore
RandyPen/sui-eco-skills

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.

5 1
Explore
RandyPen/sui-eco-skills

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.

5 1
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results