@enclave-e3/sdk 0.1.7 → 0.1.9

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/dist/index.d.ts CHANGED
@@ -23,24 +23,14 @@ interface CircuitInputs {
23
23
  e0: string[];
24
24
  e1: string[];
25
25
  e0is: string[][];
26
+ e0_quotients: string[][];
26
27
  k1: string[];
27
28
  r1is: string[][];
28
29
  r2is: string[][];
29
30
  p1is: string[][];
30
31
  p2is: string[][];
32
+ pk_commitment: string;
31
33
  }
32
- /**
33
- * Convert a string array to a polynomial
34
- * @param stringArray - The string array
35
- * @returns The polynomial
36
- */
37
- declare const convertToPolynomial: (stringArray: string[]) => Polynomial;
38
- /**
39
- * Convert an array of string arrays to an array of polynomials
40
- * @param stringArrays - The array of string arrays
41
- * @returns The array of polynomials
42
- */
43
- declare const convertToPolynomialArray: (stringArrays: string[][]) => Polynomial[];
44
34
  /**
45
35
  * Generate a proof for a given circuit and circuit inputs
46
36
  * @dev Defaults to the UltraHonkBackend
@@ -84,13 +74,9 @@ interface SDKConfig {
84
74
  */
85
75
  chainId?: number;
86
76
  /**
87
- * The protocol to use for the Enclave requests
88
- */
89
- protocol: FheProtocol;
90
- /**
91
- * The protocol parameters to use for the Enclave requests
77
+ * The threshold BFV parameters preset name to use for the Enclave requests
92
78
  */
93
- protocolParams?: ProtocolParams;
79
+ thresholdBfvParamsPresetName: ThresholdBfvParamsPresetName;
94
80
  }
