Usage
Parameters
The mutation accepts an object with:params(CreateWalletParams):encryptKey(string, optional withusePasskey: true): the PIN that encrypts the private key. WithusePasskey: trueit becomes the PIN backup; omit it for a passkey-only walletexternalUserId(string): Your application’s unique identifier for the userchain(Chain): The blockchain network. UseChain.STARKNETwalletType("SHHH" | "CHIPI" | "READY", optional): defaults to"SHHH"(the pluggable-signer ShhhAccount — guardian recovery, multisig)."CHIPI"is the legacy account that supports session keys;"READY"is Argent X compatible. Whatever you create here, persistwalletType(andsignerKind) and pass them back on every transfer/approve/call.usePasskey(boolean, optional):truemakes the hook create the passkey itself (one biometric prompt) and encrypt the private key with the key it yields. WithoutencryptKeythe wallet is passkey-only (authMethod: "passkey"); withencryptKeyit is passkey + PIN backup (authMethod: "passkey+pin"). RequiresexternalUserId. Don’t set it if you already derivedencryptKeyfrom a passkey yourself: it would create a second passkey. See Passkeys
bearerToken(string): Bearer token for authentication
Return Value
Returns an object containing:createWallet: Function to trigger wallet creation (fire-and-forget)createWalletAsync: Promise-based function that resolves with the wallet datadata: The created wallet (CreateWalletResponse) — flat object withpublicKey,encryptedPrivateKey,walletType,chain, etc.isLoading: Boolean indicating if the operation is in progressisError: Boolean indicating if an error occurrederror: Error instance whenisErroris true, otherwisenullisSuccess: Boolean indicating if wallet creation succeededreset: Function to reset the mutation state
Example Implementation
Security Considerations
- PINs should always be collected client-side
- Never log or store raw PIN values
- Use secure encryption before any transmission
- Store encrypted private key securely
- Associate with user session (not persistent storage)
Error Handling
- Catch and handle RPC connection errors
- Monitor gasless API limits
- Implement retry logic for failed deployments
Wallet creation is free! Gas fees are covered by our gasless integration.
