@cofhe/sdk 1.0.0-alpha.0 → 1.0.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/node.cjs CHANGED
@@ -44,6 +44,100 @@ function toBigInt(value) {
44
44
  }
45
45
  }
46
46
 
47
+ // core/error.ts
48
+ var CofheError = class _CofheError extends Error {
49
+ code;
50
+ cause;
51
+ hint;
52
+ context;
53
+ apiErrorCode;
54
+ constructor({ code, message, cause, hint, context, apiErrorCode }) {
55
+ const fullMessage = cause ? `${message} | Caused by: ${cause.message}` : message;
56
+ super(fullMessage);
57
+ this.name = "CofheError";
58
+ this.code = code;
59
+ this.cause = cause;
60
+ this.hint = hint;
61
+ this.context = context;
62
+ this.apiErrorCode = apiErrorCode;
63
+ if (Error.captureStackTrace) {
64
+ Error.captureStackTrace(this, _CofheError);
65
+ }
66
+ }
67
+ /**
68
+ * Creates a CofheError from an unknown error
69
+ * If the error is a CofheError, it is returned unchanged, else a new CofheError is created
70
+ * If a wrapperError is provided, it is used to create the new CofheError, else a default is used
71
+ */
72
+ static fromError(error, wrapperError) {
73
+ if (isCofheError(error))
74
+ return error;
75
+ const cause = error instanceof Error ? error : new Error(`${error}`);
76
+ return new _CofheError({
77
+ code: wrapperError?.code ?? "INTERNAL_ERROR" /* InternalError */,
78
+ message: wrapperError?.message ?? "An internal error occurred",
79
+ hint: wrapperError?.hint,
80
+ context: wrapperError?.context,
81
+ apiErrorCode: wrapperError?.apiErrorCode,
82
+ cause
83
+ });
84
+ }
85
+ /**
86
+ * Serializes the error to JSON string with proper handling of Error objects
87
+ */
88
+ serialize() {
89
+ return bigintSafeJsonStringify({
90
+ name: this.name,
91
+ code: this.code,
92
+ message: this.message,
93
+ hint: this.hint,
94
+ context: this.context,
95
+ apiErrorCode: this.apiErrorCode,
96
+ cause: this.cause ? {
97
+ name: this.cause.name,
98
+ message: this.cause.message,
99
+ stack: this.cause.stack
100
+ } : void 0,
101
+ stack: this.stack
102
+ });
103
+ }
104
+ /**
105
+ * Returns a human-readable string representation of the error
106
+ */
107
+ toString() {
108
+ const codeSuffix = this.apiErrorCode ? ` (api: ${this.apiErrorCode})` : "";
109
+ const parts = [`${this.name} [${this.code}]${codeSuffix}: ${this.message}`];
110
+ if (this.hint) {
111
+ parts.push(`Hint: ${this.hint}`);
112
+ }
113
+ if (this.context && Object.keys(this.context).length > 0) {
114
+ parts.push(`Context: ${bigintSafeJsonStringify(this.context)}`);
115
+ }
116
+ if (this.stack) {
117
+ parts.push(`
118
+ Stack trace:`);
119
+ parts.push(this.stack);
120
+ }
121
+ if (this.cause) {
122
+ parts.push(`
123
+ Caused by: ${this.cause.name}: ${this.cause.message}`);
124
+ if (this.cause.stack) {
125
+ parts.push(this.cause.stack);
126
+ }
127
+ }
128
+ return parts.join("\n");
129
+ }
130
+ };
131
+ var bigintSafeJsonStringify = (value) => {
132
+ return JSON.stringify(value, (key, value2) => {
133
+ if (typeof value2 === "bigint") {
134
+ return `${value2}n`;
135
+ }
136
+ return value2;
137
+ });
138
+ };
139
+ var isCofheError = (error) => error instanceof CofheError;
140
+
47
141
  // acps/sealing.ts
48
142
  var KEY_HEX_LENGTH = 64;
