@interfold/sdk 0.13.0 → 0.14.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/dist/index.js CHANGED
@@ -67,6 +67,15 @@ var DEFAULT_E3_CONFIG = {
67
67
  payment_amount: "0"
68
68
  // 0 ETH in wei
69
69
  };
70
+ function cryptoConfigIdForParamSet(paramSet) {
71
+ if (paramSet === 0) {
72
+ return "0x04f3677e73b0f5066d6caf5cbd92e3fb2e38338edaf5cfc971ab28f7b684da78";
73
+ }
74
+ if (paramSet === 1) {
75
+ return "0xd9c86e581f8291ffb5b63595600e8d096ed30b16e2e0a6634a76c22b1f58fb4e";
76
+ }
77
+ throw new SDKError(`Unsupported BFV parameter set: ${paramSet}`, "UNSUPPORTED_CRYPTO_CONFIG");
78
+ }
70
79
  function encodeBfvParams(params) {
71
80
  const { degree, plaintextModulus, moduli, error1Variance } = params;
72
81
  if (error1Variance === void 0) {
@@ -277,11 +286,7 @@ var ContractClient = class _ContractClient {
277
286
  }
278
287
  const committeeSize = validateCommitteeSize(params.committeeSize);
279
288
  const maxFee = params.maxFee ?? await this.getE3Quote(params);
280
- const expectedCryptoConfigId = await this.publicClient.readContract({
281
- address: this.contracts.interfold,
282
- abi: Interfold__factory.abi,
283
- functionName: "activeCryptoConfigId"
284
- });
289
+ const expectedCryptoConfigId = cryptoConfigIdForParamSet(params.paramSet);
285
290
  const { request } = await this.publicClient.simulateContract({
286
291
  address: this.contracts.interfold,
287
292
  abi: Interfold__factory.abi,
@@ -366,11 +371,7 @@ var ContractClient = class _ContractClient {
366
371
  async getE3Quote(requestParams) {
367
372
  try {
368
373
  const committeeSize = validateCommitteeSize(requestParams.committeeSize);
369
- const expectedCryptoConfigId = await this.publicClient.readContract({
370
- address: this.contracts.interfold,
371
- abi: Interfold__factory.abi,
372
- functionName: "activeCryptoConfigId"
373
- });
374
+ const expectedCryptoConfigId = cryptoConfigIdForParamSet(requestParams.paramSet);
374
375
  return this.publicClient.readContract({
375
376
  address: this.contracts.interfold,
376
377
  abi: Interfold__factory.abi,