@zama-fhe/sdk 3.0.0-alpha.2 → 3.0.0-alpha.21

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 (99) hide show
  1. package/README.md +207 -122
  2. package/dist/cjs/build.cjs +2 -0
  3. package/dist/cjs/build.cjs.map +1 -0
  4. package/dist/cjs/chains/index.cjs +1 -0
  5. package/dist/cjs/chains.cjs +2 -0
  6. package/dist/cjs/chains.cjs.map +1 -0
  7. package/dist/cjs/cleartext/index.cjs +1 -1
  8. package/dist/cjs/eip1193-subscribe.cjs +1 -1
  9. package/dist/cjs/eip1193-subscribe.cjs.map +1 -1
  10. package/dist/cjs/encryption.cjs +2 -0
  11. package/dist/cjs/encryption.cjs.map +1 -0
  12. package/dist/cjs/ethers/index.cjs +1 -1
  13. package/dist/cjs/ethers/index.cjs.map +1 -1
  14. package/dist/cjs/index.cjs +73 -73
  15. package/dist/cjs/index.cjs.map +1 -1
  16. package/dist/cjs/query/index.cjs +1 -1
  17. package/dist/cjs/query/index.cjs.map +1 -1
  18. package/dist/cjs/readonly-token.cjs +1 -1
  19. package/dist/cjs/readonly-token.cjs.map +1 -1
  20. package/dist/cjs/relayer-cleartext.cjs +2 -0
  21. package/dist/cjs/relayer-cleartext.cjs.map +1 -0
  22. package/dist/cjs/relayer-sdk.worker.js +71 -71
  23. package/dist/cjs/relayer.cjs +1 -1
  24. package/dist/cjs/relayer.cjs.map +1 -1
  25. package/dist/cjs/viem/index.cjs +1 -1
  26. package/dist/cjs/viem/index.cjs.map +1 -1
  27. package/dist/cjs/wrappers-registry.cjs +1 -1
  28. package/dist/cjs/wrappers-registry.cjs.map +1 -1
  29. package/dist/esm/{assertions-BARApuMj.js → assertions-CfqI3AJv.js} +1 -1
  30. package/dist/esm/{assertions-BARApuMj.js.map → assertions-CfqI3AJv.js.map} +1 -1
  31. package/dist/esm/build-CvenCk6R.js +2 -0
  32. package/dist/esm/build-CvenCk6R.js.map +1 -0
  33. package/dist/esm/chains/index.d.ts +3 -0
  34. package/dist/esm/chains/index.js +1 -0
  35. package/dist/esm/chains-aHmrozPh.js +2 -0
  36. package/dist/esm/chains-aHmrozPh.js.map +1 -0
  37. package/dist/esm/cleartext/index.d.ts +2 -86
  38. package/dist/esm/cleartext/index.js +1 -1
  39. package/dist/esm/cleartext-BHu6-LCv.d.ts +19 -0
  40. package/dist/esm/cleartext-I-etE_7S.js +2 -0
  41. package/dist/esm/cleartext-I-etE_7S.js.map +1 -0
  42. package/dist/esm/eip1193-subscribe-CcotSOIm.js +2 -0
  43. package/dist/esm/eip1193-subscribe-CcotSOIm.js.map +1 -0
  44. package/dist/esm/{encryption-CmIPBcfP.js → encryption-YS-Kb7qm.js} +2 -2
  45. package/dist/esm/{encryption-CmIPBcfP.js.map → encryption-YS-Kb7qm.js.map} +1 -1
  46. package/dist/esm/ethers/index.d.ts +53 -8
  47. package/dist/esm/ethers/index.js +1 -1
  48. package/dist/esm/ethers/index.js.map +1 -1
  49. package/dist/esm/{hex-D_B-zoId.js → hex-BZVTzEK6.js} +2 -2
  50. package/dist/esm/{hex-D_B-zoId.js.map → hex-BZVTzEK6.js.map} +1 -1
  51. package/dist/esm/{relayer-utils-iSPis4x-.d.ts → index-BTY0MxOt.d.ts} +50 -23
  52. package/dist/esm/{onchain-events-2VNiL78c.d.ts → index-BdyljG1F.d.ts} +387 -1505
  53. package/dist/esm/index.d.ts +61 -93
  54. package/dist/esm/index.js +73 -73
  55. package/dist/esm/index.js.map +1 -1
  56. package/dist/esm/memory-storage-CFXqXUcm.js +2 -0
  57. package/dist/esm/memory-storage-CFXqXUcm.js.map +1 -0
  58. package/dist/esm/node/index.d.ts +88 -110
  59. package/dist/esm/node/index.js +1 -1
  60. package/dist/esm/node/index.js.map +1 -1
  61. package/dist/esm/node/relayer-sdk.node-worker.js +1 -1
  62. package/dist/esm/node/relayer-sdk.node-worker.js.map +1 -1
  63. package/dist/esm/query/index.d.ts +40 -50
  64. package/dist/esm/query/index.js +1 -1
  65. package/dist/esm/query/index.js.map +1 -1
  66. package/dist/esm/readonly-token-DCLOYhws.js +2 -0
  67. package/dist/esm/readonly-token-DCLOYhws.js.map +1 -0
  68. package/dist/esm/{relayer-C6u3eOlN.js → relayer-7Hd00A6X.js} +2 -2
  69. package/dist/esm/relayer-7Hd00A6X.js.map +1 -0
  70. package/dist/esm/{relayer-sdk.types-CGfXwKcB.d.ts → relayer-cleartext-DJkSUlZ2.d.ts} +263 -106
  71. package/dist/esm/relayer-cleartext-SZCM9wTx.js +2 -0
  72. package/dist/esm/relayer-cleartext-SZCM9wTx.js.map +1 -0
  73. package/dist/esm/relayer-sdk.worker.js +71 -71
  74. package/dist/esm/types-C1S426x4.d.ts +48 -0
  75. package/dist/esm/types-CVyJHEya.d.ts +14 -0
  76. package/dist/esm/types-DePjTTbo.d.ts +30 -0
  77. package/dist/esm/types-FY7ciI37.d.ts +615 -0
  78. package/dist/esm/viem/index.d.ts +39 -11
  79. package/dist/esm/viem/index.js +1 -1
  80. package/dist/esm/viem/index.js.map +1 -1
  81. package/dist/esm/wrappers-registry-CXNs4eR0.js +2 -0
  82. package/dist/esm/wrappers-registry-CXNs4eR0.js.map +1 -0
  83. package/package.json +17 -3
  84. package/dist/cjs/cleartext.cjs +0 -2
  85. package/dist/cjs/cleartext.cjs.map +0 -1
  86. package/dist/esm/cleartext-Cs28cTsa.js +0 -2
  87. package/dist/esm/cleartext-Cs28cTsa.js.map +0 -1
  88. package/dist/esm/eip1193-subscribe-Cl_wlVuQ.js +0 -2
  89. package/dist/esm/eip1193-subscribe-Cl_wlVuQ.js.map +0 -1
  90. package/dist/esm/memory-storage-F8xjMzVy.js +0 -2
  91. package/dist/esm/memory-storage-F8xjMzVy.js.map +0 -1
  92. package/dist/esm/readonly-token-D4GjTj0q.js +0 -2
  93. package/dist/esm/readonly-token-D4GjTj0q.js.map +0 -1
  94. package/dist/esm/relayer-C6u3eOlN.js.map +0 -1
  95. package/dist/esm/relayer-sdk-DPqytEbO.d.ts +0 -44
  96. package/dist/esm/relayer-utils-BeoTNDM4.js +0 -2
  97. package/dist/esm/relayer-utils-BeoTNDM4.js.map +0 -1
  98. package/dist/esm/wrappers-registry-ydyySM9g.js +0 -2
  99. package/dist/esm/wrappers-registry-ydyySM9g.js.map +0 -1