49
143
  var GenerateSealingKey = () => {
@@ -58,9 +152,25 @@ var unsealWithPrivateKey = (privateKey, parsedData) => {
58
152
  const nonce = parsedData.nonce instanceof Uint8Array ? parsedData.nonce : new Uint8Array(parsedData.nonce);
59
153
  const ephemPublicKey = parsedData.public_key instanceof Uint8Array ? parsedData.public_key : new Uint8Array(parsedData.public_key);
60
154
  const dataToDecrypt = parsedData.data instanceof Uint8Array ? parsedData.data : new Uint8Array(parsedData.data);
61
- const decryptedMessage = nacl__default.default.box.open(dataToDecrypt, nonce, ephemPublicKey, fromHexString(privateKey));
155
+ let decryptedMessage;
156
+ let cause;
157
+ try {
158
+ decryptedMessage = nacl__default.default.box.open(dataToDecrypt, nonce, ephemPublicKey, fromHexString(privateKey));
159
+ } catch (e) {
160
+ decryptedMessage = null;
161
+ cause = e instanceof Error ? e : void 0;
162
+ }
62
163
  if (!decryptedMessage) {
63
- throw new Error("Failed to decrypt message");
164
+ throw new CofheError({
165
+ code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
166
+ message: "Failed to unseal decrypt response",
167
+ cause,
168
+ context: {
169
+ dataLength: dataToDecrypt.length,
170
+ nonceLength: nonce.length,
171
+ publicKeyLength: ephemPublicKey.length
172
+ }
173
+ });
64
174
  }
65
175
  return toBigInt(decryptedMessage);
66
176
  };
@@ -378,100 +488,6 @@ var TFHE_RS_ZK_MAX_BITS = 2048;
378
488
  var TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT = BigInt(1 << 30);
379
489
  var TFHE_RS_KEY_VERSION = 2;
380
490
 
381
- // core/error.ts
382
- var CofheError = class _CofheError extends Error {
383
- code;
384
- cause;
385
- hint;
386
- context;
387
- apiErrorCode;
388
- constructor({ code, message, cause, hint, context, apiErrorCode }) {
389
- const fullMessage = cause ? `${message} | Caused by: ${cause.message}` : message;
390
- super(fullMessage);
391
- this.name = "CofheError";
392
- this.code = code;
393
- this.cause = cause;
394
- this.hint = hint;
395
- this.context = context;
396
- this.apiErrorCode = apiErrorCode;
397
- if (Error.captureStackTrace) {
398
- Error.captureStackTrace(this, _CofheError);
399
- }
400
- }
401
- /**
402
- * Creates a CofheError from an unknown error
403
- * If the error is a CofheError, it is returned unchanged, else a new CofheError is created
404
- * If a wrapperError is provided, it is used to create the new CofheError, else a default is used
405
- */
406
- static fromError(error, wrapperError) {
407
- if (isCofheError(error))
408
- return error;
409
- const cause = error instanceof Error ? error : new Error(`${error}`);
410
- return new _CofheError({
411
- code: wrapperError?.code ?? "INTERNAL_ERROR" /* InternalError */,
412
- message: wrapperError?.message ?? "An internal error occurred",
413
- hint: wrapperError?.hint,
414
- context: wrapperError?.context,
415
- apiErrorCode: wrapperError?.apiErrorCode,
416
- cause
417
- });
418
- }
419
- /**
420
- * Serializes the error to JSON string with proper handling of Error objects
421
- */
422
- serialize() {
423
- return bigintSafeJsonStringify({
424
- name: this.name,
425
- code: this.code,
426
- message: this.message,
427
- hint: this.hint,
428
- context: this.context,
429
- apiErrorCode: this.apiErrorCode,
430
- cause: this.cause ? {
431
- name: this.cause.name,
432
- message: this.cause.message,
433
- stack: this.cause.stack
434
- } : void 0,
435
- stack: this.stack
436
- });
437
- }
438
- /**
439
- * Returns a human-readable string representation of the error
440
- */
441
- toString() {
442
- const codeSuffix = this.apiErrorCode ? ` (api: ${this.apiErrorCode})` : "";
443
- const parts = [`${this.name} [${this.code}]${codeSuffix}: ${this.message}`];
444
- if (this.hint) {
445
- parts.push(`Hint: ${this.hint}`);
446
- }
447
- if (this.context && Object.keys(this.context).length > 0) {
448
- parts.push(`Context: ${bigintSafeJsonStringify(this.context)}`);
449
- }
450
- if (this.stack) {
451
- parts.push(`
452
- Stack trace:`);
453
- parts.push(this.stack);
454
- }
455
- if (this.cause) {
456
- parts.push(`
457
- Caused by: ${this.cause.name}: ${this.cause.message}`);
458
- if (this.cause.stack) {
459
- parts.push(this.cause.stack);
460
- }
461
- }
462
- return parts.join("\n");
463
- }
464
- };
465
- var bigintSafeJsonStringify = (value) => {
466
- return JSON.stringify(value, (key, value2) => {
467
- if (typeof value2 === "bigint") {
468
- return `${value2}n`;
469
- }
470
- return value2;
471
- });
472
- };
473
- var isCofheError = (error) => error instanceof CofheError;
474
-
475
491
  // core/taskManager.ts
476
492
  var ADDRESS_BOOK_ABI = viem.parseAbi([
477
493
  "function getTm(uint256 id) view returns (address)",
@@ -779,15 +795,22 @@ var getAclServedAddresses = async (publicClient, chainId) => {
779
795
  } catch {
780
796
  return {};
781
797
  }
798
+ let transient = false;
799
+ const readServedAddress = (functionName) => publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName }).catch((err) => {
800
+ if (revertErrorName(err, ACL_SERVED_ADDRESSES_ABI) === void 0)
801
+ transient = true;
802
+ return void 0;
803
+ });
782
804
  const [defaultRevoker, shareRegistry] = await Promise.all([
783
- publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName: "defaultRevokerContract" }).catch(() => void 0),
784
- publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName: "shareRegistry" }).catch(() => void 0)
805
+ readServedAddress("defaultRevokerContract"),
806
+ readServedAddress("shareRegistry")
785
807
  ]);
