Usage
// Default CHIPI wallet (session keys, passkey support)
const newWallet = await serverClient.createWallet({
params: {
encryptKey: "user-secure-pin",
externalUserId: "your-user-id-123",
chain: "STARKNET",
},
});
// READY wallet (Argent X compatible, no session keys)
const readyWallet = await serverClient.createWallet({
params: {
encryptKey: "user-secure-pin",
externalUserId: "your-user-id-456",
chain: "STARKNET",
walletType: "READY",
},
});
// Custom account implementation (advanced)
const customWallet = await serverClient.createWallet({
params: {
encryptKey: "user-secure-pin",
externalUserId: "your-user-id-789",
chain: "STARKNET",
classHash: "0x0484bbd2404b3c7264bea271f7267d6d4004821ac7787a9eed7f472e79ef40d1",
},
});
Parameters
| Parameter | Type | Required | Description |
|---|
encryptKey | string | Yes | User-defined code or password to encrypt the wallet’s private key |
externalUserId | string | Yes | Your application’s unique identifier for the user |
chain | string | Yes | Blockchain network. Currently only "STARKNET" |
walletType | string | No | "CHIPI" (default) or "READY". CHIPI supports session keys and passkeys. READY is Argent X compatible. |
classHash | string | No | Custom StarkNet class hash for the wallet contract. Overrides the default for the wallet type. Must be declared on mainnet and implement SNIP-9. See Custom Wallet Types. |
usePasskey | boolean | No | Use WebAuthn passkey for encryption instead of PIN |
Return Value
Returns a Promise that resolves to an object containing:
publicKey: The wallet’s StarkNet address
encryptedPrivateKey: The encrypted private key (store securely)
walletType: The wallet type that was created
classHash: The class hash used for deployment
Example Implementation
import { ChipiServerSDK } from "@chipi-stack/backend";
const serverClient = new ChipiServerSDK({
apiPublicKey: process.env.CHIPI_PUBLIC_KEY!,
apiSecretKey: process.env.CHIPI_SECRET_KEY!,
});
async function createUserWallet(userId: string, userPin: string) {
const newWallet = await serverClient.createWallet({
params: {
encryptKey: userPin,
externalUserId: userId,
chain: "STARKNET",
},
});
console.log("Wallet created:", newWallet.publicKey);
// Store wallet data in your database
await saveWalletToDatabase({
userId,
publicKey: newWallet.publicKey,
encryptedPrivateKey: newWallet.encryptedPrivateKey,
});
return newWallet;
}
Wallet creation is free! Gas fees are sponsored by the Chipi paymaster for all wallet types.
Wallet Types
| Type | Account | Session Keys | Passkeys | Use Case |
|---|
CHIPI | OpenZeppelin + SNIP-9 | Yes | Yes | Default. Best for most apps. |
READY | Argent X v0.4.0 | No | No | Argent X ecosystem compatibility |
| Custom | Any SNIP-9 account | Depends | Depends | Advanced: bring your own account |
Related Methods