@@ -1,103 +1,71 @@
1
- import { A as ReadContractConfig, C as GenericSigner, D as TransactionResult, E as TransactionReceipt, F as WriteFunctionName, M as ReadFunctionName, N as WriteContractArgs, O as ContractAbi, P as WriteContractConfig, Q as GenericLogger, S as GenericStorage, T as RawLog, _ as ShieldCallbacks, a as EncryptParams, b as DelegatedStoredCredentials, c as NetworkType, d as RelayerWebConfig, f as RelayerWebSecurityConfig, g as UnshieldOptions, h as TransferOptions, i as EncryptInput, j as ReadContractReturnType, k as ReadContractArgs, l as PublicDecryptResult, m as ShieldOptions, n as DelegatedUserDecryptParams, o as EncryptResult, p as UserDecryptParams, r as EIP712TypedData, s as Handle, t as ClearValueType, u as RelayerSDKStatus, v as TransferCallbacks, w as SignerLifecycleCallbacks, x as StoredCredentials, y as UnshieldCallbacks } from "./relayer-sdk.types-CGfXwKcB.js";
2
- import { t as RelayerSDK } from "./relayer-sdk-DPqytEbO.js";
3
- import { n as MainnetConfig, r as SepoliaConfig, t as HardhatConfig } from "./relayer-utils-iSPis4x-.js";
4
- import { $ as DelegationDelegateEqualsContractError, $t as ShieldSubmittedEvent, A as loadPendingUnshield, An as isConfidentialWrapperContract, At as CredentialsManagerConfig, B as BatchDecryptAsOptions, Bn as underlyingContract, Bt as CredentialsLoadingEvent, C as decodeUnwrappedStarted, Cn as delegateForUserDecryptionContract, D as findUnwrapRequested, Dn as ERC7984_INTERFACE_ID, Dt as DelegatedCredentialsManager, E as findRevokedDelegationForUserDecryption, En as revokeDelegationContract, F as ListPairsOptions, Fn as decimalsContract, Ft as CredentialsCachedEvent, G as BalanceCheckUnavailableError, Gn as confidentialTransferFromContract, Gt as DecryptStartEvent, H as ZERO_HANDLE, Hn as confidentialBalanceOfContract, Ht as CredentialsRevokedEvent, I as WrappersRegistry, In as nameContract, It as CredentialsCorruptedEvent, J as InsufficientConfidentialBalanceError, Jn as setOperatorContract, Jt as EncryptErrorEvent, K as BalanceErrorDetails, Kn as isOperatorContract, Kt as DelegationSubmittedEvent, L as WrappersRegistryConfig, Ln as symbolContract, Lt as CredentialsCreatedEvent, M as ZamaSDK, Mn as allowanceContract, Mt as ApproveUnderlyingSubmittedEvent, N as ZamaSDKConfig, Nn as approveContract, Nt as BaseEvent, O as findWrapped, On as ERC7984_WRAPPER_INTERFACE_ID, Ot as DelegatedCredentialsManagerConfig, P as DefaultRegistryAddresses, Pn as balanceOfContract, Pt as CredentialsAllowedEvent, Q as DelegationCooldownError, Qt as SessionExpiredEvent, R as Token, Rn as finalizeUnwrapContract, Rt as CredentialsCreatingEvent, S as decodeUnwrappedFinalized, Sn as isConfidentialTokenValidContract, T as findDelegatedForUserDecryption, Tn as isHandleDelegatedContract, U as isZeroHandle, Un as confidentialTotalSupplyContract, Ut as DecryptEndEvent, V as ReadonlyToken, Vn as wrapContract, Vt as CredentialsPersistFailedEvent, W as matchAclRevert, Wn as confidentialTransferContract, Wt as DecryptErrorEvent, X as AclPausedError, Xn as unwrapContract, Xt as FinalizeUnwrapSubmittedEvent, Y as InsufficientERC20BalanceError, Yn as totalSupplyContract, Yt as EncryptStartEvent, Z as DelegationContractIsSelfError, Zn as unwrapFromBalanceContract, Zt as RevokeDelegationSubmittedEvent, _ as decodeDelegatedForUserDecryption, _n as getTokenAddressContract, _t as ZamaError, a as DelegatedForUserDecryptionEvent, an as UnshieldPhase2SubmittedEvent, at as DelegationSelfNotAllowedError, b as decodeRevokedDelegationForUserDecryption, bn as getTokenPairsLengthContract, bt as DecryptHandle, c as TOKEN_TOPICS, cn as ZamaSDKEventInput, ct as InvalidKeypairError, d as UnwrappedFinalizedEvent, dn as ZamaSDKEvents, dt as ApprovalFailedError, en as TransactionErrorEvent, et as DelegationExpirationTooSoonError, f as UnwrappedStartedEvent, fn as DecryptCache, ft as TransactionRevertedError, g as decodeConfidentialTransfer, gn as getConfidentialTokenAddressContract, gt as SigningRejectedError, h as decodeAclEvents, hn as TokenWrapperPairWithMetadata, ht as SigningFailedError, i as ConfidentialTransferEvent, in as UnshieldPhase2StartedEvent, it as DelegationNotPropagatedError, j as savePendingUnshield, jn as supportsInterfaceContract, jt as ApproveSubmittedEvent, k as clearPendingUnshield, kn as isConfidentialTokenContract, kt as CredentialsManager, l as Topics, ln as ZamaSDKEventListener, lt as KeypairExpiredError, m as decodeAclEvent, mn as TokenWrapperPair, mt as EncryptionFailedError, n as AclEvent, nn as TransferSubmittedEvent, nt as DelegationExpiryUnchangedError, o as OnChainEvent, on as UnwrapSubmittedEvent, ot as ConfigurationError, p as WrappedEvent, pn as PaginatedResult, pt as DecryptionFailedError, q as ERC20ReadFailedError, qn as rateContract, qt as EncryptEndEvent, r as AclTopics, rn as UnshieldPhase1SubmittedEvent, rt as DelegationNotFoundError, s as RevokedDelegationForUserDecryptionEvent, sn as ZamaSDKEvent, st as RelayerRequestFailedError, t as ACL_TOPICS, tn as TransferFromSubmittedEvent, tt as DelegationExpiredError, u as UnwrapRequestedEvent, un as ZamaSDKEventType, ut as NoCiphertextError, v as decodeOnChainEvent, vn as getTokenPairContract, vt as ZamaErrorCode, w as decodeWrapped, wn as getDelegationExpiryContract, x as decodeUnwrapRequested, xn as getTokenPairsSliceContract, xt as DecryptResult, y as decodeOnChainEvents, yn as getTokenPairsContract, yt as matchZamaError, z as BatchBalancesResult, zn as inferredTotalSupplyContract, zt as CredentialsExpiredEvent } from "./onchain-events-2VNiL78c.js";
5
- import { Address, Address as Address$1, Hex, Hex as Hex$1 } from "viem";
6
- import { FheTypeName, FhevmInstanceConfig, InputProofBytesType, InputProofBytesType as InputProofBytesType$1, KeypairType, KeypairType as KeypairType$1, KmsDelegatedUserDecryptEIP712Type, KmsDelegatedUserDecryptEIP712Type as KmsDelegatedUserDecryptEIP712Type$1, ZKProofLike, ZKProofLike as ZKProofLike$1 } from "@zama-fhe/relayer-sdk/bundle";
1
+ import { n as FheChain, t as AtLeastOneChain } from "./types-C1S426x4.js";
2
+ import { a as mainnet, i as hoodi, n as chains, o as sepolia, r as hardhat, t as anvil } from "./index-BTY0MxOt.js";
3
+ import { A as GenericSigner, B as ReadContractReturnType, C as ShieldCallbacks, D as StoredCredentials, E as DelegatedStoredCredentials, F as TransactionReceipt, H as WriteContractArgs, I as TransactionResult, L as ContractAbi, M as SignerIdentityChange, N as SignerIdentityListener, O as GenericStorage, P as RawLog, R as ReadContractArgs, S as UnshieldOptions, T as UnshieldCallbacks, U as WriteContractConfig, V as ReadFunctionName, W as WriteFunctionName, _ as UserDecryptParams, a as EIP712TypedData, b as ShieldOptions, c as EncryptResult, d as PublicDecryptResult, f as PublicKeyData, g as RelayerWebSecurityConfig, h as RelayerWebConfig, i as DelegatedUserDecryptParams, j as SignerIdentity, k as GenericProvider, l as Handle, m as RelayerSDKStatus, n as RelayerSDK, o as EncryptInput, p as PublicParamsData, r as ClearValueType, s as EncryptParams, st as GenericLogger, u as NetworkType, w as TransferCallbacks, x as TransferOptions, z as ReadContractConfig } from "./relayer-cleartext-DJkSUlZ2.js";
4
+ import { $ as RevokedDelegationForUserDecryptionEvent, A as EncryptStartEvent, B as UnshieldPhase2SubmittedEvent, C as CredentialsRevokedEvent, D as DelegationSubmittedEvent, E as DecryptStartEvent, F as TransactionErrorEvent, G as ZamaSDKEventType, H as ZamaSDKEvent, I as TransferFromSubmittedEvent, J as AclEvent, K as ZamaSDKEvents, L as TransferSubmittedEvent, M as RevokeDelegationSubmittedEvent, N as SessionExpiredEvent, O as EncryptEndEvent, P as ShieldSubmittedEvent, Q as OnChainEvent, R as UnshieldPhase1SubmittedEvent, S as CredentialsPersistFailedEvent, St as findWrapped, T as DecryptErrorEvent, U as ZamaSDKEventInput, V as UnwrapSubmittedEvent, W as ZamaSDKEventListener, X as ConfidentialTransferEvent, Y as AclTopics, Z as DelegatedForUserDecryptionEvent, _ as CredentialsCorruptedEvent, _t as decodeUnwrappedStarted, a as ZamaConfig, at as UnwrappedStartedEvent, b as CredentialsExpiredEvent, bt as findRevokedDelegationForUserDecryption, c as RelayerWeb, ct as decodeAclEvents, d as WorkerLike, dt as decodeOnChainEvent, et as TOKEN_TOPICS, f as ApproveSubmittedEvent, ft as decodeOnChainEvents, g as CredentialsCachedEvent, gt as decodeUnwrappedFinalized, h as CredentialsAllowedEvent, ht as decodeUnwrapRequested, i as WebRelayerOptions, it as UnwrappedFinalizedEvent, j as FinalizeUnwrapSubmittedEvent, k as EncryptErrorEvent, lt as decodeConfidentialTransfer, m as BaseEvent, mt as decodeUnwrapFinalized, n as RelayerConfig, nt as UnwrapFinalizedEvent, o as ZamaConfigBase, ot as WrappedEvent, p as ApproveUnderlyingSubmittedEvent, pt as decodeRevokedDelegationForUserDecryption, q as ACL_TOPICS, r as WebRelayerConfig, rt as UnwrapRequestedEvent, s as ZamaConfigGeneric, st as decodeAclEvent, t as CleartextRelayerConfig, tt as Topics, u as RelayerDispatcher, ut as decodeDelegatedForUserDecryption, v as CredentialsCreatedEvent, vt as decodeWrapped, w as DecryptEndEvent, x as CredentialsLoadingEvent, xt as findUnwrapRequested, y as CredentialsCreatingEvent, yt as findDelegatedForUserDecryption, z as UnshieldPhase2StartedEvent } from "./types-FY7ciI37.js";
5
+ import { t as ZamaConfigEthers } from "./types-DePjTTbo.js";
6
+ import { t as cleartext } from "./cleartext-BHu6-LCv.js";
7
+ import { t as ZamaConfigViem } from "./types-CVyJHEya.js";
8
+ import { A as DelegationExpiryUnchangedError, At as decimalsContract, B as ApprovalFailedError, Bt as confidentialTransferFromContract, C as InsufficientERC20BalanceError, Ct as ERC7984_WRAPPER_INTERFACE_ID_LEGACY, D as DelegationDelegateEqualsContractError, Dt as allowanceContract, E as DelegationCooldownError, Et as supportsInterfaceContract, F as ConfigurationError, Ft as underlyingContract, G as SigningRejectedError, Gt as unwrapContract, H as DecryptionFailedError, Ht as rateContract, I as RelayerRequestFailedError, It as wrapContract, J as matchZamaError, K as ZamaError, Kt as unwrapFromBalanceContract, L as InvalidKeypairError, Lt as confidentialBalanceOfContract, M as DelegationNotPropagatedError, Mt as symbolContract, N as DelegationSelfNotAllowedError, Nt as finalizeUnwrapContract, O as DelegationExpirationTooSoonError, Ot as approveContract, P as ChainMismatchError, Pt as inferredTotalSupplyContract, R as KeypairExpiredError, Rt as confidentialTotalSupplyContract, S as InsufficientConfidentialBalanceError, St as ERC7984_WRAPPER_INTERFACE_ID, T as DelegationContractIsSelfError, Tt as isConfidentialWrapperContract, U as EncryptionFailedError, Ut as setOperatorContract, V as TransactionRevertedError, Vt as isOperatorContract, W as SigningFailedError, Wt as totalSupplyContract, X as DecryptResult, Y as DecryptHandle, _ as isZeroHandle, _t as delegateForUserDecryptionContract, a as savePendingUnshield, at as CredentialsManagerConfig, b as BalanceErrorDetails, bt as revokeDelegationContract, c as DefaultRegistryAddresses, ct as TokenWrapperPair, d as WrappersRegistryConfig, dt as getTokenAddressContract, f as Token, ft as getTokenPairContract, g as ZERO_HANDLE, gt as isConfidentialTokenValidContract, h as ReadonlyToken, ht as getTokenPairsSliceContract, i as loadPendingUnshieldRequest, it as CredentialsManager, j as DelegationNotFoundError, jt as nameContract, k as DelegationExpiredError, kt as balanceOfContract, l as ListPairsOptions, lt as TokenWrapperPairWithMetadata, m as BatchDecryptAsOptions, mt as getTokenPairsLengthContract, n as clearPendingUnshield, nt as DelegatedCredentialsManager, o as ZamaSDK, ot as DecryptCache, p as BatchBalancesResult, pt as getTokenPairsContract, q as ZamaErrorCode, r as loadPendingUnshield, rt as DelegatedCredentialsManagerConfig, s as ZamaSDKConfig, st as PaginatedResult, t as PendingUnshieldRequest, u as WrappersRegistry, ut as getConfidentialTokenAddressContract, v as matchAclRevert, vt as getDelegationExpiryContract, w as AclPausedError, wt as isConfidentialTokenContract, x as ERC20ReadFailedError, xt as ERC7984_INTERFACE_ID, y as BalanceCheckUnavailableError, yt as isHandleDelegatedContract, z as NoCiphertextError, zt as confidentialTransferContract } from "./index-BdyljG1F.js";
9
+ import { Address, Hex } from "viem";
10
+ import { FheTypeName, FhevmInstanceConfig, InputProofBytesType, KeypairType, KmsDelegatedUserDecryptEIP712Type, ZKProofLike } from "@zama-fhe/relayer-sdk/bundle";
7
11
 