786
808
  const resolved = {
787
809
  defaultRevoker: defaultRevoker != null && defaultRevoker !== viem.zeroAddress ? defaultRevoker : void 0,
788
810
  shareRegistry: shareRegistry != null && shareRegistry !== viem.zeroAddress ? shareRegistry : void 0
789
811
  };
790
- aclServedAddressesCache.set(chainId, resolved);
812
+ if (!transient)
813
+ aclServedAddressesCache.set(chainId, resolved);
791
814
  return resolved;
792
815
  };
793
816
 
package/dist/node.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as CofheInputConfig, a as CofheConfig, b as CofheClient } from './clientTypes-C0A9ji5O.cjs';
1
+ import { C as CofheInputConfig, a as CofheConfig, b as CofheClient } from './clientTypes-IO6b5Um8.cjs';
2
2
  import 'viem';
3
3
  import './types-C07FK-cL.cjs';
4
4
  import 'zod';
5
- import './onchain-utils-D9Z33IP7.cjs';
5
+ import './onchain-utils-CgOslubH.cjs';
6
6
  import 'zustand/vanilla';
7
7
 
8
8
  /**
package/dist/node.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as CofheInputConfig, a as CofheConfig, b as CofheClient } from './clientTypes-CcU5WvdV.js';
1
+ import { C as CofheInputConfig, a as CofheConfig, b as CofheClient } from './clientTypes-b1pOxOUE.js';
2
2
  import 'viem';
3
3
  import './types-C07FK-cL.js';
4
4
  import 'zod';
5
- import './onchain-utils-D9Z33IP7.js';
5
+ import './onchain-utils-CgOslubH.js';
6
6
  import 'zustand/vanilla';
7
7
 
8
8
  /**
package/dist/node.js CHANGED
@@ -1,8 +1,8 @@
1
- import { createCofheConfigBase, createCofheClientBase } from './chunk-OL3DZN7A.js';
1
+ import { createCofheConfigBase, createCofheClientBase } from './chunk-O2ITEUEU.js';
2
2
  import './chunk-UKQAJK4N.js';
3
- import './chunk-BQWHPIYU.js';
4
- import { fromHexString } from './chunk-6ZW76ZKB.js';
5
- import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-XQ32JG3T.js';
3
+ import './chunk-3L2IVPMI.js';
4
+ import { fromHexString } from './chunk-WJGTPW7K.js';
5
+ import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-J23FYAI2.js';
6
6
  import { promises } from 'fs';
7
7
  import { join } from 'path';
8
8
  import { init_panic_hook, ProvenCompactCiphertextList, CompactPkeCrs, TfheCompactPublicKey } from 'node-tfhe';
@@ -552,9 +552,9 @@ declare const clearAclServedAddresses: () => void;
552
552
  * TaskManager -> acl() -> getters). Zero addresses and pre-upgrade ACLs (getters absent -> revert)
553
553
  * resolve to `undefined` — callers fall back to `acp.*` config.
554
554
  *
555
- * Resolutions are cached per chainId. A failure to reach the TaskManager (network
556
- * error, no CoFHE deployment) is NOT cached, so a transient outage does not pin
557
- * an empty result for the whole session.
555
+ * Resolutions are cached per chainId. A failure to reach the TaskManager or the ACL
556
+ * getters (network error, no CoFHE deployment) is NOT cached, so a transient outage
557
+ * does not pin an empty result for the whole session.
558
558
  */
