@arcium-hq/client 0.8.4 → 0.9.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.
package/build/index.d.ts CHANGED
@@ -10,41 +10,43 @@ export { x25519 } from '@noble/curves/ed25519';
10
10
  */
11
11
  declare const CURVE25519_SCALAR_FIELD_MODULUS: bigint;
12
12
  /**
13
- * Generates a random value within the field bound by q.
14
- * @param q - The upper bound (exclusive) for the random value.
15
- * @returns A random bigint value between 0 and q-1.
13
+ * Generate a random value within the field bound by q.
14
+ * @param q - Upper bound (exclusive) for the random value.
15
+ * @returns Random bigint value between 0 and q-1.
16
16
  */
17
17
  declare function generateRandomFieldElem(q: bigint): bigint;
18
18
  /**
19
- * Computes the positive modulo of a over m.
20
- * @param a - The dividend.
21
- * @param m - The modulus.
22
- * @returns The positive remainder of a mod m.
19
+ * Compute the positive modulo of a over m.
20
+ * @param a - Dividend.
21
+ * @param m - Modulus.
22
+ * @returns Positive remainder of a mod m.
23
23
  */
24
24
  declare function positiveModulo(a: bigint, m: bigint): bigint;
25
25
  /**
26
- * Serializes a bigint to a little-endian Uint8Array of the specified length.
27
- * @param val - The bigint value to serialize.
28
- * @param lengthInBytes - The desired length of the output array.
29
- * @returns The serialized value as a Uint8Array.
26
+ * Serialize a bigint to a little-endian Uint8Array of the specified length.
27
+ * @param val - Bigint value to serialize.
28
+ * @param lengthInBytes - Desired length of the output array.
29
+ * @returns Serialized value as a Uint8Array.
30
30
  * @throws Error if the value is too large for the specified length.
31
31
  */
32
32
  declare function serializeLE(val: bigint, lengthInBytes: number): Uint8Array;
33
33
  /**
34
- * Deserializes a little-endian Uint8Array to a bigint.
35
- * @param bytes - The Uint8Array to deserialize.
36
- * @returns The deserialized bigint value.
34
+ * Deserialize a little-endian Uint8Array to a bigint.
35
+ * @param bytes - Uint8Array to deserialize.
36
+ * @returns Deserialized bigint value.
37
37
  */
38
38
  declare function deserializeLE(bytes: Uint8Array): bigint;
39
39
  /**
40
- * Computes the SHA-256 hash of an array of Uint8Arrays.
41
- * @param byteArrays - The arrays to hash.
42
- * @returns The SHA-256 hash as a Buffer.
40
+ * Compute the SHA-256 hash of an array of Uint8Arrays.
41
+ * @param byteArrays - Arrays to hash.
42
+ * @returns SHA-256 hash as a Buffer.
43
43
  */
44
44
  declare function sha256(byteArrays: Uint8Array[]): Buffer;
45
45
 
46
46
  /**
47
- * Matrix class over FpField. Data is row-major.
47
+ * Matrix operations for MPC field arithmetic.
48
+ * Used internally by Rescue cipher. Not part of public API.
49
+ * @internal
48
50
  */
