@primuslabs/fhetransform-sdk 0.4.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.
Files changed (302) hide show
  1. package/README.md +198 -0
  2. package/dist/abis/acl.abi.d.ts +379 -0
  3. package/dist/abis/acl.abi.js +495 -0
  4. package/dist/abis/acl.abi.js.map +1 -0
  5. package/dist/abis/alphatrion_reward.abi.d.ts +407 -0
  6. package/dist/abis/alphatrion_reward.abi.js +532 -0
  7. package/dist/abis/alphatrion_reward.abi.js.map +1 -0
  8. package/dist/abis/ciphertext_digests.abi.d.ts +336 -0
  9. package/dist/abis/ciphertext_digests.abi.js +444 -0
  10. package/dist/abis/ciphertext_digests.abi.js.map +1 -0
  11. package/dist/abis/ciphertext_verification.abi.d.ts +637 -0
  12. package/dist/abis/ciphertext_verification.abi.js +830 -0
  13. package/dist/abis/ciphertext_verification.abi.js.map +1 -0
  14. package/dist/abis/convert_token.abi.d.ts +922 -0
  15. package/dist/abis/convert_token.abi.js +1208 -0
  16. package/dist/abis/convert_token.abi.js.map +1 -0
  17. package/dist/abis/decryption.abi.d.ts +956 -0
  18. package/dist/abis/decryption.abi.js +1244 -0
  19. package/dist/abis/decryption.abi.js.map +1 -0
  20. package/dist/abis/erc20.abi.d.ts +265 -0
  21. package/dist/abis/erc20.abi.js +350 -0
  22. package/dist/abis/erc20.abi.js.map +1 -0
  23. package/dist/abis/fhe_executor.abi.d.ts +1535 -0
  24. package/dist/abis/fhe_executor.abi.js +1962 -0
  25. package/dist/abis/fhe_executor.abi.js.map +1 -0
  26. package/dist/abis/space_bridge_config.abi.d.ts +792 -0
  27. package/dist/abis/space_bridge_config.abi.js +1032 -0
  28. package/dist/abis/space_bridge_config.abi.js.map +1 -0
  29. package/dist/abis/token.abi.d.ts +630 -0
  30. package/dist/abis/token.abi.js +828 -0
  31. package/dist/abis/token.abi.js.map +1 -0
  32. package/dist/cli/eusdc.d.ts +2 -0
  33. package/dist/cli/eusdc.js +41 -0
  34. package/dist/cli/eusdc.js.map +1 -0
  35. package/dist/contract/callbacks.d.ts +59 -0
  36. package/dist/contract/callbacks.js +2 -0
  37. package/dist/contract/callbacks.js.map +1 -0
  38. package/dist/contract/convert-token.d.ts +107 -0
  39. package/dist/contract/convert-token.js +249 -0
  40. package/dist/contract/convert-token.js.map +1 -0
  41. package/dist/contract/token.d.ts +167 -0
  42. package/dist/contract/token.js +404 -0
  43. package/dist/contract/token.js.map +1 -0
  44. package/dist/contract/transaction.d.ts +29 -0
  45. package/dist/contract/transaction.js +2 -0
  46. package/dist/contract/transaction.js.map +1 -0
  47. package/dist/core/address.d.ts +118 -0
  48. package/dist/core/address.js +200 -0
  49. package/dist/core/address.js.map +1 -0
  50. package/dist/core/auth.d.ts +68 -0
  51. package/dist/core/auth.js +58 -0
  52. package/dist/core/auth.js.map +1 -0
  53. package/dist/core/bytes.d.ts +48 -0
  54. package/dist/core/bytes.js +117 -0
  55. package/dist/core/bytes.js.map +1 -0
  56. package/dist/core/cache-manager.d.ts +138 -0
  57. package/dist/core/cache-manager.js +440 -0
  58. package/dist/core/cache-manager.js.map +1 -0
  59. package/dist/core/chain.d.ts +41 -0
  60. package/dist/core/chain.js +59 -0
  61. package/dist/core/chain.js.map +1 -0
  62. package/dist/core/constants.d.ts +24 -0
  63. package/dist/core/constants.js +25 -0
  64. package/dist/core/constants.js.map +1 -0
  65. package/dist/core/error.d.ts +2 -0
  66. package/dist/core/error.js +14 -0
  67. package/dist/core/error.js.map +1 -0
  68. package/dist/core/errors/error-catalog.d.ts +29 -0
  69. package/dist/core/errors/error-catalog.js +84 -0
  70. package/dist/core/errors/error-catalog.js.map +1 -0
  71. package/dist/core/errors/error-codes.d.ts +52 -0
  72. package/dist/core/errors/error-codes.js +61 -0
  73. package/dist/core/errors/error-codes.js.map +1 -0
  74. package/dist/core/errors/error-utils.d.ts +27 -0
  75. package/dist/core/errors/error-utils.js +110 -0
  76. package/dist/core/errors/error-utils.js.map +1 -0
  77. package/dist/core/errors/fhe-error.d.ts +98 -0
  78. package/dist/core/errors/fhe-error.js +190 -0
  79. package/dist/core/errors/fhe-error.js.map +1 -0
  80. package/dist/core/errors/index.d.ts +4 -0
  81. package/dist/core/errors/index.js +5 -0
  82. package/dist/core/errors/index.js.map +1 -0
  83. package/dist/core/estimate.d.ts +39 -0
  84. package/dist/core/estimate.js +111 -0
  85. package/dist/core/estimate.js.map +1 -0
  86. package/dist/core/event.d.ts +212 -0
  87. package/dist/core/event.js +42 -0
  88. package/dist/core/event.js.map +1 -0
  89. package/dist/core/fhe-type.d.ts +75 -0
  90. package/dist/core/fhe-type.js +115 -0
  91. package/dist/core/fhe-type.js.map +1 -0
  92. package/dist/core/fhe.d.ts +11 -0
  93. package/dist/core/fhe.js +23 -0
  94. package/dist/core/fhe.js.map +1 -0
  95. package/dist/core/handle.d.ts +42 -0
  96. package/dist/core/handle.js +99 -0
  97. package/dist/core/handle.js.map +1 -0
  98. package/dist/core/json-utils.d.ts +18 -0
  99. package/dist/core/json-utils.js +37 -0
  100. package/dist/core/json-utils.js.map +1 -0
  101. package/dist/core/kms.d.ts +42 -0
  102. package/dist/core/kms.js +70 -0
  103. package/dist/core/kms.js.map +1 -0
  104. package/dist/core/logger.d.ts +3 -0
  105. package/dist/core/logger.js +11 -0
  106. package/dist/core/logger.js.map +1 -0
  107. package/dist/core/pretty-print.d.ts +18 -0
  108. package/dist/core/pretty-print.js +84 -0
  109. package/dist/core/pretty-print.js.map +1 -0
  110. package/dist/core/primitives.d.ts +22 -0
  111. package/dist/core/primitives.js +2 -0
  112. package/dist/core/primitives.js.map +1 -0
  113. package/dist/core/retryable-handler.d.ts +74 -0
  114. package/dist/core/retryable-handler.js +227 -0
  115. package/dist/core/retryable-handler.js.map +1 -0
  116. package/dist/core/signer-address-info.d.ts +15 -0
  117. package/dist/core/signer-address-info.js +33 -0
  118. package/dist/core/signer-address-info.js.map +1 -0
  119. package/dist/core/string.d.ts +28 -0
  120. package/dist/core/string.js +33 -0
  121. package/dist/core/string.js.map +1 -0
  122. package/dist/core/swallow.d.ts +23 -0
  123. package/dist/core/swallow.js +37 -0
  124. package/dist/core/swallow.js.map +1 -0
  125. package/dist/core/system-contract-info.d.ts +17 -0
  126. package/dist/core/system-contract-info.js +41 -0
  127. package/dist/core/system-contract-info.js.map +1 -0
  128. package/dist/core/ttl-cache.d.ts +81 -0
  129. package/dist/core/ttl-cache.js +113 -0
  130. package/dist/core/ttl-cache.js.map +1 -0
  131. package/dist/core/tx-error-parser.d.ts +40 -0
  132. package/dist/core/tx-error-parser.js +83 -0
  133. package/dist/core/tx-error-parser.js.map +1 -0
  134. package/dist/core/utils.d.ts +62 -0
  135. package/dist/core/utils.js +143 -0
  136. package/dist/core/utils.js.map +1 -0
  137. package/dist/index.d.ts +40 -0
  138. package/dist/index.js +48 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/jazz/encrypt-key-p.d.ts +65 -0
  141. package/dist/jazz/encrypt-key-p.js +283 -0
  142. package/dist/jazz/encrypt-key-p.js.map +1 -0
  143. package/dist/jazz/encrypt-p.d.ts +82 -0
  144. package/dist/jazz/encrypt-p.js +139 -0
  145. package/dist/jazz/encrypt-p.js.map +1 -0
  146. package/dist/jazz/encrypt.d.ts +58 -0
  147. package/dist/jazz/encrypt.js +155 -0
  148. package/dist/jazz/encrypt.js.map +1 -0
  149. package/dist/jazz/input-proof-p.d.ts +122 -0
  150. package/dist/jazz/input-proof-p.js +265 -0
  151. package/dist/jazz/input-proof-p.js.map +1 -0
  152. package/dist/jazz/jazz-client-i.d.ts +16 -0
  153. package/dist/jazz/jazz-client-i.js +2 -0
  154. package/dist/jazz/jazz-client-i.js.map +1 -0
  155. package/dist/jazz/jazz-client.d.ts +18 -0
  156. package/dist/jazz/jazz-client.js +24 -0
  157. package/dist/jazz/jazz-client.js.map +1 -0
  158. package/dist/jazz/key-pair.d.ts +50 -0
  159. package/dist/jazz/key-pair.js +166 -0
  160. package/dist/jazz/key-pair.js.map +1 -0
  161. package/dist/jazz/mock/fake.d.ts +3 -0
  162. package/dist/jazz/mock/fake.js +23 -0
  163. package/dist/jazz/mock/fake.js.map +1 -0
  164. package/dist/jazz/mock/fetch-input-proof.d.ts +4 -0
  165. package/dist/jazz/mock/fetch-input-proof.js +63 -0
  166. package/dist/jazz/mock/fetch-input-proof.js.map +1 -0
  167. package/dist/jazz/mock/fetch-key-url.d.ts +3 -0
  168. package/dist/jazz/mock/fetch-key-url.js +15 -0
  169. package/dist/jazz/mock/fetch-key-url.js.map +1 -0
  170. package/dist/jazz/mock/fetch-public-decrypt.d.ts +3 -0
  171. package/dist/jazz/mock/fetch-public-decrypt.js +81 -0
  172. package/dist/jazz/mock/fetch-public-decrypt.js.map +1 -0
  173. package/dist/jazz/mock/fetch-user-decrypt.d.ts +4 -0
  174. package/dist/jazz/mock/fetch-user-decrypt.js +174 -0
  175. package/dist/jazz/mock/fetch-user-decrypt.js.map +1 -0
  176. package/dist/jazz/module/fetch-input-proof.d.ts +19 -0
  177. package/dist/jazz/module/fetch-input-proof.js +72 -0
  178. package/dist/jazz/module/fetch-input-proof.js.map +1 -0
  179. package/dist/jazz/module/fetch-key-url.d.ts +17 -0
  180. package/dist/jazz/module/fetch-key-url.js +46 -0
  181. package/dist/jazz/module/fetch-key-url.js.map +1 -0
  182. package/dist/jazz/module/fetch-public-decrypt.d.ts +19 -0
  183. package/dist/jazz/module/fetch-public-decrypt.js +65 -0
  184. package/dist/jazz/module/fetch-public-decrypt.js.map +1 -0
  185. package/dist/jazz/module/fetch-user-decrypt.d.ts +19 -0
  186. package/dist/jazz/module/fetch-user-decrypt.js +109 -0
  187. package/dist/jazz/module/fetch-user-decrypt.js.map +1 -0
  188. package/dist/jazz/module/jazz-async-request.d.ts +102 -0
  189. package/dist/jazz/module/jazz-async-request.js +515 -0
  190. package/dist/jazz/module/jazz-async-request.js.map +1 -0
  191. package/dist/jazz/module/jazz-p.d.ts +61 -0
  192. package/dist/jazz/module/jazz-p.js +33 -0
  193. package/dist/jazz/module/jazz-p.js.map +1 -0
  194. package/dist/jazz/module/s3-download.d.ts +85 -0
  195. package/dist/jazz/module/s3-download.js +293 -0
  196. package/dist/jazz/module/s3-download.js.map +1 -0
  197. package/dist/jazz/permit.d.ts +200 -0
  198. package/dist/jazz/permit.js +319 -0
  199. package/dist/jazz/permit.js.map +1 -0
  200. package/dist/jazz/public-decrypt-p.d.ts +96 -0
  201. package/dist/jazz/public-decrypt-p.js +258 -0
  202. package/dist/jazz/public-decrypt-p.js.map +1 -0
  203. package/dist/jazz/public-decrypt.d.ts +48 -0
  204. package/dist/jazz/public-decrypt.js +156 -0
  205. package/dist/jazz/public-decrypt.js.map +1 -0
  206. package/dist/jazz/read-contract.d.ts +81 -0
  207. package/dist/jazz/read-contract.js +125 -0
  208. package/dist/jazz/read-contract.js.map +1 -0
  209. package/dist/jazz/types/common.d.ts +17 -0
  210. package/dist/jazz/types/common.js +2 -0
  211. package/dist/jazz/types/common.js.map +1 -0
  212. package/dist/jazz/types/input-proof.d.ts +76 -0
  213. package/dist/jazz/types/input-proof.js +2 -0
  214. package/dist/jazz/types/input-proof.js.map +1 -0
  215. package/dist/jazz/types/key-url.d.ts +68 -0
  216. package/dist/jazz/types/key-url.js +5 -0
  217. package/dist/jazz/types/key-url.js.map +1 -0
  218. package/dist/jazz/types/public-decrypt.d.ts +61 -0
  219. package/dist/jazz/types/public-decrypt.js +2 -0
  220. package/dist/jazz/types/public-decrypt.js.map +1 -0
  221. package/dist/jazz/types/user-decrypt.d.ts +123 -0
  222. package/dist/jazz/types/user-decrypt.js +2 -0
  223. package/dist/jazz/types/user-decrypt.js.map +1 -0
  224. package/dist/jazz/user-decrypt-p.d.ts +111 -0
  225. package/dist/jazz/user-decrypt-p.js +280 -0
  226. package/dist/jazz/user-decrypt-p.js.map +1 -0
  227. package/dist/jazz/user-decrypt.d.ts +74 -0
  228. package/dist/jazz/user-decrypt.js +143 -0
  229. package/dist/jazz/user-decrypt.js.map +1 -0
  230. package/dist/native/fhe-api.js +5959 -0
  231. package/dist/native/fhe-api.node.cjs +6167 -0
  232. package/dist/native/fhe-api.node.worker.cjs +210 -0
  233. package/dist/native/fhe-api.wasm +0 -0
  234. package/dist/native/fhe-api.worker.js +164 -0
  235. package/dist/native/kms/node/kms_lib.d.ts +38 -0
  236. package/dist/native/kms/node/kms_lib.js +356 -0
  237. package/dist/native/kms/node/kms_lib_bg.wasm +0 -0
  238. package/dist/native/kms/node/kms_lib_bg.wasm.d.ts +21 -0
  239. package/dist/native/kms/node/package.json +11 -0
  240. package/dist/native/kms/web/kms_lib.d.ts +84 -0
  241. package/dist/native/kms/web/kms_lib.js +443 -0
  242. package/dist/native/kms/web/kms_lib_bg.wasm +0 -0
  243. package/dist/native/kms/web/kms_lib_bg.wasm.d.ts +21 -0
  244. package/dist/native/kms/web/package.json +15 -0
  245. package/dist/runtime/browser.d.ts +36 -0
  246. package/dist/runtime/browser.js +115 -0
  247. package/dist/runtime/browser.js.map +1 -0
  248. package/dist/runtime/node.d.ts +30 -0
  249. package/dist/runtime/node.js +95 -0
  250. package/dist/runtime/node.js.map +1 -0
  251. package/dist/sdk/fhetransform-sdk-b.d.ts +102 -0
  252. package/dist/sdk/fhetransform-sdk-b.js +294 -0
  253. package/dist/sdk/fhetransform-sdk-b.js.map +1 -0
  254. package/dist/sdk/fhetransform-sdk.d.ts +87 -0
  255. package/dist/sdk/fhetransform-sdk.js +135 -0
  256. package/dist/sdk/fhetransform-sdk.js.map +1 -0
  257. package/dist/sdk/jazz-service.d.ts +13 -0
  258. package/dist/sdk/jazz-service.js +58 -0
  259. package/dist/sdk/jazz-service.js.map +1 -0
  260. package/dist/sdk/permit-service.d.ts +45 -0
  261. package/dist/sdk/permit-service.js +144 -0
  262. package/dist/sdk/permit-service.js.map +1 -0
  263. package/dist/wasm/fhe-wasm-client.d.ts +19 -0
  264. package/dist/wasm/fhe-wasm-client.js +23 -0
  265. package/dist/wasm/fhe-wasm-client.js.map +1 -0
  266. package/dist/wasm/fhe-wasm-module.d.ts +24 -0
  267. package/dist/wasm/fhe-wasm-module.js +141 -0
  268. package/dist/wasm/fhe-wasm-module.js.map +1 -0
  269. package/dist/wasm/fhe-wasm-type.d.ts +59 -0
  270. package/dist/wasm/fhe-wasm-type.js +244 -0
  271. package/dist/wasm/fhe-wasm-type.js.map +1 -0
  272. package/dist/wasm/wasm-loader.browser.d.ts +21 -0
  273. package/dist/wasm/wasm-loader.browser.js +143 -0
  274. package/dist/wasm/wasm-loader.browser.js.map +1 -0
  275. package/dist/wasm/wasm-loader.node.d.ts +24 -0
  276. package/dist/wasm/wasm-loader.node.js +114 -0
  277. package/dist/wasm/wasm-loader.node.js.map +1 -0
  278. package/dist/wasm/worker-client.browser.d.ts +6 -0
  279. package/dist/wasm/worker-client.browser.js +21 -0
  280. package/dist/wasm/worker-client.browser.js.map +1 -0
  281. package/dist/wasm/worker-client.d.ts +34 -0
  282. package/dist/wasm/worker-client.js +160 -0
  283. package/dist/wasm/worker-client.js.map +1 -0
  284. package/dist/wasm/worker-client.node.d.ts +6 -0
  285. package/dist/wasm/worker-client.node.js +20 -0
  286. package/dist/wasm/worker-client.node.js.map +1 -0
  287. package/dist/wasm/worker-message.d.ts +61 -0
  288. package/dist/wasm/worker-message.js +2 -0
  289. package/dist/wasm/worker-message.js.map +1 -0
  290. package/dist/wasm/worker-transport.browser.d.ts +15 -0
  291. package/dist/wasm/worker-transport.browser.js +35 -0
  292. package/dist/wasm/worker-transport.browser.js.map +1 -0
  293. package/dist/wasm/worker-transport.d.ts +6 -0
  294. package/dist/wasm/worker-transport.js +2 -0
  295. package/dist/wasm/worker-transport.js.map +1 -0
  296. package/dist/wasm/worker-transport.node.d.ts +17 -0
  297. package/dist/wasm/worker-transport.node.js +39 -0
  298. package/dist/wasm/worker-transport.node.js.map +1 -0
  299. package/dist/wasm/worker.d.ts +1 -0
  300. package/dist/wasm/worker.js +69 -0
  301. package/dist/wasm/worker.js.map +1 -0
  302. package/package.json +81 -0