559
559
  declare const getAclServedAddresses: (publicClient: PublicClient, chainId: number) => Promise<AclServedAddresses>;
560
560
 
@@ -552,9 +552,9 @@ declare const clearAclServedAddresses: () => void;
552
552
  * TaskManager -> acl() -> getters). Zero addresses and pre-upgrade ACLs (getters absent -> revert)
553
553
  * resolve to `undefined` — callers fall back to `acp.*` config.
554
554
  *
555
- * Resolutions are cached per chainId. A failure to reach the TaskManager (network
556
- * error, no CoFHE deployment) is NOT cached, so a transient outage does not pin
557
- * an empty result for the whole session.
555
+ * Resolutions are cached per chainId. A failure to reach the TaskManager or the ACL
556
+ * getters (network error, no CoFHE deployment) is NOT cached, so a transient outage
557
+ * does not pin an empty result for the whole session.
558
558
  */
559
559
  declare const getAclServedAddresses: (publicClient: PublicClient, chainId: number) => Promise<AclServedAddresses>;
560
560
 
package/dist/web.cjs CHANGED
@@ -43,6 +43,100 @@ function toBigInt(value) {
43
43
  }
44
44
  }
45
45
 
46
+ // core/error.ts
47
+ var CofheError = class _CofheError extends Error {
48
+ code;
49
+ cause;
50
+ hint;
51
+ context;
52
+ apiErrorCode;
53
+ constructor({ code, message, cause, hint, context, apiErrorCode }) {
54
+ const fullMessage = cause ? `${message} | Caused by: ${cause.message}` : message;
55
+ super(fullMessage);
56
+ this.name = "CofheError";
57
+ this.code = code;
58
+ this.cause = cause;
59
+ this.hint = hint;
60
+ this.context = context;
61
+ this.apiErrorCode = apiErrorCode;
62
+ if (Error.captureStackTrace) {
63
+ Error.captureStackTrace(this, _CofheError);
64
+ }
65
+ }
66
+ /**
67
+ * Creates a CofheError from an unknown error
68
+ * If the error is a CofheError, it is returned unchanged, else a new CofheError is created
69
+ * If a wrapperError is provided, it is used to create the new CofheError, else a default is used
70
+ */
71
+ static fromError(error, wrapperError) {
72
+ if (isCofheError(error))
73
+ return error;
74
+ const cause = error instanceof Error ? error : new Error(`${error}`);
75
+ return new _CofheError({
76
+ code: wrapperError?.code ?? "INTERNAL_ERROR" /* InternalError */,
77
+ message: wrapperError?.message ?? "An internal error occurred",
78
+ hint: wrapperError?.hint,
79
+ context: wrapperError?.context,
80
+ apiErrorCode: wrapperError?.apiErrorCode,
81
+ cause
82
+ });
83
+ }
84
+ /**
85
+ * Serializes the error to JSON string with proper handling of Error objects
86
+ */
87
+ serialize() {
88
+ return bigintSafeJsonStringify({
89
+ name: this.name,
90
+ code: this.code,
91
+ message: this.message,
92
+ hint: this.hint,
93
+ context: this.context,
94
+ apiErrorCode: this.apiErrorCode,
95
+ cause: this.cause ? {
96
+ name: this.cause.name,
97
+ message: this.cause.message,
98
+ stack: this.cause.stack
99
+ } : void 0,
100
+ stack: this.stack
101
+ });
102
+ }
103
+ /**
104
+ * Returns a human-readable string representation of the error
105
+ */
106
+ toString() {
107
+ const codeSuffix = this.apiErrorCode ? ` (api: ${this.apiErrorCode})` : "";
108
+ const parts = [`${this.name} [${this.code}]${codeSuffix}: ${this.message}`];
109
+ if (this.hint) {
110
+ parts.push(`Hint: ${this.hint}`);
111
+ }
112
+ if (this.context && Object.keys(this.context).length > 0) {
113
+ parts.push(`Context: ${bigintSafeJsonStringify(this.context)}`);
114
+ }
115
+ if (this.stack) {
116
+ parts.push(`
117
+ Stack trace:`);
118
+ parts.push(this.stack);
119
+ }
120
+ if (this.cause) {
121
+ parts.push(`
122
+ Caused by: ${this.cause.name}: ${this.cause.message}`);
123
+ if (this.cause.stack) {
124
+ parts.push(this.cause.stack);
125
+ }
126
+ }
127
+ return parts.join("\n");
128
+ }
129
+ };
130
+ var bigintSafeJsonStringify = (value) => {
131
+ return JSON.stringify(value, (key, value2) => {
132
+ if (typeof value2 === "bigint") {
133
+ return `${value2}n`;
134
+ }
135
+ return value2;
136
+ });
137
+ };
138
+ var isCofheError = (error) => error instanceof CofheError;
139
+
46
140
  // acps/sealing.ts
