Client SDK
The Dubhe Client SDK provides a powerful TypeScript interface for connecting your frontend applications to Dubhe Engine smart contracts on Sui.Installation
Install the client SDK in your frontend project:npm
yarn
Quick Setup
Initialize the client in your application:Authentication
Connect a wallet to enable transactions:Reading Data
Query component data from your entities:Writing Data (Transactions)
Execute systems to modify game state:Real-time Updates
Subscribe to entity changes:Error Handling
Handle common errors gracefully:Client Configuration
Customize client behavior:Type Safety
The SDK provides full TypeScript support with auto-generated types:React Integration
Use React hooks for seamless integration:Performance Tips
Optimization Strategies
- Batch Queries: Group multiple component queries together
- Selective Subscriptions: Only subscribe to components you actively display
- Pagination: Use pagination for large entity lists
- Caching: Enable caching for frequently accessed data
API Reference
Core Methods
| Method | Description |
|---|---|
getComponent(params) | Fetch a single component |
queryComponents(params) | Query multiple components |
subscribe(params, callback) | Subscribe to real-time updates |
tx.system.function(params) | Execute system functions |
signAndExecute(txb) | Sign and execute transactions |
Configuration Options
| Option | Type | Description |
|---|---|---|
network | string | Sui network to connect to |
packageId | string | Your deployed package ID |
endpoint | string | Custom RPC endpoint (optional) |
enableCache | boolean | Enable query result caching |
Next Steps
Tutorial: First DApp
Build your first frontend application
Query Guide
Learn advanced querying techniques