49
51
  declare class Matrix {
50
52
  field: FpField;
@@ -67,12 +69,16 @@ declare class Matrix {
67
69
  */
68
70
  pow(e: bigint): Matrix;
69
71
  /**
70
- * computs the determinant using gaus elimination
71
- * matches the determinant implementation in arcis
72
+ * Compute the determinant using Gauss elimination.
73
+ * Match the determinant implementation in Arcis.
72
74
  */
73
75
  det(): bigint;
74
76
  is_square(): boolean;
75
77
  }
78
+ /**
79
+ * Generate random matrix for testing.
80
+ * @internal
81
+ */
76
82
  declare function randMatrix(field: FpField, nrows: number, ncols: number): Matrix;
77
83
 
78
84
  /**
@@ -82,7 +88,7 @@ declare function randMatrix(field: FpField, nrows: number, ncols: number): Matri
82
88
  type RescueMode = BlockCipher | HashFunction;
83
89
  /**
84
90
  * Block cipher mode configuration for Rescue.
85
- * Uses a key for encryption/decryption operations.
91
+ * Use a key for encryption/decryption operations.
86
92
  */
87
93
  type BlockCipher = {
88
94
  kind: 'cipher';
@@ -90,8 +96,8 @@ type BlockCipher = {
90
96
  };
91
97
  /**
92
98
  * Hash function mode configuration for Rescue.
93
- * @param m - The rate (number of field elements absorbed per round).
94
- * @param capacity - The capacity (number of field elements in the state that are not directly accessible).
99
+ * @param m - Rate (number of field elements absorbed per round).
100
+ * @param capacity - Capacity (number of field elements in the state that are not directly accessible).
95
101
  */
96
102
  type HashFunction = {
97
103
  kind: 'hash';
@@ -125,28 +131,28 @@ declare class RescueDesc {
125
131
  mdsMatInverse: Matrix;
126
132
  roundKeys: Matrix[];
127
133
  /**
128
- * Constructs a RescueDesc for a given field and mode (cipher or hash).
129
- * Initializes round constants, MDS matrix, and key schedule.
130
- * @param field - The field to use (e.g., CURVE25519_BASE_FIELD).
131
- * @param mode - The mode: block cipher or hash function.
134
+ * Construct a RescueDesc for a given field and mode (cipher or hash).
135
+ * Initialize round constants, MDS matrix, and key schedule.
136
+ * @param field - Field to use (e.g., CURVE25519_BASE_FIELD).
137
+ * @param mode - Mode: block cipher or hash function.
132
138
  */
133
139
  constructor(field: FpField, mode: RescueMode);
134
140
  /**
135
- * Samples round constants for the Rescue permutation, using SHAKE256.
136
- * @param nRounds - The number of rounds.
137
- * @returns An array of round constant matrices.
141
+ * Sample round constants for the Rescue permutation, using SHAKE256.
142
+ * @param nRounds - Number of rounds.
143
+ * @returns Array of round constant matrices.
138
144
  */
139
145
  sampleConstants(nRounds: number): Matrix[];
140
146
  /**
141
- * Applies the Rescue permutation to a state matrix.
142
- * @param state - The input state matrix.
143
- * @returns The permuted state matrix.
147
+ * Apply the Rescue permutation to a state matrix.
148
+ * @param state - Input state matrix.
149
+ * @returns Permuted state matrix.
144
150
  */
145
151
  permute(state: Matrix): Matrix;
146
152
  /**
147
- * Applies the inverse Rescue permutation to a state matrix.
148
- * @param state - The input state matrix.
149
- * @returns The inverse-permuted state matrix.
153
+ * Apply the inverse Rescue permutation to a state matrix.
154
+ * @param state - Input state matrix.
155
+ * @returns Inverse-permuted state matrix.
150
156
  */
151
157
  permuteInverse(state: Matrix): Matrix;
152
158
  }
@@ -159,39 +165,39 @@ declare function toVec(data: bigint[]): bigint[][];
159
165
  declare class RescueCipherCommon {
160
166
  desc: RescueDesc;
161
167
  /**
162
- * Constructs a RescueCipherCommon instance using a shared secret.
168
+ * Construct a RescueCipherCommon instance using a shared secret.
163
169
  * The key is derived using RescuePrimeHash and used to initialize the RescueDesc.
164
- * @param sharedSecret - The shared secret to derive the cipher key from.
170
+ * @param sharedSecret - Shared secret to derive the cipher key from.
165
171
  */
166
172
  constructor(sharedSecret: Uint8Array, field: FpField);
167
173
  /**
168
- * Encrypts the plaintext vector in Counter (CTR) mode (raw, returns bigints).
169
- * @param plaintext - The array of plaintext bigints to encrypt.
170
- * @param nonce - A 16-byte nonce for CTR mode.
171
- * @returns The ciphertext as an array of bigints.
174
+ * Encrypt the plaintext vector in Counter (CTR) mode (raw, returns bigints).
175
+ * @param plaintext - Array of plaintext bigints to encrypt.
176
+ * @param nonce - 16-byte nonce for CTR mode.
177
+ * @returns Ciphertext as an array of bigints.
172
178
  * @throws Error if the nonce is not 16 bytes long.
173
179
  */
174
180
  encrypt_raw(plaintext: bigint[], nonce: Uint8Array): bigint[];
175
181
  /**
176
- * Encrypts the plaintext vector in Counter (CTR) mode and serializes each block.
177
- * @param plaintext - The array of plaintext bigints to encrypt.
178
- * @param nonce - A 16-byte nonce for CTR mode.
179
- * @returns The ciphertext as an array of arrays of numbers (each 32 bytes).
182
+ * Encrypt the plaintext vector in Counter (CTR) mode and serialize each block.
183
+ * @param plaintext - Array of plaintext bigints to encrypt.
184
+ * @param nonce - 16-byte nonce for CTR mode.
185
+ * @returns Ciphertext as an array of arrays of numbers (each 32 bytes).
180
186
  */
181
187
  encrypt(plaintext: bigint[], nonce: Uint8Array): number[][];
182
188
  /**
183
- * Decrypts the ciphertext vector in Counter (CTR) mode (raw, expects bigints).
184
- * @param ciphertext - The array of ciphertext bigints to decrypt.
185
- * @param nonce - A 16-byte nonce for CTR mode.
186
- * @returns The decrypted plaintext as an array of bigints.
189
+ * Decrypt the ciphertext vector in Counter (CTR) mode (raw, expects bigints).
190
+ * @param ciphertext - Array of ciphertext bigints to decrypt.
191
+ * @param nonce - 16-byte nonce for CTR mode.
192
+ * @returns Decrypted plaintext as an array of bigints.
187
193
  * @throws Error if the nonce is not 16 bytes long.
188
194
  */
189
195
  decrypt_raw(ciphertext: bigint[], nonce: Uint8Array): bigint[];
190
196
  /**
191
- * Deserializes and decrypts the ciphertext vector in Counter (CTR) mode.
192
- * @param ciphertext - The array of arrays of numbers (each 32 bytes) to decrypt.
193
- * @param nonce - A 16-byte nonce for CTR mode.
194
- * @returns The decrypted plaintext as an array of bigints.
197
+ * Deserialize and decrypt the ciphertext vector in Counter (CTR) mode.
198
+ * @param ciphertext - Array of arrays of numbers (each 32 bytes) to decrypt.
199
+ * @param nonce - 16-byte nonce for CTR mode.
200
+ * @returns Decrypted plaintext as an array of bigints.
195
201
  */
196
202
  decrypt(ciphertext: number[][], nonce: Uint8Array): bigint[];
197
203
  }
@@ -203,23 +209,23 @@ declare class RescueCipherCommon {
203
209
  declare class RescueCipher {
204
210
  cipher: RescueCipherCommon;
205
211
  /**
206
- * Constructs a RescueCipher instance using a shared secret.
212
+ * Construct a RescueCipher instance using a shared secret.
207
213
  * The key is derived using RescuePrimeHash and used to initialize the RescueDesc.
208
- * @param sharedSecret - The shared secret to derive the cipher key from.
214
+ * @param sharedSecret - Shared secret to derive the cipher key from.
209
215
  */
210
216
  constructor(sharedSecret: Uint8Array);
211
217
  /**
212
- * Encrypts the plaintext vector in Counter (CTR) mode and serializes each block.
213
- * @param plaintext - The array of plaintext bigints to encrypt.
214
- * @param nonce - A 16-byte nonce for CTR mode.
215
- * @returns The ciphertext as an array of arrays of numbers (each 32 bytes).
218
+ * Encrypt the plaintext vector in Counter (CTR) mode and serialize each block.
219
+ * @param plaintext - Array of plaintext bigints to encrypt.
220
+ * @param nonce - 16-byte nonce for CTR mode.
221
+ * @returns Ciphertext as an array of arrays of numbers (each 32 bytes).
216
222
  */
217
223
  encrypt(plaintext: bigint[], nonce: Uint8Array): number[][];
218
224
  /**
219
- * Deserializes and decrypts the ciphertext vector in Counter (CTR) mode.
220
- * @param ciphertext - The array of arrays of numbers (each 32 bytes) to decrypt.
221
- * @param nonce - A 16-byte nonce for CTR mode.
222
- * @returns The decrypted plaintext as an array of bigints.
225
+ * Deserialize and decrypt the ciphertext vector in Counter (CTR) mode.
226
+ * @param ciphertext - Array of arrays of numbers (each 32 bytes) to decrypt.
227
+ * @param nonce - 16-byte nonce for CTR mode.
228
+ * @returns Decrypted plaintext as an array of bigints.
223
229
  */
224
230
  decrypt(ciphertext: number[][], nonce: Uint8Array): bigint[];
225
231
  }
@@ -231,23 +237,23 @@ declare class RescueCipher {
231
237
  declare class CSplRescueCipher {
232
238
  cipher: RescueCipherCommon;
233
239
  /**
234
- * Constructs a RescueCipher instance using a shared secret.
240
+ * Construct a CSplRescueCipher instance using a shared secret.
235
241
  * The key is derived using RescuePrimeHash and used to initialize the RescueDesc.
236
- * @param sharedSecret - The shared secret to derive the cipher key from.
242
+ * @param sharedSecret - Shared secret to derive the cipher key from.
237
243
  */
238
244
  constructor(sharedSecret: Uint8Array);
239
245
  /**
240
- * Encrypts the plaintext vector in Counter (CTR) mode and serializes each block.
241
- * @param plaintext - The array of plaintext bigints to encrypt.
242
- * @param nonce - A 16-byte nonce for CTR mode.
243
- * @returns The ciphertext as an array of arrays of numbers (each 32 bytes).
246
+ * Encrypt the plaintext vector in Counter (CTR) mode and serialize each block.
247
+ * @param plaintext - Array of plaintext bigints to encrypt.
248
+ * @param nonce - 16-byte nonce for CTR mode.
249
+ * @returns Ciphertext as an array of arrays of numbers (each 32 bytes).
244
250
  */
245
251
  encrypt(plaintext: bigint[], nonce: Uint8Array): number[][];
246
252
  /**
247
- * Deserializes and decrypts the ciphertext vector in Counter (CTR) mode.
248
- * @param ciphertext - The array of arrays of numbers (each 32 bytes) to decrypt.
249
- * @param nonce - A 16-byte nonce for CTR mode.
250
- * @returns The decrypted plaintext as an array of bigints.
253
+ * Deserialize and decrypt the ciphertext vector in Counter (CTR) mode.
254
+ * @param ciphertext - Array of arrays of numbers (each 32 bytes) to decrypt.
255
+ * @param nonce - 16-byte nonce for CTR mode.
256
+ * @returns Decrypted plaintext as an array of bigints.
251
257
  */
252
258
  decrypt(ciphertext: number[][], nonce: Uint8Array): bigint[];
253
259
  }
@@ -263,13 +269,13 @@ declare class RescuePrimeHash {
263
269
  rate: number;
264
270
  digestLength: number;
265
271
  /**
266
- * Constructs a RescuePrimeHash instance with rate = 7 and capacity = 5.
272
+ * Construct a RescuePrimeHash instance with rate = 7 and capacity = 5.
267
273
  */
268
274
  constructor(field: FpField);
269
275
  /**
270
- * Computes the Rescue-Prime hash of a message, with padding as described in Algorithm 2 of the paper.
271
- * @param message - The input message as an array of bigints.
272
- * @returns The hash output as an array of bigints (length = digestLength).
276
+ * Compute the Rescue-Prime hash of a message, with padding as described in Algorithm 2 of the paper.
277
+ * @param message - Input message as an array of bigints.
278
+ * @returns Hash output as an array of bigints (length = digestLength).
273
279
  */
274
280
  digest(message: bigint[]): bigint[];
275
281
  }
@@ -293,25 +299,25 @@ declare class AesCtrCipher {
293
299
  protected key: Uint8Array;
294
300
  private readonly keyBits;
295
301
  /**
296
- * Constructs an AES cipher instance using a shared secret.
302
+ * Construct an AES cipher instance using a shared secret.
297
303
  * The key is derived using SHA3-256.
298
- * @param sharedSecret - The shared secret to derive the AES key from.
299
- * @param keyBits - The AES key size in bits (128, 192, or 256).
304
+ * @param sharedSecret - Shared secret to derive the AES key from.
305
+ * @param keyBits - AES key size in bits (128, 192, or 256).
300
306
  */
301
307
  constructor(sharedSecret: Uint8Array, keyBits: AesKeyBits);
302
308
  /**
303
- * Encrypts the plaintext array in Counter (CTR) mode.
304
- * @param plaintext - The data to encrypt.
305
- * @param nonce - An 8-byte nonce for CTR mode.
306
- * @returns The encrypted ciphertext as a Uint8Array.
309
+ * Encrypt the plaintext array in Counter (CTR) mode.
310
+ * @param plaintext - Data to encrypt.
311
+ * @param nonce - 8-byte nonce for CTR mode.
312
+ * @returns Encrypted ciphertext as a Uint8Array.
307
313
  * @throws Error if the nonce is not 8 bytes long.
308
314
  */
309
315
  encrypt(plaintext: Uint8Array, nonce: Uint8Array): Uint8Array;
310
316
  /**
311
- * Decrypts the ciphertext array in Counter (CTR) mode.
312
- * @param ciphertext - The data to decrypt.
313
- * @param nonce - An 8-byte nonce for CTR mode.
314
- * @returns The decrypted plaintext as a Uint8Array.
317
+ * Decrypt the ciphertext array in Counter (CTR) mode.
318
+ * @param ciphertext - Data to decrypt.
319
+ * @param nonce - 8-byte nonce for CTR mode.
320
+ * @returns Decrypted plaintext as a Uint8Array.
315
321
  * @throws Error if the nonce is not 8 bytes long.
316
322
  */
317
323
  decrypt(ciphertext: Uint8Array, nonce: Uint8Array): Uint8Array;
@@ -323,9 +329,9 @@ declare class AesCtrCipher {
323
329
  */
324
330
  declare class Aes128Cipher extends AesCtrCipher {
325
331
  /**
326
- * Constructs an AES-128 cipher instance using a shared secret.
332
+ * Construct an AES-128 cipher instance using a shared secret.
327
333
  * The key is derived using SHA3-256.
328
- * @param sharedSecret - The shared secret to derive the AES key from.
334
+ * @param sharedSecret - Shared secret to derive the AES key from.
329
335
  */
330
336
  constructor(sharedSecret: Uint8Array);
331
337
  }
@@ -336,9 +342,9 @@ declare class Aes128Cipher extends AesCtrCipher {
336
342
  */
337
343
  declare class Aes192Cipher extends AesCtrCipher {
338
344
  /**
339
- * Constructs an AES-192 cipher instance using a shared secret.
345
+ * Construct an AES-192 cipher instance using a shared secret.
340
346
  * The key is derived using SHA3-256.
341
- * @param sharedSecret - The shared secret to derive the AES key from.
347
+ * @param sharedSecret - Shared secret to derive the AES key from.
342
348
  */
343
349
  constructor(sharedSecret: Uint8Array);
344
350
  }
@@ -349,22 +355,44 @@ declare class Aes192Cipher extends AesCtrCipher {
349
355
  */
350
356
  declare class Aes256Cipher extends AesCtrCipher {
351
357
  /**
352
- * Constructs an AES-256 cipher instance using a shared secret.
358
+ * Construct an AES-256 cipher instance using a shared secret.
353
359
  * The key is derived using SHA3-256.
354
- * @param sharedSecret - The shared secret to derive the AES key from.
360
+ * @param sharedSecret - Shared secret to derive the AES key from.
355
361
  */
356
362
  constructor(sharedSecret: Uint8Array);
357
363
  }
358
364
 
365
+ /**
366
+ * Size descriptor for a single field in circuit packing.
367
+ * A "full" field occupies an entire slot; partial fields are bin-packed together.
368
+ * @internal
369
+ */
359
370
  declare class DataSize {
371
+ /** Whether this field occupies a full slot. */
360
372
  isFull: boolean;
373
+ /** Bit width of the field (0 if full). */
361
374
  size: number;
375
+ /** Original index in the fields array. */
362
376
  index: number;
363
377
  constructor(index: number, size?: number);
364
378
  }
365
379
 
380
+ /**
381
+ * Field definition for circuit input/output packing.
382
+ * Pass an array of these to {@link createPacker} to create a type-safe packer.
383
+ *
384
+ * @example
385
+ * import { FieldInfo } from '@arcium-hq/client';
386
+ *
387
+ * const fields: FieldInfo[] = [
388
+ * { name: 'amount', type: { Integer: { signed: false, width: 64 } } },
389
+ * { name: 'active', type: 'Bool' },
390
+ * ];
391
+ */
366
392
  interface FieldInfo {
393
+ /** Field name matching the circuit parameter. For array types, use indexed notation (`bytes[0]`, `bytes[1]`) - the packer groups these back into arrays on unpack. */
367
394
  name: string;
395
+ /** Field type: Integer with sign/width, Bool, FullInteger (256-bit), Float, or Pubkey. */
368
396
  type: {
369
397
  Integer: {
370
398
  signed: boolean;
@@ -379,6 +407,10 @@ declare enum ArcisValueKind {
379
407
  Float = 3,
380
408
  Pubkey = 4
381
409
  }
410
+ /**
411
+ * Integer type metadata. Used internally by packer.
412
+ * @internal
413
+ */
382
414
  declare class IntegerInfo {
383
415
  signed: boolean;
384
416
  width: bigint;
@@ -391,6 +423,10 @@ declare class IntegerInfo {
391
423
  isWithinBounds(b: bigint): boolean;
392
424
  name(): string;
393
425
  }
426
+ /**
427
+ * Runtime field representation. Used internally by packer.
428
+ * @internal
429
+ */
394
430
  declare class ArcisValueField {
395
431
  name: string;
396
432
  kind: ArcisValueKind;
@@ -402,6 +438,10 @@ declare class ArcisValueField {
402
438
  static fromFieldInfo(info: FieldInfo): ArcisValueField;
403
439
  toDataSize(index: number): DataSize;
404
440
  }
441
+ /**
442
+ * Type container for pack/unpack operations. Used internally by packer.
443
+ * @internal
444
+ */
405
445
  declare class ArcisType {
406
446
  name: string;
407
447
  fields: ArcisValueField[];
@@ -411,22 +451,50 @@ declare class ArcisType {
411
451
  static fromJson(name: string, json: unknown): ArcisType;
412
452
  }
413
453
 
454
+ /**
455
+ * Container for circuit type definitions.
456
+ * Loaded from generated JSON files by build tools -- not typically used directly.
457
+ * @internal
458
+ */
414
459
  declare class ArcisModule {
460
+ /** Map of type name to parsed ArcisType. */
415
461
  types: {
416
462
  [typeName: string]: ArcisType;
417
463
  };
418
464
  constructor(types: {
419
465
  [typeName: string]: ArcisType;
420
466
  });
467
+ /**
468
+ * Parse module from JSON object (as produced by the Arcium compiler).
469
+ * @param json - Raw JSON object with type name keys.
470
+ */
421
471
  static fromJson(json: unknown): ArcisModule;
472
+ /**
473
+ * Load module from a JSON file on disk.
474
+ * @param path - Absolute or relative path to the JSON file.
475
+ */
422
476
  static loadFromFile(path: string): ArcisModule;
423
477
  }
424
478
 
425
479
  /**
426
- * Type-safe packer interface for generated code.
480
+ * Type-safe packer for converting between TypeScript objects and circuit-compatible bigint arrays.
481
+ *
482
+ * @template TInput - Input object type with field names as keys
483
+ * @template TOutput - Output object type (typically same structure as input)
427
484
  */
428
485
  interface Packer<TInput, TOutput> {
486
+ /**
487
+ * Pack input values into bigint array for circuit execution.
488
+ * @param data - Object with field values matching the packer's field definitions.
489
+ * @returns Packed bigint array ready for encryption.
490
+ * @throws Error if a required field is missing.
491
+ */
429
492
  pack(data: TInput): bigint[];
493
+ /**
494
+ * Unpack circuit output back to typed object.
495
+ * @param packed - Bigint array from decrypted circuit output.
496
+ * @returns Typed object with field values.
497
+ */
430
498
  unpack(packed: bigint[]): TOutput;
431
499
  }
432
500
  /** Extracts base field name from array-indexed names: "bytes[0]" -> "bytes" */
@@ -439,10 +507,33 @@ type FieldBaseNames<T extends readonly FieldInfo[]> = ExtractBaseName<T[number][
439
507
  */
440
508
  type ValidateFieldNames<TInput, TFields extends readonly FieldInfo[]> = string extends FieldBaseNames<TFields> ? TFields : FieldBaseNames<TFields> extends keyof TInput ? TFields : never;
441
509
  /**
442
- * Creates a type-safe packer from field definitions.
443
- * Use `as const` on the fields array for compile-time field name validation.
444
- * @param fields - Field definitions from generated code.
445
- * @param typeName - Type name for debugging.
510
+ * Create a type-safe packer from field definitions.
511
+ *
512
+ * Use `as const` on the fields array to enable compile-time field name validation.
513
+ *
514
+ * @param fields - Array of {@link FieldInfo} objects defining each field's name and type.
515
+ * @param typeName - Optional name for debugging (default: 'Packer').
516
+ * @returns Packer instance with pack() and unpack() methods.
517
+ * @throws TypeError if field types don't match expected values during pack/unpack.
518
+ * @throws RangeError if array index is out of bounds.
519
+ *
520
+ * @example
521
+ * import { createPacker } from '@arcium-hq/client';
522
+ *
523
+ * // Define fields matching your circuit's input type
524
+ * const fields = [
525
+ * { name: 'a', type: { Integer: { signed: false, width: 32 } } },
526
+ * { name: 'b', type: { Integer: { signed: false, width: 32 } } },
527
+ * ] as const;
528
+ *
529
+ * // Create packer with explicit input/output types
530
+ * const packer = createPacker<{ a: number; b: number }, { a: bigint; b: bigint }>(fields);
531
+ *
532
+ * // Pack values for circuit input
533
+ * const packed = packer.pack({ a: 10, b: 20 });
534
+ *
535
+ * // Unpack circuit output (from decrypted computation result)
536
+ * const result = packer.unpack(decryptedOutput);
446
537
  */
447
538
  declare function createPacker<TInput extends Record<string, unknown>, TOutput extends Record<string, unknown>, const TFields extends readonly FieldInfo[] = readonly FieldInfo[]>(fields: TFields & ValidateFieldNames<TInput, TFields>, typeName?: string): Packer<TInput, TOutput>;
448
539
 
@@ -456,7 +547,7 @@ type Arcium = {
456
547
  "address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
457
548
  "metadata": {
458
549
  "name": "arcium";
459
- "version": "0.8.4";
550
+ "version": "0.9.0";
460
551
  "spec": "0.1.0";
461
552
  "description": "The Arcium program";
462
553
  };
@@ -586,6 +677,167 @@ type Arcium = {
586
677
  }
587
678
  ];
588
679
  },
680
+ {
681
+ "name": "addPermissionedRecoveryPeers";
682
+ "docs": [
683
+ "Add permissioned recovery peers"
684
+ ];
685
+ "discriminator": [
686
+ 190,
687
+ 177,
688
+ 28,
689
+ 28,
690
+ 204,
691
+ 131,
692
+ 176,
693
+ 251
694
+ ];
695
+ "accounts": [
696
+ {
697
+ "name": "signer";
698
+ "writable": true;
699
+ "signer": true;
700
+ },
701
+ {
702
+ "name": "permissionedRecoveryPeersAcc";
703
+ "writable": true;
704
+ "pda": {
705
+ "seeds": [
706
+ {
707
+ "kind": "const";
708
+ "value": [
709
+ 80,
710
+ 101,
711
+ 114,
712
+ 109,
713
+ 105,
714
+ 115,
715
+ 115,
716
+ 105,
717
+ 111,
718
+ 110,
719
+ 101,
720
+ 100,
721
+ 82,
722
+ 101,
723
+ 99,
724
+ 111,
725
+ 118,
726
+ 101,
727
+ 114,
728
+ 121,
729
+ 80,
730
+ 101,
731
+ 101,
732
+ 114,
733
+ 115,
734
+ 65,
735
+ 99,
736
+ 99,
737
+ 111,
738
+ 117,
739
+ 110,
740
+ 116
741
+ ];
742
+ }
743
+ ];
744
+ };
745
+ },
746
+ {
747
+ "name": "programData";
748
+ "pda": {
749
+ "seeds": [
750
+ {
751
+ "kind": "const";
752
+ "value": [
753
+ 146,
754
+ 111,
755
+ 9,
756
+ 170,
757
+ 109,
758
+ 72,
759
+ 125,
760
+ 226,
761
+ 216,
762
+ 140,
763
+ 55,
764
+ 106,
765
+ 22,
766
+ 29,
767
+ 7,
768
+ 127,
769
+ 176,
770
+ 129,
771
+ 11,
772
+ 19,
773
+ 35,
774
+ 107,
775
+ 124,
776
+ 118,
777
+ 71,
778
+ 160,
779
+ 112,
780
+ 40,
781
+ 3,
782
+ 250,
783
+ 93,
784
+ 137
785
+ ];
786
+ }
787
+ ];
788
+ "program": {
789
+ "kind": "const";
790
+ "value": [
791
+ 2,
792
+ 168,
793
+ 246,
794
+ 145,
795
+ 78,
796
+ 136,
797
+ 161,
798
+ 176,
799
+ 226,
800
+ 16,
801
+ 21,
802
+ 62,
803
+ 247,
804
+ 99,
805
+ 174,
806
+ 43,
807
+ 0,
808
+ 194,
809
+ 185,
810
+ 61,
811
+ 22,
812
+ 193,
813
+ 36,
814
+ 210,
815
+ 192,
816
+ 83,
817
+ 122,
818
+ 16,
819
+ 4,
820
+ 128,
821
+ 0,
822
+ 0
823
+ ];
824
+ };
825
+ };
826
+ },
827
+ {
828
+ "name": "systemProgram";
829
+ "address": "11111111111111111111111111111111";
830
+ }
831
+ ];
832
+ "args": [
833
+ {
834
+ "name": "peers";
835
+ "type": {
836
+ "vec": "pubkey";
837
+ };
838
+ }
839
+ ];
840
+ },
589
841
  {
590
842
  "name": "bumpEpochCluster";
591
843
  "discriminator": [
@@ -1838,16 +2090,19 @@ type Arcium = {
1838
2090
  ];
1839
2091
  },
1840
2092
  {
1841
- "name": "deactivateArx";
2093
+ "name": "closePermissionedRecoveryPeersAccount";
2094
+ "docs": [
2095
+ "Close the permissioned recovery peers account"
2096
+ ];
1842
2097
  "discriminator": [
1843
- 117,
1844
- 244,
1845
- 137,
1846
- 148,
1847
- 25,
2098
+ 55,
2099
+ 55,
2100
+ 184,
2101
+ 150,
2102
+ 82,
1848
2103
  190,
1849
- 175,
1850
- 164
2104
+ 205,
2105
+ 92
1851
2106
  ];
1852
2107
  "accounts": [
1853
2108
  {
@@ -1856,42 +2111,38 @@ type Arcium = {
1856
2111
  "signer": true;
1857
2112
  },
1858
2113
  {
1859
- "name": "arxNodeAcc";
2114
+ "name": "permissionedRecoveryPeersAcc";
1860
2115
  "writable": true;
1861
2116
  "pda": {
1862
2117
  "seeds": [
1863
2118
  {
1864
2119
  "kind": "const";
1865
2120
  "value": [
1866
- 65,
2121
+ 80,
2122
+ 101,
1867
2123
  114,
1868
- 120,
1869
- 78,
2124
+ 109,
2125
+ 105,
2126
+ 115,
2127
+ 115,
2128
+ 105,
1870
2129
  111,
2130
+ 110,
2131
+ 101,
1871
2132
  100,
1872
- 101
1873
- ];
1874
- },
1875
- {
1876
- "kind": "arg";
1877
- "path": "nodeOffset";
1878
- }
1879
- ];
1880
- };
1881
- },
1882
- {
1883
- "name": "clock";
1884
- "writable": true;
1885
- "pda": {
1886
- "seeds": [
1887
- {
1888
- "kind": "const";
1889
- "value": [
1890
- 67,
1891
- 108,
1892
- 111,
2133
+ 82,
2134
+ 101,
1893
2135
  99,
1894
- 107,
2136
+ 111,
2137
+ 118,
2138
+ 101,
2139
+ 114,
2140
+ 121,
2141
+ 80,
2142
+ 101,
2143
+ 101,
2144
+ 114,
2145
+ 115,
1895
2146
  65,
1896
2147
  99,
1897
2148
  99,
@@ -1905,39 +2156,194 @@ type Arcium = {
1905
2156
  };
1906
2157
  },
1907
2158
  {
1908
- "name": "clusterAcc";
1909
- "optional": true;
2159
+ "name": "programData";
1910
2160
  "pda": {
1911
2161
  "seeds": [
1912
2162
  {
1913
2163
  "kind": "const";
1914
2164
  "value": [
1915
- 67,
1916
- 108,
1917
- 117,
1918
- 115,
1919
- 116,
1920
- 101,
1921
- 114
2165
+ 146,
2166
+ 111,
2167
+ 9,
2168
+ 170,
2169
+ 109,
2170
+ 72,
2171
+ 125,
2172
+ 226,
2173
+ 216,
2174
+ 140,
2175
+ 55,
2176
+ 106,
2177
+ 22,
2178
+ 29,
2179
+ 7,
2180
+ 127,
2181
+ 176,
2182
+ 129,
2183
+ 11,
2184
+ 19,
2185
+ 35,
2186
+ 107,
2187
+ 124,
2188
+ 118,
2189
+ 71,
2190
+ 160,
2191
+ 112,
2192
+ 40,
2193
+ 3,
2194
+ 250,
2195
+ 93,
2196
+ 137
1922
2197
  ];
1923
- },
1924
- {
1925
- "kind": "account";
1926
- "path": "arxNodeAcc";
1927
2198
  }
1928
2199
  ];
1929
- };
1930
- }
1931
- ];
1932
- "args": [
1933
- {
1934
- "name": "nodeOffset";
1935
- "type": "u32";
1936
- }
1937
- ];
1938
- },
1939
- {
1940
- "name": "deactivateCluster";
2200
+ "program": {
2201
+ "kind": "const";
2202
+ "value": [
2203
+ 2,
2204
+ 168,
2205
+ 246,
2206
+ 145,
2207
+ 78,
2208
+ 136,
2209
+ 161,
2210
+ 176,
2211
+ 226,
2212
+ 16,
2213
+ 21,
2214
+ 62,
2215
+ 247,
2216
+ 99,
2217
+ 174,
2218
+ 43,
2219
+ 0,
2220
+ 194,
2221
+ 185,
2222
+ 61,
2223
+ 22,
2224
+ 193,
2225
+ 36,
2226
+ 210,
2227
+ 192,
2228
+ 83,
2229
+ 122,
2230
+ 16,
2231
+ 4,
2232
+ 128,
2233
+ 0,
2234
+ 0
2235
+ ];
2236
+ };
2237
+ };
2238
+ },
2239
+ {
2240
+ "name": "systemProgram";
2241
+ "address": "11111111111111111111111111111111";
2242
+ }
2243
+ ];
2244
+ "args": [];
2245
+ },
2246
+ {
2247
+ "name": "deactivateArx";
2248
+ "discriminator": [
2249
+ 117,
2250
+ 244,
2251
+ 137,
2252
+ 148,
2253
+ 25,
2254
+ 190,
2255
+ 175,
2256
+ 164
2257
+ ];
2258
+ "accounts": [
2259
+ {
2260
+ "name": "signer";
2261
+ "writable": true;
2262
+ "signer": true;
2263
+ },
2264
+ {
2265
+ "name": "arxNodeAcc";
2266
+ "writable": true;
2267
+ "pda": {
2268
+ "seeds": [
2269
+ {
2270
+ "kind": "const";
2271
+ "value": [
2272
+ 65,
2273
+ 114,
2274
+ 120,
2275
+ 78,
2276
+ 111,
2277
+ 100,
2278
+ 101
2279
+ ];
2280
+ },
2281
+ {
2282
+ "kind": "arg";
2283
+ "path": "nodeOffset";
2284
+ }
2285
+ ];
2286
+ };
2287
+ },
2288
+ {
2289
+ "name": "clock";
2290
+ "writable": true;
2291
+ "pda": {
2292
+ "seeds": [
2293
+ {
2294
+ "kind": "const";
2295
+ "value": [
2296
+ 67,
2297
+ 108,
2298
+ 111,
2299
+ 99,
2300
+ 107,
2301
+ 65,
2302
+ 99,
2303
+ 99,
2304
+ 111,
2305
+ 117,
2306
+ 110,
2307
+ 116
2308
+ ];
2309
+ }
2310
+ ];
2311
+ };
2312
+ },
2313
+ {
2314
+ "name": "clusterAcc";
2315
+ "optional": true;
2316
+ "pda": {
2317
+ "seeds": [
2318
+ {
2319
+ "kind": "const";
2320
+ "value": [
2321
+ 67,
2322
+ 108,
2323
+ 117,
2324
+ 115,
2325
+ 116,
2326
+ 101,
2327
+ 114
2328
+ ];
2329
+ },
2330
+ {
2331
+ "kind": "account";
2332
+ "path": "arxNodeAcc";
2333
+ }
2334
+ ];
2335
+ };
2336
+ }
2337
+ ];
2338
+ "args": [
2339
+ {
2340
+ "name": "nodeOffset";
2341
+ "type": "u32";
2342
+ }
2343
+ ];
2344
+ },
2345
+ {
2346
+ "name": "deactivateCluster";
1941
2347
  "discriminator": [
1942
2348
  13,
1943
2349
  42,
@@ -4982,6 +5388,160 @@ type Arcium = {
4982
5388
  }
4983
5389
  ];
4984
5390
  },
5391
+ {
5392
+ "name": "initPermissionedRecoveryPeersAccount";
5393
+ "docs": [
5394
+ "Initialize the permissioned recovery peers account"
5395
+ ];
5396
+ "discriminator": [
5397
+ 23,
5398
+ 147,
5399
+ 149,
5400
+ 121,
5401
+ 218,
5402
+ 173,
5403
+ 81,
5404
+ 117
5405
+ ];
5406
+ "accounts": [
5407
+ {
5408
+ "name": "signer";
5409
+ "writable": true;
5410
+ "signer": true;
5411
+ },
5412
+ {
5413
+ "name": "permissionedRecoveryPeersAcc";
5414
+ "writable": true;
5415
+ "pda": {
5416
+ "seeds": [
5417
+ {
5418
+ "kind": "const";
5419
+ "value": [
5420
+ 80,
5421
+ 101,
5422
+ 114,
5423
+ 109,
5424
+ 105,
5425
+ 115,
5426
+ 115,
5427
+ 105,
5428
+ 111,
5429
+ 110,
5430
+ 101,
5431
+ 100,
5432
+ 82,
5433
+ 101,
5434
+ 99,
5435
+ 111,
5436
+ 118,
5437
+ 101,
5438
+ 114,
5439
+ 121,
5440
+ 80,
5441
+ 101,
5442
+ 101,
5443
+ 114,
5444
+ 115,
5445
+ 65,
5446
+ 99,
5447
+ 99,
5448
+ 111,
5449
+ 117,
5450
+ 110,
5451
+ 116
5452
+ ];
5453
+ }
5454
+ ];
5455
+ };
5456
+ },
5457
+ {
5458
+ "name": "programData";
5459
+ "pda": {
5460
+ "seeds": [
5461
+ {
5462
+ "kind": "const";
5463
+ "value": [
5464
+ 146,
5465
+ 111,
5466
+ 9,
5467
+ 170,
5468
+ 109,
5469
+ 72,
5470
+ 125,
5471
+ 226,
5472
+ 216,
5473
+ 140,
5474
+ 55,
5475
+ 106,
5476
+ 22,
5477
+ 29,
5478
+ 7,
5479
+ 127,
5480
+ 176,
5481
+ 129,
5482
+ 11,
5483
+ 19,
5484
+ 35,
5485
+ 107,
5486
+ 124,
5487
+ 118,
5488
+ 71,
5489
+ 160,
5490
+ 112,
5491
+ 40,
5492
+ 3,
5493
+ 250,
5494
+ 93,
5495
+ 137
5496
+ ];
5497
+ }
5498
+ ];
5499
+ "program": {
5500
+ "kind": "const";
5501
+ "value": [
5502
+ 2,
5503
+ 168,
5504
+ 246,
5505
+ 145,
5506
+ 78,
5507
+ 136,
5508
+ 161,
5509
+ 176,
5510
+ 226,
5511
+ 16,
5512
+ 21,
5513
+ 62,
5514
+ 247,
5515
+ 99,
5516
+ 174,
5517
+ 43,
5518
+ 0,
5519
+ 194,
5520
+ 185,
5521
+ 61,
5522
+ 22,
5523
+ 193,
5524
+ 36,
5525
+ 210,
5526
+ 192,
5527
+ 83,
5528
+ 122,
5529
+ 16,
5530
+ 4,
5531
+ 128,
5532
+ 0,
5533
+ 0
5534
+ ];
5535
+ };
5536
+ };
5537
+ },
5538
+ {
5539
+ "name": "systemProgram";
5540
+ "address": "11111111111111111111111111111111";
5541
+ }
5542
+ ];
5543
+ "args": [];
5544
+ },
4985
5545
  {
4986
5546
  "name": "initRawCircuitAcc";
4987
5547
  "discriminator": [
@@ -5167,6 +5727,50 @@ type Arcium = {
5167
5727
  ];
5168
5728
  };
5169
5729
  },
5730
+ {
5731
+ "name": "permissionedRecoveryPeersAcc";
5732
+ "pda": {
5733
+ "seeds": [
5734
+ {
5735
+ "kind": "const";
5736
+ "value": [
5737
+ 80,
5738
+ 101,
5739
+ 114,
5740
+ 109,
5741
+ 105,
5742
+ 115,
5743
+ 115,
5744
+ 105,
5745
+ 111,
5746
+ 110,
5747
+ 101,
5748
+ 100,
5749
+ 82,
5750
+ 101,
5751
+ 99,
5752
+ 111,
5753
+ 118,
5754
+ 101,
5755
+ 114,
5756
+ 121,
5757
+ 80,
5758
+ 101,
5759
+ 101,
5760
+ 114,
5761
+ 115,
5762
+ 65,
5763
+ 99,
5764
+ 99,
5765
+ 111,
5766
+ 117,
5767
+ 110,
5768
+ 116
5769
+ ];
5770
+ }
5771
+ ];
5772
+ };
5773
+ },
5170
5774
  {
5171
5775
  "name": "systemProgram";
5172
5776
  "address": "11111111111111111111111111111111";
@@ -5178,7 +5782,7 @@ type Arcium = {
5178
5782
  "type": "u32";
5179
5783
  },
5180
5784
  {
5181
- "name": "authority";
5785
+ "name": "signer";
5182
5786
  "type": "pubkey";
5183
5787
  },
5184
5788
  {
@@ -6153,6 +6757,32 @@ type Arcium = {
6153
6757
  "writable": true;
6154
6758
  "signer": true;
6155
6759
  },
6760
+ {
6761
+ "name": "mxe";
6762
+ "pda": {
6763
+ "seeds": [
6764
+ {
6765
+ "kind": "const";
6766
+ "value": [
6767
+ 77,
6768
+ 88,
6769
+ 69,
6770
+ 65,
6771
+ 99,
6772
+ 99,
6773
+ 111,
6774
+ 117,
6775
+ 110,
6776
+ 116
6777
+ ];
6778
+ },
6779
+ {
6780
+ "kind": "arg";
6781
+ "path": "mxeProgram";
6782
+ }
6783
+ ];
6784
+ };
6785
+ },
6156
6786
  {
6157
6787
  "name": "comp";
6158
6788
  "writable": true;
@@ -6182,8 +6812,9 @@ type Arcium = {
6182
6812
  ];
6183
6813
  },
6184
6814
  {
6185
- "kind": "arg";
6186
- "path": "mxeProgram";
6815
+ "kind": "account";
6816
+ "path": "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ";
6817
+ "account": "mxeAccount";
6187
6818
  },
6188
6819
  {
6189
6820
  "kind": "arg";
@@ -6192,6 +6823,32 @@ type Arcium = {
6192
6823
  ];
6193
6824
  };
6194
6825
  },
6826
+ {
6827
+ "name": "executingPool";
6828
+ "writable": true;
6829
+ "pda": {
6830
+ "seeds": [
6831
+ {
6832
+ "kind": "const";
6833
+ "value": [
6834
+ 69,
6835
+ 120,
6836
+ 101,
6837
+ 99,
6838
+ 112,
6839
+ 111,
6840
+ 111,
6841
+ 108
6842
+ ];
6843
+ },
6844
+ {
6845
+ "kind": "account";
6846
+ "path": "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ";
6847
+ "account": "mxeAccount";
6848
+ }
6849
+ ];
6850
+ };
6851
+ },
6195
6852
  {
6196
6853
  "name": "poolAccount";
6197
6854
  "writable": true;
@@ -6312,22 +6969,221 @@ type Arcium = {
6312
6969
  110,
6313
6970
  116
6314
6971
  ];
6315
- },
6972
+ },
6973
+ {
6974
+ "kind": "arg";
6975
+ "path": "mxeProgram";
6976
+ }
6977
+ ];
6978
+ };
6979
+ },
6980
+ {
6981
+ "name": "recoveryClusterAcc";
6982
+ "pda": {
6983
+ "seeds": [
6984
+ {
6985
+ "kind": "const";
6986
+ "value": [
6987
+ 82,
6988
+ 101,
6989
+ 99,
6990
+ 111,
6991
+ 118,
6992
+ 101,
6993
+ 114,
6994
+ 121,
6995
+ 67,
6996
+ 108,
6997
+ 117,
6998
+ 115,
6999
+ 116,
7000
+ 101,
7001
+ 114,
7002
+ 65,
7003
+ 99,
7004
+ 99,
7005
+ 111,
7006
+ 117,
7007
+ 110,
7008
+ 116
7009
+ ];
7010
+ },
7011
+ {
7012
+ "kind": "arg";
7013
+ "path": "mxeProgram";
7014
+ }
7015
+ ];
7016
+ };
7017
+ },
7018
+ {
7019
+ "name": "mxeProgram";
7020
+ }
7021
+ ];
7022
+ "args": [
7023
+ {
7024
+ "name": "mxeProgram";
7025
+ "type": "pubkey";
7026
+ }
7027
+ ];
7028
+ },
7029
+ {
7030
+ "name": "removePermissionedRecoveryPeers";
7031
+ "docs": [
7032
+ "Remove permissioned recovery peers"
7033
+ ];
7034
+ "discriminator": [
7035
+ 246,
7036
+ 123,
7037
+ 224,
7038
+ 196,
7039
+ 110,
7040
+ 208,
7041
+ 85,
7042
+ 6
7043
+ ];
7044
+ "accounts": [
7045
+ {
7046
+ "name": "signer";
7047
+ "writable": true;
7048
+ "signer": true;
7049
+ },
7050
+ {
7051
+ "name": "permissionedRecoveryPeersAcc";
7052
+ "writable": true;
7053
+ "pda": {
7054
+ "seeds": [
7055
+ {
7056
+ "kind": "const";
7057
+ "value": [
7058
+ 80,
7059
+ 101,
7060
+ 114,
7061
+ 109,
7062
+ 105,
7063
+ 115,
7064
+ 115,
7065
+ 105,
7066
+ 111,
7067
+ 110,
7068
+ 101,
7069
+ 100,
7070
+ 82,
7071
+ 101,
7072
+ 99,
7073
+ 111,
7074
+ 118,
7075
+ 101,
7076
+ 114,
7077
+ 121,
7078
+ 80,
7079
+ 101,
7080
+ 101,
7081
+ 114,
7082
+ 115,
7083
+ 65,
7084
+ 99,
7085
+ 99,
7086
+ 111,
7087
+ 117,
7088
+ 110,
7089
+ 116
7090
+ ];
7091
+ }
7092
+ ];
7093
+ };
7094
+ },
7095
+ {
7096
+ "name": "programData";
7097
+ "pda": {
7098
+ "seeds": [
6316
7099
  {
6317
- "kind": "arg";
6318
- "path": "mxeProgram";
7100
+ "kind": "const";
7101
+ "value": [
7102
+ 146,
7103
+ 111,
7104
+ 9,
7105
+ 170,
7106
+ 109,
7107
+ 72,
7108
+ 125,
7109
+ 226,
7110
+ 216,
7111
+ 140,
7112
+ 55,
7113
+ 106,
7114
+ 22,
7115
+ 29,
7116
+ 7,
7117
+ 127,
7118
+ 176,
7119
+ 129,
7120
+ 11,
7121
+ 19,
7122
+ 35,
7123
+ 107,
7124
+ 124,
7125
+ 118,
7126
+ 71,
7127
+ 160,
7128
+ 112,
7129
+ 40,
7130
+ 3,
7131
+ 250,
7132
+ 93,
7133
+ 137
7134
+ ];
6319
7135
  }
6320
7136
  ];
7137
+ "program": {
7138
+ "kind": "const";
7139
+ "value": [
7140
+ 2,
7141
+ 168,
7142
+ 246,
7143
+ 145,
7144
+ 78,
7145
+ 136,
7146
+ 161,
7147
+ 176,
7148
+ 226,
7149
+ 16,
7150
+ 21,
7151
+ 62,
7152
+ 247,
7153
+ 99,
7154
+ 174,
7155
+ 43,
7156
+ 0,
7157
+ 194,
7158
+ 185,
7159
+ 61,
7160
+ 22,
7161
+ 193,
7162
+ 36,
7163
+ 210,
7164
+ 192,
7165
+ 83,
7166
+ 122,
7167
+ 16,
7168
+ 4,
7169
+ 128,
7170
+ 0,
7171
+ 0
7172
+ ];
7173
+ };
6321
7174
  };
6322
7175
  },
6323
7176
  {
6324
- "name": "mxeProgram";
7177
+ "name": "systemProgram";
7178
+ "address": "11111111111111111111111111111111";
6325
7179
  }
6326
7180
  ];
6327
7181
  "args": [
6328
7182
  {
6329
- "name": "mxeProgram";
6330
- "type": "pubkey";
7183
+ "name": "peers";
7184
+ "type": {
7185
+ "vec": "pubkey";
7186
+ };
6331
7187
  }
6332
7188
  ];
6333
7189
  },
@@ -6409,6 +7265,44 @@ type Arcium = {
6409
7265
  ];
6410
7266
  };
6411
7267
  },
7268
+ {
7269
+ "name": "recoveryClusterAcc";
7270
+ "pda": {
7271
+ "seeds": [
7272
+ {
7273
+ "kind": "const";
7274
+ "value": [
7275
+ 82,
7276
+ 101,
7277
+ 99,
7278
+ 111,
7279
+ 118,
7280
+ 101,
7281
+ 114,
7282
+ 121,
7283
+ 67,
7284
+ 108,
7285
+ 117,
7286
+ 115,
7287
+ 116,
7288
+ 101,
7289
+ 114,
7290
+ 65,
7291
+ 99,
7292
+ 99,
7293
+ 111,
7294
+ 117,
7295
+ 110,
7296
+ 116
7297
+ ];
7298
+ },
7299
+ {
7300
+ "kind": "arg";
7301
+ "path": "originalMxeProgram";
7302
+ }
7303
+ ];
7304
+ };
7305
+ },
6412
7306
  {
6413
7307
  "name": "mxeRecoveryAccount";
6414
7308
  "writable": true;
@@ -7022,6 +7916,7 @@ type Arcium = {
7022
7916
  "docs": [
7023
7917
  "Cluster to set for the MXE."
7024
7918
  ];
7919
+ "writable": true;
7025
7920
  "pda": {
7026
7921
  "seeds": [
7027
7922
  {
@@ -7135,6 +8030,66 @@ type Arcium = {
7135
8030
  }
7136
8031
  ];
7137
8032
  },
8033
+ {
8034
+ "name": "setClusterTdInfo";
8035
+ "discriminator": [
8036
+ 182,
8037
+ 126,
8038
+ 92,
8039
+ 101,
8040
+ 25,
8041
+ 252,
8042
+ 84,
8043
+ 180
8044
+ ];
8045
+ "accounts": [
8046
+ {
8047
+ "name": "authority";
8048
+ "writable": true;
8049
+ "signer": true;
8050
+ },
8051
+ {
8052
+ "name": "clusterAcc";
8053
+ "writable": true;
8054
+ "pda": {
8055
+ "seeds": [
8056
+ {
8057
+ "kind": "const";
8058
+ "value": [
8059
+ 67,
8060
+ 108,
8061
+ 117,
8062
+ 115,
8063
+ 116,
8064
+ 101,
8065
+ 114
8066
+ ];
8067
+ },
8068
+ {
8069
+ "kind": "arg";
8070
+ "path": "id";
8071
+ }
8072
+ ];
8073
+ };
8074
+ }
8075
+ ];
8076
+ "args": [
8077
+ {
8078
+ "name": "clusterId";
8079
+ "type": "u32";
8080
+ },
8081
+ {
8082
+ "name": "tdInfo";
8083
+ "type": {
8084
+ "option": {
8085
+ "defined": {
8086
+ "name": "nodeMetadata";
8087
+ };
8088
+ };
8089
+ };
8090
+ }
8091
+ ];
8092
+ },
7138
8093
  {
7139
8094
  "name": "setMxeKeys";
7140
8095
  "discriminator": [
@@ -8234,6 +9189,19 @@ type Arcium = {
8234
9189
  117
8235
9190
  ];
8236
9191
  },
9192
+ {
9193
+ "name": "permissionedRecoveryPeersAccount";
9194
+ "discriminator": [
9195
+ 113,
9196
+ 236,
9197
+ 217,
9198
+ 203,
9199
+ 251,
9200
+ 98,
9201
+ 36,
9202
+ 240
9203
+ ];
9204
+ },
8237
9205
  {
8238
9206
  "name": "recoveryClusterAccount";
8239
9207
  "discriminator": [
@@ -8662,6 +9630,11 @@ type Arcium = {
8662
9630
  "name": "clusterNotReady";
8663
9631
  "msg": "Cluster is not ready";
8664
9632
  },
9633
+ {
9634
+ "code": 6508;
9635
+ "name": "blsPubkeyNotSet";
9636
+ "msg": "Bls pubkey not set";
9637
+ },
8665
9638
  {
8666
9639
  "code": 6600;
8667
9640
  "name": "serializationFailed";
@@ -8777,15 +9750,25 @@ type Arcium = {
8777
9750
  "name": "noFeesToClaim";
8778
9751
  "msg": "No fees available to claim";
8779
9752
  },
9753
+ {
9754
+ "code": 6623;
9755
+ "name": "recoveryPeerOffsetZero";
9756
+ "msg": "Recovery peer offset is zero";
9757
+ },
9758
+ {
9759
+ "code": 6624;
9760
+ "name": "invalidDomainSeparator";
9761
+ "msg": "Invalid domain separator";
9762
+ },
8780
9763
  {
8781
9764
  "code": 6700;
8782
- "name": "mxeNotInRecoveryState";
8783
- "msg": "MXE is not in recovery state";
9765
+ "name": "mxeNotInMigrationState";
9766
+ "msg": "MXE is not in migration state";
8784
9767
  },
8785
9768
  {
8786
9769
  "code": 6701;
8787
- "name": "mxeAlreadyInRecovery";
8788
- "msg": "MXE is already in recovery state";
9770
+ "name": "mxeAlreadyInMigration";
9771
+ "msg": "MXE is already in migration state";
8789
9772
  },
8790
9773
  {
8791
9774
  "code": 6702;
@@ -8859,8 +9842,33 @@ type Arcium = {
8859
9842
  },
8860
9843
  {
8861
9844
  "code": 6716;
8862
- "name": "mxeInRecoveryState";
8863
- "msg": "MXE is in recovery state, cannot queue new computations";
9845
+ "name": "mxeInMigrationState";
9846
+ "msg": "MXE is in migration state, cannot queue new computations";
9847
+ },
9848
+ {
9849
+ "code": 6717;
9850
+ "name": "permissionedRecoveryPeersNotDistinct";
9851
+ "msg": "Permissioned recovery peers to add must be distinct";
9852
+ },
9853
+ {
9854
+ "code": 6718;
9855
+ "name": "tooManyPermissionedRecoveryPeers";
9856
+ "msg": "Too many permissioned recovery peers to add";
9857
+ },
9858
+ {
9859
+ "code": 6719;
9860
+ "name": "removeNonExistingPermissionedRecoveryPeers";
9861
+ "msg": "Can only remove existing permissioned recovery peers";
9862
+ },
9863
+ {
9864
+ "code": 6720;
9865
+ "name": "unauthorizedRecoveryPeerCreation";
9866
+ "msg": "Unauthorized to create recovery peer on mainnet";
9867
+ },
9868
+ {
9869
+ "code": 6721;
9870
+ "name": "compilationWithoutMainnetFeatureFlag";
9871
+ "msg": "Program must be compiled with the \\mainnet\\ feature flag.";
8864
9872
  }
8865
9873
  ];
8866
9874
  "types": [
@@ -9847,7 +10855,16 @@ type Arcium = {
9847
10855
  "name": "acccountAccessInfo";
9848
10856
  };
9849
10857
  },
9850
- 12
10858
+ 13
10859
+ ];
10860
+ };
10861
+ },
10862
+ {
10863
+ "name": "padding";
10864
+ "type": {
10865
+ "array": [
10866
+ "u8",
10867
+ 6
9851
10868
  ];
9852
10869
  };
9853
10870
  }
@@ -10021,6 +11038,12 @@ type Arcium = {
10021
11038
  };
10022
11039
  }
10023
11040
  ];
11041
+ },
11042
+ {
11043
+ "name": "trustedDealer";
11044
+ },
11045
+ {
11046
+ "name": "outputTooLarge";
10024
11047
  }
10025
11048
  ];
10026
11049
  };
@@ -10142,6 +11165,14 @@ type Arcium = {
10142
11165
  {
10143
11166
  "name": "mxeProgramId";
10144
11167
  "type": "pubkey";
11168
+ },
11169
+ {
11170
+ "name": "executionStatus";
11171
+ "type": {
11172
+ "defined": {
11173
+ "name": "executionStatus";
11174
+ };
11175
+ };
10145
11176
  }
10146
11177
  ];
10147
11178
  };
@@ -10223,9 +11254,6 @@ type Arcium = {
10223
11254
  },
10224
11255
  {
10225
11256
  "name": "noPubkeysSet";
10226
- },
10227
- {
10228
- "name": "accountNotFound";
10229
11257
  }
10230
11258
  ];
10231
11259
  };
@@ -10518,7 +11546,7 @@ type Arcium = {
10518
11546
  {
10519
11547
  "name": "status";
10520
11548
  "docs": [
10521
- "The status of this MXE (Active or Recovery)."
11549
+ "The status of this MXE (Active or Migration)."
10522
11550
  ];
10523
11551
  "type": {
10524
11552
  "defined": {
@@ -10822,7 +11850,7 @@ type Arcium = {
10822
11850
  "name": "active";
10823
11851
  },
10824
11852
  {
10825
- "name": "recovery";
11853
+ "name": "migration";
10826
11854
  }
10827
11855
  ];
10828
11856
  };
@@ -11115,6 +12143,38 @@ type Arcium = {
11115
12143
  ];
11116
12144
  };
11117
12145
  },
12146
+ {
12147
+ "name": "permissionedRecoveryPeersAccount";
12148
+ "docs": [
12149
+ "Account for tracking permissioned recovery peers - needed until we have staking."
12150
+ ];
12151
+ "serialization": "bytemuck";
12152
+ "repr": {
12153
+ "kind": "c";
12154
+ };
12155
+ "type": {
12156
+ "kind": "struct";
12157
+ "fields": [
12158
+ {
12159
+ "name": "permissionedPeers";
12160
+ "docs": [
12161
+ "DO NOT PUT ANYTHING ELSE BEFORE THE PERMISSIONED_PEERS FIELD, IT'S EXPECTED TO BE AT",
12162
+ "OFFSET 8."
12163
+ ];
12164
+ "type": {
12165
+ "array": [
12166
+ "pubkey",
12167
+ 25
12168
+ ];
12169
+ };
12170
+ },
12171
+ {
12172
+ "name": "bump";
12173
+ "type": "u8";
12174
+ }
12175
+ ];
12176
+ };
12177
+ },
11118
12178
  {
11119
12179
  "name": "queueComputationEvent";
11120
12180
  "type": {
@@ -11278,6 +12338,18 @@ type Arcium = {
11278
12338
  ];
11279
12339
  };
11280
12340
  },
12341
+ {
12342
+ "name": "peerOffset";
12343
+ "docs": [
12344
+ "DO NOT PUT ANYTHING ELSE BEFORE THE PEER_OFFSET FIELD, IT'S EXPECTED TO BE AT OFFSET 72."
12345
+ ];
12346
+ "type": {
12347
+ "array": [
12348
+ "u8",
12349
+ 4
12350
+ ];
12351
+ };
12352
+ },
11281
12353
  {
11282
12354
  "name": "bump";
11283
12355
  "type": "u8";
@@ -11754,9 +12826,9 @@ declare const ARCIUM_ADDR: "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
11754
12826
  */
11755
12827
  type ComputationReference = anchor.IdlTypes<Arcium>['computationReference'];
11756
12828
  /**
11757
- * Checks if a computation reference is null (all zeros).
11758
- * @param ref - The computation reference to check
11759
- * @returns true if the reference is null, false otherwise
12829
+ * Check if a computation reference is null (all zeros).
12830
+ * @param ref - Computation reference to check.
12831
+ * @returns true if the reference is null, false otherwise.
11760
12832
  */
11761
12833
  declare function isNullRef(ref: ComputationReference): boolean;
11762
12834
 
@@ -11786,36 +12858,36 @@ type ExecutingPoolAccount = anchor.IdlTypes<Arcium>['tinyExecPool'] | anchor.Idl
11786
12858
  */
11787
12859
  type CircuitSource = anchor.IdlTypes<Arcium>['circuitSource'];
11788
12860
  /**
11789
- * Fetches and decodes the mempool account info for any mempool account size.
11790
- * @param provider - The Anchor provider to use for fetching accounts.
11791
- * @param mempoolAccPubkey - The public key of the mempool account.
11792
- * @returns The decoded mempool account info.
12861
+ * Fetch and decode the mempool account info for any mempool account size.
12862
+ * @param provider - Anchor provider to use for fetching accounts.
12863
+ * @param mempoolAccPubkey - Public key of the mempool account.
12864
+ * @returns Decoded mempool account info.
11793
12865
  * @throws Error if the account cannot be fetched or the discriminator is unknown.
11794
12866
  */
11795
12867
  declare function getMempoolAccInfo(provider: AnchorProvider, mempoolAccPubkey: anchor.web3.PublicKey): Promise<MempoolAccount>;
11796
12868
  /**
11797
- * Fetches and decodes the executing pool account info for any pool size.
11798
- * @param provider - The Anchor provider to use for fetching accounts.
11799
- * @param executingPoolAccPubkey - The public key of the executing pool account.
11800
- * @returns The decoded executing pool account info.
12869
+ * Fetch and decode the executing pool account info for any pool size.
12870
+ * @param provider - Anchor provider to use for fetching accounts.
12871
+ * @param executingPoolAccPubkey - Public key of the executing pool account.
12872
+ * @returns Decoded executing pool account info.
11801
12873
  * @throws Error if the account cannot be fetched or the discriminator is unknown.
11802
12874
  */
11803
12875
  declare function getExecutingPoolAccInfo(provider: AnchorProvider, executingPoolAccPubkey: anchor.web3.PublicKey): Promise<ExecutingPoolAccount>;
11804
12876
  /**
11805
- * Returns all computation references in the mempool for a given account.
12877
+ * Return all computation references in the mempool for a given account.
11806
12878
  * Only non-stake computations are included.
11807
- * @param arciumProgram - The Anchor program instance.
11808
- * @param address - The public key of the mempool account.
12879
+ * @param arciumProgram - Anchor program instance.
12880
+ * @param address - Public key of the mempool account.
11809
12881
  * @returns Array of ComputationReference objects.
11810
12882
  */
11811
12883
  declare function getComputationsInMempool(arciumProgram: anchor.Program<Arcium>, address: PublicKey): Promise<ComputationReference[]>;
11812
12884
  /**
11813
12885
  * Statistics about priority fees for computations in a mempool.
11814
- * @property mean - The average priority fee across all computations.
11815
- * @property median - The middle value of priority fees when sorted.
11816
- * @property min - The lowest priority fee in the mempool.
11817
- * @property max - The highest priority fee in the mempool.
11818
- * @property count - The total number of computations in the mempool.
12886
+ * @property mean - Average priority fee across all computations.
12887
+ * @property median - Middle value of priority fees when sorted.
12888
+ * @property min - Lowest priority fee in the mempool.
12889
+ * @property max - Highest priority fee in the mempool.
12890
+ * @property count - Total number of computations in the mempool.
11819
12891
  */
11820
12892
  interface MempoolPriorityFeeStats {
11821
12893
  mean: anchor.BN;
@@ -11825,24 +12897,24 @@ interface MempoolPriorityFeeStats {
11825
12897
  count: number;
11826
12898
  }
11827
12899
  /**
11828
- * Calculates priority fee statistics for computations in a mempool.
11829
- * @param arciumProgram - The Anchor program instance.
11830
- * @param mempoolAddress - The public key of the mempool account.
12900
+ * Calculate priority fee statistics for computations in a mempool.
12901
+ * @param arciumProgram - Anchor program instance.
12902
+ * @param mempoolAddress - Public key of the mempool account.
11831
12903
  * @returns Priority fee statistics (mean, median, min, max, count).
11832
12904
  */
11833
12905
  declare function getMempoolPriorityFeeStats(arciumProgram: anchor.Program<Arcium>, mempoolAddress: PublicKey): Promise<MempoolPriorityFeeStats>;
11834
12906
  /**
11835
- * Fetches and extracts the MXE X25519 public key from the MXE account.
11836
- * @param provider - The Anchor provider to use for fetching accounts.
11837
- * @param mxeProgramId - The public key of the MXE program.
11838
- * @returns The MXE's X25519 public key as a Uint8Array, or null if not set.
12907
+ * Fetch and extract the MXE X25519 public key from the MXE account.
12908
+ * @param provider - Anchor provider to use for fetching accounts.
12909
+ * @param mxeProgramId - Public key of the MXE program.
12910
+ * @returns MXE's X25519 public key as a Uint8Array, or null if not set.
11839
12911
  */
11840
12912
  declare function getMXEPublicKey(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey): Promise<Uint8Array | null>;
11841
12913
  /**
11842
- * Fetches and extracts the MXE arcis Ed25519 verifying key from the MXE account.
11843
- * @param provider - The Anchor provider to use for fetching accounts.
11844
- * @param mxeProgramId - The public key of the MXE program.
11845
- * @returns The MXE's arcis Ed25519 verifying key as a Uint8Array, or null if not set.
12914
+ * Fetch and extract the MXE arcis Ed25519 verifying key from the MXE account.
12915
+ * @param provider - Anchor provider to use for fetching accounts.
12916
+ * @param mxeProgramId - Public key of the MXE program.
12917
+ * @returns MXE's arcis Ed25519 verifying key as a Uint8Array, or null if not set.
11846
12918
  */
11847
12919
  declare function getMXEArcisEd25519VerifyingKey(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey): Promise<Uint8Array | null>;
11848
12920
  /**
@@ -11851,112 +12923,128 @@ declare function getMXEArcisEd25519VerifyingKey(provider: AnchorProvider, mxePro
11851
12923
  */
11852
12924
  type CircuitState = 'OnchainPending' | 'OnchainFinalized' | 'Offchain';
11853
12925
  /**
11854
- * Determines the current state of a circuit based on its on-chain configuration.
12926
+ * Determine the current state of a circuit based on its on-chain configuration.
11855
12927
  * @internal Called internally by `uploadCircuit` - most users don't need this directly.
11856
- * @param circuitSource - The circuitSource field from ComputationDefinitionAccount.
11857
- * @returns The current state of the circuit.
12928
+ * @param circuitSource - circuitSource field from ComputationDefinitionAccount.
12929
+ * @returns Current state of the circuit.
11858
12930
  */
11859
12931
  declare function getCircuitState(circuitSource: CircuitSource): CircuitState;
11860
12932
  /**
11861
- * Uploads a circuit to the blockchain, splitting it into multiple accounts if necessary.
11862
- * @param provider - The Anchor provider to use for transactions.
11863
- * @param circuitName - The name of the circuit.
11864
- * @param mxeProgramId - The public key of the MXE program.
11865
- * @param rawCircuit - The raw circuit data as a Uint8Array.
12933
+ * Upload a circuit to the blockchain, splitting it into multiple accounts if necessary.
12934
+ * @param provider - Anchor provider to use for transactions.
12935
+ * @param circuitName - Name of the circuit.
12936
+ * @param mxeProgramId - Public key of the MXE program.
12937
+ * @param rawCircuit - Raw circuit data as a Uint8Array.
11866
12938
  * @param logging - Whether to log progress (default: true).
11867
- * @param chunkSize - The number of upload transactions to send in parallel (default: 500).
11868
- * @returns An array of transaction signatures for all upload and finalize transactions.
12939
+ * @param chunkSize - Number of upload transactions to send in parallel (default: 500).
12940
+ * @param confirmOptions - Transaction confirmation options.
12941
+ * @returns Array of transaction signatures for all upload and finalize transactions.
11869
12942
  */
11870
12943
  declare function uploadCircuit(provider: AnchorProvider, circuitName: string, mxeProgramId: anchor.web3.PublicKey, rawCircuit: Uint8Array, logging?: boolean, chunkSize?: number, confirmOptions?: ConfirmOptions): Promise<string[]>;
12944
+ /**
12945
+ * Queue a key recovery initialization for an MXE on a given cluster.
12946
+ * @param provider - Anchor provider for signing and sending.
12947
+ * @param clusterOffset - Cluster offset to recover keys from.
12948
+ * @param mxeProgramId - Public key of the MXE program.
12949
+ * @param confirmOptions - Transaction confirmation options.
12950
+ * @returns Array of transaction signatures.
12951
+ */
11871
12952
  declare function queueKeyRecoveryInit(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string[]>;
11872
12953
  /**
11873
- * Builds a transaction to finalize a computation definition.
11874
- * @param provider - The Anchor provider to use for transactions.
11875
- * @param compDefOffset - The offset of the computation definition.
11876
- * @param mxeProgramId - The public key of the MXE program.
11877
- * @returns The transaction to finalize the computation definition.
12954
+ * Build a transaction to finalize a computation definition.
12955
+ * @param provider - Anchor provider to use for transactions.
12956
+ * @param compDefOffset - Offset of the computation definition.
12957
+ * @param mxeProgramId - Public key of the MXE program.
12958
+ * @returns Transaction to finalize the computation definition.
11878
12959
  */
11879
12960
  declare function buildFinalizeCompDefTx(provider: AnchorProvider, compDefOffset: number, mxeProgramId: anchor.web3.PublicKey): Promise<anchor.web3.Transaction>;
11880
12961
  /**
11881
- * Returns the base seed for an Arcium account, given its name.
11882
- * @param accName - The name of the account.
11883
- * @returns The base seed as a Uint8Array.
12962
+ * Return the base seed for an Arcium account, given its name.
12963
+ * @param accName - Name of the account.
12964
+ * @returns Base seed as a Uint8Array.
11884
12965
  */
11885
12966
  declare function getArciumAccountBaseSeed(accName: string): Uint8Array;
11886
12967
  /**
11887
- * Computes the offset for a computation definition account, based on the circuit name.
11888
- * @param circuitName - The name of the circuit.
11889
- * @returns The offset as a 4-byte Uint8Array.
12968
+ * Compute the offset for a computation definition account, based on the circuit name.
12969
+ * @param circuitName - Name of the circuit.
12970
+ * @returns Offset as a 4-byte Uint8Array.
11890
12971
  */
11891
12972
  declare function getCompDefAccOffset(circuitName: string): Uint8Array;
11892
12973
  /**
11893
- * Returns an Anchor program instance for the Arcium program.
11894
- * @param provider - The Anchor provider to use.
11895
- * @returns The Anchor program instance for Arcium.
12974
+ * Return an Anchor program instance for the Arcium program.
12975
+ * @param provider - Anchor provider to use.
12976
+ * @returns Anchor program instance for Arcium.
11896
12977
  */
11897
12978
  declare function getArciumProgram(provider: AnchorProvider): Program<Arcium>;
11898
12979
  /**
11899
- * Sets an MXE to Recovery status, initiating the key recovery process.
11900
- * @param provider - The Anchor provider to use for transactions.
11901
- * @param mxeProgramId - The public key of the MXE program to recover.
11902
- * @returns The transaction signature.
12980
+ * Set an MXE to Recovery status, initiating the key recovery process.
12981
+ * @param provider - Anchor provider to use for transactions.
12982
+ * @param mxeProgramId - Public key of the MXE program to recover.
12983
+ * @param confirmOptions - Transaction confirmation options.
12984
+ * @returns Transaction signature.
11903
12985
  */
11904
12986
  declare function recoverMxe(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
11905
12987
  /**
11906
- * Initializes key recovery execution by creating the MxeRecoveryAccount and
12988
+ * Initialize key recovery execution by creating the MxeRecoveryAccount and
11907
12989
  * registering the key_recovery_final computation definition on the backup MXE.
11908
12990
  * This is split into two parts due to Solana's 10KB per-instruction allocation limit.
11909
- * @param provider - The Anchor provider to use for transactions.
11910
- * @param originalMxeProgramId - The public key of the original MXE program being recovered.
11911
- * @param backupMxeProgramId - The public key of the backup MXE program that will take over.
11912
- * @returns The transaction signature from part2.
12991
+ * @param provider - Anchor provider to use for transactions.
12992
+ * @param originalMxeProgramId - Public key of the original MXE program being recovered.
12993
+ * @param backupMxeProgramId - Public key of the backup MXE program that will take over.
12994
+ * @param confirmOptions - Transaction confirmation options.
12995
+ * @returns Transaction signature from part2.
11913
12996
  */
11914
12997
  declare function initKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
11915
12998
  /**
11916
- * Submits a re-encrypted key recovery share from a recovery peer.
12999
+ * Submit a re-encrypted key recovery share from a recovery peer.
11917
13000
  * Recovery peers must decrypt shares using their x25519 private key and re-encrypt
11918
13001
  * them for the backup MXE before submission.
11919
- * @param provider - The Anchor provider to use for transactions.
11920
- * @param originalMxeProgramId - The public key of the original MXE program being recovered.
11921
- * @param backupMxeProgramId - The public key of the backup MXE program.
11922
- * @param peerOffset - The offset of the recovery peer.
11923
- * @param peerIndex - The index of this peer in the recovery peers list.
11924
- * @param share - The re-encrypted share: 5 field elements of 32 bytes each (160 bytes total).
11925
- * @returns The transaction signature.
13002
+ * @param provider - Anchor provider to use for transactions.
13003
+ * @param originalMxeProgramId - Public key of the original MXE program being recovered.
13004
+ * @param backupMxeProgramId - Public key of the backup MXE program.
13005
+ * @param peerOffset - Offset of the recovery peer.
13006
+ * @param peerIndex - Index of this peer in the recovery peers list.
13007
+ * @param share - Re-encrypted share: 5 field elements of 32 bytes each (160 bytes total).
13008
+ * @param confirmOptions - Transaction confirmation options.
13009
+ * @returns Transaction signature.
11926
13010
  */
11927
13011
  declare function submitKeyRecoveryShare(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, peerOffset: number, peerIndex: number, share: number[][] | Uint8Array[], confirmOptions?: ConfirmOptions): Promise<string>;
11928
13012
  /**
11929
- * Finalizes key recovery execution after the submission threshold is met.
13013
+ * Finalize key recovery execution after the submission threshold is met.
11930
13014
  * This queues the key_recovery_finalize MPC computation on the backup cluster.
11931
- * @param provider - The Anchor provider to use for transactions.
11932
- * @param originalMxeProgramId - The public key of the original MXE program being recovered.
11933
- * @param backupMxeProgramId - The public key of the backup MXE program.
11934
- * @param clusterOffset - The cluster offset where the backup MXE is deployed.
11935
- * @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
11936
- * @returns The transaction signature.
13015
+ * @param provider - Anchor provider to use for transactions.
13016
+ * @param originalMxeProgramId - Public key of the original MXE program being recovered.
13017
+ * @param backupMxeProgramId - Public key of the backup MXE program.
13018
+ * @param clusterOffset - Cluster offset where the backup MXE is deployed.
13019
+ * @param keyRecoveryFinalizeOffset - Computation offset for the key_recovery_finalize computation.
13020
+ * @param confirmOptions - Transaction confirmation options.
13021
+ * @returns Transaction signature.
11937
13022
  */
11938
13023
  declare function finalizeKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, clusterOffset: number, keyRecoveryFinalizeOffset: anchor.BN, confirmOptions?: ConfirmOptions): Promise<string>;
11939
13024
  /**
11940
- * Initializes an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
13025
+ * Initialize an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
11941
13026
  * this only partially allocates recovery_cluster_acc.
11942
13027
  * Call initMxePart2 afterwards to finish allocation and add keygen to mempool.
11943
- * @param provider - The Anchor provider to use for transactions.
11944
- * @param mxeProgramId - The public key to use as the MXE program ID.
11945
- * @returns The transaction signature.
13028
+ * @param provider - Anchor provider to use for transactions.
13029
+ * @param mxeProgramId - Public key to use as the MXE program ID.
13030
+ * @param confirmOptions - Transaction confirmation options.
13031
+ * @returns Transaction signature.
11946
13032
  */
11947
13033
  declare function initMxePart1(provider: AnchorProvider, mxeProgramId: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
11948
13034
  /**
11949
- * Finishes MXE initialization (part 2).
11950
- * Reallocates recovery_cluster_acc to full size, initializes recovery_peers,
11951
- * and adds the keygen computation to the mempool.
11952
- * @param provider - The Anchor provider to use for transactions.
11953
- * @param clusterOffset - The cluster offset to associate with the MXE.
11954
- * @param mxeProgramId - The public key to use as the MXE program ID.
13035
+ * Finish MXE initialization (part 2).
13036
+ * Reallocate recovery_cluster_acc to full size, initialize recovery_peers,
13037
+ * and add the keygen computation to the mempool.
13038
+ * @param provider - Anchor provider to use for transactions.
13039
+ * @param clusterOffset - Cluster offset to associate with the MXE.
13040
+ * @param mxeProgramId - Public key to use as the MXE program ID.
11955
13041
  * @param recoveryPeers - Array of 100 node offsets for recovery peers (0 for unused slots).
11956
- * @param keygenOffset - The computation offset for the keygen computation.
11957
- * @param keyRecoveryInitOffset - The computation offset for the key_recovery_init computation.
13042
+ * @param keygenOffset - Computation offset for the keygen computation.
13043
+ * @param keyRecoveryInitOffset - Computation offset for the key_recovery_init computation.
13044
+ * @param lutOffset - Lookup table offset for the MXE's address lookup table.
11958
13045
  * @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
11959
- * @returns The transaction signature.
13046
+ * @param confirmOptions - Transaction confirmation options.
13047
+ * @returns Transaction signature.
11960
13048
  */
11961
13049
  declare function initMxePart2(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, recoveryPeers: number[], keygenOffset: anchor.BN, keyRecoveryInitOffset: anchor.BN, lutOffset: anchor.BN, mxeAuthority?: anchor.web3.PublicKey, confirmOptions?: ConfirmOptions): Promise<string>;
11962
13050
 
@@ -11965,116 +13053,121 @@ declare function initMxePart2(provider: AnchorProvider, clusterOffset: number, m
11965
13053
  */
11966
13054
  type ArciumLocalEnv = {
11967
13055
  arciumClusterOffset: number;
13056
+ arciumBackupClusterOffset: number;
11968
13057
  };
11969
13058
  /**
11970
- * Reads local Arcium environment information from environment variables.
13059
+ * Read local Arcium environment information from environment variables.
11971
13060
  * Only available in Node.js and when testing locally.
11972
- * @returns The local Arcium environment configuration.
13061
+ * @returns Local Arcium environment configuration.
11973
13062
  * @throws Error if called in a browser or if required environment variables are missing or invalid.
11974
13063
  */
11975
13064
  declare function getArciumEnv(): ArciumLocalEnv;
11976
13065
 
11977
13066
  /**
11978
- * Represents possible error messages that can occur during computation processing or transaction handling.
11979
- */
11980
- type ComputationErrorType = `Transaction ${string} not found` | 'Transaction inner instructions not found' | `Transaction failed with error: ${string}` | 'No log messages found' | 'No queue computation instruction found' | `Invalid computation offset: ${string}` | 'Computation not found in executing pool, might have already executed' | `Error fetching transactions: ${string}` | `Instruction at index ${number} not found` | 'Account keys or program ID index not found' | `No Program ID found for instruction at index ${number}` | 'Max retries reached while searching for transaction';
11981
- /**
11982
- * Waits for the finalization of a computation by listening for the finalizeComputationEvent.
11983
- * Resolves with the transaction signature once the computation is finalized.
11984
- * @param provider - The Anchor provider to use for event listening.
11985
- * @param computationOffset - The offset of the computation to wait for.
11986
- * @param mxeProgramId - The public key of the MXE program.
11987
- * @param commitment - (Optional) The desired finality/commitment level (default: 'confirmed').
11988
- * @returns The transaction signature of the finalization event.
13067
+ * Wait for a computation to finalize by polling the computation account
13068
+ * status via HTTP RPC. Does not use WebSocket subscriptions.
13069
+ *
13070
+ * Polls every 500ms (same as Agave's send_and_confirm_transaction_with_config).
13071
+ * Return the most recent transaction signature on the computation account
13072
+ * once finalization is detected.
13073
+ *
13074
+ * @param provider - Anchor provider.
13075
+ * @param computationOffset - Computation offset to wait for.
13076
+ * @param mxeProgramId - MXE program public key.
13077
+ * @param commitment - Commitment level for RPC calls (default: 'confirmed').
13078
+ * @param timeoutMs - Maximum wait time in milliseconds (default: 120000).
13079
+ * @returns Transaction signature from the finalization.
13080
+ * @throws Error if the MXE account has no cluster assigned.
13081
+ * @throws Error if the computation does not finalize within timeoutMs.
11989
13082
  */
11990
- declare function awaitComputationFinalization(provider: AnchorProvider, computationOffset: BN, mxeProgramId: PublicKey, commitment?: Finality): Promise<string>;
13083
+ declare function awaitComputationFinalization(provider: AnchorProvider, computationOffset: BN, mxeProgramId: PublicKey, commitment?: Finality, timeoutMs?: number): Promise<string>;
11991
13084
 
11992
13085
  /**
11993
- * Returns the public key of the deployed Arcium program on Solana.
11994
- * @returns The Arcium program's public key.
13086
+ * Return the public key of the deployed Arcium program on Solana.
13087
+ * @returns Arcium program's public key.
11995
13088
  */
11996
13089
  declare function getArciumProgramId(): PublicKey;
11997
13090
  /**
11998
- * Derives the computation account address for a given cluster and computation offset.
11999
- * @param clusterOffset - The offset of the cluster this computation will be executed by.
12000
- * @param computationOffset - The computation offset as an anchor.BN.
12001
- * @returns The derived computation account public key.
13091
+ * Derive the computation account address for a given cluster and computation offset.
13092
+ * @param clusterOffset - Offset of the cluster this computation will be executed by.
13093
+ * @param computationOffset - Computation offset as an anchor.BN.
13094
+ * @returns Derived computation account public key.
12002
13095
  */
12003
13096
  declare function getComputationAccAddress(clusterOffset: number, computationOffset: anchor.BN): PublicKey;
12004
13097
  /**
12005
- * Derives the mempool account address for a given cluster.
12006
- * @param clusterOffset - The offset of the cluster.
12007
- * @returns The derived mempool account public key.
13098
+ * Derive the mempool account address for a given cluster.
13099
+ * @param clusterOffset - Offset of the cluster.
13100
+ * @returns Derived mempool account public key.
12008
13101
  */
12009
13102
  declare function getMempoolAccAddress(clusterOffset: number): PublicKey;
12010
13103
  /**
12011
- * Derives the executing pool account address for a given cluster.
12012
- * @param clusterOffset - The offset of the cluster.
12013
- * @returns The derived executing pool account public key.
13104
+ * Derive the executing pool account address for a given cluster.
13105
+ * @param clusterOffset - Offset of the cluster.
13106
+ * @returns Derived executing pool account public key.
12014
13107
  */
12015
13108
  declare function getExecutingPoolAccAddress(clusterOffset: number): PublicKey;
12016
13109
  /**
12017
- * Derives the fee pool account address.
12018
- * @returns The derived fee pool account public key.
13110
+ * Derive the fee pool account address.
13111
+ * @returns Derived fee pool account public key.
12019
13112
  */
12020
13113
  declare function getFeePoolAccAddress(): PublicKey;
12021
13114
  /**
12022
- * Derives the clock account address.
12023
- * @returns The derived clock account public key.
13115
+ * Derive the clock account address.
13116
+ * @returns Derived clock account public key.
12024
13117
  */
12025
13118
  declare function getClockAccAddress(): PublicKey;
12026
13119
  /**
12027
- * Derives the cluster account address for a given offset.
12028
- * @param clusterOffset - The cluster offset as a number.
12029
- * @returns The derived cluster account public key.
13120
+ * Derive the cluster account address for a given offset.
13121
+ * @param clusterOffset - Cluster offset as a number.
13122
+ * @returns Derived cluster account public key.
12030
13123
  */
12031
13124
  declare function getClusterAccAddress(clusterOffset: number): PublicKey;
12032
13125
  /**
12033
- * Derives the ArxNode account address for a given offset.
12034
- * @param nodeOffset - The ArxNode offset as a number.
12035
- * @returns The derived ArxNode account public key.
13126
+ * Derive the ArxNode account address for a given offset.
13127
+ * @param nodeOffset - ArxNode offset as a number.
13128
+ * @returns Derived ArxNode account public key.
12036
13129
  */
12037
13130
  declare function getArxNodeAccAddress(nodeOffset: number): PublicKey;
12038
13131
  /**
12039
- * Derives the MXE account address for a given MXE program ID.
12040
- * @param mxeProgramId - The public key of the MXE program.
12041
- * @returns The derived MXE account public key.
13132
+ * Derive the MXE account address for a given MXE program ID.
13133
+ * @param mxeProgramId - Public key of the MXE program.
13134
+ * @returns Derived MXE account public key.
12042
13135
  */
12043
13136
  declare function getMXEAccAddress(mxeProgramId: PublicKey): PublicKey;
12044
13137
  /**
12045
- * Derives the computation definition account address for a given MXE program ID and offset.
12046
- * @param mxeProgramId - The public key of the MXE program.
12047
- * @param compDefOffset - The computation definition offset as a number.
12048
- * @returns The derived computation definition account public key.
13138
+ * Derive the computation definition account address for a given MXE program ID and offset.
13139
+ * @param mxeProgramId - Public key of the MXE program.
13140
+ * @param compDefOffset - Computation definition offset as a number.
13141
+ * @returns Derived computation definition account public key.
12049
13142
  */
12050
13143
  declare function getCompDefAccAddress(mxeProgramId: PublicKey, compDefOffset: number): PublicKey;
12051
13144
  /**
12052
- * Derives the recovery cluster account address for a given MXE program ID.
12053
- * @param mxeProgramId - The public key of the MXE program.
12054
- * @returns The derived recovery cluster account public key.
13145
+ * Derive the recovery cluster account address for a given MXE program ID.
13146
+ * @param mxeProgramId - Public key of the MXE program.
13147
+ * @returns Derived recovery cluster account public key.
12055
13148
  */
12056
13149
  declare function getRecoveryClusterAccAddress(mxeProgramId: PublicKey): PublicKey;
12057
13150
  /**
12058
- * Derives the MXE recovery account address for a key recovery session.
12059
- * @param backupMxeProgramId - The public key of the backup MXE program that will take over.
12060
- * @param originalMxeProgramId - The public key of the original MXE program being recovered.
12061
- * @returns The derived MXE recovery account public key.
13151
+ * Derive the MXE recovery account address for a key recovery session.
13152
+ * @param backupMxeProgramId - Public key of the backup MXE program that will take over.
13153
+ * @param originalMxeProgramId - Public key of the original MXE program being recovered.
13154
+ * @returns Derived MXE recovery account public key.
12062
13155
  */
12063
13156
  declare function getMxeRecoveryAccAddress(backupMxeProgramId: PublicKey, originalMxeProgramId: PublicKey): PublicKey;
12064
13157
  /**
12065
- * Derives the raw circuit account address for a given computation definition and index.
12066
- * @param compDefPubkey - The public key of the computation definition account.
12067
- * @param rawCircuitIndex - The index of the raw circuit account (0-based).
12068
- * @returns The derived raw circuit account public key.
13158
+ * Derive the raw circuit account address for a given computation definition and index.
13159
+ * @param compDefPubkey - Public key of the computation definition account.
13160
+ * @param rawCircuitIndex - Index of the raw circuit account (0-based).
13161
+ * @returns Derived raw circuit account public key.
12069
13162
  */
12070
13163
  declare function getRawCircuitAccAddress(compDefPubkey: PublicKey, rawCircuitIndex: number): PublicKey;
12071
13164
  /**
12072
- * Derives the address lookup table address for an MXE program.
12073
- * @param mxeProgramId - The public key of the MXE program.
12074
- * @param lutOffset - The index of the lookup table, to be fetched from the mxe account.
12075
- * @returns The derived address lookup table public key.
13165
+ * Derive the address lookup table address for an MXE program.
13166
+ * @param mxeProgramId - Public key of the MXE program.
13167
+ * @param lutOffset - Index of the lookup table, to be fetched from the mxe account.
13168
+ * @returns Derived address lookup table public key.
12076
13169
  */
12077
13170
  declare function getLookupTableAddress(mxeProgramId: PublicKey, lutOffset: anchor.BN): PublicKey;
12078
13171
 
12079
13172
  export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, ArcisValueField, CSplRescueCipher, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, IntegerInfo, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, createPacker, deserializeLE, finalizeKeyRecoveryExecution, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArxNodeAccAddress, getCircuitState, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFeePoolAccAddress, getLookupTableAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getRawCircuitAccAddress, getRecoveryClusterAccAddress, initKeyRecoveryExecution, initMxePart1, initMxePart2, isNullRef, positiveModulo, queueKeyRecoveryInit, randMatrix, recoverMxe, serializeLE, sha256, submitKeyRecoveryShare, toVec, uploadCircuit };
12080
- export type { Arcium as ArciumIdlType, ArciumLocalEnv, CircuitSource, CircuitState, ComputationErrorType, ComputationReference, ExecutingPoolAccount, FieldInfo, FpField, MempoolAccount, MempoolPriorityFeeStats, Packer };
13173
+ export type { Arcium as ArciumIdlType, ArciumLocalEnv, CircuitSource, CircuitState, ComputationReference, ExecutingPoolAccount, FieldInfo, FpField, MempoolAccount, MempoolPriorityFeeStats, Packer };