@arcium-hq/client 0.6.0 → 0.6.2
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.cjs +303 -119
- package/build/index.d.ts +128 -73
- package/build/index.mjs +301 -120
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -297,12 +297,21 @@ declare class Aes256Cipher extends AesCtrCipher {
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
declare class DataSize {
|
|
300
|
-
|
|
300
|
+
isFull: boolean;
|
|
301
301
|
size: number;
|
|
302
302
|
index: number;
|
|
303
303
|
constructor(index: number, size?: number);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
interface FieldInfo {
|
|
307
|
+
name: string;
|
|
308
|
+
type: {
|
|
309
|
+
Integer: {
|
|
310
|
+
signed: boolean;
|
|
311
|
+
width: number;
|
|
312
|
+
};
|
|
313
|
+
} | 'Bool' | 'FullInteger' | 'Float' | 'Pubkey';
|
|
314
|
+
}
|
|
306
315
|
declare enum ArcisValueKind {
|
|
307
316
|
Integer = 0,
|
|
308
317
|
FullInteger = 1,
|
|
@@ -319,7 +328,7 @@ declare class IntegerInfo {
|
|
|
319
328
|
"width": number;
|
|
320
329
|
}): IntegerInfo;
|
|
321
330
|
minValue(): bigint;
|
|
322
|
-
|
|
331
|
+
isWithinBounds(b: bigint): boolean;
|
|
323
332
|
name(): string;
|
|
324
333
|
}
|
|
325
334
|
declare class ArcisValueField {
|
|
@@ -330,6 +339,7 @@ declare class ArcisValueField {
|
|
|
330
339
|
static fromJson(json: unknown): ArcisValueField;
|
|
331
340
|
toBigInt(arg: unknown): bigint;
|
|
332
341
|
fromBigInt(arg: bigint): boolean | number | bigint | Uint8Array;
|
|
342
|
+
static fromFieldInfo(info: FieldInfo): ArcisValueField;
|
|
333
343
|
toDataSize(index: number): DataSize;
|
|
334
344
|
}
|
|
335
345
|
declare class ArcisType {
|
|
@@ -352,6 +362,30 @@ declare class ArcisModule {
|
|
|
352
362
|
static loadFromFile(path: string): ArcisModule;
|
|
353
363
|
}
|
|
354
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Type-safe packer interface for generated code.
|
|
367
|
+
*/
|
|
368
|
+
interface Packer<TInput, TOutput> {
|
|
369
|
+
pack(data: TInput): bigint[];
|
|
370
|
+
unpack(packed: bigint[]): TOutput;
|
|
371
|
+
}
|
|
372
|
+
/** Extracts base field name from array-indexed names: "bytes[0]" -> "bytes" */
|
|
373
|
+
type ExtractBaseName<T extends string> = T extends `${infer Base}[${string}]` ? Base : T;
|
|
374
|
+
/** Extracts all base field names from a readonly FieldInfo array. */
|
|
375
|
+
type FieldBaseNames<T extends readonly FieldInfo[]> = ExtractBaseName<T[number]['name']>;
|
|
376
|
+
/**
|
|
377
|
+
* Validates that field base names match TInput keys. Returns `never` on mismatch.
|
|
378
|
+
* Only validates when using `as const`; skipped if types widen to `string`.
|
|
379
|
+
*/
|
|
380
|
+
type ValidateFieldNames<TInput, TFields extends readonly FieldInfo[]> = string extends FieldBaseNames<TFields> ? TFields : FieldBaseNames<TFields> extends keyof TInput ? TFields : never;
|
|
381
|
+
/**
|
|
382
|
+
* Creates a type-safe packer from field definitions.
|
|
383
|
+
* Use `as const` on the fields array for compile-time field name validation.
|
|
384
|
+
* @param fields - Field definitions from generated code.
|
|
385
|
+
* @param typeName - Type name for debugging.
|
|
386
|
+
*/
|
|
387
|
+
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>;
|
|
388
|
+
|
|
355
389
|
/**
|
|
356
390
|
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
357
391
|
*
|
|
@@ -359,10 +393,10 @@ declare class ArcisModule {
|
|
|
359
393
|
* IDL can be found at `target/idl/arcium.json`.
|
|
360
394
|
*/
|
|
361
395
|
type Arcium = {
|
|
362
|
-
"address": "
|
|
396
|
+
"address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
363
397
|
"metadata": {
|
|
364
398
|
"name": "arcium";
|
|
365
|
-
"version": "0.6.
|
|
399
|
+
"version": "0.6.2";
|
|
366
400
|
"spec": "0.1.0";
|
|
367
401
|
"description": "The Arcium program";
|
|
368
402
|
};
|
|
@@ -1535,18 +1569,24 @@ type Arcium = {
|
|
|
1535
1569
|
{
|
|
1536
1570
|
"kind": "const";
|
|
1537
1571
|
"value": [
|
|
1538
|
-
|
|
1572
|
+
77,
|
|
1539
1573
|
120,
|
|
1540
1574
|
101,
|
|
1541
|
-
|
|
1542
|
-
114,
|
|
1575
|
+
82,
|
|
1543
1576
|
101,
|
|
1544
1577
|
99,
|
|
1545
1578
|
111,
|
|
1546
1579
|
118,
|
|
1547
1580
|
101,
|
|
1548
1581
|
114,
|
|
1549
|
-
121
|
|
1582
|
+
121,
|
|
1583
|
+
65,
|
|
1584
|
+
99,
|
|
1585
|
+
99,
|
|
1586
|
+
111,
|
|
1587
|
+
117,
|
|
1588
|
+
110,
|
|
1589
|
+
116
|
|
1550
1590
|
];
|
|
1551
1591
|
},
|
|
1552
1592
|
{
|
|
@@ -2311,18 +2351,24 @@ type Arcium = {
|
|
|
2311
2351
|
{
|
|
2312
2352
|
"kind": "const";
|
|
2313
2353
|
"value": [
|
|
2314
|
-
|
|
2354
|
+
77,
|
|
2315
2355
|
120,
|
|
2316
2356
|
101,
|
|
2317
|
-
|
|
2318
|
-
114,
|
|
2357
|
+
82,
|
|
2319
2358
|
101,
|
|
2320
2359
|
99,
|
|
2321
2360
|
111,
|
|
2322
2361
|
118,
|
|
2323
2362
|
101,
|
|
2324
2363
|
114,
|
|
2325
|
-
121
|
|
2364
|
+
121,
|
|
2365
|
+
65,
|
|
2366
|
+
99,
|
|
2367
|
+
99,
|
|
2368
|
+
111,
|
|
2369
|
+
117,
|
|
2370
|
+
110,
|
|
2371
|
+
116
|
|
2326
2372
|
];
|
|
2327
2373
|
},
|
|
2328
2374
|
{
|
|
@@ -2666,18 +2712,24 @@ type Arcium = {
|
|
|
2666
2712
|
{
|
|
2667
2713
|
"kind": "const";
|
|
2668
2714
|
"value": [
|
|
2669
|
-
|
|
2715
|
+
77,
|
|
2670
2716
|
120,
|
|
2671
2717
|
101,
|
|
2672
|
-
|
|
2673
|
-
114,
|
|
2718
|
+
82,
|
|
2674
2719
|
101,
|
|
2675
2720
|
99,
|
|
2676
2721
|
111,
|
|
2677
2722
|
118,
|
|
2678
2723
|
101,
|
|
2679
2724
|
114,
|
|
2680
|
-
121
|
|
2725
|
+
121,
|
|
2726
|
+
65,
|
|
2727
|
+
99,
|
|
2728
|
+
99,
|
|
2729
|
+
111,
|
|
2730
|
+
117,
|
|
2731
|
+
110,
|
|
2732
|
+
116
|
|
2681
2733
|
];
|
|
2682
2734
|
},
|
|
2683
2735
|
{
|
|
@@ -3780,18 +3832,24 @@ type Arcium = {
|
|
|
3780
3832
|
{
|
|
3781
3833
|
"kind": "const";
|
|
3782
3834
|
"value": [
|
|
3783
|
-
|
|
3835
|
+
77,
|
|
3784
3836
|
120,
|
|
3785
3837
|
101,
|
|
3786
|
-
|
|
3787
|
-
114,
|
|
3838
|
+
82,
|
|
3788
3839
|
101,
|
|
3789
3840
|
99,
|
|
3790
3841
|
111,
|
|
3791
3842
|
118,
|
|
3792
3843
|
101,
|
|
3793
3844
|
114,
|
|
3794
|
-
121
|
|
3845
|
+
121,
|
|
3846
|
+
65,
|
|
3847
|
+
99,
|
|
3848
|
+
99,
|
|
3849
|
+
111,
|
|
3850
|
+
117,
|
|
3851
|
+
110,
|
|
3852
|
+
116
|
|
3795
3853
|
];
|
|
3796
3854
|
},
|
|
3797
3855
|
{
|
|
@@ -3953,18 +4011,24 @@ type Arcium = {
|
|
|
3953
4011
|
{
|
|
3954
4012
|
"kind": "const";
|
|
3955
4013
|
"value": [
|
|
3956
|
-
|
|
4014
|
+
77,
|
|
3957
4015
|
120,
|
|
3958
4016
|
101,
|
|
3959
|
-
|
|
3960
|
-
114,
|
|
4017
|
+
82,
|
|
3961
4018
|
101,
|
|
3962
4019
|
99,
|
|
3963
4020
|
111,
|
|
3964
4021
|
118,
|
|
3965
4022
|
101,
|
|
3966
4023
|
114,
|
|
3967
|
-
121
|
|
4024
|
+
121,
|
|
4025
|
+
65,
|
|
4026
|
+
99,
|
|
4027
|
+
99,
|
|
4028
|
+
111,
|
|
4029
|
+
117,
|
|
4030
|
+
110,
|
|
4031
|
+
116
|
|
3968
4032
|
];
|
|
3969
4033
|
},
|
|
3970
4034
|
{
|
|
@@ -6120,18 +6184,24 @@ type Arcium = {
|
|
|
6120
6184
|
{
|
|
6121
6185
|
"kind": "const";
|
|
6122
6186
|
"value": [
|
|
6123
|
-
|
|
6187
|
+
77,
|
|
6124
6188
|
120,
|
|
6125
6189
|
101,
|
|
6126
|
-
|
|
6127
|
-
114,
|
|
6190
|
+
82,
|
|
6128
6191
|
101,
|
|
6129
6192
|
99,
|
|
6130
6193
|
111,
|
|
6131
6194
|
118,
|
|
6132
6195
|
101,
|
|
6133
6196
|
114,
|
|
6134
|
-
121
|
|
6197
|
+
121,
|
|
6198
|
+
65,
|
|
6199
|
+
99,
|
|
6200
|
+
99,
|
|
6201
|
+
111,
|
|
6202
|
+
117,
|
|
6203
|
+
110,
|
|
6204
|
+
116
|
|
6135
6205
|
];
|
|
6136
6206
|
},
|
|
6137
6207
|
{
|
|
@@ -7360,18 +7430,24 @@ type Arcium = {
|
|
|
7360
7430
|
{
|
|
7361
7431
|
"kind": "const";
|
|
7362
7432
|
"value": [
|
|
7363
|
-
|
|
7433
|
+
77,
|
|
7364
7434
|
120,
|
|
7365
7435
|
101,
|
|
7366
|
-
|
|
7367
|
-
114,
|
|
7436
|
+
82,
|
|
7368
7437
|
101,
|
|
7369
7438
|
99,
|
|
7370
7439
|
111,
|
|
7371
7440
|
118,
|
|
7372
7441
|
101,
|
|
7373
7442
|
114,
|
|
7374
|
-
121
|
|
7443
|
+
121,
|
|
7444
|
+
65,
|
|
7445
|
+
99,
|
|
7446
|
+
99,
|
|
7447
|
+
111,
|
|
7448
|
+
117,
|
|
7449
|
+
110,
|
|
7450
|
+
116
|
|
7375
7451
|
];
|
|
7376
7452
|
},
|
|
7377
7453
|
{
|
|
@@ -8484,6 +8560,11 @@ type Arcium = {
|
|
|
8484
8560
|
"code": 6713;
|
|
8485
8561
|
"name": "backupClusterNotSet";
|
|
8486
8562
|
"msg": "Backup MXE cluster is not set";
|
|
8563
|
+
},
|
|
8564
|
+
{
|
|
8565
|
+
"code": 6714;
|
|
8566
|
+
"name": "shareAlreadySubmitted";
|
|
8567
|
+
"msg": "Share already submitted";
|
|
8487
8568
|
}
|
|
8488
8569
|
];
|
|
8489
8570
|
"types": [
|
|
@@ -10344,17 +10425,11 @@ type Arcium = {
|
|
|
10344
10425
|
"kind": "struct";
|
|
10345
10426
|
"fields": [
|
|
10346
10427
|
{
|
|
10347
|
-
"name": "
|
|
10428
|
+
"name": "keyRecoveryFinalizeOffset";
|
|
10348
10429
|
"docs": [
|
|
10349
|
-
"
|
|
10350
|
-
"Bit index corresponds to the index in the original MXE's recovery_peers array."
|
|
10430
|
+
"The computation offset for the queued key_recovery_finalize circuit."
|
|
10351
10431
|
];
|
|
10352
|
-
"type":
|
|
10353
|
-
"array": [
|
|
10354
|
-
"u8",
|
|
10355
|
-
13
|
|
10356
|
-
];
|
|
10357
|
-
};
|
|
10432
|
+
"type": "u64";
|
|
10358
10433
|
},
|
|
10359
10434
|
{
|
|
10360
10435
|
"name": "shares";
|
|
@@ -10380,52 +10455,32 @@ type Arcium = {
|
|
|
10380
10455
|
};
|
|
10381
10456
|
},
|
|
10382
10457
|
{
|
|
10383
|
-
"name": "
|
|
10384
|
-
"
|
|
10385
|
-
"Whether the recovery has been finalized (threshold met and marked ready)."
|
|
10386
|
-
];
|
|
10387
|
-
"type": "u8";
|
|
10458
|
+
"name": "originalMxePubkey";
|
|
10459
|
+
"type": "pubkey";
|
|
10388
10460
|
},
|
|
10389
10461
|
{
|
|
10390
|
-
"name": "
|
|
10391
|
-
"
|
|
10392
|
-
"Padding for u64 alignment (need 5 bytes to align key_recovery_final_offset at 8-byte",
|
|
10393
|
-
"boundary)"
|
|
10394
|
-
];
|
|
10395
|
-
"type": {
|
|
10396
|
-
"array": [
|
|
10397
|
-
"u8",
|
|
10398
|
-
2
|
|
10399
|
-
];
|
|
10400
|
-
};
|
|
10462
|
+
"name": "backupMxePubkey";
|
|
10463
|
+
"type": "pubkey";
|
|
10401
10464
|
},
|
|
10402
10465
|
{
|
|
10403
|
-
"name": "
|
|
10466
|
+
"name": "isFinalized";
|
|
10404
10467
|
"docs": [
|
|
10405
|
-
"
|
|
10468
|
+
"Whether the recovery has been finalized (threshold met and marked ready)."
|
|
10406
10469
|
];
|
|
10407
|
-
"type": "
|
|
10470
|
+
"type": "u8";
|
|
10408
10471
|
},
|
|
10409
10472
|
{
|
|
10410
10473
|
"name": "padding2";
|
|
10411
10474
|
"docs": [
|
|
10412
|
-
"Padding to ensure struct size is
|
|
10475
|
+
"Padding to ensure struct size is u64 aligned (6 bytes)"
|
|
10413
10476
|
];
|
|
10414
10477
|
"type": {
|
|
10415
10478
|
"array": [
|
|
10416
10479
|
"u8",
|
|
10417
|
-
|
|
10480
|
+
6
|
|
10418
10481
|
];
|
|
10419
10482
|
};
|
|
10420
10483
|
},
|
|
10421
|
-
{
|
|
10422
|
-
"name": "originalMxePubkey";
|
|
10423
|
-
"type": "pubkey";
|
|
10424
|
-
},
|
|
10425
|
-
{
|
|
10426
|
-
"name": "backupMxePubkey";
|
|
10427
|
-
"type": "pubkey";
|
|
10428
|
-
},
|
|
10429
10484
|
{
|
|
10430
10485
|
"name": "bump";
|
|
10431
10486
|
"type": "u8";
|
|
@@ -11337,7 +11392,7 @@ declare const ARCIUM_IDL: Arcium;
|
|
|
11337
11392
|
/**
|
|
11338
11393
|
* The deployed address of the Arcium program, as specified in the IDL.
|
|
11339
11394
|
*/
|
|
11340
|
-
declare const ARCIUM_ADDR: "
|
|
11395
|
+
declare const ARCIUM_ADDR: "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
11341
11396
|
|
|
11342
11397
|
/**
|
|
11343
11398
|
* Reference to a computation in a mempool or executing pool.
|
|
@@ -11636,5 +11691,5 @@ declare function getRecoveryClusterAccAddress(mxeProgramId: PublicKey): PublicKe
|
|
|
11636
11691
|
*/
|
|
11637
11692
|
declare function getMxeRecoveryAccAddress(backupMxeProgramId: PublicKey, originalMxeProgramId: PublicKey): PublicKey;
|
|
11638
11693
|
|
|
11639
|
-
export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, deserializeLE, finalizeKeyRecoveryExecution, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArxNodeAccAddress, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFeePoolAccAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getRecoveryClusterAccAddress, initKeyRecoveryExecution, initMxePart1, initMxePart2, isNullRef, positiveModulo, queueKeyRecoveryInit, randMatrix, recoverMxe, serializeLE, sha256, submitKeyRecoveryShare, toVec, uploadCircuit };
|
|
11640
|
-
export type { Arcium as ArciumIdlType, ArciumLocalEnv, ComputationErrorType, ComputationReference, ExecutingPoolAccount, FpField, MempoolAccount, MempoolPriorityFeeStats };
|
|
11694
|
+
export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, ArcisValueField, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, IntegerInfo, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, createPacker, deserializeLE, finalizeKeyRecoveryExecution, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArxNodeAccAddress, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFeePoolAccAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getRecoveryClusterAccAddress, initKeyRecoveryExecution, initMxePart1, initMxePart2, isNullRef, positiveModulo, queueKeyRecoveryInit, randMatrix, recoverMxe, serializeLE, sha256, submitKeyRecoveryShare, toVec, uploadCircuit };
|
|
11695
|
+
export type { Arcium as ArciumIdlType, ArciumLocalEnv, ComputationErrorType, ComputationReference, ExecutingPoolAccount, FieldInfo, FpField, MempoolAccount, MempoolPriorityFeeStats, Packer };
|