Usage
Parameters
The hook accepts an object with:params(CallAnyContractParams):encryptKey(string): User’s decryption PIN (or passkey-derived key)wallet(WalletData): the full wallet object —publicKey,encryptedPrivateKey, and (routing-critical)walletType+signerKindfromcreateWallet/useGetWallet. OmittingwalletTypedefaults to"READY"and reverts on a SHHH wallet.contractAddress(string): Target contract addresscalls(Call[]): Array of contract calls withcontractAddress,entrypoint, andcalldatausePasskey(boolean, optional): SettruewhenencryptKeywas derived from a passkey
bearerToken(string): Bearer token for authentication
Return Value
Returns an object containing:callAnyContract: Function to trigger contract call (fire-and-forget)callAnyContractAsync: Promise-based function that resolves with the transaction hashdata: Transaction hash of the call (string | undefined)isLoading: Boolean indicating if the operation is in progressisError: Boolean indicating if an error occurrederror: Error instance whenisErroris true, otherwisenullisSuccess: Boolean indicating if the call completed successfullyreset: Function to reset the mutation state
Example Implementation
Security Considerations
- Verify contract addresses
- Validate calldata format
- Use encrypted private keys
- Implement proper PIN validation
- Review contract ABI before calling
Error Handling
- Handle invalid contract addresses
- Validate calldata format
- Monitor gas fees
- Implement retry logic for failed calls
Related Hooks
- useApprove - For token approvals
- useTransfer - For token transfers
