@umbra-privacy/sdk 1.0.0

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.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -0
  3. package/dist/addresses-Brzgurv_.d.ts +145 -0
  4. package/dist/addresses-D_0YAS6B.d.cts +145 -0
  5. package/dist/chunk-2Q75CQQJ.js +12 -0
  6. package/dist/chunk-2Q75CQQJ.js.map +1 -0
  7. package/dist/chunk-7QVYU63E.js +6 -0
  8. package/dist/chunk-7QVYU63E.js.map +1 -0
  9. package/dist/chunk-BM7N6N7E.js +1883 -0
  10. package/dist/chunk-BM7N6N7E.js.map +1 -0
  11. package/dist/chunk-GXKSUB2U.cjs +4416 -0
  12. package/dist/chunk-GXKSUB2U.cjs.map +1 -0
  13. package/dist/chunk-HOEXDXRC.cjs +792 -0
  14. package/dist/chunk-HOEXDXRC.cjs.map +1 -0
  15. package/dist/chunk-MDFSBU5W.cjs +2033 -0
  16. package/dist/chunk-MDFSBU5W.cjs.map +1 -0
  17. package/dist/chunk-MQY7HDIA.js +600 -0
  18. package/dist/chunk-MQY7HDIA.js.map +1 -0
  19. package/dist/chunk-MVKTV3FT.cjs +20 -0
  20. package/dist/chunk-MVKTV3FT.cjs.map +1 -0
  21. package/dist/chunk-PG2J6V6Y.js +4094 -0
  22. package/dist/chunk-PG2J6V6Y.js.map +1 -0
  23. package/dist/chunk-PK6SKIKE.cjs +8 -0
  24. package/dist/chunk-PK6SKIKE.cjs.map +1 -0
  25. package/dist/chunk-VEGLTTYQ.cjs +621 -0
  26. package/dist/chunk-VEGLTTYQ.cjs.map +1 -0
  27. package/dist/chunk-WVHQ46DD.js +758 -0
  28. package/dist/chunk-WVHQ46DD.js.map +1 -0
  29. package/dist/constants/index.cjs +316 -0
  30. package/dist/constants/index.cjs.map +1 -0
  31. package/dist/constants/index.d.cts +739 -0
  32. package/dist/constants/index.d.ts +739 -0
  33. package/dist/constants/index.js +193 -0
  34. package/dist/constants/index.js.map +1 -0
  35. package/dist/cryptography-BTGC72u-.d.cts +4809 -0
  36. package/dist/cryptography-BTGC72u-.d.ts +4809 -0
  37. package/dist/errors/index.cjs +141 -0
  38. package/dist/errors/index.cjs.map +1 -0
  39. package/dist/errors/index.d.cts +1415 -0
  40. package/dist/errors/index.d.ts +1415 -0
  41. package/dist/errors/index.js +4 -0
  42. package/dist/errors/index.js.map +1 -0
  43. package/dist/index-B9pDY73x.d.ts +12933 -0
  44. package/dist/index-CLj_zWSD.d.ts +235 -0
  45. package/dist/index-CX6_pIRS.d.cts +235 -0
  46. package/dist/index-D33yo0qB.d.cts +12933 -0
  47. package/dist/index.cjs +22464 -0
  48. package/dist/index.cjs.map +1 -0
  49. package/dist/index.d.cts +11694 -0
  50. package/dist/index.d.ts +11694 -0
  51. package/dist/index.js +22314 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/interfaces/index.cjs +4 -0
  54. package/dist/interfaces/index.cjs.map +1 -0
  55. package/dist/interfaces/index.d.cts +8 -0
  56. package/dist/interfaces/index.d.ts +8 -0
  57. package/dist/interfaces/index.js +3 -0
  58. package/dist/interfaces/index.js.map +1 -0
  59. package/dist/networks-C-orpSFW.d.ts +65 -0
  60. package/dist/networks-FxYERGD1.d.cts +65 -0
  61. package/dist/types/index.cjs +605 -0
  62. package/dist/types/index.cjs.map +1 -0
  63. package/dist/types/index.d.cts +1853 -0
  64. package/dist/types/index.d.ts +1853 -0
  65. package/dist/types/index.js +4 -0
  66. package/dist/types/index.js.map +1 -0
  67. package/dist/types-BBuELtY8.d.cts +495 -0
  68. package/dist/types-n-sHFcgr.d.ts +495 -0
  69. package/dist/utils/index.cjs +1295 -0
  70. package/dist/utils/index.cjs.map +1 -0
  71. package/dist/utils/index.d.cts +9559 -0
  72. package/dist/utils/index.d.ts +9559 -0
  73. package/dist/utils/index.js +6 -0
  74. package/dist/utils/index.js.map +1 -0
  75. package/dist/versions-D9PqsEvj.d.cts +173 -0
  76. package/dist/versions-D9PqsEvj.d.ts +173 -0
  77. package/package.json +151 -0
