Actions
create-wallet
Create an Argent-compatible wallet on StarkNet.
useCreateWallet()
Creates a new Argent-compatible wallet on StarkNet. This hook deploys the wallet contract behind the scenes and uses Avnu’s paymaster to sponsor gas fees, resulting in a frictionless onboarding experience.
Parameters
- pin (string): A user-defined numeric code or password used to encrypt the wallet’s private key.
Return Value
Returns an object containing:
- createWalletAsync: Function to trigger wallet creation
- createWalletResponse: Object with deployment results
- isLoading: Boolean indicating if the operation is in progress
- error: Any error that occurred during the process
Example Implementation
Code Breakdown
1. Form Handling
- Manages PIN input state
- Validates minimum length of 4 characters
2. Wallet Creation
- Uses
createWalletAsync
from the SDK hook - Handles success/error states
3. Security Implementation
- PIN input is masked
- Never stored in plain text
- Client-side encryption only
4. Result Display
- Shows wallet address and transaction hash
- Links to StarkScan for verification
Production Notes
-
PIN Security
- Always collect PINs client-side
- Never log or store raw PIN values
- Use secure encryption before any transmission
-
Error Handling
- Catch and handle RPC connection errors
- Monitor paymaster API limits
- Implement retry logic for failed deployments
-
Wallet Storage
- Store encrypted private key securely
- Associate with user session (not persistent storage)
- Consider implementing backup/recovery flows
Related Actions
:::success Wallet creation is free! Gas fees are covered by our paymaster integration. :::