95
81
  interface EventListenerConfig {
96
82
  fromBlock?: bigint;
@@ -271,26 +257,14 @@ interface VerifiableEncryptionResult {
271
257
  proof: ProofData;
272
258
  }
273
259
  /**
274
- * The protocol to use for the Enclave requests
275
- */
276
- declare enum FheProtocol {
277
- /**
278
- * The BFV protocol
279
- */
280
- BFV = "BFV",
281
- /**
282
- * The TrBFV protocol
283
- */
284
- TRBFV = "TRBFV"
285
- }
286
- /**
287
- * Protocol parameters for an Enclave program request
260
+ * BFV parameters for an Enclave program request
288
261
  * Example for BFV
289
- * 2048, // degree
290
- * 1032193, // plaintext_modulus
291
- * 0x3FFFFFFF000001, // moduli
262
+ * 512, // degree
263
+ * 10, // plaintext_modulus
264
+ * 0xffffee001, // moduli
265
+ * 0xffffc4001, // moduli
292
266
  */
293
- interface ProtocolParams {
267
+ interface BfvParams {
294
268
  /**
295
269
  * The degree of the polynomial
296
270
  */
@@ -308,36 +282,8 @@ interface ProtocolParams {
308
282
  */
309
283
  error1Variance: string | undefined;
310
284
  }
311
- type ProtocolParamsName = 'INSECURE_SET_2048_1032193_1' | 'INSECURE_SET_512_10_1' | 'INSECURE_SET_512_0XFFFFEE001_1' | 'SET_8192_1000_4' | 'SET_8192_144115188075855872_2';
312
- /**
313
- * Parameters for the BFV protocol
314
- */
315
- declare const BfvProtocolParams: {
316
- /**
317
- * Recommended parameters for BFV protocol
318
- * - Degree: 2048
319
- * - Plaintext modulus: 1032193
320
- * - Moduli:0x3FFFFFFF000001
321
- */
322
- BFV_NORMAL: {
323
- readonly degree: 2048;
324
- readonly plaintextModulus: 1032193n;
325
- readonly moduli: [18014398492704769n];
326
- readonly error1Variance: "10";
327
- };
328
- /**
329
- * Recommended parameters for TrBFV protocol
330
- * - Degree: 8192
331
- * - Plaintext modulus: 1000
332
- * - Moduli: [0x00800000022a0001, 0x00800000021a0001, 0x0080000002120001, 0x0080000001f60001]
333
- */
334
- BFV_THRESHOLD: {
335
- readonly degree: 8192;
336
- readonly plaintextModulus: 1000n;
337
- readonly moduli: [36028797055270913n, 36028797054222337n, 36028797053698049n, 36028797051863041n];
338
- readonly error1Variance: "10";
339
- };
340
- };
285
+ type ThresholdBfvParamsPresetName = 'INSECURE_THRESHOLD_512' | 'SECURE_THRESHOLD_8192';
286
+ declare const ThresholdBfvParamsPresetNames: readonly ["INSECURE_THRESHOLD_512", "SECURE_THRESHOLD_8192"];
341
287
  /**
342
288
  * The result of encrypting a value and generating a proof
343
289
  */
@@ -349,7 +295,7 @@ interface EncryptedValueAndPublicInputs {
349
295
  /**
350
296
  * The public inputs for the proof
351
297
  */
352
- publicInputs: CircuitInputs;
298
+ circuitInputs: CircuitInputs;
353
299
  }
354
300
 
355
301
  declare class EnclaveSDK {
@@ -518,8 +464,7 @@ declare class EnclaveSDK {
518
464
  private eventListener;
519
465
  private contractClient;
520
466
  private initialized;
521
- private protocol;
522
- private protocolParams?;
467
+ private thresholdBfvParamsPresetName?;
523
468
  private publicClient;
524
469
  constructor(config: SDKConfig);
525
470
  /**
@@ -531,8 +476,9 @@ declare class EnclaveSDK {
531
476
  * @returns The public client
532
477
  */
533
478
  getPublicClient: () => PublicClient;
534
- getBfvParamsSet(name: ProtocolParamsName): Promise<ProtocolParams>;
535
- getProtocolParams(): Promise<ProtocolParams>;
479
+ getThresholdBfvParamsSet(): Promise<BfvParams>;
480
+ generatePublicKey(): Promise<Uint8Array>;
481
+ computePublicKeyCommitment(publicKey: Uint8Array): Promise<Uint8Array>;
536
482
  /**
537
483
  * Encrypt a number using the configured protocol
538
484
  * @param data - The number to encrypt
@@ -606,7 +552,7 @@ declare class EnclaveSDK {
606
552
  /**
607
553
  * Activate an E3 computation
608
554
  */
609
- activateE3(e3Id: bigint, publicKey: `0x${string}`, gasLimit?: bigint): Promise<Hash>;
555
+ activateE3(e3Id: bigint, gasLimit?: bigint): Promise<Hash>;
610
556
  /**
611
557
  * Publish input for an E3 computation
612
558
  */
@@ -671,8 +617,7 @@ declare class EnclaveSDK {
671
617
  };
672
618
  privateKey?: `0x${string}`;
673
619
  chainId: keyof typeof EnclaveSDK.chains;
674
- protocol: FheProtocol;
675
- protocolParams?: ProtocolParams;
620
+ thresholdBfvParamsPresetName: ThresholdBfvParamsPresetName;
676
621
  }): EnclaveSDK;
677
622
  }
678
623
 
@@ -743,9 +688,9 @@ declare class ContractClient {
743
688
  requestE3(threshold: [number, number], startWindow: [bigint, bigint], duration: bigint, e3Program: `0x${string}`, e3ProgramParams: `0x${string}`, computeProviderParams: `0x${string}`, customParams?: `0x${string}`, gasLimit?: bigint): Promise<Hash>;
744
689
  /**
745
690
  * Activate an E3 computation
746
- * activate(uint256 e3Id, bytes memory publicKey)
691
+ * activate(uint256 e3Id)
747
692
  */
748
- activateE3(e3Id: bigint, publicKey: `0x${string}`, gasLimit?: bigint): Promise<Hash>;
693
+ activateE3(e3Id: bigint, gasLimit?: bigint): Promise<Hash>;
749
694
  /**
750
695
  * Publish input for an E3 computation
751
696
  * publishInput(uint256 e3Id, bytes memory data)
@@ -797,12 +742,6 @@ declare function generateEventId(log: Log): string;
797
742
  * Get the current timestamp in seconds
798
743
  */
799
744
  declare function getCurrentTimestamp(): number;
800
- declare const BFV_PARAMS_SET: {
801
- readonly degree: 2048;
802
- readonly plaintext_modulus: 1032193;
803
- readonly moduli: readonly [18014398492704769n];
804
- readonly error1_variance: "10";
805
- };
806
745
  interface ComputeProviderParams {
807
746
  name: string;
808
747
  parallel: boolean;
@@ -820,7 +759,7 @@ declare const DEFAULT_E3_CONFIG: {
820
759
  * Encode BFV parameters for the smart contract
821
760
  * BFV (Brakerski-Fan-Vercauteren) is a type of fully homomorphic encryption
822
761
  */
823
- declare function encodeBfvParams(degree?: number, plaintext_modulus?: number, moduli?: readonly bigint[], error1_variance?: string): `0x${string}`;
762
+ declare function encodeBfvParams(params: BfvParams): `0x${string}`;
824
763
  /**
825
764
  * Encode compute provider parameters for the smart contract'
826
765
  * If mock is true, the compute provider parameters will return 32 bytes of 0x00
@@ -839,4 +778,4 @@ declare function calculateStartWindow(windowSize?: number): [bigint, bigint];
839
778
  */
840
779
  declare function decodePlaintextOutput(plaintextOutput: string): number | null;
841
780
 
842
- export { type AllEventTypes, BFV_PARAMS_SET, BfvProtocolParams, type CiphernodeAddedData, type CiphernodeRemovedData, type CiphertextOutputPublishedData, type CommitteeFinalizedData, type CommitteePublishedData, type CommitteeRequestedData, type ComputeProviderParams, ContractClient, type ContractInstances, DEFAULT_COMPUTE_PROVIDER_PARAMS, DEFAULT_E3_CONFIG, type E3, type E3ActivatedData, type E3RequestedData, type EnclaveEvent, type EnclaveEventData, EnclaveEventType, EnclaveSDK, type EncryptedValueAndPublicInputs, type EventCallback, type EventFilter, EventListener, type EventListenerConfig, FheProtocol, type PlaintextOutputPublishedData, type Polynomial, type ProtocolParams, type RegistryEventData, RegistryEventType, type SDKConfig, SDKError, type SDKEventEmitter, type VerifiableEncryptionResult, calculateStartWindow, convertToPolynomial, convertToPolynomialArray, decodePlaintextOutput, encodeBfvParams, encodeComputeProviderParams, encodeCustomParams, formatBigInt, formatEventName, generateEventId, generateProof, getCurrentTimestamp, isValidAddress, isValidHash, parseBigInt, parseEventData, sleep };
781
+ export { type AllEventTypes, type BfvParams, type CiphernodeAddedData, type CiphernodeRemovedData, type CiphertextOutputPublishedData, type CommitteeFinalizedData, type CommitteePublishedData, type CommitteeRequestedData, type ComputeProviderParams, ContractClient, type ContractInstances, DEFAULT_COMPUTE_PROVIDER_PARAMS, DEFAULT_E3_CONFIG, type E3, type E3ActivatedData, type E3RequestedData, type EnclaveEvent, type EnclaveEventData, EnclaveEventType, EnclaveSDK, type EncryptedValueAndPublicInputs, type EventCallback, type EventFilter, EventListener, type EventListenerConfig, type PlaintextOutputPublishedData, type Polynomial, type RegistryEventData, RegistryEventType, type SDKConfig, SDKError, type SDKEventEmitter, type ThresholdBfvParamsPresetName, ThresholdBfvParamsPresetNames, type VerifiableEncryptionResult, calculateStartWindow, decodePlaintextOutput, encodeBfvParams, encodeComputeProviderParams, encodeCustomParams, formatBigInt, formatEventName, generateEventId, generateProof, getCurrentTimestamp, isValidAddress, isValidHash, parseBigInt, parseEventData, sleep };
package/dist/index.js CHANGED
@@ -44,14 +44,6 @@ function generateEventId(log) {
44
44
  function getCurrentTimestamp() {
45
45
  return Math.floor(Date.now() / 1e3);
46
46
  }
47
- var INSECURE_SET_2048_1032193_1 = {
48
- degree: 2048,
49
- plaintext_modulus: 1032193,
50
- moduli: [0x3fffffff000001n],
51
- // BigInt for the modulus
52
- error1_variance: "10"
53
- };
54
- var BFV_PARAMS_SET = INSECURE_SET_2048_1032193_1;
55
47
  var DEFAULT_COMPUTE_PROVIDER_PARAMS = {
56
48
  name: "risc0",
57
49
  parallel: false,
@@ -67,7 +59,14 @@ var DEFAULT_E3_CONFIG = {
67
59
  payment_amount: "0"
68
60
  // 0 ETH in wei
69
61
  };
70
- function encodeBfvParams(degree = BFV_PARAMS_SET.degree, plaintext_modulus = BFV_PARAMS_SET.plaintext_modulus, moduli = BFV_PARAMS_SET.moduli, error1_variance = BFV_PARAMS_SET.error1_variance) {
62
+ function encodeBfvParams(params) {
63
+ const { degree, plaintextModulus, moduli, error1Variance } = params;
64
+ if (error1Variance === void 0) {
65
+ throw new SDKError(
66
+ "error1Variance is required in ProtocolParams. All BFV parameter sets must specify error1_variance.",
67
+ "MISSING_ERROR1_VARIANCE"
68
+ );
69
+ }
71
70
  return encodeAbiParameters(
72
71
  [
73
72
  {
@@ -84,9 +83,9 @@ function encodeBfvParams(degree = BFV_PARAMS_SET.degree, plaintext_modulus = BFV
84
83
  [
85
84
  {
86
85
  degree: BigInt(degree),
87
- plaintext_modulus: BigInt(plaintext_modulus),
86
+ plaintext_modulus: BigInt(plaintextModulus),
88
87
  moduli: [...moduli],
89
- error1_variance
88
+ error1_variance: error1Variance
90
89
  }
91
90
  ]
92
91
  );
@@ -242,9 +241,9 @@ var ContractClient = class {
242
241
  }
243
242
  /**
244
243
  * Activate an E3 computation
245
- * activate(uint256 e3Id, bytes memory publicKey)
244
+ * activate(uint256 e3Id)
246
245
  */
247
- async activateE3(e3Id, publicKey, gasLimit) {
246
+ async activateE3(e3Id, gasLimit) {
248
247
  if (!this.walletClient) {
249
248
  throw new SDKError("Wallet client required for write operations", "NO_WALLET");
250
249
  }
@@ -260,7 +259,7 @@ var ContractClient = class {
260
259
  address: this.addresses.enclave,
261
260
  abi: Enclave__factory.abi,
262
261
  functionName: "activate",
263
- args: [e3Id, publicKey],
262
+ args: [e3Id],
264
263
  account,
265
264
  gas: gasLimit
266
265
  });
@@ -631,110 +630,29 @@ var RegistryEventType = /* @__PURE__ */ ((RegistryEventType2) => {
631
630
  RegistryEventType2["INITIALIZED"] = "Initialized";
632
631
  return RegistryEventType2;
633
632
  })(RegistryEventType || {});
634
- var FheProtocol = /* @__PURE__ */ ((FheProtocol2) => {
635
- FheProtocol2["BFV"] = "BFV";
636
- FheProtocol2["TRBFV"] = "TRBFV";
637
- return FheProtocol2;
638
- })(FheProtocol || {});
639
- var BfvProtocolParams = {
640
- /**
641
- * Recommended parameters for BFV protocol
642
- * - Degree: 2048
643
- * - Plaintext modulus: 1032193
644
- * - Moduli:0x3FFFFFFF000001
645
- */
646
- BFV_NORMAL: {
647
- degree: 2048,
648
- plaintextModulus: 1032193n,
649
- moduli: [0x3fffffff000001n],
650
- error1Variance: "10"
651
- },
652
- /**
653
- * Recommended parameters for TrBFV protocol
654
- * - Degree: 8192
655
- * - Plaintext modulus: 1000
656
- * - Moduli: [0x00800000022a0001, 0x00800000021a0001, 0x0080000002120001, 0x0080000001f60001]
657
- */
658
- BFV_THRESHOLD: {
659
- degree: 8192,
660
- plaintextModulus: 1000n,
661
- moduli: [0x00800000022a0001n, 0x00800000021a0001n, 0x0080000002120001n, 0x0080000001f60001n],
662
- error1Variance: "10"
663
- }
664
- };
633
+ var ThresholdBfvParamsPresetNames = [
634
+ "INSECURE_THRESHOLD_512",
635
+ "SECURE_THRESHOLD_8192"
636
+ ];
665
637
 
666
638
  // src/enclave-sdk.ts
667
639
  import {
668
640
  bfv_encrypt_number,
669
641
  bfv_encrypt_vector,
642
+ generate_public_key,
670
643
  bfv_verifiable_encrypt_number,
671
644
  bfv_verifiable_encrypt_vector,
645
+ compute_pk_commitment,
672
646
  get_bfv_params
673
647
  } from "@enclave-e3/wasm";
674
648
 
675
649
  // src/greco.ts
676
650
  import { UltraHonkBackend } from "@aztec/bb.js";
677
651
  import { Noir } from "@noir-lang/noir_js";
678
- var defaultParams = {
679
- bounds: {
680
- pk_bounds: ["34359701504", "34359615488"],
681
- e0_bound: "20",
682
- e1_bound: "20",
683
- u_bound: "1",
684
- r1_low_bounds: ["261", "258"],
685
- r1_up_bounds: ["260", "258"],
686
- r2_bounds: ["34359701504", "34359615488"],
687
- p1_bounds: ["256", "256"],
688
- p2_bounds: ["34359701504", "34359615488"],
689
- k1_low_bound: "5",
690
- k1_up_bound: "4"
691
- },
692
- crypto: {
693
- q_mod_t: "3",
694
- qis: ["68719403009", "68719230977"],
695
- k0is: ["61847462708", "20615769293"]
696
- }
697
- };
698
- var convertToPolynomial = (stringArray) => {
699
- return {
700
- coefficients: stringArray
701
- };
702
- };
703
- var convertToPolynomialArray = (stringArrays) => {
704
- return stringArrays.map(convertToPolynomial);
705
- };
706
652
  var generateProof = async (circuitInputs, circuit) => {
707
653
  const noir = new Noir(circuit);
708
654
  const backend = new UltraHonkBackend(circuit.bytecode, { threads: 4 });
709
- const pk0is_poly = convertToPolynomialArray(circuitInputs.pk0is);
710
- const pk1is_poly = convertToPolynomialArray(circuitInputs.pk1is);
711
- const ct0is_poly = convertToPolynomialArray(circuitInputs.ct0is);
712
- const ct1is_poly = convertToPolynomialArray(circuitInputs.ct1is);
713
- const u_poly = convertToPolynomial(circuitInputs.u);
714
- const e0_poly = convertToPolynomial(circuitInputs.e0);
715
- const e1_poly = convertToPolynomial(circuitInputs.e1);
716
- const e0is_poly = convertToPolynomialArray(circuitInputs.e0is);
717
- const k1_poly = convertToPolynomial(circuitInputs.k1);
718
- const r1is_poly = convertToPolynomialArray(circuitInputs.r1is);
719
- const r2is_poly = convertToPolynomialArray(circuitInputs.r2is);
720
- const p1is_poly = convertToPolynomialArray(circuitInputs.p1is);
721
- const p2is_poly = convertToPolynomialArray(circuitInputs.p2is);
722
- const { witness } = await noir.execute({
723
- params: defaultParams,
724
- pk0is: pk0is_poly,
725
- pk1is: pk1is_poly,
726
- ct0is: ct0is_poly,
727
- ct1is: ct1is_poly,
728
- u: u_poly,
729
- e0: e0_poly,
730
- e1: e1_poly,
731
- e0is: e0is_poly,
732
- k1: k1_poly,
733
- r1is: r1is_poly,
734
- r2is: r2is_poly,
735
- p1is: p1is_poly,
736
- p2is: p2is_poly
737
- });
655
+ const { witness } = await noir.execute(circuitInputs);
738
656
  return await backend.generateProof(witness, { keccakZK: true });
739
657
  };
740
658
 
@@ -755,15 +673,18 @@ var EnclaveSDK = class _EnclaveSDK {
755
673
  if (!isValidAddress(config.contracts.feeToken)) {
756
674
  throw new SDKError("Invalid FeeToken contract address", "INVALID_ADDRESS");
757
675
  }
758
- this.eventListener = new EventListener(config.publicClient);
759
- this.contractClient = new ContractClient(config.publicClient, config.walletClient, config.contracts);
760
- if (!Object.values(FheProtocol).includes(config.protocol)) {
761
- throw new SDKError(`Invalid protocol: ${config.protocol}`, "INVALID_PROTOCOL");
676
+ if (!config.thresholdBfvParamsPresetName) {
677
+ throw new SDKError("Threshold BFV parameters preset name is required", "MISSING_THRESHOLD_BFV_PARAMS_PRESET_NAME");
762
678
  }
763
- this.protocol = config.protocol;
764
- if (config.protocolParams) {
765
- this.protocolParams = config.protocolParams;
679
+ if (!Object.values(ThresholdBfvParamsPresetNames).includes(config.thresholdBfvParamsPresetName)) {
680
+ throw new SDKError(
681
+ `Invalid threshold BFV parameters preset name: ${config.thresholdBfvParamsPresetName}`,
682
+ "INVALID_THRESHOLD_BFV_PARAMS_PRESET_NAME"
683
+ );
766
684
  }
685
+ this.thresholdBfvParamsPresetName = config.thresholdBfvParamsPresetName;
686
+ this.eventListener = new EventListener(config.publicClient);
687
+ this.contractClient = new ContractClient(config.publicClient, config.walletClient, config.contracts);
767
688
  this.publicClient = config.publicClient;
768
689
  }
769
690
  static chains = {
@@ -775,8 +696,7 @@ var EnclaveSDK = class _EnclaveSDK {
775
696
  eventListener;
776
697
  contractClient;
777
698
  initialized = false;
778
- protocol;
779
- protocolParams;
699
+ thresholdBfvParamsPresetName;
780
700
  publicClient;
781
701
  /**
782
702
  * Initialize the SDK
@@ -798,9 +718,9 @@ var EnclaveSDK = class _EnclaveSDK {
798
718
  getPublicClient = () => {
799
719
  return this.publicClient;
800
720
  };
801
- async getBfvParamsSet(name) {
721
+ async getThresholdBfvParamsSet() {
802
722
  await initializeWasm();
803
- let params = get_bfv_params(name);
723
+ let params = get_bfv_params(this.thresholdBfvParamsPresetName);
804
724
  return {
805
725
  degree: Number(params.degree),
806
726
  // degree is returned as a bigint from wasm
@@ -809,17 +729,20 @@ var EnclaveSDK = class _EnclaveSDK {
809
729
  error1Variance: params.error1_variance
810
730
  };
811
731
  }
812
- async getProtocolParams() {
732
+ async generatePublicKey() {
813
733
  await initializeWasm();
814
- if (this.protocolParams) {
815
- return this.protocolParams;
816
- }
817
- switch (this.protocol) {
818
- case "BFV" /* BFV */:
819
- return await this.getBfvParamsSet("INSECURE_SET_2048_1032193_1");
820
- case "TRBFV" /* TRBFV */:
821
- return await this.getBfvParamsSet("INSECURE_SET_512_10_1");
822
- }
734
+ const protocolParams = await this.getThresholdBfvParamsSet();
735
+ return generate_public_key(protocolParams.degree, protocolParams.plaintextModulus, BigUint64Array.from(protocolParams.moduli));
736
+ }
737
+ async computePublicKeyCommitment(publicKey) {
738
+ await initializeWasm();
739
+ const protocolParams = await this.getThresholdBfvParamsSet();
740
+ return compute_pk_commitment(
741
+ publicKey,
742
+ protocolParams.degree,
743
+ protocolParams.plaintextModulus,
744
+ BigUint64Array.from(protocolParams.moduli)
745
+ );
823
746
  }
824
747
  /**
825
748
  * Encrypt a number using the configured protocol
@@ -829,7 +752,7 @@ var EnclaveSDK = class _EnclaveSDK {
829
752
  */
830
753
  async encryptNumber(data, publicKey) {
831
754
  await initializeWasm();
832
- const protocolParams = await this.getProtocolParams();
755
+ const protocolParams = await this.getThresholdBfvParamsSet();
833
756
  return bfv_encrypt_number(
834
757
  data,
835
758
  publicKey,
@@ -846,7 +769,7 @@ var EnclaveSDK = class _EnclaveSDK {
846
769
  */
847
770
  async encryptVector(data, publicKey) {
848
771
  await initializeWasm();
849
- const protocolParams = await this.getProtocolParams();
772
+ const protocolParams = await this.getThresholdBfvParamsSet();
850
773
  return bfv_encrypt_vector(
851
774
  data,
852
775
  publicKey,
@@ -864,7 +787,7 @@ var EnclaveSDK = class _EnclaveSDK {
864
787
  */
865
788
  async encryptNumberAndGenInputs(data, publicKey) {
866
789
  await initializeWasm();
867
- const protocolParams = await this.getProtocolParams();
790
+ const protocolParams = await this.getThresholdBfvParamsSet();
868
791
  const [encryptedData, circuitInputs] = bfv_verifiable_encrypt_number(
869
792
  data,
870
793
  publicKey,
@@ -872,10 +795,9 @@ var EnclaveSDK = class _EnclaveSDK {
872
795
  protocolParams.plaintextModulus,
873
796
  BigUint64Array.from(protocolParams.moduli)
874
797
  );
875
- const publicInputs = JSON.parse(circuitInputs);
876
798
  return {
877
799
  encryptedData,
878
- publicInputs
800
+ circuitInputs: JSON.parse(circuitInputs)
879
801
  };
880
802
  }
881
803
  /**
@@ -886,7 +808,7 @@ var EnclaveSDK = class _EnclaveSDK {
886
808
  * @returns The encrypted number and the proof
887
809
  */
888
810
  async encryptNumberAndGenProof(data, publicKey, circuit) {
889
- const { publicInputs, encryptedData } = await this.encryptNumberAndGenInputs(data, publicKey);
811
+ const { circuitInputs: publicInputs, encryptedData } = await this.encryptNumberAndGenInputs(data, publicKey);
890
812
  const proof = await generateProof(publicInputs, circuit);
891
813
  return {
892
814
  encryptedData,
@@ -901,7 +823,7 @@ var EnclaveSDK = class _EnclaveSDK {
901
823
  */
902
824
  async encryptVectorAndGenInputs(data, publicKey) {
903
825
  await initializeWasm();
904
- const protocolParams = await this.getProtocolParams();
826
+ const protocolParams = await this.getThresholdBfvParamsSet();
905
827
  const [encryptedData, circuitInputs] = bfv_verifiable_encrypt_vector(
906
828
  data,
907
829
  publicKey,
@@ -909,10 +831,9 @@ var EnclaveSDK = class _EnclaveSDK {
909
831
  protocolParams.plaintextModulus,
910
832
  BigUint64Array.from(protocolParams.moduli)
911
833
  );
912
- const publicInputs = JSON.parse(circuitInputs);
913
834
  return {
914
835
  encryptedData,
915
- publicInputs
836
+ circuitInputs: JSON.parse(circuitInputs)
916
837
  };
917
838
  }
918
839
  /**
@@ -923,7 +844,7 @@ var EnclaveSDK = class _EnclaveSDK {
923
844
  * @returns The encrypted vector and the proof
924
845
  */
925
846
  async encryptVectorAndGenProof(data, publicKey, circuit) {
926
- const { publicInputs, encryptedData } = await this.encryptVectorAndGenInputs(data, publicKey);
847
+ const { circuitInputs: publicInputs, encryptedData } = await this.encryptVectorAndGenInputs(data, publicKey);
927
848
  const proof = await generateProof(publicInputs, circuit);
928
849
  return {
929
850
  encryptedData,
@@ -975,11 +896,11 @@ var EnclaveSDK = class _EnclaveSDK {
975
896
  /**
976
897
  * Activate an E3 computation
977
898
  */
978
- async activateE3(e3Id, publicKey, gasLimit) {
899
+ async activateE3(e3Id, gasLimit) {
979
900
  if (!this.initialized) {
980
901
  await this.initialize();
981
902
  }
982
- return this.contractClient.activateE3(e3Id, publicKey, gasLimit);
903
+ return this.contractClient.activateE3(e3Id, gasLimit);
983
904
  }
984
905
  /**
985
906
  * Publish input for an E3 computation
@@ -1127,26 +1048,21 @@ var EnclaveSDK = class _EnclaveSDK {
1127
1048
  walletClient,
1128
1049
  contracts: options.contracts,
1129
1050
  chainId: options.chainId,
1130
- protocol: options.protocol,
1131
- protocolParams: options.protocolParams
1051
+ thresholdBfvParamsPresetName: options.thresholdBfvParamsPresetName
1132
1052
  });
1133
1053
  }
1134
1054
  };
1135
1055
  export {
1136
- BFV_PARAMS_SET,
1137
- BfvProtocolParams,
1138
1056
  ContractClient,
1139
1057
  DEFAULT_COMPUTE_PROVIDER_PARAMS,
1140
1058
  DEFAULT_E3_CONFIG,
1141
1059
  EnclaveEventType,
1142
1060
  EnclaveSDK,
1143
1061
  EventListener,
1144
- FheProtocol,
1145
1062
  RegistryEventType,
1146
1063
  SDKError,
1064
+ ThresholdBfvParamsPresetNames,
1147
1065
  calculateStartWindow,
1148
- convertToPolynomial,
1149
- convertToPolynomialArray,
1150
1066
  decodePlaintextOutput,
1151
1067
  encodeBfvParams,
1152
1068
  encodeComputeProviderParams,