8
- //#region src/relayer/relayer-web.d.ts
12
+ //#region src/config/web.d.ts
9
13
  /**
10
- * RelayerWebbrowser encryption/decryption layer using a Web Worker.
11
- * Handles WASM initialization in a Web Worker for non-blocking operations.
14
+ * Browser relayer routes to RelayerWeb (Web Worker + WASM).
12
15
  *
13
- * ## Worker initialization / promise lock pattern
16
+ * @param options - Worker options (threads, security, logger, storage).
14
17
  *
15
- * Every public method calls `#ensureWorker()` before proceeding.
16
- * Initialization is managed by three private fields:
18
+ * @example
19
+ * ```ts
20
+ * relayers: {
21
+ * [sepolia.id]: web(),
22
+ * [mainnet.id]: web({ threads: 4 }),
23
+ * }
24
+ * ```
25
+ */
26
+ declare function web(options?: WebRelayerOptions): WebRelayerConfig;
27
+ //#endregion
28
+ //#region src/config/create.d.ts
29
+ /**
30
+ * Create a {@link ZamaConfig} from a custom {@link GenericSigner} and
31
+ * {@link GenericProvider}. Use this when the built-in adapter paths
32
+ * (`@zama-fhe/sdk/viem`, `@zama-fhe/sdk/ethers`, `@zama-fhe/react-sdk/wagmi`)
33
+ * don't cover your setup — e.g. a server-side relayer that implements
34
+ * `GenericSigner` directly.
17
35
  *
18
- * - `#workerClient` — the live worker instance (null until first init)
19
- * - `#initPromise` — cached promise from `#initWorker()`; once resolved,
20
- * all subsequent callers reuse the same worker without re-initializing.
21
- * Cleared on error so the next caller retries a fresh init.
22
- * - `#ensureLock` — short-lived promise that serializes concurrent calls
23
- * to `#ensureWorkerInner()`. While one caller is checking chain IDs and
24
- * potentially tearing down an old worker, all other callers await the
25
- * same lock instead of racing through the same logic. Cleared in
26
- * `finally` so it's never leaked.
36
+ * @example
37
+ * ```ts
38
+ * import { createConfig, web, memoryStorage } from "@zama-fhe/sdk";
39
+ * import { sepolia } from "@zama-fhe/sdk/chains";
27
40
  *
28
- * Chain switching: when `getChainId()` returns a value different from the
29
- * previously resolved chain, the old worker is terminated, `#initPromise`
30
- * is cleared, and a fresh worker is created for the new chain — all within
31
- * the `#ensureLock` critical section.
41
+ * const config = createConfig({
42
+ * chains: [sepolia],
43
+ * signer: myCustomSigner,
44
+ * provider: myCustomProvider,
45
+ * storage: memoryStorage,
46
+ * relayers: { [sepolia.id]: web() },
47
+ * });
48
+ * const sdk = new ZamaSDK(config);
49
+ * ```
32
50
  */