47
141
  var KEY_HEX_LENGTH = 64;
48
142
  var GenerateSealingKey = () => {
@@ -57,9 +151,25 @@ var unsealWithPrivateKey = (privateKey, parsedData) => {
57
151
  const nonce = parsedData.nonce instanceof Uint8Array ? parsedData.nonce : new Uint8Array(parsedData.nonce);
58
152
  const ephemPublicKey = parsedData.public_key instanceof Uint8Array ? parsedData.public_key : new Uint8Array(parsedData.public_key);
59
153
  const dataToDecrypt = parsedData.data instanceof Uint8Array ? parsedData.data : new Uint8Array(parsedData.data);
60
- const decryptedMessage = nacl__default.default.box.open(dataToDecrypt, nonce, ephemPublicKey, fromHexString(privateKey));
154
+ let decryptedMessage;
155
+ let cause;
156
+ try {
157
+ decryptedMessage = nacl__default.default.box.open(dataToDecrypt, nonce, ephemPublicKey, fromHexString(privateKey));
158
+ } catch (e) {
159
+ decryptedMessage = null;
160
+ cause = e instanceof Error ? e : void 0;
161
+ }
61
162
  if (!decryptedMessage) {
62
- throw new Error("Failed to decrypt message");
163
+ throw new CofheError({
164
+ code: "SEAL_OUTPUT_FAILED" /* SealOutputFailed */,
165
+ message: "Failed to unseal decrypt response",
166
+ cause,
167
+ context: {
168
+ dataLength: dataToDecrypt.length,
169
+ nonceLength: nonce.length,
170
+ publicKeyLength: ephemPublicKey.length
171
+ }
172
+ });
63
173
  }
64
174
  return toBigInt(decryptedMessage);
65
175
  };
@@ -377,100 +487,6 @@ var TFHE_RS_ZK_MAX_BITS = 2048;
377
487
  var TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT = BigInt(1 << 30);
378
488
  var TFHE_RS_KEY_VERSION = 2;
379
489
 
380
- // core/error.ts
381
- var CofheError = class _CofheError extends Error {
382
- code;
383
- cause;
384
- hint;
385
- context;
386
- apiErrorCode;
387
- constructor({ code, message, cause, hint, context, apiErrorCode }) {
388
- const fullMessage = cause ? `${message} | Caused by: ${cause.message}` : message;
389
- super(fullMessage);
390
- this.name = "CofheError";
391
- this.code = code;
392
- this.cause = cause;
393
- this.hint = hint;
394
- this.context = context;
395
- this.apiErrorCode = apiErrorCode;
396
- if (Error.captureStackTrace) {
397
- Error.captureStackTrace(this, _CofheError);
398
- }
399
- }
400
- /**
401
- * Creates a CofheError from an unknown error
402
- * If the error is a CofheError, it is returned unchanged, else a new CofheError is created
403
- * If a wrapperError is provided, it is used to create the new CofheError, else a default is used
404
- */
405
- static fromError(error, wrapperError) {
406
- if (isCofheError(error))
407
- return error;
408
- const cause = error instanceof Error ? error : new Error(`${error}`);
409
- return new _CofheError({
410
- code: wrapperError?.code ?? "INTERNAL_ERROR" /* InternalError */,
411
- message: wrapperError?.message ?? "An internal error occurred",
412
- hint: wrapperError?.hint,
413
- context: wrapperError?.context,
414
- apiErrorCode: wrapperError?.apiErrorCode,
415
- cause
416
- });
417
- }
418
- /**
419
- * Serializes the error to JSON string with proper handling of Error objects
420
- */
421
- serialize() {
422
- return bigintSafeJsonStringify({
423
- name: this.name,
424
- code: this.code,
425
- message: this.message,
426
- hint: this.hint,
427
- context: this.context,
428
- apiErrorCode: this.apiErrorCode,
429
- cause: this.cause ? {
430
- name: this.cause.name,
431
- message: this.cause.message,
432
- stack: this.cause.stack
433
- } : void 0,
434
- stack: this.stack
435
- });
436
- }
437
- /**
438
- * Returns a human-readable string representation of the error
439
- */
440
- toString() {
441
- const codeSuffix = this.apiErrorCode ? ` (api: ${this.apiErrorCode})` : "";
442
- const parts = [`${this.name} [${this.code}]${codeSuffix}: ${this.message}`];
443
- if (this.hint) {
444
- parts.push(`Hint: ${this.hint}`);
445
- }
446
- if (this.context && Object.keys(this.context).length > 0) {
447
- parts.push(`Context: ${bigintSafeJsonStringify(this.context)}`);
448
- }
449
- if (this.stack) {
450
- parts.push(`
451
- Stack trace:`);
452
- parts.push(this.stack);
453
- }
454
- if (this.cause) {
455
- parts.push(`
456
- Caused by: ${this.cause.name}: ${this.cause.message}`);
457
- if (this.cause.stack) {
458
- parts.push(this.cause.stack);
459
- }
460
- }
461
- return parts.join("\n");
462
- }
463
- };
464
- var bigintSafeJsonStringify = (value) => {
465
- return JSON.stringify(value, (key, value2) => {
466
- if (typeof value2 === "bigint") {
467
- return `${value2}n`;
468
- }
469
- return value2;
470
- });
471
- };
472
- var isCofheError = (error) => error instanceof CofheError;
473
-
474
490
  // core/taskManager.ts
475
491
  var ADDRESS_BOOK_ABI = viem.parseAbi([
476
492
  "function getTm(uint256 id) view returns (address)",
@@ -778,15 +794,22 @@ var getAclServedAddresses = async (publicClient, chainId) => {
778
794
  } catch {
779
795
  return {};
780
796
  }
797
+ let transient = false;
798
+ const readServedAddress = (functionName) => publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName }).catch((err) => {
799
+ if (revertErrorName(err, ACL_SERVED_ADDRESSES_ABI) === void 0)
800
+ transient = true;
801
+ return void 0;
802
+ });
781
803
  const [defaultRevoker, shareRegistry] = await Promise.all([
782
- publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName: "defaultRevokerContract" }).catch(() => void 0),
783
- publicClient.readContract({ address: aclAddress, abi: ACL_SERVED_ADDRESSES_ABI, functionName: "shareRegistry" }).catch(() => void 0)
804
+ readServedAddress("defaultRevokerContract"),
805
+ readServedAddress("shareRegistry")
784
806
  ]);
