Hooks
useCreateWallet
Creates a new Argent-compatible wallet on StarkNet. This hook deploys the wallet contract behind the scenes and uses Avnus gasless to sponsor gas fees, resulting in a frictionless onboarding experience.
Usage
Parameters
pin
(string): A user-defined code or password used to encrypt the wallet’s private key.
Return Value
Returns an object containing:
createWalletAsync
: Function to trigger wallet creationcreateWalletResponse
: Object with deployment resultsisLoading
: Boolean indicating if the operation is in progresserror
: Any error that occurred during the process
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.