@@ -0,0 +1,125 @@
1
+ import { ethers } from "ethers";
2
+ import { TTLCache } from "../core/ttl-cache.js";
3
+ import { spaceBridgeConfigAbi } from "../abis/space_bridge_config.abi.js";
4
+ import { logger } from "../core/logger.js";
5
+ /**
6
+ * Cache instance for Alphatrion signers information.
7
+ * Uses default TTL (24 hours) as this data changes infrequently.
8
+ */
9
+ const readAlphatrionSignersInfoCache = new TTLCache();
10
+ /**
11
+ * Retrieves Alphatrion signers and threshold from the SpaceBridge configuration contract.
12
+ * Results are cached to minimize expensive blockchain RPC calls.
13
+ *
14
+ * @param client - The Jazz client instance providing SDK and provider access
15
+ * @param forceRefresh - If true, bypasses cache and fetches fresh data from the contract
16
+ * @returns Promise containing Alphatrion signers array and threshold
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Get cached data (or fetch if expired)
21
+ * const info = await readAlphatrionSignersInfo(client);
22
+ *
23
+ * // Force fresh data from contract
24
+ * const freshInfo = await readAlphatrionSignersInfo(client, true);
25
+ * ```
26
+ */
27
+ export async function readAlphatrionSignersInfo(client, forceRefresh = false) {
28
+ return await readAlphatrionSignersInfoCache.get(async () => {
29
+ logger.debug('[readAlphatrionSignersInfo] Fetching Alphatrion signers info from contract');
30
+ // Get contract configuration and provider
31
+ const sysContractInfo = await client.sdk.getSystemContractInfo();
32
+ const provider = await client.sdk.requireProvider();
33
+ // Initialize contract instance
34
+ const contract = new ethers.Contract(sysContractInfo.spaceBridgeConfigAddress, spaceBridgeConfigAbi, provider);
35
+ // Fetch both values in parallel for efficiency
36
+ const [alphatrionSigners, alphatrionThreshold] = await Promise.all([
37
+ contract.getAlphatrionSigners(),
38
+ contract.getAlphatrionThreshold(),
39
+ ]);
40
+ logger.debug('[readAlphatrionSignersInfo] Alphatrion signers info retrieved', {
41
+ alphatrionSigners,
42
+ alphatrionThreshold
43
+ });
44
+ return { alphatrionSigners, alphatrionThreshold };
45
+ }, forceRefresh);
46
+ }
47
+ /**
48
+ * Cache instance for KMS signers information.
49
+ * Uses default TTL (24 hours) as this data changes infrequently.
50
+ */
51
+ const readKmsSignersInfoCache = new TTLCache();
52
+ /**
53
+ * Retrieves KMS signers and decryption thresholds from the SpaceBridge configuration contract.
54
+ * Results are cached to minimize expensive blockchain RPC calls.
55
+ *
56
+ * @param client - The Jazz client instance providing SDK and provider access
57
+ * @param forceRefresh - If true, bypasses cache and fetches fresh data from the contract
58
+ * @returns Promise containing KMS signers array and decryption thresholds
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Get cached data (or fetch if expired)
63
+ * const info = await readKmsSignersInfo(client);
64
+ *
65
+ * // Force fresh data from contract
66
+ * const freshInfo = await readKmsSignersInfo(client, true);
67
+ * ```
68
+ */
69
+ export async function readKmsSignersInfo(client, forceRefresh = false) {
70
+ return await readKmsSignersInfoCache.get(async () => {
71
+ logger.debug('[readKmsSignersInfo] Fetching KMS signers info from contract');
72
+ // Get contract configuration and provider
73
+ const sysContractInfo = await client.sdk.getSystemContractInfo();
74
+ const provider = await client.sdk.requireProvider();
75
+ // Initialize contract instance
76
+ const contract = new ethers.Contract(sysContractInfo.spaceBridgeConfigAddress, spaceBridgeConfigAbi, provider);
77
+ // Fetch all three values in parallel for efficiency
78
+ const [kmsSigners, publicDecryptionThreshold, userDecryptionThreshold] = await Promise.all([
79
+ contract.getKmsSigners(),
80
+ contract.getPublicDecryptionThreshold(),
81
+ contract.getUserDecryptionThreshold(),
82
+ ]);
83
+ logger.debug('[readKmsSignersInfo] KMS signers info retrieved', {
84
+ kmsSigners,
85
+ publicDecryptionThreshold,
86
+ userDecryptionThreshold
87
+ });
88
+ return { kmsSigners, publicDecryptionThreshold, userDecryptionThreshold };
89
+ }, forceRefresh);
90
+ }
91
+ /**
92
+ * Utility function to clear all cached contract information.
93
+ * Useful when the contract configuration is known to have changed.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * // Clear all caches after a contract upgrade
98
+ * clearAllContractCaches();
99
+ * ```
100
+ */
101
+ export function clearAllContractCaches() {
102
+ readAlphatrionSignersInfoCache.clear();
103
+ readKmsSignersInfoCache.clear();
104
+ logger.debug('[ContractCache] All contract caches cleared');
105
+ }
106
+ /**
107
+ * Utility function to refresh all cached contract information simultaneously.
108
+ *
109
+ * @param client - The Jazz client instance
110
+ * @returns Promise that resolves when all data has been refreshed
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * // Force refresh all cached contract data
115
+ * await refreshAllContractCaches(client);
116
+ * ```
117
+ */
118
+ export async function refreshAllContractCaches(client) {
119
+ await Promise.all([
120
+ readAlphatrionSignersInfo(client, true),
121
+ readKmsSignersInfo(client, true),
122
+ ]);
123
+ logger.debug('[ContractCache] All contract caches refreshed');
124
+ }
125
+ //# sourceMappingURL=read-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-contract.js","sourceRoot":"","sources":["../../src/jazz/read-contract.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,17 @@
1
+ import { TimeoutRetryOptions } from "../../core/retryable-handler.js";
2
+ export type JazzOnProgressArgs = {
3
+ operation?: string;
4
+ status?: string;
5
+ elapsed?: number;
6
+ jobId?: string;
7
+ error?: string;
8
+ };
9
+ export type JazzProcessOptions = {
10
+ onJazzProgress?: (args: JazzOnProgressArgs) => void;
11
+ /** Retry configuration options */
12
+ jazzRetryOptions?: TimeoutRetryOptions;
13
+ };
14
+ export type FetchInputProofOptions = JazzProcessOptions & {};
15
+ export type FetchUserDecryptOptions = JazzProcessOptions & {};
16
+ export type FetchPublicDecryptOptions = JazzProcessOptions & {};
17
+ export type FetchKeyUrlOptions = JazzProcessOptions & {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/jazz/types/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import { Address, Bytes, Bytes65Hex, BytesHex, BytesHexNo0x, Hex0x } from "../../core/primitives.js";
2
+ import { FetchInputProofOptions } from "./common.js";
3
+ /**
4
+ * ZK Proof data structure containing all information needed for input proof verification.
5
+ *
6
+ * This interface represents the zero-knowledge proof data that will be submitted
7
+ * to the Jazz service for verification. It includes chain information, contract
8
+ * addresses, user address, and the ciphertext with ZK proof.
9
+ */
10
+ export interface ZkProof {
11
+ /** Chain ID as a bigint */
12
+ readonly chainId: bigint;
13
+ /** ACL contract address (0x-prefixed hex string) */
14
+ readonly aclContractAddress: Address;
15
+ /** Target contract address (0x-prefixed hex string) */
16
+ readonly contractAddress: Address;
17
+ /** User address (0x-prefixed hex string) */
18
+ readonly userAddress: Address;
19
+ /** Ciphertext with embedded ZK proof as Bytes */
20
+ readonly ciphertextWithZkProof: Bytes;
21
+ }
22
+ /**
23
+ * Parameters for fetching an input proof from the Jazz service.
24
+ */
25
+ export type FetchInputProofParameters = {
26
+ /** Payload containing the ZK proof data */
27
+ readonly payload: {
28
+ readonly zkProof: ZkProof;
29
+ };
30
+ /** Additional options for the request */
31
+ readonly options?: FetchInputProofOptions;
32
+ };
33
+ /**
34
+ * Result of a successful input proof fetch operation.
35
+ */
36
+ export type FetchInputProofResult = {
37
+ /** Ordered list of hex-encoded handles with 0x prefix */
38
+ readonly handles: readonly BytesHex[];
39
+ /** EIP-712 signatures from the alphatrion, ordered to match handles */
40
+ readonly alphatrionEip712Signatures: readonly Bytes65Hex[];
41
+ /** Additional contextual data as hex with 0x prefix */
42
+ readonly extraData: BytesHex;
43
+ };
44
+ /**
45
+ * Payload structure sent to the Jazz `/v2/input-proof` endpoint.
46
+ *
47
+ * This is the raw payload format expected by the Jazz API. It differs
48
+ * from FetchInputProofParameters in that it uses specific hex formats
49
+ * expected by the service.
50
+ */
51
+ export type JazzInputProofPayload = {
52
+ /** Hex-encoded uint256 string with 0x prefix (e.g., "0x1" for chainId 1) */
53
+ readonly contractChainId: Hex0x;
54
+ /** Hex-encoded address with 0x prefix */
55
+ readonly contractAddress: Address;
56
+ /** Hex-encoded address with 0x prefix */
57
+ readonly userAddress: Address;
58
+ /** Hex-encoded binary proof without 0x prefix */
59
+ readonly ciphertextWithInputVerification: BytesHexNo0x;
60
+ /** Hex-encoded bytes with 0x prefix, defaults to "0x00" */
61
+ readonly extraData: BytesHex;
62
+ };
63
+ /**
64
+ * Result structure returned by the Jazz `/v2/input-proof` endpoint.
65
+ *
66
+ * This is the raw result format from the Jazz API before transformation
67
+ * into FetchInputProofResult.
68
+ */
69
+ export type JazzInputProofResult = {
70
+ /** Ordered list of hex-encoded handles with 0x prefix */
71
+ readonly handles: readonly any[];
72
+ /** Attestation signatures for input verification, ordered to match handles, with 0x prefix */
73
+ readonly signatures: readonly Bytes65Hex[];
74
+ /** Additional contextual data as hex with 0x prefix */
75
+ readonly extraData: BytesHex;
76
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=input-proof.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-proof.js","sourceRoot":"","sources":["../../../src/jazz/types/input-proof.ts"],"names":[],"mappings":""}
@@ -0,0 +1,68 @@
1
+ import { FetchKeyUrlOptions } from "./common.js";
2
+ /**
3
+ * Parameters for fetching key URLs from the Jazz service.
4
+ * Currently only supports optional request options.
5
+ */
6
+ export type FetchKeyUrlParameters = {
7
+ /** Additional options for the request */
8
+ readonly options?: FetchKeyUrlOptions;
9
+ };
10
+ /**
11
+ * Configuration for fetching a TFHE public key from a remote URL.
12
+ *
13
+ * Typically obtained from the `/keyurl` response, which provides
14
+ * the URLs for fetching the public key data.
15
+ */
16
+ export type FheEncryptionPublicKeySource = {
17
+ /** Unique identifier for the public key provided by the Jazz service */
18
+ readonly id: string;
19
+ /** URL from which to fetch the public key bytes */
20
+ readonly url: string;
21
+ };
22
+ /**
23
+ * Configuration for fetching a TFHE Public Key Encryption (PKE) Common Reference
24
+ * String (CRS) from a remote URL.
25
+ *
26
+ * Typically obtained from the `/keyurl` response, which provides
27
+ * the URLs for fetching the CRS data.
28
+ */
29
+ export type FheEncryptionCrsSource = {
30
+ /** Unique identifier for the CRS provided by the Jazz service */
31
+ readonly id: string;
32
+ /** URL from which to fetch the CRS bytes */
33
+ readonly url: string;
34
+ /** The CRS capacity (always 2048 in the current configuration) */
35
+ readonly capacity: number;
36
+ };
37
+ /**
38
+ * Metadata about the FHE encryption key origin.
39
+ * Used for tracking the source and context of the key.
40
+ */
41
+ export type FheEncryptionKeyMetadata = {
42
+ /** The Jazz service URL where the key was obtained */
43
+ readonly jazzUrl: string;
44
+ /** The chain ID associated with this key */
45
+ readonly chainId: number;
46
+ };
47
+ /**
48
+ * Complete URL configuration for fetching TFHE PKE (Public Key Encryption) parameters.
49
+ *
50
+ * This type combines the public key source, CRS source, and optional metadata
51
+ * into a single configuration object for easy access.
52
+ */
53
+ export type FheEncryptionKeySource = {
54
+ /** URL configuration for the TFHE compact public key */
55
+ readonly publicKeySource: FheEncryptionPublicKeySource;
56
+ /** URL configuration for the PKE CRS (Common Reference String) */
57
+ readonly crsSource: FheEncryptionCrsSource;
58
+ };
59
+ /**
60
+ * Result of a successful key URL fetch operation.
61
+ * This is the user-facing result type.
62
+ */
63
+ export type FetchKeyUrlResult = FheEncryptionKeySource;
64
+ /**
65
+ * Result type returned by the Jazz `/v2/keyurl` endpoint.
66
+ * This is the raw result from the Jazz API (same structure).
67
+ */
68
+ export type JazzKeyUrlResult = FheEncryptionKeySource;
@@ -0,0 +1,5 @@
1
+ // ============================================================================
2
+ // Fetch Key URL Types
3
+ // ============================================================================
4
+ export {};
5
+ //# sourceMappingURL=key-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-url.js","sourceRoot":"","sources":["../../../src/jazz/types/key-url.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E"}
@@ -0,0 +1,61 @@
1
+ import { HandleLike } from "../../core/fhe-type.js";
2
+ import { Bytes65Hex, BytesHex, BytesHexNo0x } from "../../core/primitives.js";
3
+ import { FetchPublicDecryptOptions } from "./common.js";
4
+ /**
5
+ * Parameters for fetching public decryption results from the Jazz service.
6
+ *
7
+ * This type defines the input required to request public decryption of
8
+ * ciphertext handles, returning the decrypted values with their signatures.
9
+ */
10
+ export type FetchPublicDecryptParameters = {
11
+ /** Payload containing the ordered list of ciphertext handles and extra data */
12
+ readonly payload: {
13
+ /** Ordered list of ciphertext handles to decrypt (HandleLike objects) */
14
+ readonly orderedHandles: readonly HandleLike[];
15
+ /** Additional contextual data as hex with 0x prefix */
16
+ readonly extraData: BytesHex;
17
+ };
18
+ /** Additional options for the request */
19
+ readonly options?: FetchPublicDecryptOptions;
20
+ };
21
+ /**
22
+ * Result of a successful public decryption fetch operation.
23
+ *
24
+ * This is the user-facing result type, containing decrypted values with
25
+ * their EIP-712 signatures and associated metadata.
26
+ */
27
+ export type FetchPublicDecryptResult = {
28
+ /** Ordered list of ABI-encoded clear values with 0x prefix */
29
+ readonly orderedAbiEncodedClearValues: BytesHex;
30
+ /** EIP-712 signatures from KMS public decryption, ordered to match decrypted values */
31
+ readonly kmsPublicDecryptEIP712Signatures: Bytes65Hex[];
32
+ /** Additional contextual data as hex with 0x prefix */
33
+ readonly extraData: BytesHex;
34
+ };
35
+ /**
36
+ * Payload structure sent to the Jazz `/v2/public-decrypt` endpoint.
37
+ *
38
+ * This is the raw payload format expected by the Jazz API. It uses
39
+ * BytesHex format without 0x prefix for the ciphertext handles.
40
+ */
41
+ export type JazzPublicDecryptPayload = {
42
+ /** Ordered list of ciphertext handles as hex with 0x prefix */
43
+ readonly ciphertextHandles: readonly BytesHex[];
44
+ /** Hex-encoded bytes with 0x prefix, defaults to "0x00" */
45
+ readonly extraData: BytesHex;
46
+ };
47
+ /**
48
+ * Result structure returned by the Jazz `/v2/public-decrypt` endpoint.
49
+ *
50
+ * This is the raw result format from the Jazz API before transformation
51
+ * into FetchPublicDecryptResult. Note that signatures and decrypted values
52
+ * are returned without 0x prefix.
53
+ */
54
+ export type JazzPublicDecryptResult = {
55
+ /** List of signatures as hex without 0x prefix */
56
+ readonly signatures: readonly BytesHexNo0x[];
57
+ /** The decrypted value as hex without 0x prefix */
58
+ readonly decryptedValue: BytesHexNo0x;
59
+ /** Additional contextual data as hex with 0x prefix */
60
+ readonly extraData: BytesHex;
61
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=public-decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-decrypt.js","sourceRoot":"","sources":["../../../src/jazz/types/public-decrypt.ts"],"names":[],"mappings":""}
@@ -0,0 +1,123 @@
1
+ import { Address, Bytes32Hex, Bytes65Hex, Bytes65HexNo0x, BytesHex, BytesHexNo0x } from "../../core/primitives.js";
2
+ import { FetchUserDecryptOptions } from "./common.js";
3
+ /**
4
+ * EIP-712 message structure for KMS user decryption requests.
5
+ *
6
+ * This defines the structured data that is signed by the user to authorize
7
+ * KMS decryption of their encrypted shares.
8
+ */
9
+ export type KmsUserDecryptEip712Message = Readonly<{
10
+ /** Public key as hex with 0x prefix */
11
+ publicKey: BytesHex;
12
+ /** List of contract addresses with 0x prefix */
13
+ contractAddresses: readonly Address[];
14
+ /** Start timestamp as string (Unix timestamp) */
15
+ startTimestamp: string;
16
+ /** Duration in days as string */
17
+ durationDays: string;
18
+ /** Additional contextual data as hex with 0x prefix */
19
+ extraData: BytesHex;
20
+ }>;
21
+ /**
22
+ * Parameters for fetching user decryption results from the Jazz service.
23
+ *
24
+ * This type defines the input required to request user decryption of
25
+ * ciphertext handles, including the EIP-712 signed authorization.
26
+ */
27
+ export type FetchUserDecryptParameters = {
28
+ /** Payload containing handle-contract pairs and signed authorization */
29
+ readonly payload: {
30
+ /** List of handle-contract pairs to decrypt */
31
+ readonly handleContractPairs: readonly HandleContractPair[];
32
+ /** Address of the EIP-712 signer with 0x prefix */
33
+ readonly kmsDecryptEip712Signer: Address;
34
+ /** EIP-712 message containing the decryption request parameters */
35
+ readonly kmsDecryptEip712Message: KmsUserDecryptEip712Message;
36
+ /** EIP-712 signature as 65-byte hex with 0x prefix */
37
+ readonly kmsDecryptEip712Signature: Bytes65Hex;
38
+ };
39
+ /** Additional options for the request */
40
+ readonly options?: FetchUserDecryptOptions;
41
+ };
42
+ /**
43
+ * A KMS signcrypted share containing the decrypted payload with its signature.
44
+ *
45
+ * This represents a single decrypted share from the KMS, containing the
46
+ * payload, signature, and associated metadata.
47
+ */
48
+ export interface KmsSigncryptedShare {
49
+ /** The decrypted payload as hex without 0x prefix */
50
+ readonly payload: BytesHexNo0x;
51
+ /** The signature as 65-byte hex without 0x prefix */
52
+ readonly signature: Bytes65HexNo0x;
53
+ /** Additional contextual data as hex without 0x prefix */
54
+ readonly extraData: BytesHexNo0x;
55
+ }
56
+ /**
57
+ * Result of a successful user decryption fetch operation.
58
+ *
59
+ * This is the user-facing result type, containing an array of
60
+ * KmsSigncryptedShare objects.
61
+ */
62
+ export type FetchUserDecryptResult = readonly KmsSigncryptedShare[];
63
+ /**
64
+ * A pairing of a handle with its associated contract address.
65
+ *
66
+ * This is used to identify which contract each handle belongs to
67
+ * for proper decryption and verification.
68
+ */
69
+ export type HandleContractPair = {
70
+ /** Hex-encoded bytes32 handle with 0x prefix */
71
+ readonly handle: Bytes32Hex;
72
+ /** Hex-encoded contract address with 0x prefix */
73
+ readonly contractAddress: Address;
74
+ };
75
+ /**
76
+ * Payload structure sent to the Jazz `/v2/user-decrypt` endpoint.
77
+ *
78
+ * This is the raw payload format expected by the Jazz API.
79
+ */
80
+ export type JazzUserDecryptPayload = {
81
+ /** List of handle-contract pairs to decrypt */
82
+ readonly handleContractPairs: readonly HandleContractPair[];
83
+ /** Validity period for the decryption request */
84
+ readonly requestValidity: {
85
+ /** Start timestamp as a string (Unix timestamp) */
86
+ readonly startTimestamp: string;
87
+ /** Duration in days as a string */
88
+ readonly durationDays: string;
89
+ };
90
+ /** Chain ID as a string */
91
+ readonly contractsChainId: string;
92
+ /** List of contract addresses with 0x prefix */
93
+ readonly contractAddresses: readonly Address[];
94
+ /** User address with 0x prefix */
95
+ readonly userAddress: Address;
96
+ /** EIP-712 signature without 0x prefix */
97
+ readonly signature: Bytes65HexNo0x;
98
+ /** Public key without 0x prefix */
99
+ readonly publicKey: BytesHexNo0x;
100
+ /** Additional contextual data with 0x prefix, defaults to "0x00" */
101
+ readonly extraData: BytesHex;
102
+ };
103
+ /**
104
+ * Individual item in the Jazz user decrypt response.
105
+ *
106
+ * This represents a single decrypted share from the Jazz API.
107
+ */
108
+ export type JazzUserDecryptItem = {
109
+ /** The decrypted payload as hex without 0x prefix */
110
+ readonly payload: BytesHexNo0x;
111
+ /** The signature as 65-byte hex without 0x prefix */
112
+ readonly signature: Bytes65HexNo0x;
113
+ /** Additional contextual data as hex with 0x prefix */
114
+ readonly extraData: BytesHex;
115
+ };
116
+ /**
117
+ * Result structure returned by the Jazz `/v2/user-decrypt` endpoint.
118
+ *
119
+ * This is the raw result format from the Jazz API before transformation
120
+ * into FetchUserDecryptResult. Note that extraData has 0x prefix in the
121
+ * API response but is transformed to no prefix in the user-facing result.
122
+ */
123
+ export type JazzUserDecryptResult = readonly JazzUserDecryptItem[];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=user-decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-decrypt.js","sourceRoot":"","sources":["../../../src/jazz/types/user-decrypt.ts"],"names":[],"mappings":""}
@@ -0,0 +1,111 @@
1
+ import { HandleLike, Plaintext } from "../core/fhe-type.js";
2
+ import { TransportKeyPair } from "./key-pair.js";
3
+ import { KmsSigncryptedShare } from "./types/user-decrypt.js";
4
+ import { Address, Bytes32Hex, BytesHex } from "../core/primitives.js";
5
+ import type { IJazzClient } from "./jazz-client-i.js";
6
+ /**
7
+ * EIP-712 message for KMS user decryption response.
8
+ */
9
+ export type KmsUserDecryptEip712Message = Readonly<{
10
+ /** Public key used for E2E encryption */
11
+ publicKey: BytesHex;
12
+ /** List of ciphertext handles */
13
+ ctHandles: readonly Bytes32Hex[];
14
+ /** User-decrypted data as hex with 0x prefix */
15
+ userDecryptedData: BytesHex;
16
+ /** Additional contextual data as hex with 0x prefix */
17
+ extraData: BytesHex;
18
+ }>;
19
+ /**
20
+ * EIP-712 type definitions for KMS user decryption.
21
+ */
22
+ export type KmsUserDecryptEip712Types = {
23
+ readonly EIP712Domain: readonly [
24
+ {
25
+ readonly name: 'name';
26
+ readonly type: 'string';
27
+ },
28
+ {
29
+ readonly name: 'version';
30
+ readonly type: 'string';
31
+ },
32
+ {
33
+ readonly name: 'chainId';
34
+ readonly type: 'uint256';
35
+ },
36
+ {
37
+ readonly name: 'verifyingContract';
38
+ readonly type: 'address';
39
+ }
40
+ ];
41
+ readonly ResponseUserDecryptSignData: readonly [
42
+ {
43
+ readonly name: 'publicKey';
44
+ readonly type: 'bytes';
45
+ },
46
+ {
47
+ readonly name: 'ctHandles';
48
+ readonly type: 'bytes32[]';
49
+ },
50
+ {
51
+ readonly name: 'userDecryptedData';
52
+ readonly type: 'bytes';
53
+ },
54
+ {
55
+ readonly name: 'extraData';
56
+ readonly type: 'bytes';
57
+ }
58
+ ];
59
+ };
60
+ /**
61
+ * EIP-712 type definitions for KMS user decryption.
62
+ *
63
+ * CRITICAL: Field order is authoritative — it determines the EIP-712 type hash.
64
+ * Changing the order will produce a different signature and break on-chain verification.
65
+ * Must match the Solidity struct definition exactly.
66
+ */
67
+ export declare const kmsUserDecryptEip712Types: KmsUserDecryptEip712Types;
68
+ /**
69
+ * Verifies KMS user decryption EIP-712 signatures.
70
+ *
71
+ * This function:
72
+ * 1. Reconstructs the EIP-712 message from each share
73
+ * 2. Recovers the signer addresses from each signature
74
+ * 3. Verifies all recovered addresses are in the KMS signer set
75
+ * 4. Verifies the threshold is met
76
+ *
77
+ * @param client - The Jazz client instance
78
+ * @param params - Verification parameters (chainId, verifyingContract, handles, publicKey)
79
+ * @param shares - Array of KMS signcrypted shares
80
+ * @throws Error if verification fails (unknown signer, threshold not met, invalid signature)
81
+ */
82
+ export declare function verifyUserDecryptionSignatures(client: IJazzClient, params: {
83
+ chainId: bigint;
84
+ verifyingContract: Address;
85
+ handles: BytesHex[];
86
+ publicKey: BytesHex;
87
+ }, shares: readonly KmsSigncryptedShare[]): Promise<void>;
88
+ /**
89
+ * Decrypts KMS signcrypted shares to recover plaintext values.
90
+ *
91
+ * This function:
92
+ * 1. Unsigncrypts each share using the KMS
93
+ * 2. Combines the shares to recover the secret
94
+ * 3. Decodes the recovered bytes to plaintext values
95
+ *
96
+ * @param handles - List of handles corresponding to the shares
97
+ * @param shares - Array of KMS signcrypted shares
98
+ * @param keypair - Transport key pair for decryption
99
+ * @returns Array of plaintext values
100
+ * @throws Error if decryption fails or shares are insufficient
101
+ */
102
+ export declare function decryptKmsSignedcryptedShares(handles: HandleLike[], shares: KmsSigncryptedShare[], keypair: TransportKeyPair, kmsDecryptionSignerAddress: Address): Promise<Plaintext[]>;
103
+ export declare function checkUserDecryptPermission(client: IJazzClient, params: {
104
+ aclContractAddress: Address;
105
+ userAddress: Address;
106
+ ctHandles: BytesHex[];
107
+ sanitizedPairs: {
108
+ handle: BytesHex;
109
+ contractAddress: BytesHex;
110
+ }[];
111
+ }): Promise<void>;