SDK reference
Generated from packages/sdk/src on each request: 249 exports in 17 modules.
builders
RingsConfiginterfaceexport interface RingsConfig
Authorizationtypeexport type Authorization =
PreparedCallinterfaceexport interface PreparedCall
PreparedDepositinterfaceexport interface PreparedDeposit
Ringsclassexport class Rings
sendPreparedfunctionexport async function sendPrepared(walletClient: WalletClient, call: PreparedCall): Promise<Hex>
Send a prepared call with the user's wallet (the simulation already passed).
encryption
HPKE_PREFIXconstexport const HPKE_PREFIX = "TSPP/hpke/";
ENC_INFO_TRANSFERconstexport const ENC_INFO_TRANSFER = "TSPP/tx";
EncryptedSchemeconstexport const EncryptedScheme =
OutputEncodingconstexport const OutputEncoding = { plaintext: 0, encrypted: 1, verifiable: 2 } as const;CONFIDENTIAL_SLOT_BYTESconstexport const CONFIDENTIAL_SLOT_BYTES = 89;
89 B: the on-chain size of one confidential output ciphertext with no data records.
applyTransferCipherfunctionexport function applyTransferCipher(
The symmetric transfer cipher (CTR, so encrypt == decrypt). `secret` is one side's X25519 secret, `counterparty` the other side's public key.
encryptSlotfunctionexport function encryptSlot(tx: ViewingKey, recipientPk: Uint8Array, plaintext: Uint8Array, salt: Uint8Array, slot: number)
Sender side: tx viewing key encrypts to the recipient's viewing key.
decryptSlotfunctionexport function decryptSlot(owner: ViewingKey, txViewingPk: Uint8Array, ct: Uint8Array, salt: Uint8Array, slot: number)
Recipient side: own viewing key and the published tx viewing pk.
decryptSlotAsTxViewerfunctionexport function decryptSlotAsTxViewer(tx: ViewingKey, recipientPk: Uint8Array, ct: Uint8Array, salt: Uint8Array, slot: number)
Disclosure side: the tx viewing key opens a slot addressed to `recipientPk`.
DataRecordsinterfaceexport interface DataRecords
encodeDatafunctionexport function encodeData(d: DataRecords = {}): Uint8ArraymemoTextconstexport const memoText = (s: string): Uint8Array => enc.encode(s);
memoStringconstexport const memoString = (b: Uint8Array | undefined): string | undefined => (b ? dec.decode(b) : undefined);
ConfidentialPlaintextinterfaceexport interface ConfidentialPlaintext
encodeConfidentialfunctionexport function encodeConfidential(p: ConfidentialPlaintext): Uint8Array
decodeConfidentialfunctionexport function decodeConfidential(b: Uint8Array): ConfidentialPlaintext
encodeOutputFramefunctionexport function encodeOutputFrame(scheme: number, body: Uint8Array, encoding: number = OutputEncoding.encrypted): Uint8Array
decodeOutputFramefunctionexport function decodeOutputFrame(b: Uint8Array): { encoding: number; scheme: number; body: Uint8Array }encryptConfidentialOutputfunctionexport function encryptConfidentialOutput(
One confidential output slot as published on chain (89 B with no data).
decryptConfidentialOutputfunctionexport function decryptConfidentialOutput(
Owner opens a slot with its own viewing key. Returns undefined if the slot is not addressed to it.
decryptConfidentialOutputAsTxViewerfunctionexport function decryptConfidentialOutputAsTxViewer(
Tx viewing key opens any slot of its transaction (selective disclosure).
dummyOutputBytesfunctionexport function dummyOutputBytes(length = CONFIDENTIAL_SLOT_BYTES): Uint8Array
Random bytes with the length of a real slot, for dummy outputs.
randomSaltfunctionexport function randomSalt(): Uint8Array
examples
ESCROW_ABIconstexport const ESCROW_ABI = parseAbi([
SWAP_ABIconstexport const SWAP_ABI = parseAbi([
ESCROW_STATESconstexport const ESCROW_STATES = ["None", "Locked", "Approved", "Released", "Refunded"] as const;
PrivateEscrow.State.
EscrowStatetypeexport type EscrowState = (typeof ESCROW_STATES)[number];
dealSecretsfunctionexport function dealSecrets(creatorNullifierSecret: bigint, lockInputNullifier: bigint): { lockSecret: bigint; seed: bigint }One-time nullifier secret of the locked note and the blinding seed of the deal's pinned outputs. Both come from the creator's nullifier secret and the first nullifier of the lock transact (public), so the creator can derive them again; nobody else can. They are shared in the ticket. They do not reveal the creator's nullifier secret (Poseidon is one-way).
pinnedOutputHashfunctionexport function pinnedOutputHash(firstNullifier: bigint, seed: bigint, to: Pick<ShieldedAddress, "address" | "nullifierPk">, token: Address, units: bigint): bigint
Output 0 of a transact whose first nullifier is `firstNullifier` and whose blinding seed is `seed`.
DealTicketinterfaceexport interface DealTicket
DealTicketDrafttypeexport type DealTicketDraft = Omit<DealTicket, "id" | "leafIndex"> & { lockedCommitment: bigint };A ticket before the lock is on chain: no id and no leaf index yet.
encodeDealTicketfunctionexport function encodeDealTicket(t: DealTicket): string
`rdt1:` + base64url(JSON). Share it with the counterparty over a private channel.
decodeDealTicketfunctionexport function decodeDealTicket(s: string): DealTicket
lockedNoteOffunctionexport function lockedNoteOf(t: Pick<DealTicket, "vault" | "token" | "amount" | "blinding" | "lockSecret"> & { leafIndex?: bigint }): NoteThe locked note of a ticket, as a spendable `Note` owned by the vault.
ticketFromReceiptfunctionexport function ticketFromReceipt(draft: DealTicketDraft, receipt: { logs: readonly Log[] }): DealTicketComplete a draft with the deal id and the leaf index from the receipt of the lock transaction.
EscrowDealinterfaceexport interface EscrowDeal
SwapOfferinterfaceexport interface SwapOffer
ExactNoteNeededErrorclassexport class ExactNoteNeededError extends Error
SignOwnerAuthtypeexport type SignOwnerAuth = (td: ReturnType<typeof ownerAuthTypedData>) => Promise<Hex>;
PreparedLocktypeexport type PreparedLock = PreparedCall & { draft: DealTicketDraft };DealsConfiginterfaceexport interface DealsConfig
Dealsclassexport class Deals
Builders for PrivateEscrow and PrivateSwap on top of a `Rings` instance.
field
BN254_Pconstexport const BN254_P = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
Byte and BN254 field helpers. Every 32-byte value in this SDK is a big-endian field element unless a comment says otherwise (X25519 keys are little-endian per RFC 7748).
Bytestypeexport type Bytes = Uint8Array;
Hextypeexport type Hex = `0x${string}`;concatfunctionexport function concat(...parts: readonly Uint8Array[]): Uint8Array
equalBytesfunctionexport function equalBytes(a: Uint8Array, b: Uint8Array): boolean
bytesToBigIntfunctionexport function bytesToBigInt(b: Uint8Array): bigint
bigIntToBytesfunctionexport function bigIntToBytes(v: bigint, len = 32): Uint8Array
hexToBytesfunctionexport function hexToBytes(h: string): Uint8Array
bytesToHexfunctionexport function bytesToHex(b: Uint8Array): Hex
fieldHexfunctionexport function fieldHex(v: bigint): Hex
0x-prefixed 32-byte big-endian hex of a field element, the prover JSON encoding.
u16befunctionexport function u16be(v: number): Uint8Array
u32befunctionexport function u32be(v: number): Uint8Array
u64befunctionexport function u64be(v: bigint): Uint8Array
u64lefunctionexport function u64le(v: bigint): Uint8Array
randomBytesfunctionexport function randomBytes(n: number): Uint8Array
randomFieldfunctionexport function randomField(): bigint
A uniformly random canonical BN254 field element (31 random bytes).
modPfunctionexport function modP(v: bigint): bigint
tag4functionexport function tag4(s: string): bigint
ASCII four-letter domain tag read as a big-endian u32, e.g. "TXOS".
hash
poseidonfunctionexport function poseidon(inputs: readonly bigint[]): bigint
hashBytesfunctionexport function hashBytes(bytes: Uint8Array): bigint
`hash_bytes_N`: 31-byte big-endian chunks folded left with Poseidon(acc, chunk).
sha256BEfunctionexport function sha256BE(bytes: Uint8Array): bigint
SHA-256 with the first byte zeroed, read as a field element (`Sha256BE`).
sha256Bytesfunctionexport function sha256Bytes(...parts: Uint8Array[]): Uint8Array
hashChainfunctionexport function hashChain(e: readonly bigint[]): bigint
Left fold, one element per Poseidon(h, e) call.
rightHashChainfunctionexport function rightHashChain(e: readonly bigint[]): bigint
Right fold, one element per Poseidon(e, h) call.
nonZeroHashChainfunctionexport function nonZeroHashChain(e: readonly bigint[]): bigint
`HashChain` over the nonzero elements only; 0 when there are none.
hashChain4functionexport function hashChain4(e: readonly bigint[]): bigint
Left fold, three elements per 4-input Poseidon call, zero-padded tail.
rightHashChain4functionexport function rightHashChain4(e: readonly bigint[]): bigint
Right fold, seeded with the last element; preceding elements in groups of up to 3 from the right, the short group leftmost and left-aligned: h = Poseidon(g0, g1 or 0, g2 or 0, h).
indexer
IndexedOutputinterfaceexport interface IndexedOutput
IndexedTxinterfaceexport interface IndexedTx
RootInfointerfaceexport interface RootInfo
PathInfointerfaceexport interface PathInfo
RegistryRecordinterfaceexport interface RegistryRecord
IndexerApiinterfaceexport interface IndexerApi
httpIndexerfunctionexport function httpIndexer(url: string, opts: { fetch?: typeof fetch } = {}): IndexerApiMemoryIndexerclassexport class MemoryIndexer implements IndexerApi
In-memory indexer for tests and local demos.
keys
DST_X25519_VIEW_ROOTconstexport const DST_X25519_VIEW_ROOT = "TSPP/view_root/x25519/v1";
INFO_NF_KEY_EIP712constexport const INFO_NF_KEY_EIP712 = "TSPP/nf_key/secp256k1-eip712/v1";
INFO_VIEW_KEY_EIP712constexport const INFO_VIEW_KEY_EIP712 = "TSPP/view_key/secp256k1-eip712/x25519/v1";
INFO_NF_KEY_ED25519constexport const INFO_NF_KEY_ED25519 = "TSPP/nf_key/ed25519/v1";
zolana Solana-rail infos, kept to check the derivation tree against zolana vectors.
INFO_VIEW_KEY_ED25519constexport const INFO_VIEW_KEY_ED25519 = "TSPP/view_key/ed25519/x25519/v1";
INFO_TX_VIEWING_X25519constexport const INFO_TX_VIEWING_X25519 = "TSPP/tx_viewing/x25519/v1";
INFO_SENDER_VIEW_TAG_SECRETconstexport const INFO_SENDER_VIEW_TAG_SECRET = "TSPP/sender_view_tag";
INFO_RECIPIENT_VIEW_TAG_SECRETconstexport const INFO_RECIPIENT_VIEW_TAG_SECRET = "TSPP/recipient_view_tag";
INFO_SENDER_VIEW_TAG_PREFIXconstexport const INFO_SENDER_VIEW_TAG_PREFIX = "TSPP/sender_view_tag/";
INFO_RECIPIENT_REQUEST_VIEW_TAG_PREFIXconstexport const INFO_RECIPIENT_REQUEST_VIEW_TAG_PREFIX = "TSPP/recipient_request_view_tag/";
INFO_PAIR_DOMAIN_PREFIXconstexport const INFO_PAIR_DOMAIN_PREFIX = "TSPP/pair-domain/";
INFO_PAIR_HINT_PREFIXconstexport const INFO_PAIR_HINT_PREFIX = "TSPP/pair-hint/";
DERIVATION_PURPOSEconstexport const DERIVATION_PURPOSE = "TSPP/derive/v1";
EVM_OWNER_SCHEMEconstexport const EVM_OWNER_SCHEME = 0x03;
Owner identity scheme byte for an EVM address and its in-field tag 'E'.
EVM_OWNER_TAGconstexport const EVM_OWNER_TAG = 0x45n;
DERIVATION_DOMAINconstexport const DERIVATION_DOMAIN = { name: "Loop", version: "1" } as const;DERIVATION_TYPESconstexport const DERIVATION_TYPES =
DERIVATION_NOTICEconstexport const DERIVATION_NOTICE =
derivationTypedDatafunctionexport function derivationTypedData(account: Address): TypedDataDefinition<typeof DERIVATION_TYPES, "Derive">
The typed data the wallet signs once. No chainId and no verifyingContract in the domain: one shielded identity per EVM address, the same on the fork and on mainnet. The purpose string is the zolana derivation payload, so no other request this app makes can reproduce the seed.
derivationSeedFromSignaturefunctionexport function derivationSeedFromSignature(signature: Hex): Uint8Array
r || s of a 65-byte ECDSA signature in canonical low-s form (64 B seed).
clampfunctionexport function clamp(secret: Uint8Array): Uint8Array
x25519PublicKeyfunctionexport function x25519PublicKey(secret: Uint8Array): Uint8Array
`0x04 || u` (33 B).
parseX25519PublicKeyfunctionexport function parseX25519PublicKey(pk: Uint8Array): Uint8Array
ecdhfunctionexport function ecdh(secret: Uint8Array, peer: Uint8Array): Uint8Array
RFC 7748 ECDH; rejects an all-zero (low-order) result.
hkdfSha256functionexport function hkdfSha256(salt: Uint8Array | undefined, ikm: Uint8Array, info: Uint8Array, len: number): Uint8Array
counterViewTagfunctionexport function counterViewTag(ikm: Uint8Array, prefix: string, counter: bigint): Uint8Array
A zero byte then 31 HKDF bytes, `info = prefix || u64_be(counter)`.
RoleSecretsinterfaceexport interface RoleSecrets
roleExpansionfunctionexport function roleExpansion(
evmOwnerIdentityfunctionexport function evmOwnerIdentity(address: Address): bigint
`(0x45 << 160) | address`: hash_bytes_21(0x45 || addr), no Poseidon needed.
nullifierPublicKeyfunctionexport function nullifierPublicKey(nullifierSecret: bigint): bigint
ownerHashfunctionexport function ownerHash(ownerIdentity: bigint, nullifierPk: bigint): bigint
ViewingKeyclassexport class ViewingKey
ShieldedAddressinterfaceexport interface ShieldedAddress
What a sender needs to pay this wallet: published in the registry.
ShieldedKeysclassexport class ShieldedKeys
unlockShieldedKeysfunctionexport async function unlockShieldedKeys(
Signs the derivation typed data twice and refuses a wallet whose signatures differ (non-deterministic ECDSA): such a wallet would lose its notes.
NON_DETERMINISTIC_SIGNER_ERRORconstexport const NON_DETERMINISTIC_SIGNER_ERROR =
encodeShieldedAddressfunctionexport function encodeShieldedAddress(a: ShieldedAddress): Uint8Array
`0x03 || address(20) || nullifier_pk(32) || viewing_pk(33)` = 86 B.
decodeShieldedAddressfunctionexport function decodeShieldedAddress(bytes: Uint8Array): ShieldedAddress
node
localBinaryProverfunctionexport function localBinaryProver(bin: string, opts: { keysDir?: string } = {}): ProverLocal binary (`<bin> prove -keys <dir>` reading the witness on stdin). Node only.
protocol
TREE_IDconstexport const TREE_ID = 1;
EMPTY_NULLIFIER_ROOTconstexport const EMPTY_NULLIFIER_ROOT = 0x1d8e71a601b3e8debbba9b557b8369c7f404ae57bebf0852236b072820954277n;
EMPTY_UTXO_ROOTconstexport const EMPTY_UTXO_ROOT = 0x2f68a1c58e257e42a17a6c61dff5551ed560b9922ab119d5ac8e184c9734ead9n;
ROOT_HISTORYconstexport const ROOT_HISTORY = 500;
ACTION_TRANSACTconstexport const ACTION_TRANSACT = 1;
ACTION_MERGEconstexport const ACTION_MERGE = 2;
ZERO_ADDRESSconstexport const ZERO_ADDRESS: Address = "0x0000000000000000000000000000000000000000";
ETH_TOKENconstexport const ETH_TOKEN: Address = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
assetFieldfunctionexport function assetField(token: Address): bigint
asset_id(token) = hash_bytes_32(bytes32(uint160(token))) = Poseidon(uint160 >> 8, uint160 & 0xff).
scaleForfunctionexport function scaleFor(decimals: number): bigint
scale = 10**(decimals - 9) when decimals > 9, else 1. Amounts on chain are units = base / scale.
MAX_UNITSconstexport const MAX_UNITS = (1n << 64n) - 1n;
AssetInfointerfaceexport interface AssetInfo
plaintextAssetIdfunctionexport function plaintextAssetId(token: Address): bigint
SDK plaintext asset id (u64 in the 50-byte confidential plaintext) = low 64 bits of asset_id(token). Any registered asset works; the recipient resolves the id against the assets it knows (AssetRegistered events) and the commitment check confirms it.
AssetRegistryclassexport class AssetRegistry
DEFAULT_ASSETSconstexport const DEFAULT_ASSETS: readonly AssetInfo[] = [
Robinhood Chain assets (LAUNCH.md / PROTOCOL.md section 2). For any other token, and to check these against the pool, use `Rings.resolveAsset` (it reads `pool.assetScale`).
toUnitsfunctionexport function toUnits(base: bigint, a: AssetInfo): bigint
Base amount (wei, token base units) to pool units. Refuses dust that the pool cannot hold.
fromUnitsfunctionexport function fromUnits(units: bigint, a: AssetInfo): bigint
ownerTagfunctionexport function ownerTag(identity: bigint): Hex
viewTag(output) = bytes32(identity(owner)).
HEADER_TRANSFERconstexport const HEADER_TRANSFER = 1;
encodeHeaderfunctionexport function encodeHeader(txViewingPk: Uint8Array, salt: Uint8Array): Hex
header = type_prefix u8 (1) || tx_viewing_pk (33, 0x04 || u) || salt (16) = 50 B.
decodeHeaderfunctionexport function decodeHeader(h: Hex): { txViewingPk: Uint8Array; salt: Uint8Array } | undefinedExtDatainterfaceexport interface ExtData
externalDataHashfunctionexport function externalDataHash(e: ExtData, ctx: { chainId: bigint; pool: Address; action?: number }): bigintmergeExternalDataHashfunctionexport function mergeExternalDataHash(ctx: { chainId: bigint; pool: Address }): bigintPOOL_ABIconstexport const POOL_ABI = [
ERC20_ABIconstexport const ERC20_ABI = [
ownerAuthTypedDatafunctionexport function ownerAuthTypedData(p: { chainId: bigint; pool: Address; publicInputHash: bigint; deadline: bigint; submitter: Address })`submitter` is the address that will call the pool (the pool checks it against `msg.sender`): the relayer's sending address, or a contract (PrivateEscrow / PrivateSwap for a lock, the deal vault for a swap fill). No other sender can use the signature.
prover
ProverInputJsoninterfaceexport interface ProverInputJson
ProverOutputJsoninterfaceexport interface ProverOutputJson
TransactProverRequestinterfaceexport interface TransactProverRequest
MergeProverRequestinterfaceexport interface MergeProverRequest
ProverRequesttypeexport type ProverRequest = TransactProverRequest | MergeProverRequest;
ProveResultinterfaceexport interface ProveResult
Proverinterfaceexport interface Prover
httpProverfunctionexport function httpProver(url: string, opts: { fetch?: typeof fetch; headers?: Record<string, string> } = {}): ProverRemote prover over HTTP (`POST {url}/prove`). The witness holds the nullifier secret: use a prover you trust.
checkProveResultfunctionexport function checkProveResult(
Asserts the prover's derived values equal the SDK's.
hexFieldconstexport const hexField = fieldHex;
registry
REGISTRY_ABIconstexport const REGISTRY_ABI = [
RecipientNotRegisteredErrorclassexport class RecipientNotRegisteredError extends Error
resolveShieldedAddressfunctionexport async function resolveShieldedAddress(
Look up a recipient. - With `publicClient` and `registry`: the answer is `ShieldedRegistry.get` on chain, always. The indexer is not asked; an RPC error is thrown (no silent fall back to the indexer). - Without them (no chain access configured): the indexer record is used. It is NOT verified. Use this mode for display only, or pass `publicClient` and `registry`.
verifyRegistryRecordfunctionexport async function verifyRegistryRecord(
Check an indexer (cache) record against the chain. Returns true when the chain holds exactly this record. Use it before you trust a record that came from the indexer.
registerShieldedAddressfunctionexport async function registerShieldedAddress(p:
Simulate, then send `register` for this wallet's keys. Returns the tx hash.
isRegisteredfunctionexport async function isRegistered(keys: ShieldedKeys, src: { indexer?: IndexerApi; publicClient?: PublicClient; registry?: Address })True when the registry already holds exactly this wallet's keys.
rpc-indexer
MerkleMirrorclassexport class MerkleMirror
RpcIndexerclassexport class RpcIndexer implements IndexerApi
select
MAX_SPEND_INPUTSconstexport const MAX_SPEND_INPUTS = 40;
Shapeinterfaceexport interface Shape
TRANSFER_SHAPESconstexport const TRANSFER_SHAPES: readonly Shape[] = [
Ordered by proving cost; the first that fits wins.
MERGE_INPUT_COUNTSconstexport const MERGE_INPUT_COUNTS: readonly number[] = [8];
pickShapefunctionexport function pickShape(nInputs: number, nOutputs: number, shapes: readonly Shape[] = TRANSFER_SHAPES): Shape
maxSpendInputsfunctionexport function maxSpendInputs(nOutputs: number, shapes: readonly Shape[] = TRANSFER_SHAPES): number
SelectionErrorclassexport class SelectionError extends Error
Selectioninterfaceexport interface Selection
selectNotesfunctionexport function selectNotes(
Largest-first cover of `amount` in `asset`. Throws TOO_MANY_INPUTS when the balance is enough but fragmented past the widest shape: merge first (see `planMerges`).
MergeBatchinterfaceexport interface MergeBatch
planMergesfunctionexport function planMerges(
Plan merges for one asset: smallest notes first, batches of the widest merge width, until the asset has at most `target` notes left (default: what one 8-input transfer can spend). Each batch turns k notes into 1.
transact
SpendInputinterfaceexport interface SpendInput
OutputRequestinterfaceexport interface OutputRequest
TransactPlanInputinterfaceexport interface TransactPlanInput
PlannedOutputinterfaceexport interface PlannedOutput
TransactPlaninterfaceexport interface TransactPlan
planTransactfunctionexport function planTransact(p: TransactPlanInput): TransactPlan
ownNotesOffunctionexport function ownNotesOf(plan: TransactPlan, keys: ShieldedKeys): PlannedOutput[]
The change note this wallet will own after the tx lands (leaf index unknown until then).
utxo
UTXO_DOMAINconstexport const UTXO_DOMAIN = 3n;
DUMMY_DOMAINconstexport const DUMMY_DOMAIN = 1n;
ADDRESS_DOMAINconstexport const ADDRESS_DOMAIN = 2n;
STATE_TREE_HEIGHTconstexport const STATE_TREE_HEIGHT = 32;
NULLIFIER_TREE_HEIGHTconstexport const NULLIFIER_TREE_HEIGHT = 40;
INPUT_TREESconstexport const INPUT_TREES = 5;
N_PUBLIC_SLOTSconstexport const N_PUBLIC_SLOTS = 3;
TXOSconstexport const TXOS = tag4("TXOS");TXOBconstexport const TXOB = tag4("TXOB");TXPBconstexport const TXPB = tag4("TXPB");TMOBconstexport const TMOB = tag4("TMOB");TMDNconstexport const TMDN = tag4("TMDN");TMOKconstexport const TMOK = tag4("TMOK");TMOCconstexport const TMOC = tag4("TMOC");Noteinterfaceexport interface Note
A spendable note this wallet owns.
UtxoBodyinterfaceexport interface UtxoBody
ownerUtxoHashfunctionexport function ownerUtxoHash(owner: bigint, blinding: bigint): bigint
ringHashfunctionexport function ringHash(ringDataHash = 0n, ringProgramId = 0n): bigint
utxoHashfunctionexport function utxoHash(u: UtxoBody, treeId: number): bigint
dummyUtxoHashfunctionexport function dummyUtxoHash(blinding: bigint, treeId: number): bigint
An empty (dummy, DummyDomain) UTXO: every body field 0 except blinding.
nullifierfunctionexport function nullifier(utxoHashValue: bigint, blinding: bigint, nullifierSecret: bigint): bigint
outputBlindingSeedfunctionexport function outputBlindingSeed(firstNullifier: bigint, blindingSeed: bigint): bigint
outputBlindingfunctionexport function outputBlinding(firstNullifier: bigint, outputSeed: bigint, i: number): bigint
blinding_i = Poseidon("TXOB", first_nullifier, output_blinding_seed, i).
privateTxBlindingfunctionexport function privateTxBlinding(firstNullifier: bigint, blindingSeed: bigint): bigint
randomBlindingSeedfunctionexport function randomBlindingSeed(): bigint
depositBlindingfunctionexport function depositBlinding(treeAccount: Uint8Array, leafIndex: bigint): bigint
zolana deposit blinding: Sha256BE("Deposit" || tree_account || u64_be(leaf_index)). On EVM the tree account is the 20-byte pool address (PROTOCOL.md decides the exact preimage; the contract derives it, the SDK only reads it back).
mergeOutputBlindingfunctionexport function mergeOutputBlinding(nullifierSecret: bigint, firstNullifier: bigint): bigint
mergeDummyNullifierfunctionexport function mergeDummyNullifier(nullifierSecret: bigint, firstNullifier: bigint, slot: number): bigint
mergeOutputKeyfunctionexport function mergeOutputKey(nullifierSecret: bigint, firstNullifier: bigint): bigint
mergePrivateTxBlindingfunctionexport function mergePrivateTxBlinding(nullifierSecret: bigint, firstNullifier: bigint): bigint
privateTxHashfunctionexport function privateTxHash(
private_tx_hash = Poseidon(nz(input_hashes), nz(output_hashes), nz(address_nullifiers), blinding). Pass 0 for padding / dummy slots.
TreeSlotinterfaceexport interface TreeSlot
ZERO_TREE_SLOTconstexport const ZERO_TREE_SLOT: TreeSlot = { id: 0, utxoRoot: 0n, nullifierRoot: 0n };treeSlotHashfunctionexport function treeSlotHash(s: TreeSlot): bigint
inputTreeSlotsfunctionexport function inputTreeSlots(slots: readonly TreeSlot[]): TreeSlot[]
Pads to INPUT_TREES slots with zero slots.
treeSlotChainfunctionexport function treeSlotChain(slots: readonly TreeSlot[]): bigint
inputFlagsfunctionexport function inputFlags(allowDummyInputs: boolean, treeIndexes: readonly number[]): bigint
bit 0 = allow_dummy_inputs; input i's 3-bit tree index at bit 1 + 3i.
mergeOutputPadsfunctionexport function mergeOutputPads(key: bigint, salt: Uint8Array): [bigint, bigint, bigint]
PoseidonCtrV1 merge-output cipher (amount, mint chunk 0, mint chunk 1).
wallet
HistoryEntryinterfaceexport interface HistoryEntry
WorldViewinterfaceexport interface WorldView
Only public fields: what any observer of the chain sees.
worldViewfunctionexport function worldView(tx: IndexedTx): WorldView
tagToAddressfunctionexport function tagToAddress(tag: Hex): Address
bytes32 owner tag (0x45 << 160 | addr) back to the address.
WalletStateinterfaceexport interface WalletState
PrivateWalletclassexport class PrivateWallet
encodeTxViewingKeyfunctionexport function encodeTxViewingKey(txHash: Hex, secret: Uint8Array): string
`rtvk1:` || hex(txHash 32 || tx_viewing_sk 32). Read-only: it opens one tx, it cannot spend.
decodeTxViewingKeyfunctionexport function decodeTxViewingKey(s: string): { txHash: Hex; key: ViewingKey }DisclosedTxinterfaceexport interface DisclosedTx
openDisclosedTxfunctionexport async function openDisclosedTx(
Third party: open every output of the one disclosed tx; checks the key matches the tx.
witness
TransferPublicInputsinterfaceexport interface TransferPublicInputs
transferPublicInputHashfunctionexport function transferPublicInputHash(p: TransferPublicInputs): bigint
emptyCacheReadHashChainfunctionexport function emptyCacheReadHashChain(nInputs: number): bigint
Cache selection when no cache is read: tree id 0, chain over n_inputs zeros.
signerWidthfunctionexport function signerWidth(nInputs: number): number
signer_width = owner_signer_slots(n) + 1, owner_signer_slots(n) = min(n, 60 - n).
fieldAmountfunctionexport function fieldAmount(v: bigint): bigint
Signed amount into the field: deposits positive, withdrawals p - |x|.
publicSlotsfunctionexport function publicSlots(legs: readonly { asset: bigint; amount: bigint }[]): { assets: bigint[]; amounts: bigint[] }Aggregate settlement legs by asset in first-appearance order, drop zero nets, pad with (0, 0).
MerklePathinterfaceexport interface MerklePath
NullifierNonInclusioninterfaceexport interface NullifierNonInclusion
Indexed (low-leaf) non-inclusion proof against the nullifier tree.
CircuitUtxointerfaceexport interface CircuitUtxo
WitnessInputinterfaceexport interface WitnessInput
WitnessOutputinterfaceexport interface WitnessOutput
TransferWitnessinterfaceexport interface TransferWitness extends TransferPublicInputs
ZolanaProverRequesttypeexport type ZolanaProverRequest = Record<string, unknown> & { circuitType: string; nInputs: number; nOutputs: number };transferProverRequestfunctionexport function transferProverRequest(w: TransferWitness): ZolanaProverRequest
The zolana prover request body for `transfer-confidential` (shape nInputs x nOutputs).
MergePublicInputsinterfaceexport interface MergePublicInputs
mergePublicInputHashfunctionexport function mergePublicInputHash(p: MergePublicInputs): bigint
Default merge (merge_transact, PoseidonCtrV1): 13 elements.