Skip to main content

Overview

Two query functions let you inspect on-chain state without modifying it:
  • getUserAccountQuerierFunction - reads registration status and account metadata for any address
  • getEncryptedBalanceQuerierFunction - reads encrypted balance metadata for the calling user across multiple mints
Both are read-only and do not require a wallet signing prompt.

Query User Account

Parameters

Address
required
The wallet address to query registration status for.
Commitment
default:"\"confirmed\""
Commitment level used for the RPC account read. Overrides the default on a per-call basis.

Return Value

The result is a discriminated union:
When state === "exists", data contains:
boolean
Whether the base account has been created on-chain. This is true after the first registration step.
boolean
Whether the X25519 public key has been registered. Required for Shared-mode ETAs and for receiving Stealth Pool Notes addressed to this account.
boolean
Whether the user commitment (Poseidon hash) has been registered. Required to receive receiver-burnable Stealth Pool Notes.
boolean
Whether both X25519 and commitment registration are complete and the account is ready for all features.
Uint8Array
The user’s registered X25519 public key (32 bytes). Used by other users to encrypt Stealth Pool Notes addressed to this account.
Uint8Array
Entropy bytes mixed into nonce derivation. Combined with generationIndex to derive the next note’s generationIndex — never invent your own.
bigint
Monotonic counter incremented on each deposit/withdrawal. Used internally for nonce derivation.

Example: Check Registration Status


Query Encrypted Balance

The function queries the calling user’s own encrypted balances. Pass an array of mint addresses to check multiple mints in a single call.

Parameters

Address[]
required
An array of SPL or Token-2022 mint addresses to query. The SDK fetches the encrypted token account PDA for each mint and returns a result for every mint in the array.
Commitment
default:"\"confirmed\""
Commitment level used for the RPC account reads. Overrides the default on a per-call basis.

Return Value

The four states represent:
  • "non_existent" — No ETA exists for this mint. The user needs to deposit first.
  • "uninitialized" — The ETA PDA exists on-chain but the Arcium balance has not been initialised yet.
  • "mxe" — The ETA is in MXE-only mode. The balance is encrypted under the network key and cannot be decrypted client-side.
  • "shared" — The ETA is in Shared mode. The SDK automatically decrypts the balance using the user’s X25519 private key and returns the plaintext balance as a MathU64.

Example

Shared-mode accounts return the decrypted balance automatically. MXE-mode accounts cannot be decrypted client-side - convert to Shared mode first using Conversion.

Common Patterns

Check Before Depositing

Before depositing to an external address, verify the recipient is registered:

Poll Until Registered

For UI flows where you start registration and want to confirm it landed:

Query Multiple Balances at Once

Use the array-based query to check several token balances in a single round-trip:

Error Handling

Both query functions are read-only - they never submit transactions. Use isQueryError from @umbra-privacy/sdk/errors and switch on err.stage to handle each failure point.
Query functions do not throw when an account does not exist - they return { state: "non_existent" } instead. Errors are reserved for infrastructure failures (RPC unreachable, malformed data).
See Error Handling for a full reference of all error types.