Quickstart
Ship on Mainnet in under a week.
Getting Started
Before you begin, make sure you’ve completed the steps in our Prerequisites page. This ensures you have:
- Installed the SDK
- Set up your environment variables
- Configured the ChipiProvider in your app layout
Critical Security Notice
Implementing the SDK
Chipi SDK provides React hooks for all actions, making it easy to integrate invisible wallets into your applications. Here’s how to use them in a Next.js project:
Available Hooks
The SDK provides these core hooks for interacting with StarkNet:
useCreateWallet()
- Generate invisible wallets for usersuseApprove()
- Authorize token spendinguseStake()
- Stake assets in supported protocolsuseWithdraw()
- Withdraw assets from contractsuseTransfer()
- Send tokens to other walletsuseCallAnyContract()
- Interact with any StarkNet contract
Each hook returns:
- An async function for the action (e.g.,
createWalletAsync
) - A response object with the result (e.g.,
createWalletResponse
) - Loading and error states to manage UI feedback
Complete Example
For a more comprehensive example including user authentication with Clerk, see our Next.js + Clerk Auth Guide.
Explore Actions
Dive deeper into each SDK action with detailed examples.
Live Example
Check out our live demo to see the Chipi SDK in action.
Real-World Example: USDC Transfer
Here’s a complete implementation for transferring USDC tokens using the Chipi SDK:
Code Breakdown
1. Security Setup
- Why Hardcode? Simplifies testing/demos (never do this in production)
- Production Note: In real apps, derive PIN from user authentication
2. Wallet Management
- getWalletData: Server action fetching encrypted wallet from your backend
- Automatic Load: Fetches wallet on component mount using useEffect
3. Transfer Execution
- transferAsync: SDK method handling entire transfer flow
- Parameters:
encryptKey
: PIN to decrypt private keycontractAddress
: USDC token contractdecimals
: Token precision (6 for USDC)
4. UI Feedback
- Shows transaction hash after successful transfer
- Can link to StarkScan for verification
Full Production Setup
For a complete implementation including:
- Dynamic PIN management
- Error handling
- Loading states
- Real-time balance updates
See our Complete Integration Guide.