AvaCloud API
AvaCloud App
Encrypted ERC
Encrypted ERC
  • Welcome
  • 🚀GETTING STARTED
    • What is Encrypted ERC ?
    • Protocol Overview
  • 🏘️ARCHITECTURE
    • Balance & Amount
    • Deposit Operation
    • Transfer Operation
    • Withdrawal Operation
  • ⚙️USAGE
    • SDK Overview
    • useEERC
    • useEncryptedBalance
Powered by GitBook

© 2025 Ava Labs, Inc.

On this page
  • Usage
  • Parameters
  • Returns

Was this helpful?

  1. USAGE

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

const { useEncryptedBalance } = useEERC(...);
const {
	decryptedBalance,
	encryptedBalance,
	decimals,
	// actions
	privateMint,
	privateBurn,
	privateTransfer,
	refetchBalance
} = useEncryptedBalance(tokenAddress?:string)

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 array

  • decimals: 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.

PrevioususeEERC

Last updated 1 month ago

Was this helpful?

⚙️