Sui move ts bridge
Skill first-mover-tw/sui-dev-agents/skills/sui-move-ts-bridge
Use when bridging Move contracts to TypeScript — generating TS types from Move ABI, creating contract API wrappers, subscribing to on-chain events, or building E2E integration tests. Triggers on "generate types from Move", "event listener", "contract ABI", "Move to TypeScript", "subscribe to events", "ABI wrapper", or any Move↔frontend bridging task. This is the CONTRACT-TO-CODE BRIDGE, not project setup (sui-full-stack) or UI/wallet (sui-frontend).From its SKILL.md
npx -y skills add first-mover-tw/sui-dev-agents --skill sui-move-ts-bridgeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.9 KB, as published. Nobody here has run it
SUI Move ↔ TypeScript Bridge
Scope: This skill covers Move ↔ TypeScript bridging: type generation, event handling, ABI wrappers. For dApp UI setup and wallet integration, use the
sui-frontendskill. For PTB construction and SDK client patterns, use thesui-ts-sdkskill.
Targets: @mysten/sui 2.24.0 (^2.16), @mysten/kiosk 1.4.0 (^1.2). Tested: 2026-08-16.
Compatibility notes: As of @mysten/[email protected], KioskCompatibleClient is typed as ClientWithCoreApi, so the kiosk example below now uses SuiGrpcClient like the other examples in this skill. Public fullnode JSON-RPC is shut off (permanent deactivation landed 2026-07-31) — use SuiGrpcClient or SuiGraphQLClient (or your own full node's JSON-RPC).
Seamlessly integrate Move smart contracts with frontend applications.
Overview
This skill bridges Move contracts and frontend code through:
- Automatic TypeScript type generation from Move ABI
- Contract API wrappers for frontend
- Event handling patterns
- Development environment setup (local node + frontend)
- End-to-end integration testing
- Error handling and user feedback
Quick Start
1. Generate Types from Move ABI
# Build Move package and generate TypeScript types
npx ts-node scripts/generate-types.ts
Output: frontend/src/types/contracts.ts
2. Create API Wrapper
// @check:skip
import { MarketplaceAPI } from './api/marketplace';
const api = new MarketplaceAPI(suiClient, packageId);
const txb = api.createListing({ nft_id: '0x...', price: 1000000000n });
3. Subscribe to Events
// @check:skip
useNFTPurchasedEvents((event) => {
console.log(`NFT ${event.nft_id} sold for ${event.price}`);
});
4. Start Dev Environment
./scripts/dev.sh # Starts local node + deploys + frontend
Integration Patterns
| Pattern | Description |
|---|---|
| Type Generation | Auto-generate TS types from Move ABI |
| API Wrapper | Type-safe transaction builders |
| React Hooks | useMarketplaceAPI() for component integration |
| Event Subscriptions | WebSocket subscribeEvent removed — gRPC stream client.subscriptionService.subscribeEvents (≥2.23), indexer / GraphQL, or filter the checkpoint stream |
| Error Handling | Map Move abort codes to user messages |
Move Type to TypeScript Mapping
| Move Type | TypeScript Type |
|---|---|
u8 | number |
u64 | number | bigint |
u128 | bigint |
bool | boolean |
address | string |
vector<u8> | Uint8Array |
String | string |
ID, UID | string |
Project Structure
project/
├── contracts/
│ └── sources/*.move
├── frontend/
│ ├── src/
│ │ ├── api/ # API wrappers
│ │ ├── hooks/ # React hooks
│ │ ├── types/ # Generated types
│ │ └── lib/ # Error handling
│ └── .env.local
└── scripts/
├── generate-types.ts
└── dev.sh
SDK v2 Notes
- SDK v2 uses
client.core.*namespace for core RPC methods - ESM-only: SDK v2 requires ESM (
"type": "module"inpackage.jsonor.mtsfiles) - Use
coinWithBalancefor non-SUI coin transfers (not just SUI) - Extend client capabilities with
$extend()for ecosystem integration:
import { SuiGrpcClient } from '@mysten/sui/grpc';
import { kiosk } from '@mysten/kiosk';
const client = new SuiGrpcClient({
network: 'mainnet',
baseUrl: 'https://fullnode.mainnet.sui.io:443',
}).$extend(kiosk());
References
- Code Examples - Complete implementation code for all patterns
Usage
This skill is invoked by sui-full-stack after Phase 2 (contracts) and Phase 3 (frontend).
For the latest dApp Kit transaction-building patterns, use the sui-docs-query skill (Context7 MCP).
Common Mistakes
❌ Manual type definitions instead of generating from Move ABI
- Problem: Types drift from contract, runtime errors in production
- Fix: Always run
generate-types.tsafter Move contract changes
❌ Not handling u64/u128 correctly in TypeScript
- Problem: Number overflow, precision loss for large values
- Fix: Use
bigintfor u64/u128,number | bigintfor safety
❌ Forgetting to update package ID after redeployment
- Problem: Frontend calls old contract, all transactions fail
- Fix: Store package ID in .env, auto-update in deployment script
❌ Not mapping Move abort codes to user messages
- Problem: Generic "Transaction failed" error, users confused
- Fix: Create error code mapping in
lib/errors.ts
❌ Expecting per-event subscriptions from the SDK
- Problem: WebSocket
subscribeEventis removed in SDK v2 — code waiting for a WS push never fires - Fix: Use the gRPC stream
client.subscriptionService.subscribeEvents(...)(≥2.23, stable since P130), consume an indexer / GraphQL, or filter the checkpoint stream (SubscribeCheckpoints)
❌ Not testing integration locally
- Problem: Integration bugs discovered after deployment
- Fix: Use
dev.shto run local node + contracts + frontend together
❌ Hardcoding transaction arguments
- Problem: Cannot reuse API wrappers, brittle code
- Fix: Use typed interfaces for transaction parameters
Bridge Move contracts and modern frontend - type-safe, real-time, production-ready integration!