import { PaymentAddress, OwnedNote, MerklePath, DecryptedNote, DepositWitness, JoinSplitWitness, WithdrawWitness } from './types.js'; /** BN254 scalar field modulus. */ declare const FIELD_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617n; /** Convert 32 little-endian bytes (or fewer; right-padded) to a field element. */ declare function bytesToField(bytes: Uint8Array): bigint; /** Convert a field element to 32 little-endian bytes. */ declare function fieldToBytes(n: bigint): Uint8Array; /** Field element → snarkjs witness string (decimal). */ declare function fieldStr(n: bigint): string; /** * Commitment per ADR-001: * commitment = Poseidon4(value, owner_pk, blinding, memo_or_zero) */ declare function deriveCommitment(args: { value: bigint; ownerPk: bigint; blinding: bigint; memo: bigint | null; }): Promise; /** * Spending pubkey per ADR-002: * spending_pk = Poseidon1(spending_sk) */ declare function deriveSpendingPk(spendingSk: bigint): Promise; /** * Nullifier per ADR-002: * nullifier = Poseidon2(commitment, nullifier_sk) */ declare function deriveNullifier(args: { commitment: bigint; nullifierSk: bigint; }): Promise; /** * Merkle node hash per lib.circom MerkleRoot template: * parent = Poseidon2(left, right) * * Used by witness builders that need to verify their own merkle path * against a published root before submitting a proof (catches * stale-witness bugs early). */ declare function merkleParent(left: bigint, right: bigint): Promise; /** * Recompute a merkle root from a leaf + path. Useful for client-side * sanity check ("does my path actually verify against the published * root?") before burning proof time. */ declare function recomputeMerkleRoot(args: { leaf: bigint; pathElements: bigint[]; pathIndices: number[]; }): Promise; declare function enrichOwnedNote(args: { note: DecryptedNote; leafIndex: number; receivedAtSlot: number; spent: boolean; nullifierSk: bigint; }): Promise; interface DepositInputs { /** Output note being created. */ recipient: PaymentAddress; /** Random 32-byte blinding for the new note. */ blinding: Uint8Array; /** Optional 32-byte memo. */ memo: Uint8Array | null; /** USDC value entering the pool, in micro-USDC. */ publicValue: bigint; /** Hash of the SPL source account (binds proof to caller). */ depositorAddrHash: bigint; /** Relayer fee, micro-USDC. */ fee: bigint; } declare function buildDepositWitness(inputs: DepositInputs): DepositWitness; interface WithdrawInputs { /** The note being spent (must have spent: false). */ note: OwnedNote; /** Caller's spending key (to prove authority). */ spendingSk: bigint; /** Caller's nullifier key (to derive `note.nullifier`). */ nullifierSk: bigint; /** Pool merkle inclusion proof for `note.commitment`. */ poolPath: MerklePath; /** ASP merkle inclusion proof for `note.commitment`. */ aspPath: MerklePath; /** Recipient address hash (binds the proof). */ publicAddress: bigint; /** USDC paid out to recipient (== note.value − fee). */ publicValue: bigint; /** Relayer fee, micro-USDC. */ fee: bigint; } declare function buildWithdrawWitness(inputs: WithdrawInputs): Promise; interface JoinSplitInputs { /** Two input notes being spent. */ inputs: [OwnedNote, OwnedNote]; /** Merkle paths for each input (pool + ASP). */ inputPoolPaths: [MerklePath, MerklePath]; inputAspPaths: [MerklePath, MerklePath]; /** Caller's spending key (must derive to both inputs' ownerPk). */ spendingSk: bigint; /** Caller's nullifier key. */ nullifierSk: bigint; /** Two output notes being created. */ outputs: [DecryptedNote, DecryptedNote]; /** Public-side flow. Set ONE of in/out non-zero, the other to 0n. */ publicValueIn: bigint; publicValueOut: bigint; /** Counterparty hash if publicValueIn or publicValueOut > 0; else 0n. */ publicAddress: bigint; /** Relayer fee. */ fee: bigint; } declare function buildJoinSplitWitness(inputs: JoinSplitInputs): Promise; export { type DepositInputs, FIELD_MODULUS, type JoinSplitInputs, type WithdrawInputs, buildDepositWitness, buildJoinSplitWitness, buildWithdrawWitness, bytesToField, deriveCommitment, deriveNullifier, deriveSpendingPk, enrichOwnedNote, fieldStr, fieldToBytes, merkleParent, recomputeMerkleRoot };