@@ -0,0 +1,739 @@
1
+ export { A as AltEntry, N as NetworkConfig, g as getNetworkConfig } from '../networks-FxYERGD1.cjs';
2
+ export { A as AlgorithmVersion, a as AlgorithmVersionSpecifierFunction, D as DEFAULT_ALGORITHM_VERSION, b as DEFAULT_NETWORK, c as DEFAULT_PROTOCOL_VERSION, d as DEFAULT_SCHEME_VERSION, N as Network, e as NetworkSpecifierFunction, P as ProtocolVersion, f as ProtocolVersionSpecifierFunction, S as SchemeVersion, g as SchemeVersionSpecifierFunction, h as assertNetwork, i as assertValidAlgorithmVersion, j as assertValidProtocolVersion, k as assertValidSchemeVersion, l as assertValidVersion, m as getDefaultAlgorithmVersion, n as getDefaultProtocolVersion, o as getDefaultSchemeVersion, p as getNetworkSpecifier } from '../versions-D9PqsEvj.cjs';
3
+ import { Address } from '@solana/kit';
4
+ import '../cryptography-BTGC72u-.cjs';
5
+
6
+ /**
7
+ * Arcium Protocol Constants
8
+ *
9
+ * This module contains constants for interacting with the Arcium protocol,
10
+ * including the program address and PDA seed prefixes for various account types.
11
+ *
12
+ * @module constants/arcium
13
+ */
14
+ /**
15
+ * Seed prefix for MXE account PDAs.
16
+ *
17
+ * @remarks
18
+ * Used to derive the MXE account address for a given program.
19
+ */
20
+ declare const ARCIUM_MXE_ACCOUNT_SEED = "MXEAccount";
21
+ /**
22
+ * Seed prefix for mempool account PDAs.
23
+ *
24
+ * @remarks
25
+ * The mempool stores pending computations for a cluster.
26
+ */
27
+ declare const ARCIUM_MEMPOOL_SEED = "Mempool";
28
+ /**
29
+ * Seed prefix for executing pool account PDAs.
30
+ *
31
+ * @remarks
32
+ * The executing pool tracks computations currently being processed.
33
+ */
34
+ declare const ARCIUM_EXEC_POOL_SEED = "Execpool";
35
+ /**
36
+ * Seed prefix for computation account PDAs.
37
+ *
38
+ * @remarks
39
+ * Each computation gets its own account to track state and results.
40
+ */
41
+ declare const ARCIUM_COMPUTATION_SEED = "ComputationAccount";
42
+ /**
43
+ * Seed prefix for computation definition account PDAs.
44
+ *
45
+ * @remarks
46
+ * Computation definitions describe the circuit/program to be executed.
47
+ */
48
+ declare const ARCIUM_COMP_DEF_SEED = "ComputationDefinitionAccount";
49
+ /**
50
+ * Seed prefix for cluster account PDAs.
51
+ *
52
+ * @remarks
53
+ * Clusters are groups of MXE nodes that process computations together.
54
+ */
55
+ declare const ARCIUM_CLUSTER_SEED = "Cluster";
56
+ /**
57
+ * Buffer size for cluster/computation offsets in bytes.
58
+ *
59
+ * @remarks
60
+ * Offsets are encoded as 4-byte little-endian unsigned integers.
61
+ */
62
+ declare const ARCIUM_OFFSET_BUFFER_SIZE = 4;
63
+
64
+ /**
65
+ * Domain Separator Constants
66
+ *
67
+ * Domain separators for cryptographic operations in claim functions.
68
+ * These are used as keys in KMAC256 for domain separation.
69
+ *
70
+ * @module constants/domain-separators
71
+ */
72
+ /**
73
+ * Types of claim operations that require domain separators.
74
+ */
75
+ type ClaimType = "SelfClaimableUtxoIntoPublicBalance" | "SelfClaimableUtxoIntoEncryptedBalance" | "ReceiverClaimableUtxoIntoEncryptedBalance";
76
+ /**
77
+ * Domain separator pair for claim operations.
78
+ */
79
+ interface ClaimDomainSeparators {
80
+ /** Domain separator for modified generation index derivation */
81
+ readonly MODIFIED_GEN_INDEX: string;
82
+ /** Domain separator for expanded generation index derivation */
83
+ readonly EXPANDED_GEN_INDEX: string;
84
+ }
85
+ /**
86
+ * Creates domain separators for a specific claim type.
87
+ *
88
+ * @param claimType - The type of claim operation
89
+ * @returns Domain separator pair for the claim type
90
+ */
91
+ declare function createClaimDomainSeparators(claimType: ClaimType): ClaimDomainSeparators;
92
+ /**
93
+ * Pre-built domain separators for all claim types.
94
+ */
95
+ declare const CLAIM_DOMAINS: {
96
+ /** Domain separators for self-claimable UTXO claims into public balance */
97
+ readonly SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: ClaimDomainSeparators;
98
+ /** Domain separators for self-claimable UTXO claims into encrypted balance */
99
+ readonly SELF_CLAIMABLE_INTO_ENCRYPTED_BALANCE: ClaimDomainSeparators;
100
+ /** Domain separators for receiver-claimable UTXO claims into encrypted balance */
101
+ readonly RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: ClaimDomainSeparators;
102
+ };
103
+ /**
104
+ * Domain separators for linker keystream blinding factor derivation.
105
+ */
106
+ declare const LINKER_KEYSTREAM_DOMAINS: {
107
+ /** Self-claimable UTXO claim into public balance */
108
+ readonly SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: "selfClaimableUtxoIntoPublicBalance / linkerKeystreamBlindingFactor";
109
+ /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */
110
+ readonly RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: "receiverClaimableUtxoIntoEncryptedBalance / linkerKeystreamBlindingFactor";
111
+ };
112
+ /**
113
+ * Domain separators for random factor generation in polynomial commitment.
114
+ */
115
+ declare const RANDOM_FACTOR_DOMAINS: {
116
+ /** Self-claimable UTXO claim into public balance */
117
+ readonly SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: "selfClaimableUtxoIntoPublicBalance / randomFactorForPolynomialCommitment";
118
+ /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */
119
+ readonly RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: "receiverClaimableUtxoIntoEncryptedBalance / randomFactorForPolynomialCommitment";
120
+ };
121
+ /**
122
+ * Domain separators for rescue encryption commitment blinding factor derivation.
123
+ */
124
+ declare const RESCUE_COMMITMENT_DOMAINS: {
125
+ /** Self-claimable UTXO claim into public balance */
126
+ readonly SELF_CLAIMABLE_INTO_PUBLIC_BALANCE: "selfClaimableUtxoIntoPublicBalance / rescueEncryptionCommitmentBlindingFactor";
127
+ /** Receiver-claimable UTXO claim into encrypted balance (also used for self-claimable into encrypted balance) */
128
+ readonly RECEIVER_CLAIMABLE_INTO_ENCRYPTED_BALANCE: "receiverClaimableUtxoIntoEncryptedBalance / rescueEncryptionCommitmentBlindingFactor";
129
+ };
130
+
131
+ /**
132
+ * Encryption Count Constants
133
+ *
134
+ * Constants for encryption operations in claim circuits.
135
+ *
136
+ * @module constants/encryption-counts
137
+ */
138
+ /**
139
+ * Number of linker encryptions per leaf for different claim types.
140
+ */
141
+ declare const LINKER_ENCRYPTIONS_PER_LEAF: {
142
+ /**
143
+ * ATA claims - excludes amount encryption (amounts are public).
144
+ * Encrypts: senderAddressLow, senderAddressHigh, mintAddressLow, mintAddressHigh, leafCommitment
145
+ */
146
+ readonly INTO_ATA: 5;
147
+ /**
148
+ * ETA claims - includes amount encryption.
149
+ * Encrypts: senderAddressLow, senderAddressHigh, amount, mintAddressLow, mintAddressHigh, leafCommitment
150
+ */
151
+ readonly INTO_ETA: 6;
152
+ };
153
+ /**
154
+ * Number of rescue cipher encryptions for different claim types.
155
+ */
156
+ declare const RESCUE_ENCRYPTIONS_COUNT: {
157
+ /**
158
+ * ATA claims - no fee encryption (amounts are public).
159
+ * Encrypts: mvkLow, mvkHigh, randomFactorLow, randomFactorHigh
160
+ */
161
+ readonly WITHOUT_FEES: 4;
162
+ /**
163
+ * ETA claims - includes fee encryption.
164
+ * Encrypts: finalAmount, protocolFees, relayerFees, mvkLow, mvkHigh, randomFactorLow, randomFactorHigh
165
+ */
166
+ readonly WITH_FEES: 7;
167
+ };
168
+ /**
169
+ * KMAC256 output length for 512-bit (64 bytes) output.
170
+ */
171
+ declare const KMAC_512_OUTPUT_LENGTH = 64;
172
+ /**
173
+ * Number of elements in the public aggregated hash input array.
174
+ */
175
+ declare const AGGREGATED_HASH_INPUT_COUNT: {
176
+ /** ATA claims use 45 elements */
177
+ readonly ATA: 45;
178
+ /** ETA claims use 70 elements */
179
+ readonly ETA: 70;
180
+ };
181
+
182
+ /**
183
+ * Solana Program Constants.
184
+ *
185
+ * This module defines well-known Solana program addresses and utility helpers
186
+ * used throughout the Umbra SDK. All addresses are typed as `Address` from
187
+ * `@solana/kit` and validated at module load time by the `address()` constructor,
188
+ * ensuring any typo is caught immediately rather than at runtime.
189
+ *
190
+ * @remarks
191
+ * The constants are organized into three groups:
192
+ *
193
+ * - **Token program IDs** — {@link SPL_TOKEN_PROGRAM_ID} (legacy) and
194
+ * {@link TOKEN_2022_PROGRAM_ID} (extensions). Use the owner field of a
195
+ * token account to determine which program governs it.
196
+ *
197
+ * - **System programs** — {@link SYSTEM_PROGRAM_ID} (SOL transfers and account
198
+ * creation) and {@link ASSOCIATED_TOKEN_PROGRAM_ID} (deterministic ATA
199
+ * derivation).
200
+ *
201
+ * - **Compute Budget** — {@link COMPUTE_BUDGET_PROGRAM_ADDRESS} and the
202
+ * {@link createSetComputeUnitLimitInstruction} helper for raising the per-
203
+ * transaction compute unit cap on Umbra's heavier MPC operations.
204
+ *
205
+ * @packageDocumentation
206
+ */
207
+
208
+ /**
209
+ * SPL Token Program ID (legacy token program).
210
+ *
211
+ * The original SPL Token program that handles standard fungible and non-fungible
212
+ * tokens on Solana. Most established tokens (USDC, BONK, SOL-wrapped assets,
213
+ * etc.) use this program.
214
+ *
215
+ * @remarks
216
+ * This program does NOT support extensions such as transfer fees, interest
217
+ * bearing tokens, or confidential transfers. For tokens that require those
218
+ * features, see {@link TOKEN_2022_PROGRAM_ID}.
219
+ *
220
+ * Use the `owner` field of an on-chain token account to determine which program
221
+ * governs it:
222
+ * - `owner === SPL_TOKEN_PROGRAM_ID` → legacy token account
223
+ * - `owner === TOKEN_2022_PROGRAM_ID` → token-2022 account
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * import { SPL_TOKEN_PROGRAM_ID } from "@umbra-privacy/sdk";
228
+ *
229
+ * // Determine which token program owns an account
230
+ * if (tokenAccount.owner === SPL_TOKEN_PROGRAM_ID) {
231
+ * console.log("Legacy SPL token account — no transfer fees possible");
232
+ * }
233
+ * ```
234
+ *
235
+ * @see {@link TOKEN_2022_PROGRAM_ID} for the newer token extensions program
236
+ * @public
237
+ */
238
+ declare const SPL_TOKEN_PROGRAM_ID: Address;
239
+ /**
240
+ * Token-2022 Program ID (token extensions program).
241
+ *
242
+ * The successor to the original SPL Token program. Token-2022 (also called
243
+ * "Token Extensions") supports a rich set of optional mint and account
244
+ * extensions that enable advanced token mechanics. Each extension is packed
245
+ * into the account data after the standard token fields.
246
+ *
247
+ * @remarks
248
+ * Umbra SDK pays special attention to the **Transfer Fee** extension because it
249
+ * affects the amount that arrives at the destination after a transfer. When
250
+ * depositing a Token-2022 token with active transfer fees, the SDK must
251
+ * calculate the gross amount (net + fee) so the protocol account receives the
252
+ * intended net amount.
253
+ *
254
+ * The active fee schedule is determined by the current epoch: if
255
+ * `currentEpoch >= newerTransferFee.epoch`, the newer schedule is active;
256
+ * otherwise the older schedule applies. Use {@link GetEpochInfo} to fetch the
257
+ * current epoch before performing this calculation.
258
+ *
259
+ * Supported extensions include (but are not limited to):
260
+ * - Transfer Fee — automatic fee withheld on every transfer
261
+ * - Interest Bearing — token balances that accrue interest over time
262
+ * - Non-Transferable — soulbound tokens that cannot be transferred
263
+ * - Permanent Delegate — irrevocable delegate authority on every account
264
+ * - Transfer Hook — arbitrary CPI called on every transfer
265
+ * - Metadata — on-chain token metadata embedded in the mint account
266
+ * - Confidential Transfer — zero-knowledge balance hiding
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * import { TOKEN_2022_PROGRAM_ID } from "@umbra-privacy/sdk";
271
+ *
272
+ * // Check if a mint is governed by Token-2022 before parsing extensions
273
+ * if (mintAccount.owner === TOKEN_2022_PROGRAM_ID) {
274
+ * const feeConfig = extractTransferFeeConfig(mintAccount.data);
275
+ * if (feeConfig) {
276
+ * console.log("Mint has transfer fees — adjust deposit amount accordingly");
277
+ * }
278
+ * }
279
+ * ```
280
+ *
281
+ * @see {@link SPL_TOKEN_PROGRAM_ID} for the legacy token program
282
+ * @public
283
+ */
284
+ declare const TOKEN_2022_PROGRAM_ID: Address;
285
+ /**
286
+ * Solana System Program ID.
287
+ *
288
+ * The native Solana program at address `11111111111111111111111111111111` is
289
+ * responsible for the fundamental account management operations on the network:
290
+ * creating new accounts, allocating data space, assigning account ownership, and
291
+ * transferring lamports (SOL).
292
+ *
293
+ * @remarks
294
+ * Every Solana account that is not yet initialized is implicitly owned by the
295
+ * System Program. Anchor programs typically transfer ownership to their own
296
+ * program ID during the `init` instruction by using the System Program's
297
+ * `createAccount` or `createAccountWithSeed` instructions.
298
+ *
299
+ * In Umbra SDK transaction building, the System Program is included in account
300
+ * metas whenever a new on-chain account needs to be created (e.g., initializing
301
+ * a user's encrypted token account or a pool).
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * import { SYSTEM_PROGRAM_ID } from "@umbra-privacy/sdk";
306
+ *
307
+ * // Include the System Program when an instruction may create accounts
308
+ * const accounts = [
309
+ * { address: payer, role: AccountRole.WRITABLE_SIGNER },
310
+ * { address: newAccount, role: AccountRole.WRITABLE },
311
+ * { address: SYSTEM_PROGRAM_ID, role: AccountRole.READONLY },
312
+ * ];
313
+ * ```
314
+ *
315
+ * @public
316
+ */
317
+ declare const SYSTEM_PROGRAM_ID: Address;
318
+ /**
319
+ * Associated Token Account Program ID.
320
+ *
321
+ * The Associated Token Account (ATA) program provides a canonical, deterministic
322
+ * token account address for any `(wallet, mint, tokenProgram)` triple. Because
323
+ * the address is fully derived from public inputs, any party can compute it
324
+ * without coordination, making ATAs the de facto standard for token accounts on
325
+ * Solana.
326
+ *
327
+ * @remarks
328
+ * The ATA address for a given wallet and mint is derived via PDA seeds:
329
+ * `[wallet, tokenProgramId, mint]` under the ATA program. This derivation is
330
+ * deterministic — the same inputs always produce the same address.
331
+ *
332
+ * When sending tokens to a user for the first time, the sender or a relayer
333
+ * typically creates the recipient's ATA using the ATA program's `create`
334
+ * instruction if it does not already exist. The `getOrCreateAssociatedTokenAccount`
335
+ * pattern is common in Umbra's public (non-confidential) token flows.
336
+ *
337
+ * @example
338
+ * ```typescript
339
+ * import { ASSOCIATED_TOKEN_PROGRAM_ID } from "@umbra-privacy/sdk";
340
+ *
341
+ * // Include when an instruction may create an ATA
342
+ * const accounts = [
343
+ * { address: ASSOCIATED_TOKEN_PROGRAM_ID, role: AccountRole.READONLY },
344
+ * ];
345
+ * ```
346
+ *
347
+ * @public
348
+ */
349
+ declare const ASSOCIATED_TOKEN_PROGRAM_ID: Address;
350
+ /**
351
+ * Solana Compute Budget Program ID.
352
+ *
353
+ * The Compute Budget program allows transactions to modify their compute unit
354
+ * limit and compute unit price. These settings affect transaction prioritization
355
+ * and whether a transaction will succeed within the default compute cap.
356
+ *
357
+ * @remarks
358
+ * Umbra's MPC-backed instructions (encrypted deposits, transfers, claims) are
359
+ * computation-heavy and regularly exceed the default 200,000 compute unit limit.
360
+ * Transactions that include such instructions must prepend a
361
+ * `SetComputeUnitLimit` instruction using {@link createSetComputeUnitLimitInstruction}
362
+ * to raise the cap before the Umbra instruction runs.
363
+ *
364
+ * @see {@link createSetComputeUnitLimitInstruction} for the helper that builds
365
+ * the `SetComputeUnitLimit` instruction targeting this program
366
+ * @public
367
+ */
368
+ declare const COMPUTE_BUDGET_PROGRAM_ADDRESS: Address;
369
+ /**
370
+ * Creates a `SetComputeUnitLimit` instruction for the Solana Compute Budget program.
371
+ *
372
+ * Compute Budget instruction discriminator `2` tells the runtime to override the
373
+ * default per-transaction compute unit limit (200,000 CU) with the specified
374
+ * `units` value. The instruction must appear before any instructions that need
375
+ * the higher limit, typically as the first instruction in the transaction.
376
+ *
377
+ * @remarks
378
+ * **Encoding** — The instruction data is 5 bytes:
379
+ * - Byte 0: discriminator `2` (SetComputeUnitLimit)
380
+ * - Bytes 1–4: `units` encoded as a little-endian `u32`
381
+ *
382
+ * **No accounts** — This instruction requires no account inputs; the `accounts`
383
+ * field is always an empty tuple.
384
+ *
385
+ * **Umbra usage** — Umbra's confidential instructions (encrypted deposits,
386
+ * transfers, claims) are compute-intensive due to ZK proof verification and
387
+ * Arcium MPC bookkeeping. The SDK prepends this instruction to those transactions
388
+ * with a limit of 1,400,000 CU (the maximum allowed per transaction as of this
389
+ * writing).
390
+ *
391
+ * **Maximum value** — The maximum allowed compute unit limit per transaction is
392
+ * 1,400,000. Requesting more will cause the transaction to fail at preflight.
393
+ *
394
+ * @param units - The desired compute unit limit. Must be a non-negative integer
395
+ * no greater than 1,400,000. Values are encoded as little-endian `u32`.
396
+ * @returns A plain instruction object with:
397
+ * - `programAddress`: {@link COMPUTE_BUDGET_PROGRAM_ADDRESS}
398
+ * - `data`: 5-byte `Uint8Array` encoding the `SetComputeUnitLimit` payload
399
+ * - `accounts`: an empty readonly tuple (no accounts needed)
400
+ *
401
+ * @example
402
+ * Adding a compute unit limit to a transaction message:
403
+ * ```typescript
404
+ * import { createSetComputeUnitLimitInstruction } from "@umbra-privacy/sdk";
405
+ * import { appendTransactionMessageInstruction } from "@solana/kit";
406
+ *
407
+ * const cuLimitIx = createSetComputeUnitLimitInstruction(1_400_000);
408
+ *
409
+ * const txMessage = appendTransactionMessageInstruction(cuLimitIx, baseMessage);
410
+ * ```
411
+ *
412
+ * @example
413
+ * Checking the serialized instruction bytes:
414
+ * ```typescript
415
+ * const ix = createSetComputeUnitLimitInstruction(300_000);
416
+ * // ix.data === Uint8Array [2, 224, 147, 4, 0]
417
+ * // 300000 = 0x493E0 → LE bytes: 0xE0, 0x93, 0x04, 0x00
418
+ * ```
419
+ *
420
+ * @see {@link COMPUTE_BUDGET_PROGRAM_ADDRESS} for the program address used
421
+ * @public
422
+ */
423
+ declare function createSetComputeUnitLimitInstruction(units: number): {
424
+ programAddress: Address;
425
+ data: Uint8Array;
426
+ accounts: readonly [];
427
+ };
428
+
429
+ /**
430
+ * Umbra Protocol Constants
431
+ *
432
+ * Defines the configuration constants used when building and validating Umbra protocol
433
+ * instructions on the client side. These constants mirror on-chain values defined in the
434
+ * Anchor program (`programs/umbra/src/`) and must be kept in sync with that source of
435
+ * truth.
436
+ *
437
+ * ## Sections
438
+ *
439
+ * - **Message signing** — the canonical warning text presented to users before their
440
+ * wallet signature is used to derive the master private key.
441
+ * - **Protocol fee configuration** — the fee schedule applied to the protocol's share
442
+ * of each claim or transfer. Set by program admin, enforced on-chain.
443
+ * - **Relayer fee configuration** — the fee schedule applied to the relayer's commission
444
+ * on claim and transfer instructions. Set per-relayer.
445
+ * - **Fee offset configuration** — the `offset` discriminators used when deriving PDAs
446
+ * for fee-related accounts.
447
+ * - **BPS divisor** — the basis-point denominator used in fee arithmetic.
448
+ *
449
+ * @packageDocumentation
450
+ * @module umbra/constants
451
+ */
452
+ /**
453
+ * Canonical message shown to the user before their wallet signature is requested for
454
+ * master key derivation.
455
+ *
456
+ * @remarks
457
+ * Signing this message is the root of the user's key hierarchy. The resulting signature
458
+ * is fed into the SDK's key derivation pipeline to produce the `MasterSeed`, from which
459
+ * all spending keys, viewing keys, and Poseidon private keys are derived.
460
+ *
461
+ * The message is deliberately verbose and alarming to ensure that:
462
+ * 1. Users understand the cryptographic weight of their signature.
463
+ * 2. Phishing sites that silently request this signature cannot hide the operation from
464
+ * an attentive user.
465
+ *
466
+ * The exact string (including surrounding newlines) must not be modified without a
467
+ * corresponding protocol upgrade, because changing the message changes all derived keys
468
+ * for every existing user.
469
+ *
470
+ * @example
471
+ * ```typescript
472
+ * import { UMBRA_MESSAGE_TO_SIGN } from "@umbra-privacy/sdk";
473
+ * import { signMessage } from "@solana/kit";
474
+ *
475
+ * // Present to the user before requesting their signature:
476
+ * console.log(UMBRA_MESSAGE_TO_SIGN);
477
+ *
478
+ * // Obtain the signature and pass it to the key derivation pipeline:
479
+ * const signature = await signer.signMessage(
480
+ * new TextEncoder().encode(UMBRA_MESSAGE_TO_SIGN)
481
+ * );
482
+ * ```
483
+ *
484
+ * @public
485
+ */
486
+ declare const UMBRA_MESSAGE_TO_SIGN = "\nSigning this message is a sensitive cryptographic operation that generates the master key used to derive your private spending keys and decrypt your account balances. This signature acts as the root of your privacy and financial security within the Umbra ecosystem.\n\nYou must ensure that you are interacting with the official Umbra Privacy application or a verified integration. Signing this message on an unverified or malicious site could allow an attacker to gain full control over your funds and expose your entire transaction history.\n";
487
+ /**
488
+ * Default fee schedule applied to the protocol's share of each claim or transfer
489
+ * instruction.
490
+ *
491
+ * @remarks
492
+ * These values mirror the `ProtocolFeesConfiguration` account that is written by the
493
+ * program admin during pool setup. The SDK uses them client-side to:
494
+ *
495
+ * 1. Pre-calculate expected fee amounts before building a transaction, so callers can
496
+ * display accurate fee estimates in the UI.
497
+ * 2. Compute the amount of tokens the user actually receives after fees are deducted
498
+ * from the claimed UTXO.
499
+ *
500
+ * The on-chain program independently validates the actual fee config account, so these
501
+ * client-side defaults act as a best-effort estimate rather than an authoritative source.
502
+ * If the admin updates fee parameters on-chain, callers should fetch the live
503
+ * `ProtocolFeesConfiguration` PDA and override these defaults.
504
+ *
505
+ * ## Fee formula
506
+ *
507
+ * ```
508
+ * fee = clamp(BASE_FEE + floor(amount * BPS / BPS_DIVISOR), LOWER_BOUND, UPPER_BOUND)
509
+ * ```
510
+ *
511
+ * Where `BPS_DIVISOR = 10_000n` (see {@link BPS_DIVISOR}).
512
+ *
513
+ * @example
514
+ * ```typescript
515
+ * import { PROTOCOL_FEE, BPS_DIVISOR } from "@umbra-privacy/sdk";
516
+ *
517
+ * function estimateProtocolFee(amount: bigint): bigint {
518
+ * const bpsFee = (amount * PROTOCOL_FEE.BPS) / BPS_DIVISOR;
519
+ * const rawFee = PROTOCOL_FEE.BASE_FEE + bpsFee;
520
+ * const clamped = rawFee < PROTOCOL_FEE.LOWER_BOUND
521
+ * ? PROTOCOL_FEE.LOWER_BOUND
522
+ * : rawFee > PROTOCOL_FEE.UPPER_BOUND
523
+ * ? PROTOCOL_FEE.UPPER_BOUND
524
+ * : rawFee;
525
+ * return clamped;
526
+ * }
527
+ * ```
528
+ *
529
+ * @see {@link RELAYER_FEE} for the relayer's fee schedule.
530
+ * @see {@link BPS_DIVISOR} for the basis-point denominator.
531
+ * @public
532
+ */
533
+ declare const PROTOCOL_FEE: {
534
+ /**
535
+ * Fixed base fee charged per operation, denominated in the SPL token's smallest unit.
536
+ *
537
+ * @remarks
538
+ * Added to the proportional BPS fee before clamping. A value of `10n` means 10
539
+ * token micro-units (e.g. 0.00001 USDC for a 6-decimal token).
540
+ *
541
+ * @readonly
542
+ */
543
+ readonly BASE_FEE: 10n;
544
+ /**
545
+ * Proportional fee rate expressed in basis points (1 BPS = 0.01%).
546
+ *
547
+ * @remarks
548
+ * `35n` corresponds to 0.35%. Applied to the claimed or transferred amount before
549
+ * adding `BASE_FEE` and clamping to `[LOWER_BOUND, UPPER_BOUND]`.
550
+ *
551
+ * @readonly
552
+ */
553
+ readonly BPS: 35n;
554
+ /**
555
+ * Minimum fee amount. The total fee is never less than this value.
556
+ *
557
+ * @remarks
558
+ * Currently `0n`, meaning there is no enforced minimum beyond the `BASE_FEE`.
559
+ *
560
+ * @readonly
561
+ */
562
+ readonly LOWER_BOUND: 0n;
563
+ /**
564
+ * Maximum fee amount (cap). The total fee is never greater than this value.
565
+ *
566
+ * @remarks
567
+ * Set to `1_000_000n` (one million token micro-units), which equals 1 USDC for a
568
+ * 6-decimal token. This cap prevents runaway fees on very large claims.
569
+ *
570
+ * @readonly
571
+ */
572
+ readonly UPPER_BOUND: bigint;
573
+ };
574
+ /**
575
+ * Default fee schedule applied to the relayer's commission on each claim or transfer
576
+ * instruction that involves a relayer.
577
+ *
578
+ * @remarks
579
+ * These values mirror the `RelayerFeesConfiguration` account associated with a specific
580
+ * relayer. The SDK uses them client-side for fee estimation and for constructing the
581
+ * `expected_fee` field that is verified on-chain during MPC computation.
582
+ *
583
+ * Note that `BASE_FEE` is `0n` for relayers by default — relayers are compensated
584
+ * entirely through the proportional BPS component, unlike the protocol which charges a
585
+ * fixed base fee on top of BPS.
586
+ *
587
+ * ## Fee formula
588
+ *
589
+ * ```
590
+ * relayerFee = clamp(BASE_FEE + floor(amount * BPS / BPS_DIVISOR), LOWER_BOUND, UPPER_BOUND)
591
+ * ```
592
+ *
593
+ * @example
594
+ * ```typescript
595
+ * import { RELAYER_FEE, BPS_DIVISOR } from "@umbra-privacy/sdk";
596
+ *
597
+ * function estimateRelayerFee(amount: bigint): bigint {
598
+ * const bpsFee = (amount * RELAYER_FEE.BPS) / BPS_DIVISOR;
599
+ * const rawFee = RELAYER_FEE.BASE_FEE + bpsFee;
600
+ * return rawFee > RELAYER_FEE.UPPER_BOUND ? RELAYER_FEE.UPPER_BOUND : rawFee;
601
+ * }
602
+ * ```
603
+ *
604
+ * @see {@link PROTOCOL_FEE} for the protocol's fee schedule.
605
+ * @see {@link BPS_DIVISOR} for the basis-point denominator.
606
+ * @public
607
+ */
608
+ declare const RELAYER_FEE: {
609
+ /**
610
+ * Fixed base fee for relayer operations, denominated in the SPL token's smallest unit.
611
+ *
612
+ * @remarks
613
+ * `0n` — relayers do not charge a fixed base fee; they earn purely through BPS.
614
+ *
615
+ * @readonly
616
+ */
617
+ readonly BASE_FEE: 0n;
618
+ /**
619
+ * Proportional fee rate for the relayer, expressed in basis points (1 BPS = 0.01%).
620
+ *
621
+ * @remarks
622
+ * `35n` corresponds to 0.35%. The relayer earns this percentage of the claimed amount
623
+ * as compensation for submitting and funding the MPC callback transaction.
624
+ *
625
+ * @readonly
626
+ */
627
+ readonly BPS: 35n;
628
+ /**
629
+ * Minimum relayer fee. Currently `0n`.
630
+ *
631
+ * @readonly
632
+ */
633
+ readonly LOWER_BOUND: 0n;
634
+ /**
635
+ * Maximum relayer fee (cap). `1_000_000n` token micro-units.
636
+ *
637
+ * @remarks
638
+ * Mirrors the protocol fee cap to ensure the combined fee never exceeds a predictable
639
+ * maximum, protecting users from paying unexpectedly large fees on large claims.
640
+ *
641
+ * @readonly
642
+ */
643
+ readonly UPPER_BOUND: bigint;
644
+ };
645
+ /**
646
+ * Offset discriminators used when deriving PDAs for fee-related on-chain accounts.
647
+ *
648
+ * @remarks
649
+ * The Umbra program uses an `offset` field in PDA seeds to allow multiple independent
650
+ * instances of the same account type to coexist (e.g. multiple fee pools for future
651
+ * protocol versions). The offset is encoded as a `U128` little-endian byte array and
652
+ * appended as the final seed when calling `getProgramDerivedAddress`.
653
+ *
654
+ * All offsets are currently `0n` because the protocol uses a single canonical instance
655
+ * of each fee account type. Future upgrades may introduce non-zero offsets for versioned
656
+ * account sets.
657
+ *
658
+ * These values are passed directly to PDA derivation helpers such as
659
+ * `getProtocolOnlyUnifiedFeesPoolPda`, `getRelayerUnifiedFeesPoolPda`, and
660
+ * `getProtocolFeesConfigurationPda`.
661
+ *
662
+ * @example
663
+ * ```typescript
664
+ * import { FEE_OFFSETS } from "@umbra-privacy/sdk";
665
+ * import { getProtocolFeesConfigurationPda } from "@umbra-privacy/sdk/pda";
666
+ *
667
+ * const [feeConfigPda] = await getProtocolFeesConfigurationPda(
668
+ * instructionSeed as U128,
669
+ * mintAddress,
670
+ * FEE_OFFSETS.PROTOCOL_FEES_CONFIG as U128,
671
+ * programId,
672
+ * );
673
+ * ```
674
+ *
675
+ * @see {@link getProtocolOnlyUnifiedFeesPoolPda} for protocol-only pool PDA derivation.
676
+ * @see {@link getRelayerUnifiedFeesPoolPda} for relayer pool PDA derivation.
677
+ * @see {@link getProtocolFeesConfigurationPda} for fee config PDA derivation.
678
+ * @public
679
+ */
680
+ declare const FEE_OFFSETS: {
681
+ /**
682
+ * Offset used in `UnifiedFeesPool` PDA derivation for the unified protocol fees pool.
683
+ *
684
+ * @remarks
685
+ * Passed as the final seed to `getProtocolOnlyUnifiedFeesPoolPda` and
686
+ * `getRelayerUnifiedFeesPoolPda`. Currently `0n`.
687
+ *
688
+ * @readonly
689
+ */
690
+ readonly PROTOCOL_FEES_POOL: 0n;
691
+ /**
692
+ * Offset used in `ProtocolFeesConfiguration` PDA derivation.
693
+ *
694
+ * @remarks
695
+ * Passed as the final seed to `getProtocolFeesConfigurationPda`. Currently `0n`.
696
+ *
697
+ * @readonly
698
+ */
699
+ readonly PROTOCOL_FEES_CONFIG: 0n;
700
+ /**
701
+ * Offset used in relayer fee configuration PDA derivation.
702
+ *
703
+ * @remarks
704
+ * Passed as the offset seed when looking up the relayer's fee configuration account.
705
+ * Currently `0n`.
706
+ *
707
+ * @readonly
708
+ */
709
+ readonly RELAYER_FEES_CONFIG: 0n;
710
+ };
711
+ /**
712
+ * Denominator for basis-point fee calculations.
713
+ *
714
+ * @remarks
715
+ * Basis points (BPS) express a fee rate as an integer fraction of 10,000.
716
+ * For example, 35 BPS = 35 / 10,000 = 0.35%.
717
+ *
718
+ * To convert a BPS fee rate to a proportional fee amount:
719
+ * ```
720
+ * proportionalFee = floor(amount * bps / BPS_DIVISOR)
721
+ * ```
722
+ *
723
+ * Using integer division (`/` on `bigint`) automatically floors the result, which is
724
+ * the correct behaviour for fee deductions (always round down in favour of the user).
725
+ *
726
+ * @example
727
+ * ```typescript
728
+ * import { BPS_DIVISOR, PROTOCOL_FEE } from "@umbra-privacy/sdk";
729
+ *
730
+ * const amount = 1_000_000n; // 1 USDC in micro-units
731
+ * const proportionalFee = (amount * PROTOCOL_FEE.BPS) / BPS_DIVISOR;
732
+ * // proportionalFee = 1_000_000n * 35n / 10_000n = 3_500n (0.0035 USDC)
733
+ * ```
734
+ *
735
+ * @public
736
+ */
737
+ declare const BPS_DIVISOR = 10000n;
738
+
739
+ export { AGGREGATED_HASH_INPUT_COUNT, ARCIUM_CLUSTER_SEED, ARCIUM_COMPUTATION_SEED, ARCIUM_COMP_DEF_SEED, ARCIUM_EXEC_POOL_SEED, ARCIUM_MEMPOOL_SEED, ARCIUM_MXE_ACCOUNT_SEED, ARCIUM_OFFSET_BUFFER_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, BPS_DIVISOR, CLAIM_DOMAINS, COMPUTE_BUDGET_PROGRAM_ADDRESS, type ClaimDomainSeparators, type ClaimType, FEE_OFFSETS, KMAC_512_OUTPUT_LENGTH, LINKER_ENCRYPTIONS_PER_LEAF, LINKER_KEYSTREAM_DOMAINS, PROTOCOL_FEE, RANDOM_FACTOR_DOMAINS, RELAYER_FEE, RESCUE_COMMITMENT_DOMAINS, RESCUE_ENCRYPTIONS_COUNT, SPL_TOKEN_PROGRAM_ID, SYSTEM_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, UMBRA_MESSAGE_TO_SIGN, createClaimDomainSeparators, createSetComputeUnitLimitInstruction };