Hooks
useTransfer
Transfers tokens from the user wallet to another address. Uses Avnus gasless to cover gas fees.
Usage
Parameters
encryptKey
(string): PIN used to decrypt the private keywallet
(WalletData): Object with publicKey and encryptedPrivateKeycontractAddress
(string): Token contract addressrecipient
(string): Destination wallet addressamount
(string | number): Transfer amountdecimals
(number): Token decimals (default: 18)
Return Value
Returns an object containing:
transferAsync
: Function to trigger token transfertransferData
: Transaction hash of the transferisLoading
: Boolean indicating if the operation is in progresserror
: Any error that occurred during the process
Example Implementation
Security Considerations
- Always verify recipient addresses
- Use encrypted private keys
- Implement proper PIN validation
- Monitor transaction status
Error Handling
- Handle insufficient token balance
- Validate wallet addresses
- Monitor gas fees
- Implement retry logic for failed transactions
Always verify recipient addresses. Transfers on StarkNet are irreversible.