import * as _solana_web3_js from '@solana/web3.js'; import { PublicKey, VersionedTransaction, Connection } from '@solana/web3.js'; import { CodeKeyMaterial } from './keys.cjs'; export { parsePaymentAddress } from './keys.cjs'; type PrivatePoolV2Config = { network: string; cluster: 'devnet' | 'mainnet'; programIds: { pool: string; depositVerifier: string; withdrawVerifier: string; joinsplitVerifier: string; }; poolPda: string; vaultAta: string; usdcMint: string; aspAuthority: string; tokenProgramId: string; associatedTokenProgramId: string; feePayer: string | null; constants: { poolDepth: number; aspDepth: number; rootHistorySize: number; aspRootHistorySize: number; encryptedNoteBytes: number; encryptedNoteWithMemoBytes: number; usdcDecimals: number; }; }; declare function loadConfig(args: { apiBaseUrl: string; network: string; }): Promise; declare function fieldToBytes32BE(value: bigint): Buffer; type PrepareDepositArgs = { cfg: PrivatePoolV2Config; depositor: PublicKey; recipientSpendingPkField: bigint; recipientViewingPk: Uint8Array; publicValue: bigint; fee: bigint; memo: Uint8Array | null; storeBlobOnChain?: boolean; }; type PreparedDepositTx = { transaction: VersionedTransaction; commitmentHex: string; commitmentField: bigint; leafPda: PublicKey; blobPda: PublicKey; ownedNoteSecret: { blinding: Uint8Array; ownerPk: Uint8Array; memo: Uint8Array | null; valueMicroUsdc: bigint; }; proveMs: number; }; declare function prepareDepositTransaction(args: PrepareDepositArgs, options?: { connection: Connection; recentBlockhash?: string; }): Promise; type PrepareWithdrawArgs = { cfg: PrivatePoolV2Config; spendingSkField: bigint; nullifierSkField: bigint; note: { value: bigint; blinding: bigint; memo: bigint; commitmentField: bigint; leafIndex: number; }; allLeaves: bigint[]; poolRoot: bigint; aspRoot: bigint; aspPath: { pathElements: bigint[]; pathIndices: number[]; }; recipient: PublicKey; publicValue: bigint; fee: bigint; }; type PreparedWithdrawTx = { transaction: VersionedTransaction; nullifierField: bigint; nullifierPda: PublicKey; proveMs: number; }; declare function prepareWithdrawTransaction(args: PrepareWithdrawArgs, options: { connection: Connection; payer: PublicKey; recentBlockhash?: string; }): Promise; type WithdrawRelayPayload = { network: string; nullifier_hex: string; root_hex: string; asp_root_hex: string; public_address_hex: string; public_value: string; fee: string; recipient: string; recipient_ata: string; proof_b64: string; }; type PreparedWithdrawRelay = { payload: WithdrawRelayPayload; nullifierField: bigint; proveMs: number; }; declare function prepareWithdrawRelayPayload(args: PrepareWithdrawArgs & { network: string; }): Promise; /** * Submit a prepared relay payload. Returns the on-chain tx signature * + an explorer URL when confirmation succeeds. * * Network-error handling: if the POST itself fails (server down, * timeout, etc.), the error is rethrown for the caller to retry — * the on-chain state is unchanged because no tx was built. If the * POST returns a structured error (e.g. `already_consumed`, * `fee_below_min`), it's surfaced as a typed exception with the * server's error code on `cause.error`. */ declare function submitWithdrawViaRelay(args: { apiBaseUrl: string; payload: WithdrawRelayPayload; }): Promise<{ signature: string; confirmed: boolean; explorerUrl: string; }>; type JoinSplitNoteRecipient = { spendingPkField: bigint; viewingPk: Uint8Array; }; type PrepareJoinSplitArgs = { cfg: PrivatePoolV2Config; senderSpendingSkField: bigint; senderSpendingPkField: bigint; senderNullifierSkField: bigint; senderViewingPk: Uint8Array; inputNotes: [ { value: bigint; blinding: bigint; memo: bigint; commitmentField: bigint; leafIndex: number; }, { value: bigint; blinding: bigint; memo: bigint; commitmentField: bigint; leafIndex: number; } ]; allLeaves: bigint[]; poolRoot: bigint; aspRoot: bigint; aspPaths: [ { pathElements: bigint[]; pathIndices: number[]; }, { pathElements: bigint[]; pathIndices: number[]; } ]; recipient: JoinSplitNoteRecipient; recipientAmount: bigint; fee: bigint; recipientMemo?: Uint8Array | null; lookupTable: _solana_web3_js.AddressLookupTableAccount; }; type PreparedJoinSplitTx = { transaction: VersionedTransaction; nullifiers: [bigint, bigint]; outputCommitments: [bigint, bigint]; blobs: [ { commitmentHex: string; ephemeralPkHex: string; ciphertextB64: string; ciphertextLen: number; }, { commitmentHex: string; ephemeralPkHex: string; ciphertextB64: string; ciphertextLen: number; } ]; proveMs: number; }; declare function prepareJoinSplitTransaction(args: PrepareJoinSplitArgs, options: { connection: Connection; payer: PublicKey; recentBlockhash?: string; }): Promise; type JoinSplitRelayPayload = { network: string; root_hex: string; asp_root_hex: string; public_address_hex: string; input_nullifiers_hex: [string, string]; output_commitments_hex: [string, string]; ephemeral_pks_b64: [string, string]; encrypted_notes_b64: [string, string]; spl_counterparty: string; spl_counterparty_ata: string; public_value_in: string; public_value_out: string; fee: string; proof_b64: string; }; type PreparedJoinSplitRelay = { payload: JoinSplitRelayPayload; nullifiers: [bigint, bigint]; outputCommitments: [bigint, bigint]; blobs: [ { commitmentHex: string; ephemeralPkHex: string; ciphertextB64: string; ciphertextLen: number; }, { commitmentHex: string; ephemeralPkHex: string; ciphertextB64: string; ciphertextLen: number; } ]; proveMs: number; }; type PrepareJoinSplitRelayArgs = Omit & { network: string; payer: PublicKey; }; declare function prepareJoinSplitRelayPayload(args: PrepareJoinSplitRelayArgs): Promise; /** * Submit a prepared joinsplit relay payload. Same shape as * `submitWithdrawViaRelay`. Returns the on-chain tx signature on * success; throws with `cause.error` on structured server errors * (e.g. `not_relayable`, `already_consumed`). */ declare function submitJoinSplitViaRelay(args: { apiBaseUrl: string; payload: JoinSplitRelayPayload; }): Promise<{ signature: string; confirmed: boolean; explorerUrl: string; }>; declare function relaySponsoredTransaction(args: { apiBaseUrl: string; network: string; signedTx: VersionedTransaction; }): Promise<{ signature: string; confirmed: boolean; }>; type ClaimCreditV3RelayPayload = { network: string; source_nullifier_hex: string; source_root_hex: string; asp_root_hex: string; public_address_hex: string; public_value: string; fee: string; source_proof_b64: string; credit_commitment_hex: string; encrypted_note_b64: string; }; type PreparedClaimCreditV3Relay = { payload: ClaimCreditV3RelayPayload; sourceNullifierField: bigint; creditCommitmentField: bigint; creditNote: { value: bigint; blinding: Uint8Array; ownerPk: Uint8Array; }; proveMs: number; }; declare function prepareClaimCreditV3RelayPayload(args: { cfg: PrivatePoolV2Config; note: { value: bigint; blinding: bigint; memo: bigint; commitmentField: bigint; leafIndex: number; }; spendingSkField: bigint; nullifierSkField: bigint; recipientSpendingPkField: bigint; recipientViewingPk: Uint8Array; recipient: PublicKey; allLeaves: bigint[]; poolRoot: bigint; aspRoot: bigint; aspPath: { pathElements: bigint[]; pathIndices: number[]; }; publicValue: bigint; fee: bigint; network: string; }): Promise; declare function submitClaimCreditV3ViaRelay(args: { apiBaseUrl: string; payload: ClaimCreditV3RelayPayload; }): Promise<{ signature: string; credit_commitment_hex: string; credit_root_hex: string; }>; type CashOutV3RelayPayload = { network: string; credit_nullifier_hex: string; credit_pool_root_hex: string; public_address_hex: string; public_value: string; fee: string; recipient: string; recipient_ata: string; proof_b64: string; }; type PreparedCashOutV3Relay = { payload: CashOutV3RelayPayload; creditNullifierField: bigint; proveMs: number; }; declare function prepareCashOutV3RelayPayload(args: { cfg: PrivatePoolV2Config; note: { value: bigint; blinding: bigint; ownerPkField: bigint; commitmentField: bigint; leafIndex: number; }; spendingSkField: bigint; nullifierSkField: bigint; recipient: PublicKey; recipientAta: PublicKey; allCreditLeaves: bigint[]; creditPoolRoot: bigint; publicValue: bigint; fee: bigint; network: string; }): Promise; declare function prepareClaimCreditV3RelayPayloadAsBearer(args: { cfg: PrivatePoolV2Config; note: { value: bigint; blinding: bigint; memo: bigint; commitmentField: bigint; leafIndex: number; }; spendingSkField: bigint; nullifierSkField: bigint; codeKeys?: CodeKeyMaterial; codeSeed?: Uint8Array; allLeaves: bigint[]; poolRoot: bigint; aspRoot: bigint; aspPath: { pathElements: bigint[]; pathIndices: number[]; }; publicValue: bigint; fee: bigint; network: string; }): Promise; declare function prepareCashOutV3RelayPayloadAsBearer(args: { cfg: PrivatePoolV2Config; note: { value: bigint; blinding: bigint; ownerPkField: bigint; commitmentField: bigint; leafIndex: number; }; codeKeys: CodeKeyMaterial; recipient: PublicKey; recipientAta: PublicKey; allCreditLeaves: bigint[]; creditPoolRoot: bigint; publicValue: bigint; fee: bigint; network: string; }): Promise; declare function fetchCreditPoolLeafForBearerRedeem(args: { apiBaseUrl: string; network: string; commitmentHex: string; codeKeys: CodeKeyMaterial; }): Promise<{ value: bigint; blinding: bigint; ownerPkField: bigint; commitmentField: bigint; leafIndex: number; alreadySpent: boolean; } | null>; declare function discoverCreditPoolLeafByCodeKeys(args: { apiBaseUrl: string; network: string; codeKeys: CodeKeyMaterial; }): Promise<{ value: bigint; blinding: bigint; ownerPkField: bigint; commitmentField: bigint; commitmentHex: string; leafIndex: number; alreadySpent: boolean; } | null>; declare function submitCashOutV3ViaRelay(args: { apiBaseUrl: string; payload: CashOutV3RelayPayload; }): Promise<{ signature: string; }>; declare function fetchCreditPoolLeaves(args: { apiBaseUrl: string; network: string; }): Promise<{ commitmentField: bigint; leafIndex: number; }[]>; declare function fetchCreditPoolLatestRoot(args: { apiBaseUrl: string; network: string; }): Promise; type V3CashableCreditPoolNote = { value: bigint; blindingField: bigint; ownerPkField: bigint; commitmentField: bigint; commitmentHex: string; leafIndex: number; claimedAtSlot: number; nullifierField: bigint; spent: boolean; }; declare function discoverCashableCreditPoolNotesV3(args: { apiBaseUrl: string; network: string; viewingSk: Uint8Array; spendingPkField: bigint; nullifierSkField: bigint; }): Promise; declare function relayJoinSplitBlob(args: { apiBaseUrl: string; network: string; blob: PreparedJoinSplitTx['blobs'][number]; sourceTx?: string; senderPubkey?: string; }): Promise; export { type CashOutV3RelayPayload, type ClaimCreditV3RelayPayload, type JoinSplitNoteRecipient, type JoinSplitRelayPayload, type PrepareDepositArgs, type PrepareJoinSplitArgs, type PrepareJoinSplitRelayArgs, type PrepareWithdrawArgs, type PreparedCashOutV3Relay, type PreparedClaimCreditV3Relay, type PreparedDepositTx, type PreparedJoinSplitRelay, type PreparedJoinSplitTx, type PreparedWithdrawRelay, type PreparedWithdrawTx, type PrivatePoolV2Config, type V3CashableCreditPoolNote, type WithdrawRelayPayload, discoverCashableCreditPoolNotesV3, discoverCreditPoolLeafByCodeKeys, fetchCreditPoolLatestRoot, fetchCreditPoolLeafForBearerRedeem, fetchCreditPoolLeaves, fieldToBytes32BE, loadConfig, prepareCashOutV3RelayPayload, prepareCashOutV3RelayPayloadAsBearer, prepareClaimCreditV3RelayPayload, prepareClaimCreditV3RelayPayloadAsBearer, prepareDepositTransaction, prepareJoinSplitRelayPayload, prepareJoinSplitTransaction, prepareWithdrawRelayPayload, prepareWithdrawTransaction, relayJoinSplitBlob, relaySponsoredTransaction, submitCashOutV3ViaRelay, submitClaimCreditV3ViaRelay, submitJoinSplitViaRelay, submitWithdrawViaRelay };