sui-client

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SuiClient Skill

SuiClient技能

A comprehensive Claude Code skill for interacting with the Sui blockchain using the official
@mysten/sui
SDK.
一款基于官方
@mysten/sui
SDK的全功能Claude Code技能,用于与Sui区块链进行交互。

Instructions

使用说明

Use this skill when you need to interact with the Sui blockchain. Includes:
  1. Network Connection: Connect to mainnet, testnet, devnet, or localnet
  2. Data Reading: Get tokens, objects, transactions, and balances
  3. Transaction Execution: Build, sign, and execute transactions
  4. Network Information: Get system state, gas prices, and protocol configuration
  5. Move Package Interactions: Query normalized Move data
  6. Event Handling: Query and subscribe to blockchain events
  7. Staking Operations: Manage staking positions
  8. Error Handling: Implement comprehensive error handling patterns
当你需要与Sui区块链交互时,可使用此技能。包含以下功能:
  1. 网络连接:连接至主网、测试网、开发网或本地网
  2. 数据读取:获取代币、对象、交易记录及余额
  3. 交易执行:构建、签名并执行交易
  4. 网络信息查询:获取系统状态、Gas价格及协议配置
  5. Move包交互:查询标准化的Move数据
  6. 事件处理:查询并订阅区块链事件
  7. 质押操作:管理质押仓位
  8. 错误处理:实现全场景错误处理模式

Quick Start

快速开始

typescript
import { SuiClient } from '@mysten/sui/client';

// Connect to mainnet
const client = new SuiClient({
  url: 'https://sui-mainnet.nodeinfra.com'
});

// Get account balance
const balance = await client.getBalance({
  owner: '0x123...',
  coinType: '0x2::sui::SUI'
});
typescript
import { SuiClient } from '@mysten/sui/client';

// Connect to mainnet
const client = new SuiClient({
  url: 'https://sui-mainnet.nodeinfra.com'
});

// Get account balance
const balance = await client.getBalance({
  owner: '0x123...',
  coinType: '0x2::sui::SUI'
});

Installation

安装

bash
undefined
bash
undefined

Install the skill

Install the skill

claude skills install sui-client
claude skills install sui-client

Install dependencies

Install dependencies

bun add @mysten/sui
undefined
bun add @mysten/sui
undefined

Features

功能特性

  • Client Management: Connect to mainnet, testnet, devnet, and localnet
  • Data Reading: Get tokens, objects, transactions, and balances
  • Transaction Execution: Build, sign, and execute transactions
  • Network Information: Get system state, gas prices, and protocol configuration
  • Move Package Interactions: Query normalized Move data
  • Event Handling: Query and subscribe to blockchain events
  • Staking Operations: Manage staking positions
  • Error Handling: Comprehensive error handling patterns
  • 客户端管理:连接至主网、测试网、开发网及本地网
  • 数据读取:获取代币、对象、交易记录及余额
  • 交易执行:构建、签名并执行交易
  • 网络信息查询:获取系统状态、Gas价格及协议配置
  • Move包交互:查询标准化的Move数据
  • 事件处理:查询并订阅区块链事件
  • 质押操作:管理质押仓位
  • 错误处理:全场景错误处理模式

Examples

示例代码

Check the
examples/
directory for complete usage examples:
  • basic-usage.ts
    - Basic client setup and data reading
  • transactions.ts
    - Transaction building and execution
  • advanced.ts
    - Advanced patterns and error handling
请查看
examples/
目录下的完整使用示例:
  • basic-usage.ts
    - 基础客户端配置与数据读取
  • transactions.ts
    - 交易构建与执行
  • advanced.ts
    - 高级模式与错误处理

API Reference

API参考

This skill provides comprehensive coverage of the SuiClient API including:
  • Reading Data:
    getObject()
    ,
    getCoins()
    ,
    getTransactionBlock()
  • Writing Data:
    signAndExecuteTransaction()
    ,
    executeTransactionBlock()
  • Network Information:
    getLatestSuiSystemState()
    ,
    getReferenceGasPrice()
  • Events:
    queryEvents()
    ,
    subscribeEvent()
  • Staking:
    getStakes()
    ,
    getStakesByIds()
此技能全面覆盖SuiClient API,包括:
  • 数据读取
    getObject()
    getCoins()
    getTransactionBlock()
  • 数据写入
    signAndExecuteTransaction()
    executeTransactionBlock()
  • 网络信息
    getLatestSuiSystemState()
    getReferenceGasPrice()
  • 事件
    queryEvents()
    subscribeEvent()
  • 质押
    getStakes()
    getStakesByIds()

Detailed Documentation

详细文档

  • Source Code - Complete SuiClient API implementation
  • Type Definitions - TypeScript type definitions
  • Code Templates - Common code templates
  • Example Code - Complete usage examples
  • 源代码 - 完整的SuiClient API实现
  • 类型定义 - TypeScript类型定义
  • 代码模板 - 常用代码模板
  • 示例代码 - 完整使用示例

Dependencies

依赖

  • @mysten/sui
    : ^1.45.0 (managed via package.json)
  • @mysten/sui
    : ^1.45.0 (通过package.json管理)

Contributing

贡献

Contributions are welcome! Please see the CONTRIBUTING.md file for details.
欢迎贡献代码!详情请查看CONTRIBUTING.md文件。

License

许可证

MIT
MIT