veilix-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,275 @@
1
+ # veilix-sdk
2
+
3
+ TypeScript SDK for interacting with the Veilix privacy protocol on Solana — deposits, withdrawals, private transfers, and fee quotes.
4
+
5
+ **Third-party partners** integrating Private Send into their own website or app (quote → wallet sign → deposit → `/submit`): see [`docs/partner-private-send.md`](./docs/partner-private-send.md).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install veilix-sdk
11
+ ```
12
+
13
+ Peer dependencies (optional, for React):
14
+
15
+ ```bash
16
+ npm install @solana/wallet-adapter-react react
17
+ ```
18
+
19
+ ## Prerequisites
20
+
21
+ - A Solana wallet (`Keypair` for backend/scripts, or a wallet adapter with `signMessage` / `signAllTransactions` for frontend)
22
+ - A [Range API key](https://range.org) (`rangeApiKey`)
23
+ - An RPC endpoint or existing `@solana/web3.js` `Connection`
24
+
25
+ Supported networks: `mainnet` and `devnet` (inferred from the RPC URL, or set explicitly via `network`).
26
+
27
+ ---
28
+
29
+ ## Creating a `VeilixSDK` instance
30
+
31
+ Create one SDK instance per configuration (network, RPC, wallet, rangeApiKey). Initialization loads active relayers for the target network.
32
+
33
+ ```ts, tsx
34
+ import { VeilixSDK } from "veilix-sdk";
35
+
36
+ VeilixSDK.create({
37
+ rangeApiKey: RANGE_API_KEY,
38
+ rpcEndpoint: RPC_URL,
39
+ wallet,
40
+ network: NETWORK,
41
+ })
42
+ .then((sdk) => {
43
+ ...
44
+ })
45
+ ```
46
+
47
+ ### Init options
48
+
49
+ | Option | Required | Description |
50
+ |--------|----------|-------------|
51
+ | `rangeApiKey` | yes | Range API key for risk/oracle features |
52
+ | `wallet` | yes | Anchor-compatible wallet (`Keypair` or wallet adapter) |
53
+ | `rpcEndpoint` | yes | Solana JSON-RPC URL |
54
+ | `network` | yes | `"mainnet"` or `"devnet"` — override when the RPC URL has no cluster hint |
55
+
56
+ After creation, inspect runtime config via `sdk.config` or helpers like `sdk.getNetwork()`, `sdk.relayers`, and `sdk.getTokenMints()`.
57
+
58
+ ---
59
+
60
+ ## `getEncryptionKey`
61
+
62
+ Derives a note-encryption key from a wallet signature and stores it on the SDK instance (`sdk.encryptKey`). **Required before any deposit that uses on-chain note backup** (`onChainBackup: true`, including `veilixTransfer`).
63
+
64
+ The wallet signs the message `veilix:notes:v1`. Accepts a backend `Keypair` or a frontend wallet adapter with `signMessage`.
65
+
66
+ ```ts
67
+ await sdk.getEncryptionKey(wallet);
68
+ // sdk.encryptKey is now set
69
+ ```
70
+
71
+ The key is used to encrypt secret notes before they are stored on-chain via `backupNotes`, so you can recover notes later from the same wallet.
72
+
73
+ ---
74
+
75
+ ## `buildDepositTx`
76
+
77
+ Builds an unsigned deposit transaction for a pre-generated secret note.
78
+
79
+ ### 1. Generate deposit parameters
80
+
81
+ ```ts
82
+ // 1 SOL deposit (lamports)
83
+ const { note } = sdk.generateDepositParams(1_000_000_000n, null);
84
+
85
+ // SPL token deposit — pass the token mint
86
+ const usdcMint = sdk.getTokenMint("USDC");
87
+ const { note: usdcNote } = sdk.generateDepositParams(1_000_000n, usdcMint);
88
+ ```
89
+
90
+ Deposit amounts must match [supported pool denominations](#supported-deposit-denominations) for each token.
91
+
92
+ ### 2. Build the transaction
93
+
94
+ ```ts
95
+ await sdk.getEncryptionKey(wallet); // required when onChainBackup is true
96
+
97
+ const { tx, note } = await sdk.buildDepositTx({
98
+ senderPublicKey: wallet.publicKey,
99
+ note,
100
+ onChainBackup: true, // encrypt and store note on-chain (recommended)
101
+ computeUnitPrice: 50_000, // optional priority fee
102
+ tempSigner: tempSignerPublicKey // to prevent ix assertion in browser
103
+ });
104
+ ```
105
+
106
+ Sign and send the returned `tx` with your wallet. **Save the returned `note`** — it is required to withdraw later.
107
+
108
+ | Parameter | Description |
109
+ |-----------|-------------|
110
+ | `senderPublicKey` | Depositor's public key |
111
+ | `note` | Secret note from `generateDepositParams` |
112
+ | `onChainBackup` | When `true`, encrypts the note and adds a `backupNotes` instruction (requires `getEncryptionKey`) |
113
+ | `computeUnitPrice` | Priority fee in micro-lamports (default `50000`) |
114
+
115
+ ---
116
+
117
+ ## `withdraw`
118
+
119
+ Withdraws funds from the privacy pool to a recipient using a secret note from a prior deposit. The SDK:
120
+
121
+ 1. Validates the recipient against the risk API
122
+ 2. Fetches Merkle commitments from the indexer
123
+ 3. Generates a ZK withdraw proof
124
+ 4. Submits the proof to a relayer (chosen at random, or by index)
125
+ 5. Polls until the relayer confirms the on-chain transaction
126
+
127
+ ```ts
128
+ const result = await sdk.withdraw({
129
+ note: "veilix-1-...", // secret note from deposit
130
+ recipient: "RecipientPubkey...", // withdrawal destination
131
+ },
132
+ relayerIdx: -1, // optional — random relayer when omitted
133
+ );
134
+
135
+ console.log(result.txHash); // on-chain transaction signature
136
+ console.log(result.status); // "success" | "failed"
137
+ ```
138
+
139
+ | Parameter | Description |
140
+ |-----------|-------------|
141
+ | `note` | Secret note from the original deposit |
142
+ | `recipient` | Recipient public key (`PublicKey` or base58 string) |
143
+ | `relayerIdx` | Optional index into `sdk.relayers` |
144
+
145
+ Withdraw fees are calculated automatically from the relayer fee and on-chain platform fee.
146
+
147
+ ---
148
+
149
+ ## `veilixTransfer`
150
+
151
+ End-to-end private transfer: deposit into the pool (split across supported denominations), then withdraw each successful note to the recipient. Handles signing, sending, and settlement automatically.
152
+
153
+ **Requires keep open the window till get response for correct work**
154
+
155
+ ```ts
156
+ import { PublicKey } from "@solana/web3.js";
157
+
158
+ const result = await sdk.veilixTransfer(
159
+ [
160
+ {
161
+ mint: new PublicKey(sdk.getTokenMint("USDC")),
162
+ amount: "25", // human-readable amount
163
+ recipient: new PublicKey("RecipientPubkey..."),
164
+ },
165
+ {
166
+ mint: new PublicKey(sdk.getTokenMints().Solana),
167
+ amount: "1.5",
168
+ recipient: new PublicKey("AnotherRecipient..."),
169
+ },
170
+ ],
171
+ );
172
+
173
+ if (result.error) {
174
+ console.log("Deposit failures:", result.depositFailed);
175
+ console.log("Withdraw failures:", result.withdrawFailed);
176
+ }
177
+ ```
178
+
179
+ | Field | Description |
180
+ |-------|-------------|
181
+ | `items[].mint` | Token mint to transfer |
182
+ | `items[].amount` | Human-readable amount (e.g. `"1.5"` SOL) |
183
+ | `items[].recipient` | Withdrawal destination for that transfer |
184
+
185
+ The SDK splits each amount into the nearest supported deposit denominations, builds and sends deposit transactions, waits for settlement, then withdraws each note to its recipient. Partial failures are reported in `depositFailed` and `withdrawFailed` without throwing.
186
+
187
+ ---
188
+
189
+ ## `getQuote`
190
+
191
+ Fetches a withdraw fee quote from the Veilix indexer before executing a withdrawal. Returns estimated relayer fees, recipient amount, ETA, and how the amount splits across denominations.
192
+
193
+ ```ts
194
+ const { quote } = await sdk.getQuote({
195
+ amount: 1.5, // human-readable amount
196
+ amountLamports: 1_500_000_000, // same amount in smallest units
197
+ recipient: "RecipientPubkey...",
198
+ asset: "SOL", // optional — default "SOL"
199
+ });
200
+
201
+ console.log(quote.recipientAmount); // amount recipient receives after fees
202
+ console.log(quote.totalRelayerFee);
203
+ console.log(quote.etaSeconds);
204
+ console.log(quote.splits); // per-denomination breakdown
205
+ console.log(quote.platformFee); // platform fee (added by SDK)
206
+ ```
207
+
208
+ | Parameter | Description |
209
+ |-----------|-------------|
210
+ | `amount` | Human-readable transfer/withdraw amount |
211
+ | `amountLamports` | Amount in smallest token units |
212
+ | `recipient` | Intended withdrawal recipient |
213
+ | `asset` | Indexer asset label (default `"SOL"`) |
214
+ | `network` | Optional cluster override |
215
+
216
+ `getQuote` is also exported as a standalone function but requires an initialized SDK context.
217
+
218
+ ---
219
+
220
+ ## Typical flows
221
+
222
+ ### Deposit and withdraw
223
+
224
+ ```ts
225
+ const sdk = await VeilixSDK.create({ rangeApiKey, rpcEndpoint, wallet });
226
+
227
+ await sdk.getEncryptionKey(wallet);
228
+
229
+ const { note } = sdk.generateDepositParams(1_000_000_000n, null);
230
+ const { tx } = await sdk.buildDepositTx({
231
+ senderPublicKey: wallet.publicKey,
232
+ note,
233
+ onChainBackup: true,
234
+ });
235
+
236
+ // sign and send tx...
237
+
238
+ const { txHash } = await sdk.withdraw({
239
+ note,
240
+ recipient: "RecipientPubkey...",
241
+ });
242
+ ```
243
+
244
+ ### Quote before withdraw
245
+
246
+ ```ts
247
+ const { quote } = await sdk.getQuote({
248
+ amount: 1,
249
+ amountLamports: 1_000_000_000,
250
+ recipient: "RecipientPubkey...",
251
+ });
252
+
253
+ console.log(`Recipient receives ~${quote.recipientAmount} SOL`);
254
+
255
+ await sdk.withdraw({ note, recipient: "RecipientPubkey..." });
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Supported deposit denominations
261
+
262
+ Amounts must decompose exactly into these pool denominations:
263
+
264
+ | Token | Denominations | Mint Address (mainnet) |
265
+ |-------|---------------|---------------|
266
+ | SOL | 0.1, 1, 5, 10, 50, 100, 500 | |
267
+ | USDC | 1, 10, 50, 100, 1000, 10000, 100000, 1000000 | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
268
+ | Veilix | 10000,50000,100000,500000,1000000,10000000 | |
269
+ | Bitcoin | 0.01, 0.05, 0.1, 0.5, 1, 5 | 3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh |
270
+ | Ethereum (coming soon) | 0.1, 1, 10, 50, 100, 500 | 7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs |
271
+
272
+ Use `sdk.getDepositAmounts("Solana")` (or another symbol) to retrieve the list programmatically.
273
+
274
+ ---
275
+
@@ -0,0 +1,390 @@
1
+ import { PublicKey, Keypair, Connection, TransactionInstruction, Transaction } from '@solana/web3.js';
2
+ import { OracleJob } from '@switchboard-xyz/common';
3
+ import { Program } from '@coral-xyz/anchor';
4
+ import { Wallet } from '@coral-xyz/anchor/dist/cjs/provider';
5
+ import { C as CircuitPaths } from './constants-9OPXLj27.cjs';
6
+
7
+ type IndexerAsset = string | {
8
+ mint?: string;
9
+ asset?: string;
10
+ } | null;
11
+
12
+ /** Frontend wallet adapter or backend {@link Keypair}. */
13
+ type EncryptKeyWallet = Keypair | {
14
+ signMessage: (message: Uint8Array) => Promise<Uint8Array> | Uint8Array;
15
+ };
16
+ type BuildDepositTxParams = {
17
+ senderPublicKey: PublicKey | string;
18
+ /** Pre-generated secret note from {@link generateDepositParams}. */
19
+ note: string;
20
+ onChainBackup?: boolean;
21
+ computeUnitPrice?: number;
22
+ tempSigner?: PublicKey | string;
23
+ };
24
+ type FetchWalletBalanceOptions = {
25
+ includeDeposits?: boolean;
26
+ indexerAsset?: IndexerAsset;
27
+ };
28
+ type BuildRelayPayloadParams = {
29
+ args: unknown[];
30
+ proofHex: string;
31
+ denomination: number | bigint | string;
32
+ withdrawAddress: unknown;
33
+ relayerPubkey: unknown;
34
+ mint?: unknown;
35
+ };
36
+ type RelayPayload = Record<string, unknown>;
37
+
38
+ type DepositParams = {
39
+ nullifier: string;
40
+ secret: string;
41
+ amount: string;
42
+ commitment: string;
43
+ nullifierHash: string;
44
+ mint: string | null;
45
+ };
46
+ type GenerateDepositParamsResult = {
47
+ params: DepositParams;
48
+ note: string;
49
+ };
50
+ type PreparedCircuitArtifacts = {
51
+ wasmPath: string;
52
+ zkeyPath: string;
53
+ /** Revokes the browser object URLs. `null` outside the browser. */
54
+ cleanup: (() => void) | null;
55
+ };
56
+ type GenerateWithdrawProofOptions = {
57
+ /** Override WASM path/URL (for bundled frontends, use a Vite `?url` import). */
58
+ circuitWasmPath?: string;
59
+ /** Override zkey path/URL (for bundled frontends, use a Vite `?url` import). */
60
+ circuitZkeyPath?: string;
61
+ /**
62
+ * Artifacts already fetched and verified by {@link prepareCircuitArtifacts}.
63
+ * Skips the download and takes precedence over the path overrides; the caller
64
+ * stays responsible for calling `cleanup`.
65
+ */
66
+ circuitArtifacts?: PreparedCircuitArtifacts;
67
+ };
68
+ /**
69
+ * Fetch and integrity-check the withdraw circuit artifacts once so that several
70
+ * proofs can share them. Call `cleanup` after the last proof has settled.
71
+ */
72
+ declare const prepareCircuitArtifacts: (circuitWasmPath?: string, circuitZkeyPath?: string) => Promise<PreparedCircuitArtifacts>;
73
+
74
+ type Network = "mainnet" | "devnet";
75
+ declare const MAINNET_TOKEN_MINTS: {
76
+ readonly Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon";
77
+ readonly Bitcoin: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
78
+ readonly Ethereum: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
79
+ readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
80
+ };
81
+ type TokenSymbol = keyof typeof MAINNET_TOKEN_MINTS;
82
+ declare const TOKEN_DECIMALS: {
83
+ readonly Solana: 9;
84
+ readonly Veilix: 9;
85
+ readonly Ethereum: 8;
86
+ readonly Bitcoin: 8;
87
+ readonly USDC: 6;
88
+ };
89
+ type TokenDecimalsSymbol = keyof typeof TOKEN_DECIMALS;
90
+ /** Supported deposit denominations per token (same on mainnet and devnet). */
91
+ declare const DEPOSIT_AMOUNTS: {
92
+ readonly Solana: readonly [0.1, 1, 5, 10, 50, 100, 500];
93
+ readonly Veilix: readonly [10000, 50000, 100000, 500000, 1000000, 10000000];
94
+ readonly Bitcoin: readonly [0.01, 0.05, 0.1, 0.5, 1, 5];
95
+ readonly Ethereum: readonly [0.1, 1, 10, 50, 100, 500];
96
+ readonly USDC: readonly [1, 10, 50, 100, 1000, 10000, 100000, 1000000];
97
+ };
98
+ type DepositTokenSymbol = keyof typeof DEPOSIT_AMOUNTS;
99
+
100
+ type Relayer = {
101
+ isValid: true;
102
+ label: string;
103
+ url: string;
104
+ key: number;
105
+ value: string;
106
+ fee: unknown;
107
+ recentActivities: unknown;
108
+ userPubkey: unknown;
109
+ workers: unknown;
110
+ totalFeeEarningsSol: unknown;
111
+ totalWithdrawCount: unknown;
112
+ stakedAmount: unknown;
113
+ volume24hSol: unknown;
114
+ volume7dSol: unknown;
115
+ };
116
+
117
+ interface VeilixSdkInitOptions {
118
+ /** Range API key (frontend: VITE_RANGE_API_KEY). */
119
+ rangeApiKey: string;
120
+ /** Wallet for Anchor provider transactions. */
121
+ wallet: Wallet;
122
+ /**
123
+ * Solana JSON-RPC endpoint (Node/scripts). Omit when passing {@link connection}
124
+ * from `@solana/wallet-adapter-react` (`useConnection()`).
125
+ */
126
+ rpcEndpoint?: string;
127
+ /** Existing connection (e.g. `useConnection()` in React). */
128
+ connection?: Connection;
129
+ /**
130
+ * Cluster override when the RPC URL does not contain `devnet` / `mainnet` hints
131
+ * (common with private RPC providers).
132
+ */
133
+ network: Network;
134
+ /**
135
+ * Base URL/path for withdraw circuit artifacts in the browser.
136
+ * Defaults to `/node_modules/<pkg>/dist/circuits/` on localhost and the
137
+ * pinned, SHA-256-verified jsDelivr CDN in production (domain-independent).
138
+ * Set this to self-host instead, e.g. `"/circuits/"` (verified, with CDN fallback)
139
+ * or `"https://cdn.example.com/veilix/circuits/"`.
140
+ */
141
+ circuitPathsBase?: string;
142
+ }
143
+ interface VeilixSdkRuntimeConfig {
144
+ rangeApiKey: string;
145
+ rpcEndpoint: string;
146
+ /** Cluster inferred from {@link rpcEndpoint}. */
147
+ network: Network;
148
+ programId: string;
149
+ /** Active relayers for {@link network}, loaded at SDK initialization. */
150
+ relayers: Relayer[];
151
+ connection: Connection;
152
+ wallet: Wallet;
153
+ program: Program;
154
+ /** Set by {@link VeilixSDK.getEncryptionKey}; required for on-chain note backup. */
155
+ encryptKey?: Uint8Array;
156
+ /** Resolved withdraw circuit wasm/zkey URLs for browser proof generation. */
157
+ circuitPaths?: CircuitPaths;
158
+ }
159
+
160
+ type WithdrawParams = {
161
+ /** Secret note from the original deposit. */
162
+ note: string;
163
+ /** Withdrawal recipient public key. */
164
+ recipient: PublicKey | string;
165
+ /** Mode for normal withdraw or veilix transfer. */
166
+ veilixTransferMode?: boolean;
167
+ };
168
+ type WithdrawStatus = "success" | "failed";
169
+ type WithdrawResult = {
170
+ txHash: string;
171
+ status: WithdrawStatus;
172
+ };
173
+
174
+ type QuoteRelayer = {
175
+ url: string;
176
+ [key: string]: unknown;
177
+ };
178
+ type QuoteTransaction = Record<string, unknown>;
179
+ type QuoteSplit = {
180
+ denomination: number;
181
+ totalRelayerFee: number;
182
+ relayer: QuoteRelayer;
183
+ transaction: QuoteTransaction;
184
+ };
185
+ type Quote = {
186
+ amount: number;
187
+ transactionCount: number;
188
+ recipientAmount: number;
189
+ totalRelayerFee: number;
190
+ etaSeconds: number;
191
+ splits: QuoteSplit[];
192
+ platformFee?: number;
193
+ };
194
+ type GetQuoteResponse = {
195
+ success: boolean;
196
+ quote: Quote;
197
+ };
198
+ type GetQuoteParams = {
199
+ amount: number | string;
200
+ amountLamports: number | string | bigint;
201
+ recipient: PublicKey | string;
202
+ /** Indexer asset label (default `SOL`). */
203
+ asset?: string;
204
+ /** Cluster for the quote (default active SDK network). */
205
+ network?: Network;
206
+ };
207
+ /** Fetch a withdraw quote from the indexer. Requires SDK init or an active instance context. */
208
+ declare function getQuote(params: GetQuoteParams): Promise<GetQuoteResponse>;
209
+
210
+ type ResolvedNoteAsset = {
211
+ key: string;
212
+ tokenName: TokenDecimalsSymbol;
213
+ unit: string;
214
+ multiplier: bigint;
215
+ mint: string | null;
216
+ poolAmounts: readonly number[];
217
+ decimals: number;
218
+ };
219
+
220
+ type VeilixTransferItem = {
221
+ mint: PublicKey;
222
+ /** Human-readable token amount (e.g. `"1.5"` SOL). */
223
+ amount: string;
224
+ recipient: PublicKey;
225
+ };
226
+ type VeilixTransferDepositFailure = {
227
+ amount: string;
228
+ mint: string;
229
+ recipient: string;
230
+ };
231
+ type VeilixTransferWithdrawFailure = {
232
+ note: string;
233
+ recipient: string;
234
+ };
235
+ type VeilixTransferResult = {
236
+ error: boolean;
237
+ depositFailed: VeilixTransferDepositFailure[];
238
+ withdrawFailed: VeilixTransferWithdrawFailure[];
239
+ depositSuccess: string[];
240
+ };
241
+ type VeilixTransferOptions = {
242
+ /** When true, all withdraws use the same randomly selected relayer. */
243
+ uniqueRelayer?: boolean;
244
+ };
245
+
246
+ /**
247
+ * Veilix SDK client. Create one instance per configuration (network, RPC, API keys).
248
+ *
249
+ * @example
250
+ * ```js
251
+ * const { VeilixSDK } = require('veilix-sdk');
252
+ * const sdk = await VeilixSDK.create({
253
+ * rangeApiKey: process.env.RANGE_API_KEY,
254
+ * rpcEndpoint: 'https://api.devnet.solana.com',
255
+ * wallet,
256
+ * });
257
+ * console.log(sdk.config.relayers);
258
+ * ```
259
+ *
260
+ * @example React (wallet-adapter)
261
+ * ```tsx
262
+ * import { useVeilixSdk } from 'veilix-sdk/react';
263
+ *
264
+ * function MyComponent() {
265
+ * const sdk = useVeilixSdk({ rangeApiKey: import.meta.env.VITE_RANGE_API_KEY });
266
+ * if (!sdk) return null;
267
+ * // ...
268
+ * }
269
+ * ```
270
+ *
271
+ * @example
272
+ * ```ts
273
+ * import { VeilixSDK } from 'veilix-sdk';
274
+ * const sdk = await VeilixSDK.create({ rangeApiKey, rpcEndpoint, wallet });
275
+ * await sdk.getEncryptionKey(wallet);
276
+ * const { note } = sdk.generateDepositParams(1_000_000_000n, null);
277
+ * await sdk.buildDepositTx({ senderPublicKey: wallet.publicKey, note, onChainBackup: true });
278
+ * ```
279
+ */
280
+ declare class VeilixSDK {
281
+ static readonly VERSION = "0.0.1";
282
+ readonly config: VeilixSdkRuntimeConfig;
283
+ private constructor();
284
+ /** Create an SDK instance (loads relayers for the inferred network). */
285
+ static create(options: VeilixSdkInitOptions): Promise<VeilixSDK>;
286
+ private run;
287
+ private runAsync;
288
+ getConfig(): VeilixSdkRuntimeConfig;
289
+ getRangeApiKey(): string;
290
+ getRpcEndpoint(): string;
291
+ getNetwork(): Network;
292
+ getProgramIdString(): string;
293
+ /** Encryption key derived by {@link getEncryptionKey}; undefined until set. */
294
+ get encryptKey(): Uint8Array | undefined;
295
+ /** Relayers loaded at initialization; use {@link fetchRelayers} to refresh. */
296
+ get relayers(): Relayer[];
297
+ getIndexerUrl(): string;
298
+ getRiskApiUrl(): string;
299
+ getTokenMints(): {
300
+ Solana: string;
301
+ Veilix: "3jSL5nnnYcRLmTqFmwvY1Mikh42fQsT7p7NvXPYzanon" | "ARCxcL6oX2pd4bKmUxhdoARaaHdKU6TJrTTthPANPQtQ";
302
+ Bitcoin: "" | "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
303
+ Ethereum: "" | "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
304
+ USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
305
+ };
306
+ getVeilixTokenMint(): string;
307
+ getTokenMint(symbol: TokenSymbol): string;
308
+ getDepositAmounts(symbol: DepositTokenSymbol): readonly number[];
309
+ getTokenDecimals(symbol: TokenDecimalsSymbol): number;
310
+ resolveCircuitPaths(base?: string): Promise<CircuitPaths>;
311
+ getRangeRiskScoreJob(address: string): OracleJob;
312
+ getOracleQuote(payer: Keypair | PublicKey, addressToCheck: string): Promise<{
313
+ queueAccount: PublicKey;
314
+ sigVerifyIx: TransactionInstruction;
315
+ }>;
316
+ getProgramId(): PublicKey;
317
+ getPoolPDA(denominationLamports: number | bigint): [PublicKey, number];
318
+ getTokenPoolPDA(mint: PublicKey | string, denominationSmallestUnits: number | bigint): [PublicKey, number];
319
+ getTreasuryPDA(): [PublicKey, number];
320
+ getCommitmentPDA(commitmentBigInt: bigint | number | string): [PublicKey, number];
321
+ getNullifierPDA(nullifierHashBigInt: bigint | number | string): [PublicKey, number];
322
+ getNetworkStatePDA(): [PublicKey, number];
323
+ buildDepositTx(params: BuildDepositTxParams): Promise<{
324
+ tx: Transaction;
325
+ note: string;
326
+ }>;
327
+ /**
328
+ * Withdraw to `recipient` using a secret `note`.
329
+ * Relayer is chosen at random from {@link config.relayers}, or by {@link WithdrawParams.relayerIdx}.
330
+ */
331
+ withdraw(params: WithdrawParams, relayerIdx?: number): Promise<WithdrawResult>;
332
+ /**
333
+ * Private transfer: deposit into the pool (split by supported denominations),
334
+ * then withdraw each successful note to the recipient.
335
+ *
336
+ * Requires {@link getEncryptionKey} before calling (deposits use on-chain backup).
337
+ *
338
+ * @param tempKeypair Ephemeral keypair co-signed on deposit instructions.
339
+ */
340
+ veilixTransfer(items: VeilixTransferItem[], tempKeypair: Keypair): Promise<VeilixTransferResult>;
341
+ /** Validate a withdraw recipient against the risk API. */
342
+ assertWithdrawRecipientAllowed(address: string): Promise<void>;
343
+ /** Resolve the token asset encoded in a secret note. */
344
+ resolveNoteAsset(amount: string, mint?: string | null, tokenNameHint?: TokenDecimalsSymbol): ResolvedNoteAsset;
345
+ fetchPlatformFee(): Promise<string>;
346
+ /** Fetch a withdraw quote from the indexer. */
347
+ getQuote(params: GetQuoteParams): Promise<GetQuoteResponse>;
348
+ fetchCommitments(denomination: number | bigint | string, indexerAsset?: IndexerAsset): Promise<unknown>;
349
+ validateNullifier(nullifierHash: string, indexerAsset?: IndexerAsset): Promise<unknown>;
350
+ fetchTxStatus(commitmentHex: string, nullifierHashHex: string, indexerAsset?: IndexerAsset): Promise<unknown>;
351
+ fetchDepositCountByCommitment(commitment: string, denomination: number | bigint | string, indexerAsset?: IndexerAsset): Promise<unknown>;
352
+ fetchWalletBalance(wallet: string, options?: FetchWalletBalanceOptions): Promise<unknown>;
353
+ /** Re-fetch relayers from the indexer and update {@link config.relayers}. */
354
+ fetchRelayers(): Promise<Relayer[]>;
355
+ fetchLatestTransactions(type?: string, indexerAsset?: IndexerAsset): Promise<unknown>;
356
+ fetchTxCounts(type?: string, indexerAsset?: IndexerAsset): Promise<unknown>;
357
+ normalizePubkeyString(value: unknown): string;
358
+ buildRelayPayload(params: BuildRelayPayloadParams): RelayPayload;
359
+ submitToRelayer(relayerUrl: string, payload: RelayPayload): Promise<unknown>;
360
+ pollRelayerJob(relayerUrl: string, jobId: string, maxWaitMs?: number): Promise<unknown>;
361
+ /**
362
+ * Derives the note encryption key from a wallet signature and stores it on
363
+ * {@link config.encryptKey}. Required before {@link buildDepositTx} with
364
+ * `onChainBackup: true`.
365
+ *
366
+ * Accepts a frontend wallet adapter (`signMessage`) or a backend {@link Keypair}.
367
+ */
368
+ getEncryptionKey(wallet: EncryptKeyWallet): Promise<Uint8Array>;
369
+ encryptData(key: Uint8Array, plaintext: string): Uint8Array<ArrayBufferLike>;
370
+ decryptData(key: Uint8Array, combined: Uint8Array): string;
371
+ generateRandomFieldElement(): bigint;
372
+ createCommitment(nullifier: bigint | number | string, secret: bigint | number | string): bigint;
373
+ createNullifierHash(nullifier: bigint | number | string): bigint;
374
+ generateDepositParams(amountLamports: bigint | number | string, mint?: string | null): GenerateDepositParamsResult;
375
+ parseSecretNote(note: string): Record<string, string>;
376
+ publicKeyToFieldElement(publicKeyBytes: Uint8Array | number[]): bigint;
377
+ amountToFieldElement(amount: bigint | number | string): bigint;
378
+ generateMerkleProof(depositParams: Record<string, unknown>, leaves: unknown[]): unknown;
379
+ generateWithdrawProof(depositParams: Record<string, unknown>, leaves: unknown[], recipient: PublicKey | string, relayer: PublicKey | string, fee: bigint | number | string, refund: bigint | number | string, options?: GenerateWithdrawProofOptions): Promise<unknown>;
380
+ convertProofToBytes(proof: unknown): Promise<number[] | Uint8Array<ArrayBufferLike>>;
381
+ to32ByteBuffer(bigInt: bigint | number | string): Uint8Array<ArrayBufferLike>;
382
+ toFixedHex(value: bigint | number | string, length?: number): string;
383
+ toFieldElementHex(value: bigint | number | string): string;
384
+ formatNoteForDisplay(note: string, segmentLen?: number): string;
385
+ appendIndexerAsset(params: URLSearchParams, indexerAsset?: IndexerAsset): void;
386
+ /** Program ID for a cluster without an SDK instance. */
387
+ static getProgramIdForNetwork(network: Network): string;
388
+ }
389
+
390
+ export { type BuildDepositTxParams as B, type DepositTokenSymbol as D, type EncryptKeyWallet as E, type FetchWalletBalanceOptions as F, type GenerateDepositParamsResult as G, type IndexerAsset as I, type Network as N, type PreparedCircuitArtifacts as P, type Quote as Q, type RelayPayload as R, type TokenDecimalsSymbol as T, VeilixSDK as V, type WithdrawParams as W, type BuildRelayPayloadParams as a, type GenerateWithdrawProofOptions as b, type GetQuoteParams as c, type GetQuoteResponse as d, type QuoteRelayer as e, type QuoteSplit as f, type QuoteTransaction as g, type Relayer as h, type ResolvedNoteAsset as i, type TokenSymbol as j, type VeilixSdkInitOptions as k, type VeilixSdkRuntimeConfig as l, type VeilixTransferDepositFailure as m, type VeilixTransferItem as n, type VeilixTransferOptions as o, type VeilixTransferResult as p, type VeilixTransferWithdrawFailure as q, type WithdrawResult as r, type WithdrawStatus as s, getQuote as t, prepareCircuitArtifacts as u };