785
807
  const resolved = {
786
808
  defaultRevoker: defaultRevoker != null && defaultRevoker !== viem.zeroAddress ? defaultRevoker : void 0,
787
809
  shareRegistry: shareRegistry != null && shareRegistry !== viem.zeroAddress ? shareRegistry : void 0
788
810
  };
789
- aclServedAddressesCache.set(chainId, resolved);
811
+ if (!transient)
812
+ aclServedAddressesCache.set(chainId, resolved);
790
813
  return resolved;
791
814
  };
792
815
 
package/dist/web.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-C0A9ji5O.cjs';
1
+ import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-IO6b5Um8.cjs';
2
2
  import 'viem';
3
3
  import './types-C07FK-cL.cjs';
4
4
  import 'zod';
5
- import './onchain-utils-D9Z33IP7.cjs';
5
+ import './onchain-utils-CgOslubH.cjs';
6
6
  import 'zustand/vanilla';
7
7
 
8
8
  declare function createSsrStorage(): IStorage;
package/dist/web.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-CcU5WvdV.js';
1
+ import { I as IStorage, C as CofheInputConfig, a as CofheConfig, b as CofheClient, E as EncryptableItem } from './clientTypes-b1pOxOUE.js';
2
2
  import 'viem';
3
3
  import './types-C07FK-cL.js';