33
- declare class RelayerWeb implements RelayerSDK, Disposable {
34
- #private;
35
- constructor(config: RelayerWebConfig);
36
- /** Current WASM initialization status. */
37
- get status(): RelayerSDKStatus;
38
- /** The error that caused initialization to fail, if `status` is `"error"`. */
39
- get initError(): Error | undefined;
40
- /**
41
- * Terminate the worker and clean up resources.
42
- * Call this when the SDK is no longer needed.
43
- */
44
- terminate(): void;
45
- /** Calls {@link terminate}, shutting down the Web Worker. */
46
- [Symbol.dispose](): void;
47
- /**
48
- * Generate a keypair for FHE operations.
49
- */
50
- generateKeypair(): Promise<KeypairType$1<Hex$1>>;
51
- /**
52
- * Create EIP712 typed data for user decryption authorization.
53
- */
54
- createEIP712(publicKey: Hex$1, contractAddresses: Address$1[], startTimestamp: number, durationDays?: number): Promise<EIP712TypedData>;
55
- /**
56
- * Encrypt values for use in smart contract calls.
57
- * Each value must specify its FHE type (ebool, euint8–256, eaddress).
58
- */
59
- encrypt(params: EncryptParams): Promise<EncryptResult>;
60
- /**
61
- * Decrypt ciphertexts using user's private key.
62
- * Requires a valid EIP712 signature.
63
- */
64
- userDecrypt(params: UserDecryptParams): Promise<Readonly<Record<Handle, ClearValueType>>>;
65
- /**
66
- * Public decryption - no authorization needed.
67
- * Used for publicly visible encrypted values.
68
- */
69
- publicDecrypt(handles: Handle[]): Promise<PublicDecryptResult>;
70
- /**
71
- * Create EIP712 typed data for delegated user decryption authorization.
72
- */
73
- createDelegatedUserDecryptEIP712(publicKey: Hex$1, contractAddresses: Address$1[], delegatorAddress: Address$1, startTimestamp: number, durationDays?: number): Promise<KmsDelegatedUserDecryptEIP712Type$1>;
74
- /**
75
- * Decrypt ciphertexts via delegation.
76
- * Requires a valid EIP712 signature from the delegator.
77
- */
78
- delegatedUserDecrypt(params: DelegatedUserDecryptParams): Promise<Readonly<Record<Handle, ClearValueType>>>;
79
- /**
80
- * Submit a ZK proof to the relayer for verification.
81
- */
82
- requestZKProofVerification(zkProof: ZKProofLike$1): Promise<InputProofBytesType$1>;
83
- /**
84
- * Get the TFHE compact public key.
85
- * When storage is configured, the result is cached persistently.
86
- */
87
- getPublicKey(): Promise<{
88
- publicKeyId: string;
89
- publicKey: Uint8Array;
90
- } | null>;
91
- /**
92
- * Get public parameters for encryption capacity.
93
- * When storage is configured, the result is cached persistently.
94
- */
95
- getPublicParams(bits: number): Promise<{
96
- publicParams: Uint8Array;
97
- publicParamsId: string;
98
- } | null>;
99
- getAclAddress(): Promise<Address$1>;
51
+ declare function createConfig<const TChains extends readonly [FheChain, ...FheChain[]]>(params: ZamaConfigGeneric<TChains>): ZamaConfig;
52
+ //#endregion
53
+ //#region src/config/resolve.d.ts
54
+ declare function resolveStorage(storage?: GenericStorage | undefined, sessionStorage?: GenericStorage | undefined): {
55
+ storage: GenericStorage;
56
+ sessionStorage: GenericStorage;
57
+ };
58
+ interface ResolvedChainRelayer {
59
+ chain: FheChain;
60
+ relayer: RelayerConfig;
100
61
  }
62
+ declare function resolveChainRelayers(chains: readonly FheChain[], relayers: Readonly<Record<number, RelayerConfig>>): Map<number, ResolvedChainRelayer>;
63
+ //#endregion
64
+ //#region src/config/build.d.ts
65
+ /**
66
+ * @internal Shared config builder — not part of the public API.
67
+ */
68
+ declare function buildZamaConfig(signer: GenericSigner, provider: GenericProvider, params: ZamaConfigBase): ZamaConfig;
101
69
  //#endregion
102
70
  //#region src/storage/memory-storage.d.ts
103
71
  /** In-memory credential store. Credentials are lost on page reload. */
@@ -157,5 +125,5 @@ declare class ChromeSessionStorage implements GenericStorage {
157
125
  /** Default singleton for application-wide use. */
158
126
  declare const chromeSessionStorage: ChromeSessionStorage;
159
127
  //#endregion
160
- export { ACL_TOPICS, type AclEvent, AclPausedError, AclTopics, type Address, ApprovalFailedError, type ApproveSubmittedEvent, type ApproveUnderlyingSubmittedEvent, BalanceCheckUnavailableError, type BalanceErrorDetails, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, ChromeSessionStorage, type ClearValueType, type ConfidentialTransferEvent, ConfigurationError, type ContractAbi, type CredentialsAllowedEvent, type CredentialsCachedEvent, type CredentialsCorruptedEvent, type CredentialsCreatedEvent, type CredentialsCreatingEvent, type CredentialsExpiredEvent, type CredentialsLoadingEvent, CredentialsManager, type CredentialsManagerConfig, type CredentialsPersistFailedEvent, type CredentialsRevokedEvent, DecryptCache, type DecryptEndEvent, type DecryptErrorEvent, type DecryptHandle, type DecryptResult, type DecryptStartEvent, DecryptionFailedError, DefaultRegistryAddresses, DelegatedCredentialsManager, type DelegatedCredentialsManagerConfig, type DelegatedForUserDecryptionEvent, type DelegatedStoredCredentials, type DelegatedUserDecryptParams, DelegationContractIsSelfError, DelegationCooldownError, DelegationDelegateEqualsContractError, DelegationExpirationTooSoonError, DelegationExpiredError, DelegationExpiryUnchangedError, DelegationNotFoundError, DelegationNotPropagatedError, DelegationSelfNotAllowedError, type DelegationSubmittedEvent, type EIP712TypedData, ERC20ReadFailedError, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, EncryptionFailedError, type FheTypeName, type FhevmInstanceConfig, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericSigner, type GenericStorage, type Handle, HardhatConfig, type Hex, IndexedDBStorage, type InputProofBytesType, InsufficientConfidentialBalanceError, InsufficientERC20BalanceError, InvalidKeypairError, KeypairExpiredError, type KeypairType, type KmsDelegatedUserDecryptEIP712Type, type ListPairsOptions, MainnetConfig, MemoryStorage, type NetworkType, NoCiphertextError, type OnChainEvent, type PaginatedResult, type PublicDecryptResult, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, ReadonlyToken, RelayerRequestFailedError, type RelayerSDK, type RelayerSDKStatus, RelayerWeb, type RelayerWebConfig, type RelayerWebSecurityConfig, type RevokeDelegationSubmittedEvent, type RevokedDelegationForUserDecryptionEvent, SepoliaConfig, type SessionExpiredEvent, type ShieldCallbacks, type ShieldOptions, type ShieldSubmittedEvent, type SignerLifecycleCallbacks, SigningFailedError, SigningRejectedError, type StoredCredentials, TOKEN_TOPICS, Token, type TokenWrapperPair, type TokenWrapperPairWithMetadata, Topics, type TransactionErrorEvent, type TransactionReceipt, type TransactionResult, TransactionRevertedError, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnshieldCallbacks, type UnshieldOptions, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type UnwrappedFinalizedEvent, type UnwrappedStartedEvent, type UserDecryptParams, type WrappedEvent, WrappersRegistry, type WrappersRegistryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, ZERO_HANDLE, type ZKProofLike, ZamaError, ZamaErrorCode, ZamaSDK, type ZamaSDKConfig, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, allowanceContract, approveContract, balanceOfContract, chromeSessionStorage, clearPendingUnshield, confidentialBalanceOfContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, decimalsContract, decodeAclEvent, decodeAclEvents, decodeConfidentialTransfer, decodeDelegatedForUserDecryption, decodeOnChainEvent, decodeOnChainEvents, decodeRevokedDelegationForUserDecryption, decodeUnwrapRequested, decodeUnwrappedFinalized, decodeUnwrappedStarted, decodeWrapped, delegateForUserDecryptionContract, finalizeUnwrapContract, findDelegatedForUserDecryption, findRevokedDelegationForUserDecryption, findUnwrapRequested, findWrapped, getConfidentialTokenAddressContract, getDelegationExpiryContract, getTokenAddressContract, getTokenPairContract, getTokenPairsContract, getTokenPairsLengthContract, getTokenPairsSliceContract, indexedDBStorage, inferredTotalSupplyContract, isConfidentialTokenContract, isConfidentialTokenValidContract, isConfidentialWrapperContract, isHandleDelegatedContract, isOperatorContract, isZeroHandle, loadPendingUnshield, matchAclRevert, matchZamaError, memoryStorage, nameContract, rateContract, revokeDelegationContract, savePendingUnshield, setOperatorContract, supportsInterfaceContract, symbolContract, totalSupplyContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract };
128
+ export { ACL_TOPICS, type AclEvent, AclPausedError, AclTopics, type Address, ApprovalFailedError, type ApproveSubmittedEvent, type ApproveUnderlyingSubmittedEvent, type AtLeastOneChain, BalanceCheckUnavailableError, type BalanceErrorDetails, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, ChainMismatchError, ChromeSessionStorage, type ClearValueType, type CleartextRelayerConfig, type ConfidentialTransferEvent, ConfigurationError, type ContractAbi, type CredentialsAllowedEvent, type CredentialsCachedEvent, type CredentialsCorruptedEvent, type CredentialsCreatedEvent, type CredentialsCreatingEvent, type CredentialsExpiredEvent, type CredentialsLoadingEvent, CredentialsManager, type CredentialsManagerConfig, type CredentialsPersistFailedEvent, type CredentialsRevokedEvent, DecryptCache, type DecryptEndEvent, type DecryptErrorEvent, type DecryptHandle, type DecryptResult, type DecryptStartEvent, DecryptionFailedError, DefaultRegistryAddresses, DelegatedCredentialsManager, type DelegatedCredentialsManagerConfig, type DelegatedForUserDecryptionEvent, type DelegatedStoredCredentials, type DelegatedUserDecryptParams, DelegationContractIsSelfError, DelegationCooldownError, DelegationDelegateEqualsContractError, DelegationExpirationTooSoonError, DelegationExpiredError, DelegationExpiryUnchangedError, DelegationNotFoundError, DelegationNotPropagatedError, DelegationSelfNotAllowedError, type DelegationSubmittedEvent, type EIP712TypedData, ERC20ReadFailedError, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID_LEGACY, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, EncryptionFailedError, type FheChain, type FheTypeName, type FhevmInstanceConfig, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type Handle, type Hex, IndexedDBStorage, type InputProofBytesType, InsufficientConfidentialBalanceError, InsufficientERC20BalanceError, InvalidKeypairError, KeypairExpiredError, type KeypairType, type KmsDelegatedUserDecryptEIP712Type, type ListPairsOptions, MemoryStorage, type NetworkType, NoCiphertextError, type OnChainEvent, type PaginatedResult, type PendingUnshieldRequest, type PublicDecryptResult, type PublicKeyData, type PublicParamsData, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, ReadonlyToken, type RelayerConfig, type RelayerDispatcher, RelayerRequestFailedError, type RelayerSDK, type RelayerSDKStatus, RelayerWeb, type RelayerWebConfig, type RelayerWebSecurityConfig, type ResolvedChainRelayer, type RevokeDelegationSubmittedEvent, type RevokedDelegationForUserDecryptionEvent, type SessionExpiredEvent, type ShieldCallbacks, type ShieldOptions, type ShieldSubmittedEvent, type SignerIdentity, type SignerIdentityChange, type SignerIdentityListener, SigningFailedError, SigningRejectedError, type StoredCredentials, TOKEN_TOPICS, Token, type TokenWrapperPair, type TokenWrapperPairWithMetadata, Topics, type TransactionErrorEvent, type TransactionReceipt, type TransactionResult, TransactionRevertedError, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnshieldCallbacks, type UnshieldOptions, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapFinalizedEvent, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type UnwrappedFinalizedEvent, type UnwrappedStartedEvent, type UserDecryptParams, type WebRelayerConfig, type WebRelayerOptions, type WorkerLike, type WrappedEvent, WrappersRegistry, type WrappersRegistryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, ZERO_HANDLE, type ZKProofLike, type ZamaConfig, type ZamaConfigBase, type ZamaConfigEthers, type ZamaConfigGeneric, type ZamaConfigViem, ZamaError, ZamaErrorCode, ZamaSDK, type ZamaSDKConfig, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, allowanceContract, anvil, approveContract, balanceOfContract, buildZamaConfig, chains, chromeSessionStorage, clearPendingUnshield, cleartext, confidentialBalanceOfContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, createConfig, decimalsContract, decodeAclEvent, decodeAclEvents, decodeConfidentialTransfer, decodeDelegatedForUserDecryption, decodeOnChainEvent, decodeOnChainEvents, decodeRevokedDelegationForUserDecryption, decodeUnwrapFinalized, decodeUnwrapRequested, decodeUnwrappedFinalized, decodeUnwrappedStarted, decodeWrapped, delegateForUserDecryptionContract, finalizeUnwrapContract, findDelegatedForUserDecryption, findRevokedDelegationForUserDecryption, findUnwrapRequested, findWrapped, getConfidentialTokenAddressContract, getDelegationExpiryContract, getTokenAddressContract, getTokenPairContract, getTokenPairsContract, getTokenPairsLengthContract, getTokenPairsSliceContract, hardhat, hoodi, indexedDBStorage, inferredTotalSupplyContract, isConfidentialTokenContract, isConfidentialTokenValidContract, isConfidentialWrapperContract, isHandleDelegatedContract, isOperatorContract, isZeroHandle, loadPendingUnshield, loadPendingUnshieldRequest, mainnet, matchAclRevert, matchZamaError, memoryStorage, nameContract, rateContract, resolveChainRelayers, resolveStorage, revokeDelegationContract, savePendingUnshield, sepolia, setOperatorContract, supportsInterfaceContract, symbolContract, totalSupplyContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, web, wrapContract };
161
129
  //# sourceMappingURL=index.d.ts.map