Custom Hooks
Encapsulated logic for blockchain interaction and state management
Contract Interaction
useCreateDeposit
WriteHandles the interaction with PrivateLendingIngress.createDeposit(). Automatically handles ERC20 approvals if the deposit token is not native MNT.
useSubmitAction
Write + EncryptThe most complex hook. It: 1. Takes plaintext inputs (amount, token). 2. Encrypts them using sapphire-js. 3. Submits the ciphertext to the Ingress contract.
Data Fetching
usePonderDeposits
ReadWraps useQuery (TanStack Query) to fetch the user's deposits from the Ponder GraphQL API. Includes auto-refetching on window focus.
useTokenBalance
ReadFetches the user's wallet balance for a specific token to ensure they have enough funds to deposit.