4
4
  import 'zod';
5
- import './onchain-utils-D9Z33IP7.js';
5
+ import './onchain-utils-CgOslubH.js';
6
6
  import 'zustand/vanilla';
7
7
 
8
8
  declare function createSsrStorage(): IStorage;
package/dist/web.js CHANGED
@@ -1,9 +1,9 @@
1
- import { createCofheConfigBase, createCofheClientBase } from './chunk-OL3DZN7A.js';
1
+ import { createCofheConfigBase, createCofheClientBase } from './chunk-O2ITEUEU.js';
2
2
  import './chunk-UKQAJK4N.js';
3
- import './chunk-BQWHPIYU.js';
3
+ import './chunk-3L2IVPMI.js';
4
4
  import { initTfheThreadPool } from './chunk-KSOV5B4B.js';
5
- import { fheTypeToString, fromHexString } from './chunk-6ZW76ZKB.js';
6
- import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-XQ32JG3T.js';
5
+ import { fheTypeToString, fromHexString } from './chunk-WJGTPW7K.js';
6
+ import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-J23FYAI2.js';
7
7
  import { constructClient } from 'iframe-shared-storage';
8
8
 
9
9
  // web/const.ts
@@ -1,6 +1,6 @@
1
1
  import { initTfheThreadPool } from './chunk-KSOV5B4B.js';
