useEncryptedBalance
The useEncryptedBalance
hook provides developers with an interface to manage encrypted token balances within the eERC protocol. This includes accessing decrypted and encrypted balances, as well as performing key actions such as minting, burning, transferring tokens, and fetching updated balance data. The hook is designed to simplify balance management while leveraging the protocol's encryption and privacy features.
Usage
Parameters
tokenAddress
(optional) :`0x${string}`
The address of the underlying ERC20 token. This parameter is only required in converter mode.
Returns
decryptedBalance: bigint
The user's decrypted token balance.encryptedBalance: bigint[]
Encrypted balance of the user as an arraydecimals: bigint
Encrypted token decimals
Methods
privateMint(recipient: string, amount: bigint): Promise<{ transactionHash: string }>
Mints encrypted tokens for a specified recipient address. This action can only be performed by the contract owner.privateBurn(amount: bigint): Promise<{ transactionHash: string }>
Burns a specified amount of encrypted tokens from the user's balance.privateTransfer(to: string, amount: bigint): Promise<{ transactionHash: string }>
Transfers encrypted tokens to another user.refetchBalance(): void
Refetches and updates the user's encrypted and decrypted balances from the contract.
Last updated
Was this helpful?