sui-sdk-js
Installation
SKILL.md
Sui TypeScript SDK v2
Use this skill for JavaScript and TypeScript projects that interact with Sui through @mysten/sui v2+.
Primary source: Mysten Labs Sui TypeScript SDK docs at https://sdk.mystenlabs.com/sui.
JSON-RPC is deprecated and will be decommissioned soon. Default to SuiGrpcClient (or SuiGraphQLClient) and migrate existing JSON-RPC code away from SuiJsonRpcClient. Documented exception: the Kiosk SDK requires SuiJsonRpcClient or SuiGraphQLClient because kiosk event queries are not available over gRPC — for kiosk work, follow the sui-kiosk-sdk-js skill.
All code in this skill targets SDK v2+. The legacy SuiClient from @mysten/sui/client (pre-v2) has been removed. Do not use it.
Current Defaults
- Use
@mysten/suiv2+ docs and imports. - If
@mysten/*packages are installed, readnode_modules/@mysten/*/docs/llms-index.mdfirst; current packages ship flat LLM docs with the SDK. - The SDK is ESM-only. Ensure
package.jsonhas"type": "module"and TypeScript usesmoduleResolutioncompatible with ESM, such asNodeNext,Node16, orBundler. - Prefer modular subpath imports like
@mysten/sui/grpc,@mysten/sui/transactions,@mysten/sui/keypairs/ed25519,@mysten/sui/bcs, and@mysten/sui/utils. - For new code, prefer
SuiGrpcClientand the transport-agnosticclient.coreAPI. In reusable code, acceptClientWithCoreApiand callclient.core.*even when native clients expose shortcuts. - JSON-RPC is deprecated and will be decommissioned. Do not introduce
SuiJsonRpcClientcode except for the documented kiosk/event-query exception (see thesui-kiosk-sdk-jsskill). Migrate other JSON-RPC usage to gRPC or GraphQL. - Public Mysten fullnode endpoints are rate-limited (100 requests per 30 seconds). Production apps should use dedicated nodes or a provider endpoint.