getFetchClaimableUtxosFunction
Import:@umbra-privacy/sdk
client.indexerApiEndpoint must be set (pass it to getUmbraClientFromSigner).
GetFetchClaimableUtxosFunctionArgs
client: IUmbraClient- Must haveindexerApiEndpointconfigured.
GetFetchClaimableUtxosFunctionDeps
fetchUtxoData?: FetchUtxoDataFunction- Override the default indexer UTXO data fetcher.fetchMerkleProof?: FetchMerkleProofFunction- Override the default indexer Merkle proof fetcher.aesDecryptor?: AesDecryptorFunction- Override the AES-256-GCM decryptor used for receiver-claimable UTXOs.x25519GetSharedSecret?: (privateKey: X25519PrivateKey, publicKey: X25519PublicKey) => Uint8Array- Override the X25519 shared secret derivation.
Returns
FetchClaimableUtxosFunction
treeIndex: number- The mixer tree index to scan.startInsertionIndex: number- Inclusive start of the UTXO insertion range to scan.endInsertionIndex?: number- Exclusive end of the range. Defaults to the current tree size.
ClaimableUtxoResult
ephemeral- Self-claimable UTXOs created via MPC (from encrypted balance).receiver- Receiver-claimable UTXOs created via MPC (from encrypted balance), addressed to the caller.publicEphemeral- Self-claimable UTXOs created without MPC (from public balance).publicReceiver- Receiver-claimable UTXOs created without MPC (from public balance), addressed to the caller.
ClaimableUtxoData
Fields present on every claimable UTXO:merkleRoot: U256LeBytes- The Merkle root at the time this UTXO’s proof was fetched (little-endian bytes).merklePath: U256LeBytes[]- Sibling hashes forming the Merkle inclusion proof (little-endian bytes).leafIndex: U128- The UTXO’s leaf index in the Indexed Merkle Tree.amount: U64- Token amount in base units.destinationAddress: Address- The Umbra-registered owner who can claim this UTXO.depositModifiedGenerationIndex: U128- Generation index encoded in the deposit.version: U64- Protocol version of the UTXO.commitmentIndex: U128- Commitment index used in key derivation.senderAddressLow: U128- Low 128 bits of the sender address (for the ZK circuit).senderAddressHigh: U128- High 128 bits of the sender address.relayerFixedSolFees: U64- Fixed SOL fees paid to relayer (in lamports).mintAddressLow: U128- Low 128 bits of the mint address.mintAddressHigh: U128- High 128 bits of the mint address.timestamp: TimestampComponents- UTXO creation timestamp components for TVK derivation.purpose: number- Caller-defined purpose tag.h1CircuitProvableOnChainDataHash: U256LeBytes- H1 hash for the ZK circuit public inputs (little-endian bytes).h1SmartProgramProvableOnChainDataHash: U256LeBytes- H1 hash for the on-chain verifier (little-endian bytes).
Errors
ThrowsFetchUtxosError. See Errors.
Example
getClaimSelfClaimableUtxoIntoEncryptedBalanceFunction
Import:@umbra-privacy/sdk
deps.zkProver is required. The nullifier is burned on-chain after a successful claim to prevent double-spending.
GetClaimSelfClaimableUtxoIntoEncryptedBalanceFunctionArgs
client: IUmbraClient
GetClaimSelfClaimableUtxoIntoEncryptedBalanceFunctionDeps
zkProver: IZkProverForClaimSelfClaimableUtxo- Required. Groth16 prover for the claim circuit.accountInfoProvider?: AccountInfoProviderFunctionblockhashProvider?: GetLatestBlockhashtransactionForwarder?: TransactionForwarder- Additional cryptographic dependency overrides (key derivation, Poseidon, Rescue - all optional).
Returns
ClaimSelfClaimableUtxoIntoEncryptedBalanceFunction
utxos: readonly ClaimableUtxoData[]- Array of claimable UTXOs fromgetFetchClaimableUtxosFunction. Use UTXOs fromresult.ephemeral.optionalData?: OptionalData32- Optional 32-byte caller metadata.
ClaimUtxoIntoEncryptedBalanceResult with signatures: Record<number, TransactionSignature[]> organized by batch index.
Errors
ThrowsClaimUtxoError. See Errors. The "transaction-validate" stage often indicates a stale Merkle proof - fetch fresh UTXOs and retry.
getClaimSelfClaimableUtxoIntoPublicBalanceFunction
Import:@umbra-privacy/sdk
getClaimSelfClaimableUtxoIntoEncryptedBalanceFunction but the output goes to a public account instead of an encrypted balance. deps.zkProver is required.
Returns
ClaimSelfClaimableUtxoIntoPublicBalanceFunction
utxos: readonly ClaimableUtxoData[]- Array of claimable UTXOs. Use UTXOs fromresult.ephemeralorresult.publicEphemeral.optionalData?: OptionalData32- Optional 32-byte caller metadata.
ClaimUtxoIntoPublicBalanceResult with signatures: Record<number, TransactionSignature[]> organized by batch index.
Errors
ThrowsClaimUtxoError. See Errors.
getClaimReceiverClaimableUtxoIntoEncryptedBalanceFunction
Import:@umbra-privacy/sdk
deps.zkProver is required.
Returns
ClaimReceiverClaimableUtxoIntoEncryptedBalanceFunction
utxos: readonly ClaimableUtxoData[]- Array of claimable UTXOs. Use UTXOs fromresult.receiverorresult.publicReceiver.optionalData?: OptionalData32- Optional 32-byte caller metadata.
ClaimUtxoIntoEncryptedBalanceResult with signatures: Record<number, TransactionSignature[]> organized by batch index.
Errors
ThrowsClaimUtxoError. See Errors.
Full Mixer Flow Example
FetchUtxosError
Thrown bygetFetchClaimableUtxosFunction.
Stage values: "initialization" | "validation" | "key-derivation" | "indexer-fetch" | "proof-fetch"
See Errors for full documentation.
ClaimUtxoError
Thrown by all three claim functions. Stage values:"initialization" | "validation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send"
See Errors for full documentation. Before retrying after "transaction-send", verify on-chain - the nullifier may have been burned.