@umbra-privacy/sdk 1.0.0 → 2.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 (181) hide show
  1. package/README.md +104 -25
  2. package/dist/{addresses-Brzgurv_.d.ts → addresses-B7HybtbJ.d.ts} +2 -1
  3. package/dist/{addresses-D_0YAS6B.d.cts → addresses-CTVY1oi7.d.cts} +2 -1
  4. package/dist/arcium-BXXlryfe.d.cts +20 -0
  5. package/dist/arcium-BXXlryfe.d.ts +20 -0
  6. package/dist/chunk-4RHXVBNI.js +203 -0
  7. package/dist/chunk-4RHXVBNI.js.map +1 -0
  8. package/dist/chunk-4TZVXB5G.js +324 -0
  9. package/dist/chunk-4TZVXB5G.js.map +1 -0
  10. package/dist/chunk-5GUSMQ74.cjs +549 -0
  11. package/dist/chunk-5GUSMQ74.cjs.map +1 -0
  12. package/dist/chunk-5KPQXPQM.js +36 -0
  13. package/dist/chunk-5KPQXPQM.js.map +1 -0
  14. package/dist/chunk-AXD7LXYY.cjs +405 -0
  15. package/dist/chunk-AXD7LXYY.cjs.map +1 -0
  16. package/dist/{chunk-HOEXDXRC.cjs → chunk-BL6WXLPV.cjs} +32 -360
  17. package/dist/chunk-BL6WXLPV.cjs.map +1 -0
  18. package/dist/chunk-CFFLOE7D.cjs +598 -0
  19. package/dist/chunk-CFFLOE7D.cjs.map +1 -0
  20. package/dist/{chunk-BM7N6N7E.js → chunk-CFTW5WNG.js} +3 -325
  21. package/dist/chunk-CFTW5WNG.js.map +1 -0
  22. package/dist/chunk-DD2WCK4C.js +327 -0
  23. package/dist/chunk-DD2WCK4C.js.map +1 -0
  24. package/dist/chunk-DMPMQ74B.cjs +246 -0
  25. package/dist/chunk-DMPMQ74B.cjs.map +1 -0
  26. package/dist/{chunk-2Q75CQQJ.js → chunk-EEKF4553.js} +2 -2
  27. package/dist/chunk-EEKF4553.js.map +1 -0
  28. package/dist/chunk-ENVYYEM4.cjs +113 -0
  29. package/dist/chunk-ENVYYEM4.cjs.map +1 -0
  30. package/dist/chunk-FQX6ZYGJ.js +500 -0
  31. package/dist/chunk-FQX6ZYGJ.js.map +1 -0
  32. package/dist/chunk-FSK2ICMB.cjs +39 -0
  33. package/dist/chunk-FSK2ICMB.cjs.map +1 -0
  34. package/dist/chunk-FZYWLQAF.cjs +355 -0
  35. package/dist/chunk-FZYWLQAF.cjs.map +1 -0
  36. package/dist/chunk-GP26R377.js +436 -0
  37. package/dist/chunk-GP26R377.js.map +1 -0
  38. package/dist/chunk-HA5FLM63.js +393 -0
  39. package/dist/chunk-HA5FLM63.js.map +1 -0
  40. package/dist/chunk-INJ73LXQ.js +1107 -0
  41. package/dist/chunk-INJ73LXQ.js.map +1 -0
  42. package/dist/chunk-JPDF7BIT.cjs +10892 -0
  43. package/dist/chunk-JPDF7BIT.cjs.map +1 -0
  44. package/dist/{chunk-MDFSBU5W.cjs → chunk-LTCKPTZC.cjs} +2 -351
  45. package/dist/chunk-LTCKPTZC.cjs.map +1 -0
  46. package/dist/chunk-MKNCBUFA.js +564 -0
  47. package/dist/chunk-MKNCBUFA.js.map +1 -0
  48. package/dist/chunk-NKVMSABR.cjs +207 -0
  49. package/dist/chunk-NKVMSABR.cjs.map +1 -0
  50. package/dist/chunk-OFDWNWCL.js +70 -0
  51. package/dist/chunk-OFDWNWCL.js.map +1 -0
  52. package/dist/chunk-QJAUUYZU.cjs +331 -0
  53. package/dist/chunk-QJAUUYZU.cjs.map +1 -0
  54. package/dist/chunk-RVUYPKKD.js +10750 -0
  55. package/dist/chunk-RVUYPKKD.js.map +1 -0
  56. package/dist/chunk-TLR7A64G.js +103 -0
  57. package/dist/chunk-TLR7A64G.js.map +1 -0
  58. package/dist/{chunk-MVKTV3FT.cjs → chunk-TQQZGNOI.cjs} +2 -2
  59. package/dist/chunk-TQQZGNOI.cjs.map +1 -0
  60. package/dist/chunk-UOFYS6M3.js +219 -0
  61. package/dist/chunk-UOFYS6M3.js.map +1 -0
  62. package/dist/chunk-UXMQI6B7.js +2406 -0
  63. package/dist/chunk-UXMQI6B7.js.map +1 -0
  64. package/dist/chunk-WN75ORDT.js +571 -0
  65. package/dist/chunk-WN75ORDT.js.map +1 -0
  66. package/dist/chunk-Y55PYKXH.cjs +595 -0
  67. package/dist/chunk-Y55PYKXH.cjs.map +1 -0
  68. package/dist/chunk-YEZBTYCP.cjs +77 -0
  69. package/dist/chunk-YEZBTYCP.cjs.map +1 -0
  70. package/dist/chunk-ZQOIYCGA.cjs +1126 -0
  71. package/dist/chunk-ZQOIYCGA.cjs.map +1 -0
  72. package/dist/chunk-ZY3TSHMJ.cjs +2665 -0
  73. package/dist/chunk-ZY3TSHMJ.cjs.map +1 -0
  74. package/dist/client-DkVBHMWb.d.cts +2613 -0
  75. package/dist/client-V4AF6Bz9.d.ts +2613 -0
  76. package/dist/common/pda/index.cjs +145 -0
  77. package/dist/common/pda/index.cjs.map +1 -0
  78. package/dist/common/pda/index.d.cts +1250 -0
  79. package/dist/common/pda/index.d.ts +1250 -0
  80. package/dist/common/pda/index.js +8 -0
  81. package/dist/common/pda/index.js.map +1 -0
  82. package/dist/constants/index.cjs +38 -164
  83. package/dist/constants/index.cjs.map +1 -1
  84. package/dist/constants/index.d.cts +8 -425
  85. package/dist/constants/index.d.ts +8 -425
  86. package/dist/constants/index.js +15 -124
  87. package/dist/constants/index.js.map +1 -1
  88. package/dist/crypto/index.cjs +583 -0
  89. package/dist/crypto/index.cjs.map +1 -0
  90. package/dist/crypto/index.d.cts +6731 -0
  91. package/dist/crypto/index.d.ts +6731 -0
  92. package/dist/crypto/index.js +14 -0
  93. package/dist/crypto/index.js.map +1 -0
  94. package/dist/{cryptography-BTGC72u-.d.ts → cryptography-BFSJcvi6.d.ts} +3 -2465
  95. package/dist/{cryptography-BTGC72u-.d.cts → cryptography-D6tPDh-Y.d.cts} +3 -2465
  96. package/dist/errors/index.cjs +64 -54
  97. package/dist/errors/index.d.cts +7 -797
  98. package/dist/errors/index.d.ts +7 -797
  99. package/dist/errors/index.js +3 -1
  100. package/dist/errors-B9EoPeWV.d.cts +593 -0
  101. package/dist/errors-B9EoPeWV.d.ts +593 -0
  102. package/dist/errors-DAIrstEL.d.cts +300 -0
  103. package/dist/errors-DPNMfyh0.d.ts +300 -0
  104. package/dist/index-BG0yjL7C.d.cts +6006 -0
  105. package/dist/index-ByynoyBO.d.ts +6006 -0
  106. package/dist/index.cjs +5126 -16118
  107. package/dist/index.cjs.map +1 -1
  108. package/dist/index.d.cts +1031 -7685
  109. package/dist/index.d.ts +1031 -7685
  110. package/dist/index.js +3219 -14905
  111. package/dist/index.js.map +1 -1
  112. package/dist/interfaces/index.d.cts +14 -6
  113. package/dist/interfaces/index.d.ts +14 -6
  114. package/dist/interfaces-43cReBcS.d.cts +3346 -0
  115. package/dist/interfaces-B8xKNl_6.d.ts +997 -0
  116. package/dist/interfaces-D2NO6kDD.d.cts +997 -0
  117. package/dist/interfaces-z_xYJlgV.d.ts +3346 -0
  118. package/dist/math/index.cjs +115 -0
  119. package/dist/math/index.cjs.map +1 -0
  120. package/dist/math/index.d.cts +1327 -0
  121. package/dist/math/index.d.ts +1327 -0
  122. package/dist/math/index.js +10 -0
  123. package/dist/math/index.js.map +1 -0
  124. package/dist/networks-RMd3abPE.d.ts +44 -0
  125. package/dist/networks-yAoO8peQ.d.cts +44 -0
  126. package/dist/relayer-NRRMSMNB.js +4 -0
  127. package/dist/relayer-NRRMSMNB.js.map +1 -0
  128. package/dist/relayer-RJHEIXJG.cjs +21 -0
  129. package/dist/relayer-RJHEIXJG.cjs.map +1 -0
  130. package/dist/solana/index.cjs +56 -0
  131. package/dist/solana/index.cjs.map +1 -0
  132. package/dist/solana/index.d.cts +105 -0
  133. package/dist/solana/index.d.ts +105 -0
  134. package/dist/solana/index.js +7 -0
  135. package/dist/solana/index.js.map +1 -0
  136. package/dist/{index-CLj_zWSD.d.ts → temporal-BbRaEPoO.d.ts} +1 -1
  137. package/dist/{index-CX6_pIRS.d.cts → temporal-oUj7iCaq.d.cts} +1 -1
  138. package/dist/transaction-forwarder-5mAMTjw6.d.ts +1155 -0
  139. package/dist/transaction-forwarder-C6gMUG7a.d.cts +1155 -0
  140. package/dist/types/index.cjs +232 -231
  141. package/dist/types/index.d.cts +15 -1485
  142. package/dist/types/index.d.ts +15 -1485
  143. package/dist/types/index.js +2 -1
  144. package/dist/types-BohhvPth.d.cts +87 -0
  145. package/dist/types-CW0oTT0j.d.ts +87 -0
  146. package/dist/types-C_V_CaKK.d.cts +2468 -0
  147. package/dist/types-C_V_CaKK.d.ts +2468 -0
  148. package/dist/types-Ca7frykr.d.ts +793 -0
  149. package/dist/types-CuKeoI19.d.cts +1296 -0
  150. package/dist/types-CxfTIpN9.d.ts +1052 -0
  151. package/dist/{types-n-sHFcgr.d.ts → types-D1jDUjfN.d.ts} +2 -2
  152. package/dist/types-DKEDUlH9.d.ts +1296 -0
  153. package/dist/types-EKuIfxTz.d.cts +1052 -0
  154. package/dist/{types-BBuELtY8.d.cts → types-IMGYmlv-.d.cts} +2 -2
  155. package/dist/types-PwNLi_2k.d.cts +793 -0
  156. package/dist/utils/index.cjs +823 -525
  157. package/dist/utils/index.d.cts +1711 -4021
  158. package/dist/utils/index.d.ts +1711 -4021
  159. package/dist/utils/index.js +9 -3
  160. package/dist/{versions-D9PqsEvj.d.cts → versions-BRlR36EA.d.cts} +1 -0
  161. package/dist/{versions-D9PqsEvj.d.ts → versions-BRlR36EA.d.ts} +1 -0
  162. package/package.json +79 -18
  163. package/dist/chunk-2Q75CQQJ.js.map +0 -1
  164. package/dist/chunk-BM7N6N7E.js.map +0 -1
  165. package/dist/chunk-GXKSUB2U.cjs +0 -4416
  166. package/dist/chunk-GXKSUB2U.cjs.map +0 -1
  167. package/dist/chunk-HOEXDXRC.cjs.map +0 -1
  168. package/dist/chunk-MDFSBU5W.cjs.map +0 -1
  169. package/dist/chunk-MQY7HDIA.js +0 -600
  170. package/dist/chunk-MQY7HDIA.js.map +0 -1
  171. package/dist/chunk-MVKTV3FT.cjs.map +0 -1
  172. package/dist/chunk-PG2J6V6Y.js +0 -4094
  173. package/dist/chunk-PG2J6V6Y.js.map +0 -1
  174. package/dist/chunk-VEGLTTYQ.cjs +0 -621
  175. package/dist/chunk-VEGLTTYQ.cjs.map +0 -1
  176. package/dist/chunk-WVHQ46DD.js +0 -758
  177. package/dist/chunk-WVHQ46DD.js.map +0 -1
  178. package/dist/index-B9pDY73x.d.ts +0 -12933
  179. package/dist/index-D33yo0qB.d.cts +0 -12933
  180. package/dist/networks-C-orpSFW.d.ts +0 -65
  181. package/dist/networks-FxYERGD1.d.cts +0 -65
