@cofhe/sdk 1.1.0-alpha.0 → 1.1.0-alpha.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/dist/core.cjs CHANGED
@@ -60,6 +60,7 @@ var CofheErrorCode = /* @__PURE__ */ ((CofheErrorCode2) => {
60
60
  CofheErrorCode2["AccountUninitialized"] = "ACCOUNT_UNINITIALIZED";
61
61
  CofheErrorCode2["ChainIdUninitialized"] = "CHAIN_ID_UNINITIALIZED";
62
62
  CofheErrorCode2["ConsumingContractUninitialized"] = "CONSUMING_CONTRACT_UNINITIALIZED";
63
+ CofheErrorCode2["ConsumingContractInvalid"] = "CONSUMING_CONTRACT_INVALID";
63
64
  CofheErrorCode2["SealOutputFailed"] = "SEAL_OUTPUT_FAILED";
64
65
  CofheErrorCode2["SealOutputReturnedNull"] = "SEAL_OUTPUT_RETURNED_NULL";
65
66
  CofheErrorCode2["InvalidUtype"] = "INVALID_UTYPE";
@@ -2129,19 +2130,22 @@ var zkProve = async (builder, crs, metadata) => {
2129
2130
  }, 0);
2130
2131
  });
2131
2132
  };
2132
- var constructZkPoKMetadata = (accountAddr, securityZone, chainId) => {
2133
+ var constructZkPoKMetadata = (accountAddr, securityZone, chainId, consumingContract) => {
2133
2134
  const accountAddrNoPrefix = accountAddr.startsWith("0x") ? accountAddr.slice(2) : accountAddr;
2134
2135
  const accountBytes = hexToBytes(accountAddrNoPrefix);
2136
+ const contractNoPrefix = consumingContract.startsWith("0x") ? consumingContract.slice(2) : consumingContract;
2137
+ const contractBytes = hexToBytes(contractNoPrefix);
2135
2138
  const chainIdBytes = new Uint8Array(32);
2136
2139
  let value = chainId;
2137
2140
  for (let i = 31; i >= 0 && value > 0; i--) {
2138
2141
  chainIdBytes[i] = value & 255;
2139
2142
  value = value >>> 8;
2140
2143
  }
2141
- const metadata = new Uint8Array(1 + accountBytes.length + 32);
2144
+ const metadata = new Uint8Array(1 + accountBytes.length + 32 + contractBytes.length);
2142
2145
  metadata[0] = securityZone;
2143
2146
  metadata.set(accountBytes, 1);
2144
2147
  metadata.set(chainIdBytes, 1 + accountBytes.length);
2148
+ metadata.set(contractBytes, 1 + accountBytes.length + 32);
2145
2149
  return metadata;
2146
2150
  };
2147
2151
  var zkVerifyBatch = async (verifierUrl, serializedBytes, address, securityZone, chainId, consumingContract) => {
@@ -3057,20 +3061,33 @@ var EncryptInputsBuilder = class extends BaseBuilder {
3057
3061
  return this.consumingContract;
3058
3062
  }
3059
3063
  /**
3060
- * Asserts that this.consumingContract is populated
3061
- * @throws {CofheError} If consumingContract is not set
3064
+ * Asserts that this.consumingContract is populated and is an address.
3065
+ * Runs before TFHE init, key fetching and proving, so a bad address costs
3066
+ * nothing: the contract is bound into the proof, and a proof built for a
3067
+ * non-address could only fail at the verifier, after the expensive step.
3068
+ * @throws {CofheError} If consumingContract is not set or is not an address
3062
3069
  */
3063
3070
  assertConsumingContract() {
3064
- if (this.consumingContract)
3065
- return;
3066
- throw new CofheError({
3067
- code: "CONSUMING_CONTRACT_UNINITIALIZED" /* ConsumingContractUninitialized */,
3068
- message: "Consuming contract is not set",
3069
- hint: "Use setConsumingContract(...) to set the contract that will consume the encrypted inputs.",
3070
- context: {
3071
- consumingContract: this.consumingContract
3072
- }
3073
- });
3071
+ if (!this.consumingContract) {
3072
+ throw new CofheError({
3073
+ code: "CONSUMING_CONTRACT_UNINITIALIZED" /* ConsumingContractUninitialized */,
3074
+ message: "Consuming contract is not set",
3075
+ hint: "Use setConsumingContract(...) to set the contract that will consume the encrypted inputs.",
3076
+ context: {
3077
+ consumingContract: this.consumingContract
3078
+ }
3079
+ });
3080
+ }
3081
+ if (!viem.isAddress(this.consumingContract, { strict: false })) {
3082
+ throw new CofheError({
3083
+ code: "CONSUMING_CONTRACT_INVALID" /* ConsumingContractInvalid */,
3084
+ message: "Consuming contract is not an address",
3085
+ hint: "setConsumingContract(...) takes the 20-byte address of the contract that will consume the encrypted inputs.",
3086
+ context: {
3087
+ consumingContract: this.consumingContract
3088
+ }
3089
+ });
3090
+ }
3074
3091
  }
3075
3092
  setUseWorker(useWorker) {
3076
3093
  this.useWorker = useWorker;
@@ -3286,7 +3303,7 @@ var EncryptInputsBuilder = class extends BaseBuilder {
3286
3303
  zkBuilder = zkPack(this.inputItems, zkBuilder);
3287
3304
  this.fireStepEnd("pack" /* Pack */);
3288
3305
  this.fireStepStart("prove" /* Prove */);
3289
- const metadata = constructZkPoKMetadata(this.account, this.securityZone, this.chainId);
3306
+ const metadata = constructZkPoKMetadata(this.account, this.securityZone, this.chainId, this.consumingContract);
3290
3307
  let proof = null;
3291
3308
  let usedWorker = false;
3292
3309
  let workerFailedError;
@@ -3984,6 +4001,16 @@ function mapApiErrorCodeToCofheErrorCode(apiErrorCode, fallback) {
3984
4001
 
3985
4002
  // core/decrypt/submitRetry.ts
3986
4003
  var DEFAULT_404_RETRY_TIMEOUT_MS = 1e4;
4004
+ var DEFAULT_DECRYPT_TIMEOUT_MS = 5 * 60 * 1e3;
4005
+ function assertDecryptTimeoutMs(timeoutMs, operationLabel) {
4006
+ if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
4007
+ throw new CofheError({
4008
+ code: "INTERNAL_ERROR" /* InternalError */,
4009
+ message: `${operationLabel}: setTimeout(timeoutMs) expects a finite number greater than 0.`,
4010
+ context: { timeoutMs }
4011
+ });
4012
+ }
4013
+ }
3987
4014
  function normalize404RetryTimeoutMs(params) {
3988
4015
  const { timeoutMs, operationLabel, errorCode } = params;
3989
4016
  if (timeoutMs === void 0)
@@ -4122,7 +4149,6 @@ function parseDecryptedBytesToBigInt(decrypted) {
4122
4149
  // core/decrypt/tnSealOutputV2.ts
4123
4150
  var POLL_INTERVAL_MS = 1e3;
4124
4151
  var POLL_MAX_INTERVAL_MS = 1e4;
4125
- var SEAL_OUTPUT_TIMEOUT_MS = 5 * 60 * 1e3;
4126
4152
  var SUBMIT_RETRY_INTERVAL_MS = 1e3;
4127
4153
  function numberArrayToUint8Array(arr) {
4128
4154
  return new Uint8Array(arr);
@@ -4180,7 +4206,7 @@ function parseCompletedSealOutputResponse(params) {
4180
4206
  }
4181
4207
  return convertSealedData(sealed);
4182
4208
  }
4183
- async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, acp, overallStartTime, retry404TimeoutMs, onPoll) {
4209
+ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, acp, overallStartTime, retry404TimeoutMs, timeoutMs, onPoll) {
4184
4210
  const body = {
4185
4211
  ct_tempkey: BigInt(ctHash).toString(16).padStart(64, "0"),
4186
4212
  host_chain_id: chainId,
@@ -4283,7 +4309,7 @@ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, acp
4283
4309
  status: responseClassification.status,
4284
4310
  elapsedMs,
4285
4311
  retry404TimeoutMs,
4286
- overallTimeoutMs: SEAL_OUTPUT_TIMEOUT_MS,
4312
+ overallTimeoutMs: timeoutMs,
4287
4313
  thresholdNetworkUrl,
4288
4314
  body,
4289
4315
  attemptIndex,
@@ -4295,13 +4321,13 @@ async function submitSealOutputRequest(thresholdNetworkUrl, ctHash, chainId, acp
4295
4321
  attemptIndex,
4296
4322
  elapsedMs,
4297
4323
  intervalMs: SUBMIT_RETRY_INTERVAL_MS,
4298
- timeoutMs: SEAL_OUTPUT_TIMEOUT_MS
4324
+ timeoutMs
4299
4325
  });
4300
4326
  await new Promise((resolve) => setTimeout(resolve, SUBMIT_RETRY_INTERVAL_MS));
4301
4327
  attemptIndex += 1;
4302
4328
  }
4303
4329
  }
4304
- async function pollSealOutputStatus(thresholdNetworkUrl, requestId, overallStartTime, onPoll) {
4330
+ async function pollSealOutputStatus(thresholdNetworkUrl, requestId, overallStartTime, timeoutMs, onPoll) {
4305
4331
  let attemptIndex = 0;
4306
4332
  while (true) {
4307
4333
  const elapsedMs = Date.now() - overallStartTime;
@@ -4315,17 +4341,17 @@ async function pollSealOutputStatus(thresholdNetworkUrl, requestId, overallStart
4315
4341
  attemptIndex,
4316
4342
  elapsedMs,
4317
4343
  intervalMs,
4318
- timeoutMs: SEAL_OUTPUT_TIMEOUT_MS
4344
+ timeoutMs
4319
4345
  });
4320
- if (elapsedMs > SEAL_OUTPUT_TIMEOUT_MS) {
4346
+ if (elapsedMs > timeoutMs) {
4321
4347
  throw new CofheError({
4322
4348
  code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
4323
- message: `sealOutput polling timed out after ${SEAL_OUTPUT_TIMEOUT_MS}ms`,
4349
+ message: `sealOutput polling timed out after ${timeoutMs}ms`,
4324
4350
  hint: "The request may still be processing. Try again later.",
4325
4351
  context: {
4326
4352
  thresholdNetworkUrl,
4327
4353
  requestId,
4328
- timeoutMs: SEAL_OUTPUT_TIMEOUT_MS
4354
+ timeoutMs
4329
4355
  }
4330
4356
  });
4331
4357
  }
@@ -4413,6 +4439,7 @@ async function pollSealOutputStatus(thresholdNetworkUrl, requestId, overallStart
4413
4439
  }
4414
4440
  async function tnSealOutputV2(params) {
4415
4441
  const { thresholdNetworkUrl, ctHash, chainId, acp, retry404TimeoutMs, onPoll } = params;
4442
+ const timeoutMs = params.timeoutMs ?? DEFAULT_DECRYPT_TIMEOUT_MS;
4416
4443
  const normalized404RetryTimeoutMs = normalize404RetryTimeoutMs({
4417
4444
  timeoutMs: retry404TimeoutMs,
4418
4445
  operationLabel: "sealOutput",
@@ -4426,12 +4453,13 @@ async function tnSealOutputV2(params) {
4426
4453
  acp,
4427
4454
  overallStartTime,
4428
4455
  normalized404RetryTimeoutMs,
4456
+ timeoutMs,
4429
4457
  onPoll
4430
4458
  );
4431
4459
  if (submitResult.kind === "completed") {
4432
4460
  return submitResult.sealed;
4433
4461
  }
4434
- return await pollSealOutputStatus(thresholdNetworkUrl, submitResult.requestId, overallStartTime, onPoll);
4462
+ return await pollSealOutputStatus(thresholdNetworkUrl, submitResult.requestId, overallStartTime, timeoutMs, onPoll);
4435
4463
  }
4436
4464
 
4437
4465
  // core/decrypt/decryptForViewBuilder.ts
@@ -4443,6 +4471,7 @@ var DecryptForViewBuilder = class extends BaseBuilder {
4443
4471
  acp;
4444
4472
  pollCallback;
4445
4473
  retry404TimeoutMs = DEFAULT_404_RETRY_TIMEOUT_MS2;
4474
+ timeoutMs;
4446
4475
  constructor(params) {
4447
4476
  super({
4448
4477
  config: params.config,
@@ -4516,6 +4545,16 @@ var DecryptForViewBuilder = class extends BaseBuilder {
4516
4545
  this.retry404TimeoutMs = timeoutMs;
4517
4546
  return this;
4518
4547
  }
4548
+ /**
4549
+ * The whole budget of this decrypt in milliseconds, submit retries and status polling together
4550
+ * (5 minutes by default). Past it, `execute()` rejects with `SealOutputFailed`; a request still
4551
+ * processing on the threshold network is not cancelled.
4552
+ */
4553
+ setTimeout(timeoutMs) {
4554
+ assertDecryptTimeoutMs(timeoutMs, "decryptForView");
4555
+ this.timeoutMs = timeoutMs;
4556
+ return this;
4557
+ }
4519
4558
  withACP(acpOrACPHash) {
4520
4559
  if (typeof acpOrACPHash === "string") {
4521
4560
  this.acpHash = acpOrACPHash;
@@ -4645,6 +4684,7 @@ var DecryptForViewBuilder = class extends BaseBuilder {
4645
4684
  acp: wireAcp,
4646
4685
  thresholdNetworkUrl,
4647
4686
  retry404TimeoutMs: this.retry404TimeoutMs,
4687
+ timeoutMs: this.timeoutMs,
4648
4688
  onPoll: this.pollCallback
4649
4689
  });
4650
4690
  return ACPUtils.unseal(acp, sealed);
@@ -4747,7 +4787,6 @@ async function cofheMocksDecryptForTx(ctHash, utype, acp, publicClient) {
4747
4787
  // core/decrypt/tnDecryptV2.ts
4748
4788
  var POLL_INTERVAL_MS2 = 1e3;
4749
4789
  var POLL_MAX_INTERVAL_MS2 = 1e4;
4750
- var DECRYPT_TIMEOUT_MS = 5 * 60 * 1e3;
4751
4790
  var SUBMIT_RETRY_INTERVAL_MS2 = 1e3;
4752
4791
  function assertDecryptSubmitResponseV2(value) {
4753
4792
  if (value == null || typeof value !== "object") {
@@ -4864,7 +4903,7 @@ function assertDecryptStatusResponseV2(value) {
4864
4903
  }
4865
4904
  return value;
4866
4905
  }
4867
- async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, acp, overallStartTime, retry404TimeoutMs, onPoll) {
4906
+ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, acp, overallStartTime, retry404TimeoutMs, timeoutMs, onPoll) {
4868
4907
  const body = {
4869
4908
  ct_tempkey: BigInt(ctHash).toString(16).padStart(64, "0"),
4870
4909
  host_chain_id: chainId
@@ -4971,7 +5010,7 @@ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, acp,
4971
5010
  status: responseClassification.status,
4972
5011
  elapsedMs,
4973
5012
  retry404TimeoutMs,
4974
- overallTimeoutMs: DECRYPT_TIMEOUT_MS,
5013
+ overallTimeoutMs: timeoutMs,
4975
5014
  thresholdNetworkUrl,
4976
5015
  body,
4977
5016
  attemptIndex,
@@ -4983,13 +5022,13 @@ async function submitDecryptRequestV2(thresholdNetworkUrl, ctHash, chainId, acp,
4983
5022
  attemptIndex,
4984
5023
  elapsedMs,
4985
5024
  intervalMs: SUBMIT_RETRY_INTERVAL_MS2,
4986
- timeoutMs: DECRYPT_TIMEOUT_MS
5025
+ timeoutMs
4987
5026
  });
4988
5027
  await new Promise((resolve) => setTimeout(resolve, SUBMIT_RETRY_INTERVAL_MS2));
4989
5028
  attemptIndex += 1;
4990
5029
  }
4991
5030
  }
4992
- async function pollDecryptStatusV2(thresholdNetworkUrl, requestId, overallStartTime, onPoll) {
5031
+ async function pollDecryptStatusV2(thresholdNetworkUrl, requestId, overallStartTime, timeoutMs, onPoll) {
4993
5032
  let attemptIndex = 0;
4994
5033
  while (true) {
4995
5034
  const elapsedMs = Date.now() - overallStartTime;
@@ -5003,17 +5042,17 @@ async function pollDecryptStatusV2(thresholdNetworkUrl, requestId, overallStartT
5003
5042
  attemptIndex,
5004
5043
  elapsedMs,
5005
5044
  intervalMs,
5006
- timeoutMs: DECRYPT_TIMEOUT_MS
5045
+ timeoutMs
5007
5046
  });
5008
- if (elapsedMs > DECRYPT_TIMEOUT_MS) {
5047
+ if (elapsedMs > timeoutMs) {
5009
5048
  throw new CofheError({
5010
5049
  code: "DECRYPT_FAILED" /* DecryptFailed */,
5011
- message: `decrypt polling timed out after ${DECRYPT_TIMEOUT_MS}ms`,
5050
+ message: `decrypt polling timed out after ${timeoutMs}ms`,
5012
5051
  hint: "The request may still be processing. Try again later.",
5013
5052
  context: {
5014
5053
  thresholdNetworkUrl,
5015
5054
  requestId,
5016
- timeoutMs: DECRYPT_TIMEOUT_MS
5055
+ timeoutMs
5017
5056
  }
5018
5057
  });
5019
5058
  }
@@ -5102,6 +5141,7 @@ async function pollDecryptStatusV2(thresholdNetworkUrl, requestId, overallStartT
5102
5141
  }
5103
5142
  async function tnDecryptV2(params) {
5104
5143
  const { thresholdNetworkUrl, ctHash, chainId, acp, retry404TimeoutMs, onPoll } = params;
5144
+ const timeoutMs = params.timeoutMs ?? DEFAULT_DECRYPT_TIMEOUT_MS;
5105
5145
  const normalized404RetryTimeoutMs = normalize404RetryTimeoutMs({
5106
5146
  timeoutMs: retry404TimeoutMs,
5107
5147
  operationLabel: "decrypt",
@@ -5115,12 +5155,13 @@ async function tnDecryptV2(params) {
5115
5155
  acp,
5116
5156
  overallStartTime,
5117
5157
  normalized404RetryTimeoutMs,
5158
+ timeoutMs,
5118
5159
  onPoll
5119
5160
  );
5120
5161
  if (submitResult.kind === "completed") {
5121
5162
  return submitResult;
5122
5163
  }
5123
- return await pollDecryptStatusV2(thresholdNetworkUrl, submitResult.requestId, overallStartTime, onPoll);
5164
+ return await pollDecryptStatusV2(thresholdNetworkUrl, submitResult.requestId, overallStartTime, timeoutMs, onPoll);
5124
5165
  }
5125
5166
 
5126
5167
  // core/decrypt/decryptForTxBuilder.ts
@@ -5132,6 +5173,7 @@ var DecryptForTxBuilder = class extends BaseBuilder {
5132
5173
  acpSelection = "unset";
5133
5174
  pollCallback;
5134
5175
  retry404TimeoutMs = DEFAULT_404_RETRY_TIMEOUT_MS3;
5176
+ timeoutMs;
5135
5177
  constructor(params) {
5136
5178
  super({
5137
5179
  config: params.config,
@@ -5174,6 +5216,11 @@ var DecryptForTxBuilder = class extends BaseBuilder {
5174
5216
  this.retry404TimeoutMs = timeoutMs;
5175
5217
  return this;
5176
5218
  }
5219
+ setTimeout(timeoutMs) {
5220
+ assertDecryptTimeoutMs(timeoutMs, "decryptForTx");
5221
+ this.timeoutMs = timeoutMs;
5222
+ return this;
5223
+ }
5177
5224
  withACP(acpOrACPHash) {
5178
5225
  if (this.acpSelection === "with-acp") {
5179
5226
  throw new CofheError({
@@ -5307,6 +5354,7 @@ var DecryptForTxBuilder = class extends BaseBuilder {
5307
5354
  acp: wireAcp,
5308
5355
  thresholdNetworkUrl,
5309
5356
  retry404TimeoutMs: this.retry404TimeoutMs,
5357
+ timeoutMs: this.timeoutMs,
5310
5358
  onPoll: this.pollCallback
5311
5359
  });
5312
5360
  return {
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-RXwLVWou.cjs';
2
- export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S as Encryptable, p as EncryptableAddress, j as EncryptableBool, E as EncryptableItem, B as EncryptableToExternalHashMap, o as EncryptableUint128, l as EncryptableUint16, m as EncryptableUint32, n as EncryptableUint64, k as EncryptableUint8, q as EncryptedNumber, y as ExternalAddressHash, s as ExternalBoolHash, z as ExternalHashProof, D as ExternalItemHashes, x as ExternalUint128Hash, u as ExternalUint16Hash, v as ExternalUint32Hash, w as ExternalUint64Hash, t as ExternalUint8Hash, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-RXwLVWou.cjs';
1
+ import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-BCAMwrqk.cjs';
2
+ export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S as Encryptable, p as EncryptableAddress, j as EncryptableBool, E as EncryptableItem, B as EncryptableToExternalHashMap, o as EncryptableUint128, l as EncryptableUint16, m as EncryptableUint32, n as EncryptableUint64, k as EncryptableUint8, q as EncryptedNumber, y as ExternalAddressHash, s as ExternalBoolHash, z as ExternalHashProof, D as ExternalItemHashes, x as ExternalUint128Hash, u as ExternalUint16Hash, v as ExternalUint32Hash, w as ExternalUint64Hash, t as ExternalUint8Hash, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-BCAMwrqk.cjs';
3
3
  import { PublicClient, Address, Hex } from 'viem';
4
4
  import './types-C07FK-cL.cjs';
5
5
  import 'zod';
@@ -55,6 +55,7 @@ declare enum CofheErrorCode {
55
55
  AccountUninitialized = "ACCOUNT_UNINITIALIZED",
56
56
  ChainIdUninitialized = "CHAIN_ID_UNINITIALIZED",
57
57
  ConsumingContractUninitialized = "CONSUMING_CONTRACT_UNINITIALIZED",
58
+ ConsumingContractInvalid = "CONSUMING_CONTRACT_INVALID",
58
59
  SealOutputFailed = "SEAL_OUTPUT_FAILED",
59
60
  SealOutputReturnedNull = "SEAL_OUTPUT_RETURNED_NULL",
60
61
  InvalidUtype = "INVALID_UTYPE",
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-CnslFzxB.js';
2
- export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S as Encryptable, p as EncryptableAddress, j as EncryptableBool, E as EncryptableItem, B as EncryptableToExternalHashMap, o as EncryptableUint128, l as EncryptableUint16, m as EncryptableUint32, n as EncryptableUint64, k as EncryptableUint8, q as EncryptedNumber, y as ExternalAddressHash, s as ExternalBoolHash, z as ExternalHashProof, D as ExternalItemHashes, x as ExternalUint128Hash, u as ExternalUint16Hash, v as ExternalUint32Hash, w as ExternalUint64Hash, t as ExternalUint8Hash, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-CnslFzxB.js';
1
+ import { a as CofheConfig, c as CofheClientParams, b as CofheClient, d as CofheClientConnectionState, F as FheTypes } from './clientTypes-LvslG7o0.js';
2
+ export { A as AnyExternalHash, i as CofheClientACPs, C as CofheInputConfig, h as CofheInternalConfig, K as DecryptEndpoint, a4 as DecryptForTxBuilder, a5 as DecryptForTxResult, a3 as DecryptForViewBuilder, J as DecryptPollCallbackContext, G as DecryptPollCallbackFunction, a1 as EncryptInputsBuilder, a2 as EncryptInputsBuilderUnset, M as EncryptSetStateFn, W as EncryptStep, N as EncryptStepCallbackContext, S as Encryptable, p as EncryptableAddress, j as EncryptableBool, E as EncryptableItem, B as EncryptableToExternalHashMap, o as EncryptableUint128, l as EncryptableUint16, m as EncryptableUint32, n as EncryptableUint64, k as EncryptableUint8, q as EncryptedNumber, y as ExternalAddressHash, s as ExternalBoolHash, z as ExternalHashProof, D as ExternalItemHashes, x as ExternalUint128Hash, u as ExternalUint16Hash, v as ExternalUint32Hash, w as ExternalUint64Hash, t as ExternalUint8Hash, R as FheAllUTypes, Z as FheKeyDeserializer, r as FheTypeValue, Q as FheUintUTypes, H as HashPlusProofResult, I as IStorage, $ as KeysStorage, a0 as KeysStore, L as LiteralToPrimitive, P as Primitive, T as TfheInitializer, O as TfheThreadsSetting, U as UnsealedItem, a6 as ZkBuilderAndCrsGenerator, a7 as ZkProveWorkerFunction, a8 as ZkProveWorkerRequest, a9 as ZkProveWorkerResponse, f as assertNoRenamedConfigKeys, e as createCofheConfigBase, _ as createKeysStore, Y as fetchKeys, g as getCofheConfigItem, V as isEncryptableItem, X as isLastEncryptionStep, aa as zkProveWithWorker } from './clientTypes-LvslG7o0.js';
3
3
  import { PublicClient, Address, Hex } from 'viem';
4
4
  import './types-C07FK-cL.js';
5
5
  import 'zod';
@@ -55,6 +55,7 @@ declare enum CofheErrorCode {
55
55
  AccountUninitialized = "ACCOUNT_UNINITIALIZED",
56
56
  ChainIdUninitialized = "CHAIN_ID_UNINITIALIZED",
57
57
  ConsumingContractUninitialized = "CONSUMING_CONTRACT_UNINITIALIZED",
58
+ ConsumingContractInvalid = "CONSUMING_CONTRACT_INVALID",
58
59
  SealOutputFailed = "SEAL_OUTPUT_FAILED",
59
60
  SealOutputReturnedNull = "SEAL_OUTPUT_RETURNED_NULL",
60
61
  InvalidUtype = "INVALID_UTYPE",
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
- export { InitialConnectStore as CONNECT_STORE_DEFAULTS, DecryptForTxBuilder, DecryptForViewBuilder, EncryptInputsBuilder, assertNoRenamedConfigKeys, cofheFetch, createCofheClientBase, createCofheConfigBase, createKeysStore, fetchKeys, getCofheConfigItem, getCofheDebugInterceptors, setCofheDebugInterceptors, verifyDecryptResult, zkProveWithWorker } from './chunk-2EO4JSR7.js';
1
+ export { InitialConnectStore as CONNECT_STORE_DEFAULTS, DecryptForTxBuilder, DecryptForViewBuilder, EncryptInputsBuilder, assertNoRenamedConfigKeys, cofheFetch, createCofheClientBase, createCofheConfigBase, createKeysStore, fetchKeys, getCofheConfigItem, getCofheDebugInterceptors, setCofheDebugInterceptors, verifyDecryptResult, zkProveWithWorker } from './chunk-KHM6LYLU.js';
2
2
  import './chunk-UKQAJK4N.js';
3
- export { getTaskManagerAddress } from './chunk-3L2IVPMI.js';
4
- export { EncryptStep, Encryptable, FheAllUTypes, FheTypes, FheUintUTypes, fheTypeToString, isEncryptableItem, isLastEncryptionStep } from './chunk-WJGTPW7K.js';
5
- export { COFHE_ADDRESS_BOOK_ADDRESS, CofheError, CofheErrorCode, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_TASK_MANAGER_ADDRESS, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ID, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, isCofheError } from './chunk-J23FYAI2.js';
3
+ export { getTaskManagerAddress } from './chunk-WAA2U7CT.js';
4
+ export { EncryptStep, Encryptable, FheAllUTypes, FheTypes, FheUintUTypes, fheTypeToString, isEncryptableItem, isLastEncryptionStep } from './chunk-3SD2UCRE.js';
5
+ export { COFHE_ADDRESS_BOOK_ADDRESS, CofheError, CofheErrorCode, MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY, MOCKS_TASK_MANAGER_ADDRESS, MOCKS_THRESHOLD_NETWORK_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_ADDRESS, MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY, TASK_MANAGER_ID, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, isCofheError } from './chunk-OC5TGQGG.js';