Design Philosophy
The Umbra SDK is written in the same functional, dependency-injected style as Anza’s@solana/kit. Every capability is either a pure function or a factory that returns one. There are no classes with internal state, no singletons, and no implicit globals. Dependencies are explicit, injectable, and testable.
This mirrors the architecture of @solana/kit itself - functions like getTransferSolInstruction and createSolanaRpc follow the same closure-based factory pattern you will find throughout the Umbra SDK.
The Factory Pattern
Every SDK operation follows the same two-step pattern:get*Function) is cheap. It binds configuration and resolves defaults. The returned function is what does the actual async work - sending transactions, generating proofs, querying the indexer.
This is the same pattern @solana/kit uses for its instruction builders:
Naming Conventions
All factory functions use a consistentget[Source]To[Target][Verb]Function scheme. The name describes the data flow and operation:
getPublicBalanceToEncryptedBalance...- credits tokens from a public account to an encrypted accountgetEncryptedBalanceToPublicBalance...- debits tokens from an encrypted account to a public accountgetEncryptedBalanceTo...UtxoCreator...- creates a UTXO from an encrypted balancegetPublicBalanceTo...UtxoCreator...- creates a UTXO from a public balanceget...UtxoToEncryptedBalanceClaimer...- claims a UTXO into an encrypted balanceget...UtxoToPublicBalanceClaimer...- claims a UTXO into a public balancegetClaimableUtxoScanner...- scans for claimable UTXOs via the indexerget...Querier...- queries on-chain state (RPC)get...Rotator...- replaces a registered keyget...Converter...- migrates an account between protocol modesget...Reencryptor...- re-encrypts ciphertexts under a new keygetComplianceGrantIssuer...- creates a compliance grantgetComplianceGrantRevoker...- deletes a compliance grantgetUserRegistration...- the full registration flow
args and deps
Every factory accepts two arguments:args- required. Always containsclient: IUmbraClientand any fixed configuration for this operation (e.g. a specific mint).deps- optional. Contains every infrastructure provider, key generator, and ZK prover used internally. Alldepsfields have sensible defaults derived from theclient. The only exceptions are ZK provers, which have no default and must always be supplied explicitly.
deps override client-level deps. Client-level deps override built-in defaults.
The Advanced section covers dependency injection internals, key generators, ZK provers, transaction callbacks, and key rotation in depth. Most applications do not need those details to get started.