@@ -0,0 +1,1250 @@
1
+ import { Address } from '@solana/kit';
2
+ import { R as RcEncryptionNonce } from '../../cryptography-D6tPDh-Y.cjs';
3
+ import { U as U128 } from '../../types-C_V_CaKK.cjs';
4
+
5
+ /**
6
+ * User PDA Utilities
7
+ *
8
+ * This module provides functions to derive Program Derived Addresses (PDAs)
9
+ * for user-related accounts in the Umbra protocol.
10
+ *
11
+ * @remarks
12
+ * Umbra users have two distinct on-chain account types, both stored as
13
+ * Arcium-encrypted accounts so their contents are opaque to on-chain
14
+ * observers:
15
+ *
16
+ * - **`EncryptedUserAccount`** — stores the user's protocol-level state,
17
+ * including their registered X25519 public key and account generation index.
18
+ * Created once per user wallet via `RegisterUser`. Referenced by all
19
+ * confidential and compliance instructions that need to look up the user's
20
+ * encryption key.
21
+ *
22
+ * - **`EncryptedTokenAccount`** — stores the user's encrypted SPL token
23
+ * balance for a specific mint. Created once per `(user, mint)` pair via
24
+ * `InitialiseUserTokenAccount`. Modified by deposit, withdrawal, transfer,
25
+ * and claim instructions.
26
+ *
27
+ * Both PDAs are keyed under the Umbra program address (not the Arcium program)
28
+ * because the Umbra program owns and manages these accounts through its
29
+ * instruction handlers and Arcium callbacks.
30
+ *
31
+ * @see {@link findEncryptedUserAccountPda}
32
+ * @see {@link findEncryptedTokenAccountPda}
33
+ *
34
+ * @packageDocumentation
35
+ * @since 2.0.0
36
+ * @module utils/pda/user
37
+ */
38
+
39
+ /**
40
+ * Derives the Program Derived Address for an encrypted user account.
41
+ * Seeds: [EncryptedUserAccount::SEED, user_pubkey]
42
+ *
43
+ * The `EncryptedUserAccount` is the user's top-level protocol identity
44
+ * within Umbra. It is a singleton per user wallet and stores the user's
45
+ * registered X25519 public key and account generation index.
46
+ *
47
+ * @param userPubkey - The user's wallet public key (Solana Ed25519 address).
48
+ * @param umbraProgram - The Umbra program address.
49
+ * @returns A Promise resolving to the derived PDA `Address`.
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * import { findEncryptedUserAccountPda } from "@umbra-privacy/sdk";
54
+ *
55
+ * const userAccountPda = await findEncryptedUserAccountPda(
56
+ * userWalletAddress,
57
+ * networkConfig.programId,
58
+ * );
59
+ * ```
60
+ *
61
+ * @see {@link findEncryptedTokenAccountPda} for per-mint encrypted balance accounts
62
+ *
63
+ * @public
64
+ */
65
+ declare function findEncryptedUserAccountPda(userPubkey: Address, umbraProgram: Address): Promise<Address>;
66
+ /**
67
+ * Derives the Program Derived Address for an encrypted token account.
68
+ * Seeds: [EncryptedTokenAccount::SEED, user_pubkey, mint_pubkey]
69
+ *
70
+ * The `EncryptedTokenAccount` holds the user's encrypted SPL token
71
+ * balance for a specific mint. A separate account exists for each
72
+ * `(user, mint)` pair.
73
+ *
74
+ * @param userPubkey - The user's wallet public key (Solana Ed25519 address).
75
+ * @param mintPubkey - The SPL token mint address.
76
+ * @param umbraProgram - The Umbra program address.
77
+ * @returns A Promise resolving to the derived PDA `Address`.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * import { findEncryptedTokenAccountPda } from "@umbra-privacy/sdk";
82
+ *
83
+ * const tokenAccountPda = await findEncryptedTokenAccountPda(
84
+ * userWalletAddress,
85
+ * usdcMint,
86
+ * networkConfig.programId,
87
+ * );
88
+ * ```
89
+ *
90
+ * @see {@link findEncryptedUserAccountPda} for the top-level user identity account
91
+ * @see {@link findTokenPoolPda} for the per-mint pool configuration that governs this account's features
92
+ *
93
+ * @public
94
+ */
95
+ declare function findEncryptedTokenAccountPda(userPubkey: Address, mintPubkey: Address, umbraProgram: Address): Promise<Address>;
96
+
97
+ /**
98
+ * Arcium PDA (Program Derived Address) Generator Utilities
99
+ *
100
+ * This module provides functions for deriving Arcium protocol account addresses.
101
+ * These PDAs are used to locate various Arcium accounts on-chain, including
102
+ * MXE accounts, computation accounts, and cluster accounts.
103
+ *
104
+ * @see {@link findArciumMxePda}
105
+ * @see {@link findArciumMempoolPda}
106
+ * @see {@link findArciumExecutingPoolPda}
107
+ * @see {@link findArciumComputationPda}
108
+ * @see {@link findArciumCompDefPda}
109
+ * @see {@link findArciumClusterPda}
110
+ * @see {@link findArciumInfrastructurePdas}
111
+ * @see {@link computeCompDefOffset}
112
+ *
113
+ * @packageDocumentation
114
+ * @since 2.0.0
115
+ * @module utils/pda/arcium
116
+ */
117
+
118
+ /**
119
+ * Computes the computation definition offset from an Arcium instruction name.
120
+ *
121
+ * The comp-def offset uniquely identifies which comp-def account corresponds
122
+ * to a given Umbra instruction. It is derived deterministically by taking the
123
+ * SHA-256 hash of the instruction name and interpreting the first four bytes
124
+ * as a little-endian u32.
125
+ *
126
+ * @param instructionName - The Arcium instruction name in snake_case format
127
+ * (e.g. `"register_user"`, `"deposit_into_existing_mxe_v3"`).
128
+ * @returns The computation definition offset as an unsigned 32-bit integer.
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * import { computeCompDefOffset } from "@umbra-privacy/sdk";
133
+ *
134
+ * const offset = computeCompDefOffset("register_user");
135
+ *
136
+ * const compDefPda = await findArciumCompDefPda(
137
+ * networkConfig.programId,
138
+ * networkConfig.arciumProgramAddress,
139
+ * offset,
140
+ * );
141
+ * ```
142
+ *
143
+ * @see {@link findArciumCompDefPda} for deriving the full comp-def PDA
144
+ * @see {@link findArciumInfrastructurePdas} for deriving all Arcium accounts at once
145
+ *
146
+ * @public
147
+ */
148
+ declare function computeCompDefOffset(instructionName: string): number;
149
+ /**
150
+ * Derives the Program Derived Address for the Arcium MXE registration account.
151
+ * Seeds: [ARCIUM_MXE_ACCOUNT_SEED, umbra_program_pubkey] (against Arcium program)
152
+ *
153
+ * The MXE account is the Arcium protocol's main registration account for a
154
+ * guest program (Umbra). Required as a read-only account on every
155
+ * Arcium-integrated instruction.
156
+ *
157
+ * @param umbraProgram - The Umbra program address.
158
+ * @param arciumProgram - The Arcium program address.
159
+ * @returns A Promise resolving to the derived MXE account `Address`.
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * import { findArciumMxePda } from "@umbra-privacy/sdk";
164
+ *
165
+ * const mxeAccount = await findArciumMxePda(
166
+ * networkConfig.programId,
167
+ * networkConfig.arciumProgramAddress,
168
+ * );
169
+ * ```
170
+ *
171
+ * @see {@link findArciumInfrastructurePdas} for deriving all Arcium accounts at once
172
+ *
173
+ * @public
174
+ */
175
+ declare function findArciumMxePda(umbraProgram: Address, arciumProgram: Address): Promise<Address>;
176
+ /**
177
+ * Derives the Program Derived Address for an Arcium cluster mempool account.
178
+ * Seeds: [ARCIUM_MEMPOOL_SEED, cluster_offset_u32_le] (against Arcium program)
179
+ *
180
+ * The mempool account is a queue that holds pending computation requests
181
+ * waiting to be picked up by cluster nodes.
182
+ *
183
+ * @param arciumProgram - The Arcium program address.
184
+ * @param clusterOffset - The cluster offset (u32).
185
+ * @returns A Promise resolving to the derived mempool account `Address`.
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * import { findArciumMempoolPda } from "@umbra-privacy/sdk";
190
+ *
191
+ * const mempoolAccount = await findArciumMempoolPda(
192
+ * networkConfig.arciumProgramAddress,
193
+ * networkConfig.clusterOffset,
194
+ * );
195
+ * ```
196
+ *
197
+ * @see {@link findArciumClusterPda} for the parent cluster account
198
+ *
199
+ * @public
200
+ */
201
+ declare function findArciumMempoolPda(arciumProgram: Address, clusterOffset: number): Promise<Address>;
202
+ /**
203
+ * Derives the Program Derived Address for an Arcium cluster executing pool account.
204
+ * Seeds: [ARCIUM_EXEC_POOL_SEED, cluster_offset_u32_le] (against Arcium program)
205
+ *
206
+ * The executing pool account tracks computations currently being processed
207
+ * by cluster nodes.
208
+ *
209
+ * @param arciumProgram - The Arcium program address.
210
+ * @param clusterOffset - The cluster offset (u32).
211
+ * @returns A Promise resolving to the derived executing pool account `Address`.
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * import { findArciumExecutingPoolPda } from "@umbra-privacy/sdk";
216
+ *
217
+ * const execPoolAccount = await findArciumExecutingPoolPda(
218
+ * networkConfig.arciumProgramAddress,
219
+ * networkConfig.clusterOffset,
220
+ * );
221
+ * ```
222
+ *
223
+ * @see {@link findArciumMempoolPda} for the pending computation queue
224
+ * @see {@link findArciumClusterPda} for the parent cluster account
225
+ *
226
+ * @public
227
+ */
228
+ declare function findArciumExecutingPoolPda(arciumProgram: Address, clusterOffset: number): Promise<Address>;
229
+ /**
230
+ * Derives the Program Derived Address for an individual Arcium computation account.
231
+ * Seeds: [ARCIUM_COMPUTATION_SEED, cluster_offset_u32_le, computation_offset_u64_le] (against Arcium program)
232
+ *
233
+ * Each computation request gets its own account that stores the computation's
234
+ * state. Created by `queue_computation` and closed when the callback executes.
235
+ *
236
+ * @param arciumProgram - The Arcium program address.
237
+ * @param clusterOffset - The cluster offset (u32).
238
+ * @param computationOffset - The computation offset (u64).
239
+ * @returns A Promise resolving to the derived computation account `Address`.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * import { findArciumComputationPda } from "@umbra-privacy/sdk";
244
+ *
245
+ * const computationAccount = await findArciumComputationPda(
246
+ * networkConfig.arciumProgramAddress,
247
+ * networkConfig.clusterOffset,
248
+ * computationOffset,
249
+ * );
250
+ * ```
251
+ *
252
+ * @see {@link findArciumInfrastructurePdas} for deriving all required accounts at once
253
+ * @see {@link findArciumCompDefPda} for the computation definition account
254
+ *
255
+ * @public
256
+ */
257
+ declare function findArciumComputationPda(arciumProgram: Address, clusterOffset: number, computationOffset: bigint): Promise<Address>;
258
+ /**
259
+ * Derives the Program Derived Address for an Arcium computation definition account.
260
+ * Seeds: [ARCIUM_COMP_DEF_SEED, umbra_program_pubkey, comp_def_offset_u32_le] (against Arcium program)
261
+ *
262
+ * A computation definition account stores the encrypted circuit program that
263
+ * cluster nodes execute for a specific Arcium instruction. One comp-def
264
+ * account exists per Umbra instruction that uses Arcium MPC.
265
+ *
266
+ * @param umbraProgram - The Umbra program address.
267
+ * @param arciumProgram - The Arcium program address.
268
+ * @param compDefOffset - The computation definition offset, derived via
269
+ * `computeCompDefOffset(instructionName)`.
270
+ * @returns A Promise resolving to the derived comp-def account `Address`.
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * import { computeCompDefOffset, findArciumCompDefPda } from "@umbra-privacy/sdk";
275
+ *
276
+ * const offset = computeCompDefOffset("deposit_into_existing_mxe_v3");
277
+ * const compDefAccount = await findArciumCompDefPda(
278
+ * networkConfig.programId,
279
+ * networkConfig.arciumProgramAddress,
280
+ * offset,
281
+ * );
282
+ * ```
283
+ *
284
+ * @see {@link computeCompDefOffset} for computing the offset from an instruction name
285
+ * @see {@link findArciumInfrastructurePdas} for deriving all required accounts at once
286
+ *
287
+ * @public
288
+ */
289
+ declare function findArciumCompDefPda(umbraProgram: Address, arciumProgram: Address, compDefOffset: number): Promise<Address>;
290
+ /**
291
+ * Derives the Program Derived Address for an Arcium cluster account.
292
+ * Seeds: [ARCIUM_CLUSTER_SEED, cluster_offset_u32_le] (against Arcium program)
293
+ *
294
+ * A cluster account represents a group of Arcium MXE nodes that jointly
295
+ * process computations using multi-party computation (MPC).
296
+ *
297
+ * @param arciumProgram - The Arcium program address.
298
+ * @param clusterOffset - The cluster offset (u32).
299
+ * @returns A Promise resolving to the derived cluster account `Address`.
300
+ *
301
+ * @example
302
+ * ```typescript
303
+ * import { findArciumClusterPda } from "@umbra-privacy/sdk";
304
+ *
305
+ * const clusterAccount = await findArciumClusterPda(
306
+ * networkConfig.arciumProgramAddress,
307
+ * networkConfig.clusterOffset,
308
+ * );
309
+ * ```
310
+ *
311
+ * @see {@link findArciumMempoolPda} for the cluster's pending computation queue
312
+ * @see {@link findArciumExecutingPoolPda} for the cluster's active computation pool
313
+ *
314
+ * @public
315
+ */
316
+ declare function findArciumClusterPda(arciumProgram: Address, clusterOffset: number): Promise<Address>;
317
+ /**
318
+ * Collection of all Arcium infrastructure account addresses needed to submit
319
+ * a computation to the Arcium MPC network.
320
+ *
321
+ * @see {@link findArciumInfrastructurePdas} for the function that produces this object
322
+ *
323
+ * @public
324
+ */
325
+ interface ArciumInfrastructurePdas {
326
+ /** The MXE protocol account address for the Umbra program. @readonly */
327
+ readonly mxeAccount: Address;
328
+ /** The mempool account address for the cluster. @readonly */
329
+ readonly mempoolAccount: Address;
330
+ /** The executing pool account address for the cluster. @readonly */
331
+ readonly executingPoolAccount: Address;
332
+ /** The computation account address for this specific computation request. @readonly */
333
+ readonly computationAccount: Address;
334
+ /** The computation definition account address for the target instruction. @readonly */
335
+ readonly compDefAccount: Address;
336
+ /** The cluster account address. @readonly */
337
+ readonly clusterAccount: Address;
338
+ }
339
+ /**
340
+ * Derives all Arcium infrastructure account addresses required for a single
341
+ * computation request.
342
+ *
343
+ * This is a convenience function that computes all six required Arcium PDAs in
344
+ * parallel and returns them as an {@link ArciumInfrastructurePdas} object.
345
+ *
346
+ * @param umbraProgram - The Umbra program address.
347
+ * @param arciumProgram - The Arcium program address.
348
+ * @param clusterOffset - The cluster offset identifying which Arcium cluster to use.
349
+ * @param computationOffset - The unique u64 offset for this specific computation.
350
+ * @param instructionName - The snake_case Arcium instruction name used to derive
351
+ * the comp-def offset.
352
+ * @returns A Promise resolving to an {@link ArciumInfrastructurePdas} object.
353
+ *
354
+ * @example
355
+ * ```typescript
356
+ * import { findArciumInfrastructurePdas } from "@umbra-privacy/sdk";
357
+ *
358
+ * const arciumAccounts = await findArciumInfrastructurePdas(
359
+ * networkConfig.programId,
360
+ * networkConfig.arciumProgramAddress,
361
+ * networkConfig.clusterOffset,
362
+ * computationOffset,
363
+ * "deposit_into_existing_mxe_v3",
364
+ * );
365
+ * ```
366
+ *
367
+ * @see {@link computeCompDefOffset} for the comp-def offset derivation
368
+ * @see {@link ArciumInfrastructurePdas} for the return type shape
369
+ *
370
+ * @public
371
+ */
372
+ declare function findArciumInfrastructurePdas(umbraProgram: Address, arciumProgram: Address, clusterOffset: number, computationOffset: bigint, instructionName: string): Promise<ArciumInfrastructurePdas>;
373
+
374
+ /**
375
+ * Compliance Grant PDA Utilities
376
+ *
377
+ * This module provides functions to derive Program Derived Addresses (PDAs)
378
+ * for compliance grant accounts in the Umbra protocol.
379
+ *
380
+ * @remarks
381
+ * Umbra implements a master viewing key system that allows authorised parties
382
+ * to decrypt encrypted user data without gaining control over funds. Three
383
+ * grant variants exist, each modelling a different trust relationship:
384
+ *
385
+ * - **Network grant** — the Arcium MXE network itself can decrypt the
386
+ * user's data; the granter is implicitly the network. Used for regulatory
387
+ * or protocol-level compliance.
388
+ * - **Shared grant** — the user explicitly shares a re-encrypted view
389
+ * key with the network for a specific receiver, scoped to a nonce to
390
+ * prevent replay.
391
+ * - **User grant** — the user directly grants a named receiver (e.g. an
392
+ * auditor) the ability to read their encrypted data by re-encrypting the
393
+ * view key under the receiver's X25519 public key.
394
+ *
395
+ * All three grant PDAs share a common prefix (`VIEWING_GRANT_SEED`)
396
+ * and are disambiguated by a variant seed (`USER_GRANT_VARIANT_SEED`, etc.).
397
+ * The nonce component prevents one grant from accidentally overwriting another.
398
+ *
399
+ * @see {@link findUserComplianceGrantPda}
400
+ * @see {@link findNetworkComplianceGrantPda}
401
+ * @see {@link findSharedComplianceGrantPda}
402
+ *
403
+ * @packageDocumentation
404
+ * @since 2.0.0
405
+ * @module utils/pda/compliance
406
+ */
407
+
408
+ /**
409
+ * Derives the Program Derived Address for a user-granted compliance grant.
410
+ * Seeds: [ViewingGrant::SEED, UserGrant::VARIANT, granter_x25519, nonce, receiver_x25519]
411
+ *
412
+ * A user-granted compliance grant stores a re-encrypted view of the granter's
413
+ * private data under the receiver's X25519 public key, enabling a specific
414
+ * party (e.g. an auditor) to decrypt the granter's encrypted balances.
415
+ *
416
+ * @param granterX25519 - The 32-byte X25519 public key of the granter.
417
+ * @param nonce - A `RcEncryptionNonce` (u128) uniquely identifying this grant issuance.
418
+ * @param receiverX25519 - The 32-byte X25519 public key of the receiver.
419
+ * @param umbraProgram - The Umbra program address.
420
+ * @returns A Promise resolving to the derived PDA `Address`.
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * import { findUserComplianceGrantPda } from "@umbra-privacy/sdk";
425
+ *
426
+ * const grantPda = await findUserComplianceGrantPda(
427
+ * granterX25519PublicKey,
428
+ * nonce,
429
+ * auditorX25519PublicKey,
430
+ * networkConfig.programId,
431
+ * );
432
+ * ```
433
+ *
434
+ * @see {@link findNetworkComplianceGrantPda} for network-level MXE grants
435
+ * @see {@link findSharedComplianceGrantPda} for network shared grants
436
+ *
437
+ * @public
438
+ */
439
+ declare function findUserComplianceGrantPda(granterX25519: Uint8Array, nonce: RcEncryptionNonce, receiverX25519: Uint8Array, umbraProgram: Address): Promise<Address>;
440
+ /**
441
+ * Derives the Program Derived Address for a network (MXE) compliance grant.
442
+ * Seeds: [ViewingGrant::SEED, NetworkMxeGrant::VARIANT, nonce, receiver_x25519]
443
+ *
444
+ * A network compliance grant allows the Arcium MXE network itself to
445
+ * decrypt a user's encrypted data. There is no explicit granter key in the
446
+ * seeds -- the granter is implicitly the network.
447
+ *
448
+ * @param nonce - A `RcEncryptionNonce` (u128) uniquely identifying this grant issuance.
449
+ * @param receiverX25519 - The 32-byte X25519 public key of the receiver.
450
+ * @param umbraProgram - The Umbra program address.
451
+ * @returns A Promise resolving to the derived PDA `Address`.
452
+ *
453
+ * @example
454
+ * ```typescript
455
+ * import { findNetworkComplianceGrantPda } from "@umbra-privacy/sdk";
456
+ *
457
+ * const grantPda = await findNetworkComplianceGrantPda(
458
+ * nonce,
459
+ * networkX25519PublicKey,
460
+ * networkConfig.programId,
461
+ * );
462
+ * ```
463
+ *
464
+ * @see {@link findUserComplianceGrantPda} for user-to-auditor grants
465
+ * @see {@link findSharedComplianceGrantPda} for network shared grants
466
+ *
467
+ * @public
468
+ */
469
+ declare function findNetworkComplianceGrantPda(nonce: RcEncryptionNonce, receiverX25519: Uint8Array, umbraProgram: Address): Promise<Address>;
470
+ /**
471
+ * Derives the Program Derived Address for a shared (network-shared) compliance grant.
472
+ * Seeds: [ViewingGrant::SEED, NetworkSharedGrant::VARIANT, granter_x25519, nonce, receiver_x25519]
473
+ *
474
+ * A shared compliance grant is issued by a specific user to share a
475
+ * re-encrypted view key with a named receiver via the Arcium network.
476
+ * Unlike the network compliance grant, this variant includes the granter's
477
+ * key so multiple users can each issue independent shared grants.
478
+ *
479
+ * @param granterX25519 - The 32-byte X25519 public key of the granter.
480
+ * @param nonce - A `RcEncryptionNonce` (u128) uniquely identifying this grant issuance.
481
+ * @param receiverX25519 - The 32-byte X25519 public key of the receiver.
482
+ * @param umbraProgram - The Umbra program address.
483
+ * @returns A Promise resolving to the derived PDA `Address`.
484
+ *
485
+ * @example
486
+ * ```typescript
487
+ * import { findSharedComplianceGrantPda } from "@umbra-privacy/sdk";
488
+ *
489
+ * const grantPda = await findSharedComplianceGrantPda(
490
+ * granterX25519PublicKey,
491
+ * nonce,
492
+ * receiverX25519PublicKey,
493
+ * networkConfig.programId,
494
+ * );
495
+ * ```
496
+ *
497
+ * @see {@link findUserComplianceGrantPda} for direct user-to-auditor grants
498
+ * @see {@link findNetworkComplianceGrantPda} for implicit network-level grants
499
+ *
500
+ * @public
501
+ */
502
+ declare function findSharedComplianceGrantPda(granterX25519: Uint8Array, nonce: RcEncryptionNonce, receiverX25519: Uint8Array, umbraProgram: Address): Promise<Address>;
503
+
504
+ /**
505
+ * Umbra PDA (Program Derived Address) Generator Utilities
506
+ *
507
+ * This module provides functions for deriving Umbra protocol account addresses,
508
+ * specifically for mixer tree accounts used in the privacy-preserving UTXO system.
509
+ *
510
+ * @remarks
511
+ * ## Mixer Tree Overview
512
+ *
513
+ * The mixer tree is an Indexed Merkle Tree (IMT) that stores Poseidon H2 hash
514
+ * commitments to UTXOs. Multiple mixer trees can exist, with each tree indexed
515
+ * sequentially (0, 1, 2, ...). When a tree reaches capacity, a new tree is
516
+ * created and becomes the active tree. Old trees remain readable for proof
517
+ * generation and claiming.
518
+ *
519
+ * ## Nullifier Set Overview
520
+ *
521
+ * Each mixer tree has five associated nullifier set accounts (variants 0-4). These
522
+ * accounts form an Indexed Merkle Tree of nullifiers and serve as the primary
523
+ * double-spend prevention mechanism: before a UTXO can be claimed its
524
+ * nullifier is checked against -- and then inserted into -- the nullifier set.
525
+ *
526
+ * ## UTXO Burner Accounts
527
+ *
528
+ * Confidential and public UTXO burner accounts act as temporary storage for
529
+ * nullifiers during relayer-submitted claim transactions. They are scoped to
530
+ * a `(relayer, receiver_address, offset)` triple and are created and closed
531
+ * within the same transaction.
532
+ *
533
+ * ## Utility Functions
534
+ *
535
+ * `computeStructSeed` is re-exported from this module because every other PDA module
536
+ * depends on it to compute seed constants.
537
+ *
538
+ * @see {@link findStealthPoolPda}
539
+ * @see {@link findActiveStealthPoolPda}
540
+ * @see {@link findNullifierSetPdas}
541
+ * @see {@link findConfidentialNullifierBufferPda}
542
+ * @see {@link findPublicNullifierBufferPda}
543
+ * @see {@link computeStructSeed}
544
+ *
545
+ * @packageDocumentation
546
+ * @since 2.0.0
547
+ * @module utils/pda/umbra
548
+ */
549
+
550
+ /**
551
+ * Computes the SHA-256 hash of a struct/seed name string and returns the
552
+ * result as a 32-byte `Uint8Array`.
553
+ *
554
+ * This mirrors the `sha256_seed!` macro and the `#[umbra_account]` macro used
555
+ * in the Rust smart contract. Every PDA seed constant in the Umbra program is
556
+ * derived as `SHA-256(struct_name_utf8)`.
557
+ *
558
+ * This function is also exported from the barrel (`index.ts`) for callers that
559
+ * need to compute arbitrary struct seeds outside the SDK, for example when
560
+ * verifying a PDA derivation manually or in tests.
561
+ *
562
+ * @param name - The struct or domain name to hash (UTF-8 string, e.g. `"TokenPool"`).
563
+ * @returns A 32-byte `Uint8Array` containing the SHA-256 digest.
564
+ *
565
+ * @example
566
+ * ```typescript
567
+ * import { computeStructSeed } from "@umbra-privacy/sdk";
568
+ *
569
+ * const poolSeed = computeStructSeed("TokenPool");
570
+ * // poolSeed is SHA-256("TokenPool") as a 32-byte Uint8Array
571
+ * ```
572
+ *
573
+ * @public
574
+ */
575
+ declare function computeStructSeed(name: string): Uint8Array;
576
+ /**
577
+ * Derives the Program Derived Address for a stealth pool (mixer tree) at the given index.
578
+ * Seeds: [StealthPool::SEED, index_u128_le]
579
+ *
580
+ * The mixer tree is an Indexed Merkle Tree (IMT) that stores Poseidon H2 hash
581
+ * commitments for UTXOs. Multiple trees can exist simultaneously, each
582
+ * identified by a sequential integer index.
583
+ *
584
+ * @param index - The mixer tree index, starting from `0n`.
585
+ * @param umbraProgram - The Umbra program address.
586
+ * @returns A Promise resolving to the derived PDA `Address`.
587
+ *
588
+ * @example
589
+ * ```typescript
590
+ * import { findStealthPoolPda } from "@umbra-privacy/sdk";
591
+ *
592
+ * const mixerTree0 = await findStealthPoolPda(0n as U128, networkConfig.programId);
593
+ * ```
594
+ *
595
+ * @see {@link findActiveStealthPoolPda} for the convenience wrapper that always returns tree index 0
596
+ * @see {@link findNullifierSetPdas} for the nullifier storage accounts associated with each tree
597
+ * @see {@link findProtocolConfigPda} for the global account that stores the active tree index
598
+ *
599
+ * @public
600
+ */
601
+ declare function findStealthPoolPda(index: U128, umbraProgram: Address): Promise<Address>;
602
+ /**
603
+ * Derives the Program Derived Address for the currently active stealth pool (tree index 0).
604
+ * Seeds: [StealthPool::SEED, 0_u128_le]
605
+ *
606
+ * This is a convenience wrapper around `findStealthPoolPda(0n)` for the
607
+ * common case where a caller needs the genesis tree address.
608
+ *
609
+ * @param umbraProgram - The Umbra program address.
610
+ * @returns A Promise resolving to the PDA `Address` of tree index 0.
611
+ *
612
+ * @example
613
+ * ```typescript
614
+ * import { findActiveStealthPoolPda } from "@umbra-privacy/sdk";
615
+ *
616
+ * const activeMixer = await findActiveStealthPoolPda(networkConfig.programId);
617
+ * ```
618
+ *
619
+ * @see {@link findStealthPoolPda} for arbitrary tree index derivation
620
+ * @see {@link findProtocolConfigPda} for the account that tracks the true active index
621
+ *
622
+ * @public
623
+ */
624
+ declare function findActiveStealthPoolPda(umbraProgram: Address): Promise<Address>;
625
+ /**
626
+ * Derives the Program Derived Address for a confidential nullifier buffer account.
627
+ * Seeds: [ConfidentialNullifierLinkerBuffer::SEED, relayer_pubkey, receiver_address, offset_u128_le]
628
+ *
629
+ * Confidential nullifier buffer accounts are temporary storage PDAs that hold
630
+ * the nullifier set for a batch of confidential UTXOs being claimed in a
631
+ * single relayer-submitted transaction.
632
+ *
633
+ * @param relayerAddress - The relayer's public key.
634
+ * @param receiverAddress - The receiver's public key (claim destination address).
635
+ * @param burnerAccountOffset - The U128 offset discriminator.
636
+ * @param umbraProgram - The Umbra program address.
637
+ * @returns A Promise resolving to the derived PDA `Address`.
638
+ *
639
+ * @example
640
+ * ```typescript
641
+ * import { findConfidentialNullifierBufferPda } from "@umbra-privacy/sdk";
642
+ *
643
+ * const burnerPda = await findConfidentialNullifierBufferPda(
644
+ * relayerAddress,
645
+ * receiverAddress,
646
+ * 0n as U128,
647
+ * networkConfig.programId,
648
+ * );
649
+ * ```
650
+ *
651
+ * @see {@link findPublicNullifierBufferPda} for the public-balance variant
652
+ * @see {@link findNullifierSetPdas} for the nullifier storage accounts the burner writes into
653
+ *
654
+ * @public
655
+ */
656
+ declare function findConfidentialNullifierBufferPda(relayerAddress: Address, receiverAddress: Address, burnerAccountOffset: U128, umbraProgram: Address): Promise<Address>;
657
+ /**
658
+ * Derives the Program Derived Address for a public nullifier buffer account.
659
+ * Seeds: [PublicNullifierLinkerBuffer::SEED, relayer_pubkey, receiver_address, offset_u128_le]
660
+ *
661
+ * Public nullifier buffer accounts serve the same purpose as confidential
662
+ * nullifier buffer accounts but for claims that deposit into a public ATA
663
+ * rather than an encrypted balance.
664
+ *
665
+ * @param relayerAddress - The relayer's public key.
666
+ * @param receiverAddress - The receiver's public key (claim destination address).
667
+ * @param burnerAccountOffset - The U128 offset discriminator.
668
+ * @param umbraProgram - The Umbra program address.
669
+ * @returns A Promise resolving to the derived PDA `Address`.
670
+ *
671
+ * @example
672
+ * ```typescript
673
+ * import { findPublicNullifierBufferPda } from "@umbra-privacy/sdk";
674
+ *
675
+ * const burnerPda = await findPublicNullifierBufferPda(
676
+ * relayerAddress,
677
+ * receiverAddress,
678
+ * 0n as U128,
679
+ * networkConfig.programId,
680
+ * );
681
+ * ```
682
+ *
683
+ * @see {@link findConfidentialNullifierBufferPda} for the confidential-balance variant
684
+ * @see {@link findNullifierSetPdas} for the nullifier storage accounts the burner writes into
685
+ *
686
+ * @public
687
+ */
688
+ declare function findPublicNullifierBufferPda(relayerAddress: Address, receiverAddress: Address, burnerAccountOffset: U128, umbraProgram: Address): Promise<Address>;
689
+ /**
690
+ * Return type for `findNullifierSetPdas` containing all five nullifier set
691
+ * account addresses for a given mixer tree index.
692
+ *
693
+ * @remarks
694
+ * Each mixer tree has exactly five associated nullifier set accounts (variants 0-4).
695
+ * Together they form the Indexed Merkle Tree of nullifiers that prevents
696
+ * double-spending. All five accounts must be passed to claim instructions
697
+ * so the program can update the correct nullifier set node.
698
+ *
699
+ * @see {@link findNullifierSetPdas}
700
+ *
701
+ * @public
702
+ */
703
+ interface NullifierSetPdas {
704
+ /** Nullifier set account variant 0 (first segment of the nullifier IMT). @readonly */
705
+ readonly treap0: Address;
706
+ /** Nullifier set account variant 1 (second segment of the nullifier IMT). @readonly */
707
+ readonly treap1: Address;
708
+ /** Nullifier set account variant 2 (third segment of the nullifier IMT). @readonly */
709
+ readonly treap2: Address;
710
+ /** Nullifier set account variant 3 (fourth segment of the nullifier IMT). @readonly */
711
+ readonly treap3: Address;
712
+ /** Nullifier set account variant 4 (fifth segment of the nullifier IMT). @readonly */
713
+ readonly treap4: Address;
714
+ }
715
+ /**
716
+ * Derives all five nullifier set PDAs for a given mixer tree index.
717
+ * Seeds (per variant): [Treap::SEED, stealth_pool_index_u128_le, variant_byte]
718
+ *
719
+ * Nullifier set accounts implement the Indexed Merkle Tree (IMT) of nullifiers
720
+ * used to prevent double-spending of UTXOs. There are exactly five accounts
721
+ * per mixer tree, addressed by variant byte 0-4.
722
+ *
723
+ * @param stealthPoolIndex - The mixer tree index whose nullifier set PDAs to derive.
724
+ * @param umbraProgram - The Umbra program address.
725
+ * @returns A Promise resolving to a {@link NullifierSetPdas} object containing all
726
+ * five nullifier set account addresses (`treap0` through `treap4`).
727
+ *
728
+ * @example
729
+ * ```typescript
730
+ * import { findNullifierSetPdas } from "@umbra-privacy/sdk";
731
+ *
732
+ * const nullifierSetPdas = await findNullifierSetPdas(0n as U128, networkConfig.programId);
733
+ * console.log(nullifierSetPdas.treap0, nullifierSetPdas.treap1, nullifierSetPdas.treap2);
734
+ * ```
735
+ *
736
+ * @see {@link findStealthPoolPda} for the Merkle commitment tree PDAs
737
+ * @see {@link NullifierSetPdas} for the return type shape
738
+ *
739
+ * @public
740
+ */
741
+ declare function findNullifierSetPdas(stealthPoolIndex: U128, umbraProgram: Address): Promise<NullifierSetPdas>;
742
+
743
+ /**
744
+ * Global PDA Utilities
745
+ *
746
+ * This module provides functions to derive Program Derived Addresses (PDAs)
747
+ * for singleton program-level accounts in the Umbra protocol.
748
+ *
749
+ * Mirrors the smart contract's `state/global/` module, which holds
750
+ * `ProtocolConfig` — a singleton account storing protocol-wide state.
751
+ *
752
+ * @remarks
753
+ * There is exactly one `ProtocolConfig` account per Umbra program
754
+ * deployment. It acts as the canonical source of truth for cross-instruction
755
+ * protocol state: the index of the currently active mixer tree, global
756
+ * feature activation flags, and the program upgrade authority. Most
757
+ * instructions pass it as a read-only account for validation.
758
+ *
759
+ * @see {@link findProtocolConfigPda} for the derivation function
760
+ * @see {@link findTokenPoolPda} for per-mint pool configuration
761
+ *
762
+ * @packageDocumentation
763
+ * @since 2.0.0
764
+ * @module utils/pda/global
765
+ */
766
+
767
+ /**
768
+ * Derives the Program Derived Address for the singleton protocol configuration account.
769
+ * Seeds: [ProtocolConfig::SEED]
770
+ *
771
+ * The `ProtocolConfig` account stores global configuration state including
772
+ * the active mixer tree index, feature flags, and the upgrade authority.
773
+ *
774
+ * @param umbraProgram - The Umbra program address.
775
+ * @returns A Promise resolving to the derived PDA `Address`.
776
+ *
777
+ * @example
778
+ * ```typescript
779
+ * import { findProtocolConfigPda } from "@umbra-privacy/sdk";
780
+ *
781
+ * const protocolConfig = await findProtocolConfigPda(networkConfig.programId);
782
+ * ```
783
+ *
784
+ * @see {@link findTokenPoolPda} for per-mint pool configuration
785
+ * @see {@link findStealthPoolPda} for per-index mixer tree accounts
786
+ *
787
+ * @public
788
+ */
789
+ declare function findProtocolConfigPda(umbraProgram: Address): Promise<Address>;
790
+
791
+ /**
792
+ * Pool PDA Utilities
793
+ *
794
+ * This module provides functions to derive Program Derived Addresses (PDAs)
795
+ * for pool-related accounts in the Umbra protocol.
796
+ *
797
+ * Mirrors the smart contract's `state/pool/` module, which holds the `Pool`
798
+ * account — a per-mint configuration account that enables confidentiality and
799
+ * mixer features for a specific SPL token.
800
+ *
801
+ * @remarks
802
+ * The `Pool` account is a singleton per SPL token mint. It is created by the
803
+ * protocol administrator and acts as the root configuration object for all
804
+ * privacy operations involving that mint. Instructions that add or remove
805
+ * privacy features (confidentiality, mixer) modify this account.
806
+ *
807
+ * @see {@link findTokenPoolPda} for the derivation function
808
+ * @see {@link findProtocolConfigPda} for the global singleton that tracks active tree index
809
+ *
810
+ * @packageDocumentation
811
+ * @since 2.0.0
812
+ * @module utils/pda/pool
813
+ */
814
+
815
+ /**
816
+ * SHA-256 of the string `"TokenPool"`, stored as a 32-byte `Uint8Array`.
817
+ *
818
+ * Matches `Pool::SEED` as generated by the `#[umbra_account]` macro
819
+ * in `state/pool/pool.rs`. Used as the first seed when deriving Pool PDAs.
820
+ *
821
+ * Also re-exported from the barrel (`index.ts`) as `TOKEN_POOL_SEED` for callers
822
+ * that need the raw bytes — for example, to verify a PDA server-side without
823
+ * calling `findTokenPoolPda`.
824
+ *
825
+ * @internal
826
+ */
827
+ declare const TOKEN_POOL_SEED: Uint8Array<ArrayBufferLike>;
828
+ /**
829
+ * Derives the Program Derived Address for a token pool configuration account.
830
+ * Seeds: [TokenPool::SEED, mint_pubkey]
831
+ *
832
+ * The `Pool` account is a per-mint singleton that stores whether
833
+ * confidentiality and mixer features are activated for a specific SPL token.
834
+ *
835
+ * @param mintAddress - The SPL token mint address for this pool.
836
+ * @param umbraProgram - The Umbra program address.
837
+ * @returns A Promise resolving to the derived PDA `Address`.
838
+ *
839
+ * @example
840
+ * ```typescript
841
+ * import { findTokenPoolPda } from "@umbra-privacy/sdk";
842
+ *
843
+ * const pool = await findTokenPoolPda(mintAddress, networkConfig.programId);
844
+ * ```
845
+ *
846
+ * @see {@link TOKEN_POOL_SEED} for the raw seed bytes
847
+ * @see {@link findProtocolConfigPda} for the global singleton account
848
+ *
849
+ * @public
850
+ */
851
+ declare function findTokenPoolPda(mintAddress: Address, umbraProgram: Address): Promise<Address>;
852
+
853
+ /**
854
+ * Relayer PDA Utilities
855
+ *
856
+ * This module provides functions to derive Program Derived Addresses (PDAs)
857
+ * for relayer-related accounts in the Umbra protocol.
858
+ *
859
+ * Mirrors the smart contract's `state/relayer/` module, which holds:
860
+ * - `Relayer` — a per-relayer, per-mint account that stores the
861
+ * relayer's registration state and fee configuration references.
862
+ *
863
+ * @remarks
864
+ * Relayers are permissioned transaction forwarders in the Umbra privacy
865
+ * protocol. They submit user-generated proofs and encrypted payloads
866
+ * on-chain, collecting a commission fee for the service. Each relayer must
867
+ * register a `Relayer` for every SPL token mint they wish to support.
868
+ *
869
+ * The `Relayer` PDA is scoped to a `(relayer, mint)` pair so that a
870
+ * single relayer wallet can independently manage fee configurations for
871
+ * multiple mints without conflicting accounts.
872
+ *
873
+ * @see {@link findRelayerPda} for the derivation function
874
+ * @see {@link findRelayerFeeVaultPda} for the associated fee pool derivation
875
+ *
876
+ * @packageDocumentation
877
+ * @since 2.0.0
878
+ * @module utils/pda/relayer
879
+ */
880
+
881
+ /**
882
+ * Derives the Program Derived Address for a relayer registration account.
883
+ * Seeds: [Relayer::SEED, relayer_pubkey, mint_pubkey]
884
+ *
885
+ * The `Relayer` stores a relayer's registration data and fee
886
+ * configuration for a specific SPL token mint. A unique account exists per
887
+ * `(relayer, mint)` pair.
888
+ *
889
+ * @param relayerAddress - The relayer's wallet public key.
890
+ * @param mintAddress - The SPL token mint address that this relayer supports.
891
+ * @param umbraProgram - The Umbra program address.
892
+ * @returns A Promise resolving to the derived PDA `Address`.
893
+ *
894
+ * @example
895
+ * ```typescript
896
+ * import { findRelayerPda } from "@umbra-privacy/sdk";
897
+ *
898
+ * const relayerAccount = await findRelayerPda(
899
+ * relayerPublicKey,
900
+ * mintAddress,
901
+ * networkConfig.programId,
902
+ * );
903
+ * ```
904
+ *
905
+ * @see {@link findRelayerFeeVaultPda} for the associated unified fee pool
906
+ * @see {@link findFeeSchedulePda} for the fee rate configuration account
907
+ *
908
+ * @public
909
+ */
910
+ declare function findRelayerPda(relayerAddress: Address, mintAddress: Address, umbraProgram: Address): Promise<Address>;
911
+
912
+ /**
913
+ * Fees PDA Utilities
914
+ *
915
+ * This module provides functions to derive Program Derived Addresses (PDAs)
916
+ * for protocol and relayer fee accounts in the Umbra protocol.
917
+ *
918
+ * Mirrors the smart contract's `state/fees/` module, which holds:
919
+ * - `FeeVault` — a single account storing both protocol and relayer fees,
920
+ * partitioned by a domain seed into two variants:
921
+ * - Protocol-only pools (deposits, withdrawals, public UTXO creation)
922
+ * - Relayer pools (transfers, confidential/public claims)
923
+ * - `FeeSchedule` — admin-managed fee rate config per mint
924
+ *
925
+ * @remarks
926
+ * Umbra separates fee collection from fee disbursement by accumulating fees in
927
+ * dedicated PDA accounts (`FeeVault`) that can be swept by the protocol
928
+ * treasury or relayer at any time. The fee amount charged per instruction is
929
+ * governed by the `FeeSchedule` account for that instruction + mint
930
+ * pair.
931
+ *
932
+ * Both `FeeVault` variants and `FeeSchedule` include an
933
+ * `offset` seed, following the canonical seed pattern:
934
+ *
935
+ * `SEED -> domain_seed (for fees pool) -> instructionSeed -> entity_key -> mint -> offset`
936
+ *
937
+ * The `offset` allows the protocol to create multiple fee pool or config
938
+ * accounts for the same instruction + mint combination if needed in future.
939
+ * Currently `offset` is always `0n` for `FeeSchedule` and an
940
+ * instruction-specific constant for `FeeVault`.
941
+ *
942
+ * @see {@link findProtocolFeeVaultPda}
943
+ * @see {@link findRelayerFeeVaultPda}
944
+ * @see {@link findFeeSchedulePda}
945
+ *
946
+ * @packageDocumentation
947
+ * @since 2.0.0
948
+ * @module utils/pda/fees
949
+ */
950
+
951
+ /**
952
+ * Derives the Program Derived Address for a protocol-only fee vault account.
953
+ * Seeds: [FeeVault::SEED, ProtocolFees::DOMAIN, instruction_seed, mint_pubkey, offset]
954
+ *
955
+ * Protocol-only fee pools accumulate the protocol's share of fees for
956
+ * instructions that have no relayer commission component (deposits,
957
+ * withdrawals, and public UTXO creation).
958
+ *
959
+ * @param instructionSeed - The instruction-specific U128 seed constant.
960
+ * @param mintAddress - The SPL token mint address for this pool.
961
+ * @param offset - The account offset discriminator (U128).
962
+ * @param umbraProgram - The Umbra program address.
963
+ * @returns A Promise resolving to the `[pda, bump]` tuple.
964
+ *
965
+ * @example
966
+ * ```typescript
967
+ * import { findProtocolFeeVaultPda } from "@umbra-privacy/sdk";
968
+ *
969
+ * const [feesPoolPda] = await findProtocolFeeVaultPda(
970
+ * instructionSeed as U128,
971
+ * mintAddress,
972
+ * PROTOCOL_FEES_POOL_OFFSET as U128,
973
+ * networkConfig.programId,
974
+ * );
975
+ * ```
976
+ *
977
+ * @see {@link findRelayerFeeVaultPda} for the relayer commission pool variant
978
+ * @see {@link findFeeSchedulePda} for the fee rate configuration account
979
+ *
980
+ * @public
981
+ */
982
+ declare function findProtocolFeeVaultPda(instructionSeed: U128, mintAddress: Address, offset: U128, umbraProgram: Address): Promise<readonly [Address, number]>;
983
+ /**
984
+ * Derives the Program Derived Address for a relayer fee vault account.
985
+ * Seeds: [FeeVault::SEED, ProtocolRelayerFees::DOMAIN, instruction_seed, relayer_pubkey, mint_pubkey, offset]
986
+ *
987
+ * Relayer fee pools accumulate both the protocol's share and the relayer's
988
+ * commission for instructions that involve a relayer (claims and transfers).
989
+ *
990
+ * @param instructionSeed - The instruction-specific U128 seed constant.
991
+ * @param relayerAddress - The relayer's wallet public key.
992
+ * @param mintAddress - The SPL token mint address for this pool.
993
+ * @param offset - The account offset discriminator (U128).
994
+ * @param umbraProgram - The Umbra program address.
995
+ * @returns A Promise resolving to the `[pda, bump]` tuple.
996
+ *
997
+ * @example
998
+ * ```typescript
999
+ * import { findRelayerFeeVaultPda } from "@umbra-privacy/sdk";
1000
+ *
1001
+ * const [unifiedFeesPoolPda] = await findRelayerFeeVaultPda(
1002
+ * instructionSeed as U128,
1003
+ * relayerPublicKey,
1004
+ * mintAddress,
1005
+ * PROTOCOL_FEES_POOL_OFFSET as U128,
1006
+ * networkConfig.programId,
1007
+ * );
1008
+ * ```
1009
+ *
1010
+ * @see {@link findProtocolFeeVaultPda} for the protocol-only pool variant
1011
+ * @see {@link findRelayerPda} for the relayer registration account
1012
+ *
1013
+ * @public
1014
+ */
1015
+ declare function findRelayerFeeVaultPda(instructionSeed: U128, relayerAddress: Address, mintAddress: Address, offset: U128, umbraProgram: Address): Promise<readonly [Address, number]>;
1016
+ /**
1017
+ * Derives the Program Derived Address for a protocol fee schedule account.
1018
+ * Seeds: [FeeSchedule::SEED, instruction_seed, mint_pubkey, offset]
1019
+ *
1020
+ * The `FeeSchedule` account defines the fee rates for a specific instruction
1021
+ * variant and SPL token mint. Consulted during instruction validation to
1022
+ * calculate how much the user must pay.
1023
+ *
1024
+ * @param instructionSeed - The instruction-specific U128 seed constant.
1025
+ * @param mintAddress - The SPL token mint address for this fee configuration.
1026
+ * @param offset - The account offset discriminator (U128).
1027
+ * @param umbraProgram - The Umbra program address.
1028
+ * @returns A Promise resolving to the `[pda, bump]` tuple.
1029
+ *
1030
+ * @example
1031
+ * ```typescript
1032
+ * import { findFeeSchedulePda } from "@umbra-privacy/sdk";
1033
+ *
1034
+ * const [feeConfigPda] = await findFeeSchedulePda(
1035
+ * instructionSeed as U128,
1036
+ * mintAddress,
1037
+ * 0n as U128,
1038
+ * networkConfig.programId,
1039
+ * );
1040
+ * ```
1041
+ *
1042
+ * @see {@link findProtocolFeeVaultPda} for the corresponding fee collection account
1043
+ * @see {@link findRelayerFeeVaultPda} for the relayer fee collection account
1044
+ *
1045
+ * @public
1046
+ */
1047
+ declare function findFeeSchedulePda(instructionSeed: U128, mintAddress: Address, offset: U128, umbraProgram: Address): Promise<readonly [Address, number]>;
1048
+ /**
1049
+ * Derives the Program Derived Address for a relayer fee schedule account.
1050
+ * Seeds: [RelayerFeeSchedule::SEED, instruction_seed, relayer_pubkey, mint_pubkey, offset]
1051
+ *
1052
+ * The `RelayerFeeSchedule` account defines the fee rates a specific relayer
1053
+ * charges for a given instruction variant and SPL token mint.
1054
+ *
1055
+ * @param instructionSeed - The instruction-specific U128 seed constant.
1056
+ * @param relayerAddress - The relayer's wallet public key.
1057
+ * @param mintAddress - The SPL token mint address for this fee configuration.
1058
+ * @param offset - The account offset discriminator (U128).
1059
+ * @param umbraProgram - The Umbra program address.
1060
+ * @returns A Promise resolving to the `[pda, bump]` tuple.
1061
+ *
1062
+ * @public
1063
+ */
1064
+ declare function findRelayerFeeSchedulePda(instructionSeed: U128, relayerAddress: Address, mintAddress: Address, offset: U128, umbraProgram: Address): Promise<readonly [Address, number]>;
1065
+
1066
+ /**
1067
+ * ZK and MPC Callback PDA Utilities
1068
+ *
1069
+ * This module provides functions to derive Program Derived Addresses (PDAs)
1070
+ * for zero-knowledge proof accounts and MPC callback data accounts in the
1071
+ * Umbra protocol.
1072
+ *
1073
+ * @see {@link findVerifyingKeyPda}
1074
+ * @see {@link findClaimInputBufferPda}
1075
+ * @see {@link findUtxoInputBufferPda}
1076
+ * @see {@link findPublicClaimInputBufferPda}
1077
+ * @see {@link findPublicClaimComputationDataPda}
1078
+ *
1079
+ * @packageDocumentation
1080
+ * @since 2.0.0
1081
+ * @module utils/pda/zk
1082
+ */
1083
+
1084
+ /**
1085
+ * Derives the Program Derived Address for a Groth16 verifying key account.
1086
+ * Seeds: [Groth16VerifyingKey::SEED, instruction_seed]
1087
+ *
1088
+ * Stores the on-chain Groth16 verifying key for a specific proof circuit
1089
+ * variant. Set up by the protocol administrator and read as immutable input
1090
+ * in claim and UTXO instructions.
1091
+ *
1092
+ * @param instructionSeed - The U128 seed identifying the specific verifying key.
1093
+ * @param umbraProgram - The Umbra program address.
1094
+ * @returns A Promise resolving to the derived PDA `Address`.
1095
+ *
1096
+ * @example
1097
+ * ```typescript
1098
+ * import { findVerifyingKeyPda } from "@umbra-privacy/sdk";
1099
+ *
1100
+ * const zkVerifyingKeyAccount = await findVerifyingKeyPda(
1101
+ * zkSeed as U128,
1102
+ * networkConfig.programId,
1103
+ * );
1104
+ * ```
1105
+ *
1106
+ * @see {@link findClaimInputBufferPda} for the proof buffer read alongside this account
1107
+ *
1108
+ * @public
1109
+ */
1110
+ declare function findVerifyingKeyPda(instructionSeed: U128, umbraProgram: Address): Promise<Address>;
1111
+ /**
1112
+ * Derives the Program Derived Address for a confidential claim input buffer account.
1113
+ * Seeds: [ConfidentialClaimProofAccount::SEED, payer_pubkey, offset]
1114
+ *
1115
+ * An ephemeral buffer account that holds the Groth16 proof bytes and encrypted
1116
+ * public inputs required for a confidential claim instruction. Created by the
1117
+ * relayer, consumed by the claim instruction, and closed in the MPC callback.
1118
+ *
1119
+ * @param payerAddress - The relayer's public key (proof account creator).
1120
+ * @param offset - The U128 offset discriminator.
1121
+ * @param umbraProgram - The Umbra program address.
1122
+ * @returns A Promise resolving to the derived PDA `Address`.
1123
+ *
1124
+ * @example
1125
+ * ```typescript
1126
+ * import { findClaimInputBufferPda } from "@umbra-privacy/sdk";
1127
+ *
1128
+ * const proofAccountPda = await findClaimInputBufferPda(
1129
+ * relayerPublicKey,
1130
+ * proofAccountOffset as U128,
1131
+ * networkConfig.programId,
1132
+ * );
1133
+ * ```
1134
+ *
1135
+ * @see {@link findVerifyingKeyPda} for the verifying key used to check this proof
1136
+ * @see {@link findPublicClaimInputBufferPda} for the public-balance claim variant
1137
+ *
1138
+ * @public
1139
+ */
1140
+ declare function findClaimInputBufferPda(payerAddress: Address, offset: U128, umbraProgram: Address): Promise<Address>;
1141
+ /**
1142
+ * Derives the Program Derived Address for a confidential UTXO input buffer account.
1143
+ * Seeds: [ConfidentialUtxoProofAccount::SEED, depositor_pubkey, offset]
1144
+ *
1145
+ * An ephemeral buffer account that holds the Groth16 proof data required to
1146
+ * create a new confidential UTXO from an existing encrypted MXE balance.
1147
+ *
1148
+ * @param depositorAddress - The depositor's public key (account creator).
1149
+ * @param offset - The U128 offset discriminator.
1150
+ * @param umbraProgram - The Umbra program address.
1151
+ * @returns A Promise resolving to the derived PDA `Address`.
1152
+ *
1153
+ * @example
1154
+ * ```typescript
1155
+ * import { findUtxoInputBufferPda } from "@umbra-privacy/sdk";
1156
+ *
1157
+ * const proofAccountPda = await findUtxoInputBufferPda(
1158
+ * client.signer.address,
1159
+ * offset as U128,
1160
+ * networkConfig.programId,
1161
+ * );
1162
+ * ```
1163
+ *
1164
+ * @see {@link findVerifyingKeyPda} for the verifying key used to check this proof
1165
+ * @see {@link findClaimInputBufferPda} for the claim-side proof buffer
1166
+ *
1167
+ * @public
1168
+ */
1169
+ declare function findUtxoInputBufferPda(depositorAddress: Address, offset: U128, umbraProgram: Address): Promise<Address>;
1170
+ /**
1171
+ * Derives the Program Derived Address for a public UTXO input buffer account.
1172
+ * Seeds: [PublicUtxoProofAccount::SEED, depositor_pubkey, offset]
1173
+ *
1174
+ * An ephemeral buffer account that holds cryptographic proof data for the
1175
+ * `create_deposit_into_mixer_tree_from_public_balance` instruction.
1176
+ *
1177
+ * @param depositorAddress - The depositor's public key (account creator).
1178
+ * @param offset - The U128 offset discriminator.
1179
+ * @param umbraProgram - The Umbra program address.
1180
+ * @returns A Promise resolving to the derived PDA `Address`.
1181
+ *
1182
+ * @public
1183
+ */
1184
+ declare function findPublicUtxoInputBufferPda(depositorAddress: Address, offset: U128, umbraProgram: Address): Promise<Address>;
1185
+ /**
1186
+ * Derives the Program Derived Address for a public claim input buffer account.
1187
+ * Seeds: [PublicClaimProofAccount::SEED, relayer_pubkey, offset]
1188
+ *
1189
+ * An ephemeral buffer account that holds the Groth16 proof data for a
1190
+ * public-balance claim instruction (claiming UTXOs into a standard SPL
1191
+ * token ATA).
1192
+ *
1193
+ * @param relayerAddress - The relayer's public key (proof account creator).
1194
+ * @param offset - The U128 offset discriminator.
1195
+ * @param umbraProgram - The Umbra program address.
1196
+ * @returns A Promise resolving to the derived PDA `Address`.
1197
+ *
1198
+ * @example
1199
+ * ```typescript
1200
+ * import { findPublicClaimInputBufferPda } from "@umbra-privacy/sdk";
1201
+ *
1202
+ * const proofAccountPda = await findPublicClaimInputBufferPda(
1203
+ * relayerPublicKey,
1204
+ * proofAccountOffset as U128,
1205
+ * networkConfig.programId,
1206
+ * );
1207
+ * ```
1208
+ *
1209
+ * @see {@link findVerifyingKeyPda} for the verifying key used to check this proof
1210
+ * @see {@link findClaimInputBufferPda} for the confidential-balance claim variant
1211
+ * @see {@link findPublicClaimComputationDataPda} for the companion MPC callback data account
1212
+ *
1213
+ * @public
1214
+ */
1215
+ declare function findPublicClaimInputBufferPda(relayerAddress: Address, offset: U128, umbraProgram: Address): Promise<Address>;
1216
+ /**
1217
+ * Derives the Program Derived Address for a public claim MPC computation data account.
1218
+ * Seeds: [PublicClaimMxeMpcCallbackData::SEED, relayer_pubkey, offset]
1219
+ *
1220
+ * Stores all data needed by the Arcium MPC callback handler for a public
1221
+ * claim instruction. Initialised in the handler and closed when the callback
1222
+ * executes.
1223
+ *
1224
+ * Returns the full `[address, bump]` tuple because the canonical bump must be
1225
+ * passed as the `mpcCallbackDataCanonicalBump` instruction argument.
1226
+ *
1227
+ * @param relayerAddress - The relayer's public key.
1228
+ * @param offset - The U128 offset discriminator.
1229
+ * @param umbraProgram - The Umbra program address.
1230
+ * @returns A Promise resolving to the `[pda, bump]` tuple.
1231
+ *
1232
+ * @example
1233
+ * ```typescript
1234
+ * import { findPublicClaimComputationDataPda } from "@umbra-privacy/sdk";
1235
+ *
1236
+ * const [callbackDataPda, mpcCallbackDataCanonicalBump] =
1237
+ * await findPublicClaimComputationDataPda(
1238
+ * relayerPublicKey,
1239
+ * 0n as U128,
1240
+ * networkConfig.programId,
1241
+ * );
1242
+ * ```
1243
+ *
1244
+ * @see {@link findPublicClaimInputBufferPda} for the companion proof buffer account
1245
+ *
1246
+ * @public
1247
+ */
1248
+ declare function findPublicClaimComputationDataPda(relayerAddress: Address, offset: U128, umbraProgram: Address): Promise<readonly [Address, number]>;
1249
+
1250
+ export { type ArciumInfrastructurePdas, type NullifierSetPdas, TOKEN_POOL_SEED, computeCompDefOffset, computeStructSeed, findActiveStealthPoolPda, findArciumClusterPda, findArciumCompDefPda, findArciumComputationPda, findArciumExecutingPoolPda, findArciumInfrastructurePdas, findArciumMempoolPda, findArciumMxePda, findClaimInputBufferPda, findConfidentialNullifierBufferPda, findEncryptedTokenAccountPda, findEncryptedUserAccountPda, findFeeSchedulePda, findNetworkComplianceGrantPda, findNullifierSetPdas, findProtocolConfigPda, findProtocolFeeVaultPda, findPublicClaimComputationDataPda, findPublicClaimInputBufferPda, findPublicNullifierBufferPda, findPublicUtxoInputBufferPda, findRelayerFeeSchedulePda, findRelayerFeeVaultPda, findRelayerPda, findSharedComplianceGrantPda, findStealthPoolPda, findTokenPoolPda, findUserComplianceGrantPda, findUtxoInputBufferPda, findVerifyingKeyPda };