2
- import { fromHexString } from './chunk-6ZW76ZKB.js';
3
- import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-XQ32JG3T.js';
2
+ import { fromHexString } from './chunk-WJGTPW7K.js';
3
+ import { TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT } from './chunk-J23FYAI2.js';
4
4
 
5
5
  // web/zkProve.worker.ts
6
6
  var tfheModule = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofhe/sdk",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "description": "SDK for Fhenix COFHE coprocessor interaction",
6
6
  "main": "./dist/core.cjs",
@@ -102,8 +102,8 @@
102
102
  "typescript": "5.5.4",
103
103
  "vitest": "3.2.4",
104
104
  "@cofhe/eslint-config": "0.2.1",
105
- "@cofhe/test-setup": "0.0.0",
106
- "@cofhe/tsconfig": "0.1.2"
105
+ "@cofhe/tsconfig": "0.1.2",
106
+ "@cofhe/test-setup": "0.0.0"
107
107
  },
108
108
  "publishConfig": {
109
109
  "access": "public",
@@ -1,16 +1,3 @@
1
- // core/consts.ts
2
- var COFHE_ADDRESS_BOOK_ADDRESS = "0xC0F4e00E531a2B086492Ae3DCC1515038307196b";
3
- var TASK_MANAGER_ID = 1n;
4
- var MOCKS_TASK_MANAGER_ADDRESS = "0x0000000000000000000000000000000000005000";
5
- var MOCKS_ZK_VERIFIER_ADDRESS = "0x0000000000000000000000000000000000005001";
6
- var MOCKS_THRESHOLD_NETWORK_ADDRESS = "0x0000000000000000000000000000000000005002";
7
- var MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY = "0x6C8D7F768A6BB4AAFE85E8A2F5A9680355239C7E14646ED62B044E39DE154512";
8
- var MOCKS_ZK_VERIFIER_SIGNER_ADDRESS = "0x6E12D8C87503D4287c294f2Fdef96ACd9DFf6bd2";
9
- var MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY = "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d";
10
- var TFHE_RS_ZK_MAX_BITS = 2048;
11
- var TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT = BigInt(1 << 30);
12
- var TFHE_RS_KEY_VERSION = 2;
13
-
14
1
  // core/error.ts
15
2
  var CofheErrorCode = /* @__PURE__ */ ((CofheErrorCode2) => {
16
3
  CofheErrorCode2["InternalError"] = "INTERNAL_ERROR";
@@ -171,4 +158,17 @@ var bigintSafeJsonStringify = (value) => {
171
158
  };
172
159
  var isCofheError = (error) => error instanceof CofheError;
173
160
 
161
+ // core/consts.ts
162
+ var COFHE_ADDRESS_BOOK_ADDRESS = "0xC0F4e00E531a2B086492Ae3DCC1515038307196b";
163
+ var TASK_MANAGER_ID = 1n;
164
+ var MOCKS_TASK_MANAGER_ADDRESS = "0x0000000000000000000000000000000000005000";
165
+ var MOCKS_ZK_VERIFIER_ADDRESS = "0x0000000000000000000000000000000000005001";
166
+ var MOCKS_THRESHOLD_NETWORK_ADDRESS = "0x0000000000000000000000000000000000005002";
167
+ var MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY = "0x6C8D7F768A6BB4AAFE85E8A2F5A9680355239C7E14646ED62B044E39DE154512";
168
+ var MOCKS_ZK_VERIFIER_SIGNER_ADDRESS = "0x6E12D8C87503D4287c294f2Fdef96ACd9DFf6bd2";
169
+ var MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY = "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d";
170
+ var TFHE_RS_ZK_MAX_BITS = 2048;
171
+ var TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT = BigInt(1 << 30);
172
+ var TFHE_RS_KEY_VERSION = 2;
173
+
174
174
  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_KEY_VERSION, TFHE_RS_SAFE_SERIALIZATION_SIZE_LIMIT, TFHE_RS_ZK_MAX_BITS, isCofheError };