@zama-fhe/sdk 3.4.0-alpha.8 → 3.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 (73) hide show
  1. package/dist/cjs/base-signer.cjs +1 -1
  2. package/dist/cjs/base-signer.cjs.map +1 -1
  3. package/dist/cjs/ethers/index.cjs +1 -1
  4. package/dist/cjs/ethers/index.cjs.map +1 -1
  5. package/dist/cjs/fhevm-relayer.cjs +1 -1
  6. package/dist/cjs/fhevm-relayer.cjs.map +1 -1
  7. package/dist/cjs/index.cjs +1 -1
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs/node/index.cjs.map +1 -1
  10. package/dist/cjs/query/index.cjs +1 -1
  11. package/dist/cjs/query/index.cjs.map +1 -1
  12. package/dist/cjs/relayer.cjs +1 -1
  13. package/dist/cjs/relayer.cjs.map +1 -1
  14. package/dist/cjs/sdk-events.cjs +2 -0
  15. package/dist/cjs/sdk-events.cjs.map +1 -0
  16. package/dist/cjs/token.cjs +1 -1
  17. package/dist/cjs/token.cjs.map +1 -1
  18. package/dist/cjs/viem/index.cjs +1 -1
  19. package/dist/cjs/viem/index.cjs.map +1 -1
  20. package/dist/esm/{base-signer-Ds8CoYy0.d.ts → base-signer-BvL-jMNO.d.ts} +15 -2
  21. package/dist/esm/base-signer-YpkEmlp2.js +2 -0
  22. package/dist/esm/base-signer-YpkEmlp2.js.map +1 -0
  23. package/dist/esm/chains/index.d.ts +1 -1
  24. package/dist/esm/cleartext/index.d.ts +2 -2
  25. package/dist/esm/cleartext/index.js +1 -1
  26. package/dist/esm/{cleartext-_RCZVPOe.d.ts → cleartext-CxlICeUh.d.ts} +2 -2
  27. package/dist/esm/{cleartext-DfX0GUj1.js → cleartext-Qqh5JohW.js} +2 -2
  28. package/dist/esm/{cleartext-DfX0GUj1.js.map → cleartext-Qqh5JohW.js.map} +1 -1
  29. package/dist/esm/ethers/index.d.ts +53 -5
  30. package/dist/esm/ethers/index.js +1 -1
  31. package/dist/esm/ethers/index.js.map +1 -1
  32. package/dist/esm/fhevm-relayer-4Zd4QkKq.js +2 -0
  33. package/dist/esm/fhevm-relayer-4Zd4QkKq.js.map +1 -0
  34. package/dist/esm/{index-C4Hn6K9c.d.ts → index-DLaQtvYu.d.ts} +213 -400
  35. package/dist/esm/index-DNofJMCK.d.ts +61 -0
  36. package/dist/esm/{index-doNE2KoX.d.ts → index-S6_V7aAH.d.ts} +10 -1
  37. package/dist/esm/index.d.ts +8 -8
  38. package/dist/esm/index.js +1 -1
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/node/index.d.ts +5 -5
  41. package/dist/esm/node/index.js +1 -1
  42. package/dist/esm/node/index.js.map +1 -1
  43. package/dist/esm/query/index.d.ts +143 -9
  44. package/dist/esm/query/index.js +1 -1
  45. package/dist/esm/query/index.js.map +1 -1
  46. package/dist/esm/relayer-BWHOLVcG.js +2 -0
  47. package/dist/esm/relayer-BWHOLVcG.js.map +1 -0
  48. package/dist/esm/sdk-events-D68bJ5jT.js +2 -0
  49. package/dist/esm/sdk-events-D68bJ5jT.js.map +1 -0
  50. package/dist/esm/token-Bn8I7xAu.js +2 -0
  51. package/dist/esm/token-Bn8I7xAu.js.map +1 -0
  52. package/dist/esm/{types-Tk8PiPCk.d.ts → types-BEz-VgR_.d.ts} +6 -3
  53. package/dist/esm/{types-CELdIAFG.d.ts → types-CWPSTRF6.d.ts} +98 -146
  54. package/dist/esm/{types-DlSUyFe2.d.ts → types-Dr7AmEs1.d.ts} +3 -3
  55. package/dist/esm/viem/index.d.ts +34 -5
  56. package/dist/esm/viem/index.js +1 -1
  57. package/dist/esm/viem/index.js.map +1 -1
  58. package/dist/esm/web/index.d.ts +2 -2
  59. package/dist/esm/web/index.js +1 -1
  60. package/package.json +3 -3
  61. package/dist/cjs/wrappers-registry.cjs +0 -2
  62. package/dist/cjs/wrappers-registry.cjs.map +0 -1
  63. package/dist/esm/base-signer-9CqICeQ8.js +0 -2
  64. package/dist/esm/base-signer-9CqICeQ8.js.map +0 -1
  65. package/dist/esm/fhevm-relayer-Bb_-KFJA.js +0 -2
  66. package/dist/esm/fhevm-relayer-Bb_-KFJA.js.map +0 -1
  67. package/dist/esm/index-9Cn2VKDw.d.ts +0 -329
  68. package/dist/esm/relayer-DLlyoabr.js +0 -2
  69. package/dist/esm/relayer-DLlyoabr.js.map +0 -1
  70. package/dist/esm/token-oxpZ2kAk.js +0 -2
  71. package/dist/esm/token-oxpZ2kAk.js.map +0 -1
  72. package/dist/esm/wrappers-registry-B1GuTt5t.js +0 -2
  73. package/dist/esm/wrappers-registry-B1GuTt5t.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { u as FheChain } from "./index-doNE2KoX.js";
2
- import { C as ChainRouter, Ft as TransactionResult, Gt as FhevmRelayerOptions, Ht as EncryptResult, It as ClearValue, Kt as FhevmRelayerSDK, Lt as DecryptPublicValuesResult, Q as ShieldOptions, R as TransactionOperation, Ut as EncryptedValue, Vt as EncryptParams, at as TransferCallbacks, c as GenericStorage, d as WalletAccount, et as TransferOptions, i as ZamaConfig, l as GenericProvider, n as RelayerConfig, nt as UnwrapResult, o as ZamaConfigGeneric, ot as UnshieldCallbacks, p as WalletAccountListener, q as ZamaSDKEventInput, rt as WrapOptions, s as GenericLogger, tt as UnshieldOptions, u as GenericSigner, x as WriteContractConfig } from "./types-CELdIAFG.js";
3
- import "./cleartext-_RCZVPOe.js";
4
- import "./types-DlSUyFe2.js";
5
- import "./base-signer-Ds8CoYy0.js";
6
- import "./types-Tk8PiPCk.js";
1
+ import { u as FheChain } from "./index-S6_V7aAH.js";
2
+ import { $ as UnshieldOptions, Bt as EncryptResult, Ft as DecryptPublicValuesResult, Nt as TransactionResult, Pt as ClearValue, Q as TransferOptions, Vt as EncryptedValue, Wt as FhevmRelayerOptions, X as ShieldOptions, c as GenericStorage, d as WalletAccount, et as UnwrapResult, i as ZamaConfig, it as UnshieldCallbacks, l as GenericProvider, o as ZamaConfigGeneric, qt as RelayerSDK, rt as TransferCallbacks, tt as WrapOptions, u as GenericSigner, zt as EncryptParams } from "./types-CWPSTRF6.js";
3
+ import "./cleartext-CxlICeUh.js";
4
+ import "./types-Dr7AmEs1.js";
5
+ import "./base-signer-BvL-jMNO.js";
6
+ import "./types-BEz-VgR_.js";
7
7
  import { Address, Address as Address$1, Hex, Hex as Hex$1 } from "viem";
8
8
  import { z } from "zod/mini";
9
9
  import { MutationFunctionContext, QueryKey, QueryObserverOptions, skipToken } from "@tanstack/query-core";
@@ -33,17 +33,6 @@ import { MutationFunctionContext, QueryKey, QueryObserverOptions, skipToken } fr
33
33
  */
34
34
  declare function createConfig<const TChains extends readonly [FheChain, ...FheChain[]]>(params: ZamaConfigGeneric<TChains>): ZamaConfig;
35
35
  //#endregion
36
- //#region src/config/resolve.d.ts
37
- declare function resolveStorage(storage?: GenericStorage | undefined, permitStorage?: GenericStorage | undefined): {
38
- storage: GenericStorage;
39
- permitStorage: GenericStorage;
40
- };
41
- interface ResolvedChainRelayer {
42
- chain: FheChain;
43
- relayerConfig: RelayerConfig;
44
- }
45
- declare function resolveChainRelayers(chains: readonly FheChain[], relayers: Readonly<Record<number, RelayerConfig>>): Map<number, ResolvedChainRelayer>;
46
- //#endregion
47
36
  //#region src/contracts/confidential-wrapper.d.ts
48
37
  /**
49
38
  * Returns the contract config to read an encrypted balance.
@@ -17089,19 +17078,25 @@ declare function isHandleDelegatedContract(aclAddress: Address, delegatorAddress
17089
17078
  };
17090
17079
  //#endregion
17091
17080
  //#region src/contracts/wrappers-registry.d.ts
17081
+ /** A registered plain-token / confidential-token pairing from the wrappers registry. */
17092
17082
  interface TokenWrapperPair {
17083
+ /** Address of the underlying public ERC-20 token. */
17093
17084
  readonly tokenAddress: Address;
17085
+ /** Address of the paired confidential (ERC-7984) token. */
17094
17086
  readonly confidentialTokenAddress: Address;
17087
+ /** Whether the pairing is currently valid (registered and not revoked). */
17095
17088
  readonly isValid: boolean;
17096
17089
  }
17097
17090
  /** Extended pair with on-chain metadata for both tokens. */
17098
17091
  interface TokenWrapperPairWithMetadata extends TokenWrapperPair {
17092
+ /** On-chain metadata of the underlying public ERC-20 token. */
17099
17093
  readonly underlying: {
17100
17094
  readonly name: string;
17101
17095
  readonly symbol: string;
17102
17096
  readonly decimals: number;
17103
17097
  readonly totalSupply: bigint;
17104
17098
  };
17099
+ /** On-chain metadata of the confidential token. */
17105
17100
  readonly confidential: {
17106
17101
  readonly name: string;
17107
17102
  readonly symbol: string;
@@ -17110,9 +17105,13 @@ interface TokenWrapperPairWithMetadata extends TokenWrapperPair {
17110
17105
  }
17111
17106
  /** Paginated result set modelled after standard API pagination. */
17112
17107
  interface PaginatedResult<T> {
17108
+ /** Items on the current page. */
17113
17109
  readonly items: readonly T[];
17110
+ /** Total number of items across all pages. */
17114
17111
  readonly total: number;
17112
+ /** One-based index of the current page. */
17115
17113
  readonly page: number;
17114
+ /** Maximum number of items per page. */
17116
17115
  readonly pageSize: number;
17117
17116
  }
17118
17117
  /**
@@ -18460,13 +18459,21 @@ declare function isConfidentialTokenValidContract(registry: Address, confidentia
18460
18459
  };
18461
18460
  //#endregion
18462
18461
  //#region src/query/factory-types.d.ts
18463
- type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
18464
- type QueryFactoryOptions<TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<RequiredBy<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey">, "queryFn" | "queryHash" | "queryKeyHashFn" | "throwOnError"> & {
18462
+ /**
18463
+ * TanStack Query options object returned by the SDK's `*QueryOptions` factories:
18464
+ * `QueryObserverOptions` with `queryKey` and `queryFn` required and the
18465
+ * cache-internal keys (`queryHash`, `queryKeyHashFn`, `throwOnError`) removed.
18466
+ */
18467
+ type QueryFactoryOptions<TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<Omit<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey"> & Required<Pick<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey">>, "queryFn" | "queryHash" | "queryKeyHashFn" | "throwOnError"> & {
18465
18468
  queryFn: Exclude<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>["queryFn"], typeof skipToken | undefined>;
18466
18469
  };
18470
+ /** TanStack Query mutation options object returned by the SDK's `*MutationOptions` factories. */
18467
18471
  interface MutationFactoryOptions<TMutationKey extends readonly unknown[], TVariables, TData, TOnMutateResult = unknown> {
18472
+ /** Cache key identifying the mutation. */
18468
18473
  mutationKey: TMutationKey;
18474
+ /** Runs the mutation for the given variables. */
18469
18475
  mutationFn: (variables: TVariables) => Promise<TData>;
18476
+ /** Optional callback invoked after the mutation succeeds. */
18470
18477
  onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => void;
18471
18478
  }
18472
18479
  //#endregion
@@ -18674,229 +18681,25 @@ declare const zamaQueryKeys: {
18674
18681
  };
18675
18682
  //#endregion
18676
18683
  //#region src/query/signer-query-context.d.ts
18684
+ /** Connected-wallet context threaded into query factories to scope cache keys and gate signer-dependent queries. */
18677
18685
  interface SignerQueryContext {
18686
+ /** Connected wallet account; queries that need a signer stay disabled until it is set. */
18678
18687
  walletAccount?: WalletAccount;
18679
18688
  }
18680
18689
  //#endregion
18681
18690
  //#region src/query/user-decrypt.d.ts
18691
+ /** A single encrypted value to decrypt, paired with the contract that owns it. */
18682
18692
  interface EncryptedInput {
18693
+ /** Encrypted handle to decrypt. */
18683
18694
  encryptedValue: EncryptedValue;
18695
+ /** Address of the contract the encrypted value belongs to. */
18684
18696
  contractAddress: Address;
18685
18697
  }
18686
18698
  /** Decrypted clear values keyed by encrypted handle. */
18687
18699
  type DecryptResult = Readonly<Record<EncryptedValue, ClearValue>>;
18700
+ /** Builds TanStack Query options for decrypting a batch of encrypted handles into their clear values. */
18688
18701
  declare function decryptValuesQueryOptions(sdk: ZamaSDK, encryptedInputs: EncryptedInput[], signerContext?: SignerQueryContext): QueryFactoryOptions<DecryptResult, Error, DecryptResult, ReturnType<typeof zamaQueryKeys.decryption.encryptedInputs>>;
18689
18702
  //#endregion
18690
- //#region src/schemas/primitives.d.ts
18691
- declare const checksummedTag: unique symbol;
18692
- /** An EVM address that has been put through `getAddress` (EIP-55 checksum form). */
18693
- type ChecksummedAddress = Address & {
18694
- readonly [checksummedTag]: true;
18695
- };
18696
- //#endregion
18697
- //#region src/credentials/schemas.d.ts
18698
- declare const StoredTransportKeyPairSchema: z.ZodMiniObject<{
18699
- publicKey: z.ZodMiniCustom<`0x${string}`, `0x${string}`>;
18700
- privateKey: z.ZodMiniCustom<`0x${string}`, `0x${string}`>;
18701
- createdAt: z.ZodMiniNumberFormat;
18702
- expiresAt: z.ZodMiniNumberFormat;
18703
- }, z.core.$strip>;
18704
- declare const PermissionSchema: z.ZodMiniObject<{
18705
- keypairPublicKey: z.ZodMiniCustom<`0x${string}`, `0x${string}`>;
18706
- contractAddresses: z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniCustom<`0x${string}`, `0x${string}`>, z.ZodMiniTransform<ChecksummedAddress, `0x${string}`>>>;
18707
- serializedPermit: z.ZodMiniObject<{
18708
- version: z.ZodMiniNumberFormat;
18709
- eip712: z.ZodMiniObject<{
18710
- domain: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
18711
- primaryType: z.ZodMiniOptional<z.ZodMiniString<string>>;
18712
- types: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniObject<{
18713
- name: z.ZodMiniString<string>;
18714
- type: z.ZodMiniString<string>;
18715
- }, z.core.$strip>>>;
18716
- message: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
18717
- }, z.core.$strip>;
18718
- signature: z.ZodMiniCustom<`0x${string}`, `0x${string}`>;
18719
- signerAddress: z.ZodMiniPipe<z.ZodMiniCustom<`0x${string}`, `0x${string}`>, z.ZodMiniTransform<ChecksummedAddress, `0x${string}`>>;
18720
- }, z.core.$strip>;
18721
- startTimestamp: z.ZodMiniNumberFormat;
18722
- durationDays: z.ZodMiniNumberFormat;
18723
- }, z.core.$strip>;
18724
- //#endregion
18725
- //#region src/credentials/types.d.ts
18726
- /**
18727
- * Serialized transport key pair — ML-KEM public + private key as hex, the shape
18728
- * we persist and hand to the decrypt path. Mirrors `@fhevm/sdk`'s
18729
- * `serializeTransportKeyPair` output; the private half is plaintext, so treat it
18730
- * as sensitive.
18731
- */
18732
- interface SerializedTransportKeyPair {
18733
- publicKey: Hex;
18734
- privateKey: Hex;
18735
- }
18736
- /** Persisted transport key pair entry with a bounded lifetime. */
18737
- type StoredTransportKeyPair = z.infer<typeof StoredTransportKeyPairSchema>;
18738
- /**
18739
- * A signed EIP-712 permit binding a signer (and optional delegator) to a set of
18740
- * contract addresses for a bounded time window. Wraps the serialized `@fhevm/sdk`
18741
- * permit ({@link SerializedPermit}) alongside the scope/coverage metadata the
18742
- * permission store indexes on.
18743
- */
18744
- type Permission = z.infer<typeof PermissionSchema>;
18745
- /**
18746
- * Credentials resolved for a decrypt operation: the transport key pair plus the
18747
- * permits covering the requested contracts. A live, in-memory bundle — not a
18748
- * storage record. {@link resolvePermit} extracts one {@link ResolvedPermit} from
18749
- * it per contract.
18750
- */
18751
- interface SerializedTransportKeyPairWithPermissions {
18752
- readonly keypair: SerializedTransportKeyPair;
18753
- readonly permissions: readonly Permission[];
18754
- }
18755
- //#endregion
18756
- //#region src/credentials/credential-service.d.ts
18757
- /** Configuration for {@link CredentialService}. TTLs are pre-validated by the caller. */
18758
- interface CredentialServiceConfig {
18759
- router: ChainRouter;
18760
- signer: GenericSigner;
18761
- /** Transport key pair lifetime in seconds. Pre-validated. */
18762
- transportKeyPairTTL: number;
18763
- /** Permit lifetime in days. Pre-validated. */
18764
- permitTTL: number;
18765
- /** Backing storage for transport key pairs (and permits if `permitStorage` is omitted). */
18766
- storage: GenericStorage;
18767
- /** Optional dedicated storage for permits; defaults to `storage`. */
18768
- permitStorage?: GenericStorage;
18769
- /** SDK-wide logger for credential-path diagnostics. */
18770
- logger: GenericLogger;
18771
- /**
18772
- * Opt-in shared-tenant scope (B2B2C/WaaS operators). When set, every signer
18773
- * configured with the same scope shares one transport key pair instead of one
18774
- * per signer address. Permits stay per-signer regardless — see
18775
- * {@link revokeTransportKeyPair} for the operator-level counterpart to
18776
- * signer-level revocation.
18777
- */
18778
- scope?: string;
18779
- }
18780
- /**
18781
- * Single facade coordinating the keypair vault and the permission store.
18782
- *
18783
- * `CredentialService` is the only credentials object held by `ZamaSDK`. It accepts identity
18784
- * transitions via `handleWalletAccountChange`.
18785
- *
18786
- * Two distinct revocation tiers exist and must not be conflated: {@link clearCredentials}
18787
- * (signer-level, e.g. an end-user "disconnect") only ever removes that signer's own
18788
- * key-pair slot and permits — when a scope is configured, the shared key pair was never
18789
- * stored there, so it's untouched. {@link revokeTransportKeyPair} (operator-level) is
18790
- * the only way to invalidate a scope's shared key pair, and it does so for every signer
18791
- * in the scope at once.
18792
- */
18793
- declare class CredentialService {
18794
- #private;
18795
- constructor(config: CredentialServiceConfig);
18796
- /**
18797
- * Resolve a keypair and permissions covering `contracts`, minimizing wallet
18798
- * prompts by reusing or widening existing permits where possible. Empty
18799
- * `contracts` warms the keypair without prompting.
18800
- *
18801
- * @returns The resolved keypair and permits covering the requested contracts.
18802
- * @throws if the user rejects a wallet signature prompt. {@link SigningRejectedError}
18803
- * @throws if signing fails for any other reason. {@link SigningFailedError}
18804
- */
18805
- grantPermit(contracts: readonly Address[], delegator?: Address): Promise<SerializedTransportKeyPairWithPermissions>;
18806
- /**
18807
- * Pure store lookup: are stored permits sufficient to cover `contracts`? No wallet prompt.
18808
- *
18809
- * @returns `true` if cached permits cover all requested contracts (vacuously
18810
- * true for an empty list); `false` if no keypair exists or coverage is
18811
- * incomplete.
18812
- */
18813
- hasPermit(contracts: readonly Address[], delegator?: Address): Promise<boolean>;
18814
- /**
18815
- * Wipe FHE permits for the current signer.
18816
- *
18817
- * - With no argument: every permit referencing this signer is removed across
18818
- * all chains and delegators. The keypair survives — use
18819
- * {@link clearCredentials} to also wipe the keypair.
18820
- * - With a contract list: every signed permit in the direct-decrypt scope
18821
- * (current chain) whose immutable payload touches any listed address is
18822
- * removed. Delegated permits are not touched in this mode.
18823
- *
18824
- * @throws if reading the signer address fails. {@link SigningFailedError}
18825
- */
18826
- revokePermits(contracts?: readonly Address[]): Promise<void>;
18827
- /**
18828
- * Wipe the keypair for the current signer and cascade-delete every
18829
- * permission referencing it across all chains and delegators.
18830
- *
18831
- * Signer-level only: when a scope is configured, the shared key pair was never
18832
- * stored under this signer's own slot, so it survives untouched — only this
18833
- * signer's permits are removed. Use {@link revokeTransportKeyPair} to invalidate
18834
- * the shared key pair itself.
18835
- *
18836
- * @throws if reading the signer address fails. {@link SigningFailedError}
18837
- */
18838
- clearCredentials(): Promise<void>;
18839
- /**
18840
- * Revoke this scope's shared transport key pair (operator-level action).
18841
- *
18842
- * Deletes the shared key pair. Every permit signed under it embeds the old
18843
- * public key, so `listUsableAndPrune` treats them all as stale on next access —
18844
- * no permit is touched directly, and no connected wallet is required. This is
18845
- * the only operation that can invalidate a shared key pair; signer-level
18846
- * {@link clearCredentials} never does.
18847
- *
18848
- * Not best-effort: unlike {@link clearCredentials}, a storage failure here rejects
18849
- * instead of being logged and swallowed — see {@link TransportKeyPairVault.clearScope}.
18850
- *
18851
- * Only stops the SDK from reissuing or reusing the deleted key going forward — does
18852
- * not revoke any permit already issued under it. A permit is a self-contained,
18853
- * bearer-style EIP-712 signature the relayer accepts independently of this SDK's
18854
- * storage; one already exfiltrated alongside the key remains usable until its own
18855
- * `permitTTL` expiry regardless of this call.
18856
- *
18857
- * @param scopeId - Must match the scope this service was configured with. Requiring
18858
- * the caller to name it guards against revoking the wrong scope by mistake.
18859
- * @throws if no scope is configured, or `scopeId` doesn't match it. {@link ConfigurationError}
18860
- * @throws if the underlying storage delete fails.
18861
- */
18862
- revokeTransportKeyPair(scopeId: string): Promise<void>;
18863
- /**
18864
- * Warm the signer transport key pair cache for a known address.
18865
- *
18866
- * Best-effort prefetch primitive: correctness still comes from `grantPermit`,
18867
- * which lazily creates the transport key pair when needed. Errors (storage failure,
18868
- * relayer 4xx, missing Worker in SSR) are **not** swallowed here — the caller
18869
- * decides whether to log, ignore, or surface them.
18870
- *
18871
- * Not for pre-warming a shared scope: `address` is ignored for storage keying once
18872
- * a scope is configured (see {@link TransportKeyPairVault}), so this call's actual
18873
- * effect wouldn't match its apparent per-signer intent. Use
18874
- * {@link warmTransportKeyPairScope} instead.
18875
- */
18876
- warmTransportKeyPair(address: Address): Promise<void>;
18877
- /**
18878
- * Warm this scope's shared transport key pair (operator-level, no wallet needed) —
18879
- * the pre-warm counterpart to {@link revokeTransportKeyPair}.
18880
- *
18881
- * @param scopeId - Must match the scope this service was configured with. Requiring
18882
- * the caller to name it guards against warming the wrong scope by mistake.
18883
- * @throws if no scope is configured, or `scopeId` doesn't match it. {@link ConfigurationError}
18884
- */
18885
- warmTransportKeyPairScope(scopeId: string): Promise<void>;
18886
- /**
18887
- * Apply a wallet account transition.
18888
- *
18889
- * Address change clears persisted credentials for the previous account.
18890
- * Chain-only changes keep credentials intact because permits are chain-scoped
18891
- * already and stale decrypt plaintext is cleared by `ZamaSDK`.
18892
- */
18893
- handleWalletAccountChange(prev?: {
18894
- address: Address;
18895
- }, next?: {
18896
- address: Address;
18897
- }): Promise<void>;
18898
- }
18899
- //#endregion
18900
18703
  //#region src/errors/base.d.ts
18901
18704
  /**
18902
18705
  * Typed error codes thrown by the SDK.
@@ -19057,8 +18860,11 @@ declare function retryAfterSeconds(error: unknown): number | undefined;
19057
18860
  * ```
19058
18861
  */
19059
18862
  declare class ChainMismatchError extends ZamaError {
18863
+ /** Name of the operation that triggered the check. */
19060
18864
  readonly operation: string;
18865
+ /** Chain ID the signer is connected to. */
19061
18866
  readonly signerChainId: number;
18867
+ /** Chain ID the provider is connected to. */
19062
18868
  readonly providerChainId: number;
19063
18869
  constructor({ operation, signerChainId, providerChainId }: {
19064
18870
  operation: string;
@@ -19158,8 +18964,11 @@ declare class DecryptionFailedError extends ZamaError {
19158
18964
  //#region src/errors/balance.d.ts
19159
18965
  /** Structured details shared by balance-related errors. */
19160
18966
  interface BalanceErrorDetails {
18967
+ /** Amount the caller requested, in the token's base units. */
19161
18968
  readonly requested: bigint;
18969
+ /** Amount available at the time of the check, in the token's base units. */
19162
18970
  readonly available: bigint;
18971
+ /** Address of the token contract involved. */
19163
18972
  readonly token: Address;
19164
18973
  }
19165
18974
  /** Confidential (cToken) balance is insufficient for the requested operation. */
@@ -19297,6 +19106,7 @@ declare class RpcRateLimitError extends ZamaError {
19297
19106
  * Base class for signer/account readiness failures.
19298
19107
  */
19299
19108
  declare class SignerRequiredError extends ZamaError {
19109
+ /** Name of the operation that required a signer. */
19300
19110
  readonly operation: string;
19301
19111
  constructor(code: ZamaErrorCode, operation: string, message: string, options?: ErrorOptions);
19302
19112
  }
@@ -19346,51 +19156,75 @@ declare class TransactionRevertedError extends ZamaError {
19346
19156
  }
19347
19157
  //#endregion
19348
19158
  //#region src/errors/match.d.ts
19349
- /**
19350
- * Identity type that fails to instantiate unless `T` maps every code to a `ZamaError`.
19351
- * Guards presence + value type only: a wrong-but-valid mapping (a code pointing at a
19352
- * structurally identical sibling class) still compiles — `errors.test-d.ts` backstops that.
19353
- */
19354
- type Complete<T extends Record<ZamaErrorCode, ZamaError>> = T;
19355
19159
  /**
19356
19160
  * Maps each {@link ZamaErrorCode} to the error class thrown with that code, so
19357
19161
  * {@link matchZamaError} handlers receive the matched subtype instead of the base
19358
- * `ZamaError`. Hand-maintained; the `Complete` wrapper fails the build if a code is
19359
- * added without an entry here (or mapped to a non-`ZamaError`).
19162
+ * `ZamaError`.
19360
19163
  */
19361
- type ErrorForCode = Complete<{
19164
+ interface ErrorForCode {
19165
+ /** Thrown for {@link ZamaErrorCode.SigningRejected}. */
19362
19166
  [ZamaErrorCode.SigningRejected]: SigningRejectedError;
19167
+ /** Thrown for {@link ZamaErrorCode.SigningFailed}. */
19363
19168
  [ZamaErrorCode.SigningFailed]: SigningFailedError;
19169
+ /** Thrown for {@link ZamaErrorCode.EncryptionFailed}. */
19364
19170
  [ZamaErrorCode.EncryptionFailed]: EncryptionFailedError;
19171
+ /** Thrown for {@link ZamaErrorCode.DecryptionFailed}. */
19365
19172
  [ZamaErrorCode.DecryptionFailed]: DecryptionFailedError;
19173
+ /** Thrown for {@link ZamaErrorCode.TransactionReverted}. */
19366
19174
  [ZamaErrorCode.TransactionReverted]: TransactionRevertedError;
19175
+ /** Thrown for {@link ZamaErrorCode.TransportKeyPairExpired}. */
19367
19176
  [ZamaErrorCode.TransportKeyPairExpired]: TransportKeyPairExpiredError;
19177
+ /** Thrown for {@link ZamaErrorCode.InvalidTransportKeyPair}. */
19368
19178
  [ZamaErrorCode.InvalidTransportKeyPair]: InvalidTransportKeyPairError;
19179
+ /** Thrown for {@link ZamaErrorCode.NoCiphertext}. */
19369
19180
  [ZamaErrorCode.NoCiphertext]: NoCiphertextError;
19181
+ /** Thrown for {@link ZamaErrorCode.RelayerRequestFailed}. */
19370
19182
  [ZamaErrorCode.RelayerRequestFailed]: RelayerRequestFailedError;
19183
+ /** Thrown for {@link ZamaErrorCode.NotEntitled}. */
19371
19184
  [ZamaErrorCode.NotEntitled]: NotEntitledError;
19185
+ /** Thrown for {@link ZamaErrorCode.RpcRateLimited}. */
19372
19186
  [ZamaErrorCode.RpcRateLimited]: RpcRateLimitError;
19187
+ /** Thrown for {@link ZamaErrorCode.Configuration}. */
19373
19188
  [ZamaErrorCode.Configuration]: ConfigurationError;
19189
+ /** Thrown for {@link ZamaErrorCode.DelegationSelfNotAllowed}. */
19374
19190
  [ZamaErrorCode.DelegationSelfNotAllowed]: DelegationSelfNotAllowedError;
19191
+ /** Thrown for {@link ZamaErrorCode.DelegationCooldown}. */
19375
19192
  [ZamaErrorCode.DelegationCooldown]: DelegationCooldownError;
19193
+ /** Thrown for {@link ZamaErrorCode.DelegationNotFound}. */
19376
19194
  [ZamaErrorCode.DelegationNotFound]: DelegationNotFoundError;
19195
+ /** Thrown for {@link ZamaErrorCode.DelegationExpired}. */
19377
19196
  [ZamaErrorCode.DelegationExpired]: DelegationExpiredError;
19197
+ /** Thrown for {@link ZamaErrorCode.InsufficientConfidentialBalance}. */
19378
19198
  [ZamaErrorCode.InsufficientConfidentialBalance]: InsufficientConfidentialBalanceError;
19199
+ /** Thrown for {@link ZamaErrorCode.InsufficientERC20Balance}. */
19379
19200
  [ZamaErrorCode.InsufficientERC20Balance]: InsufficientERC20BalanceError;
19201
+ /** Thrown for {@link ZamaErrorCode.InsufficientAllowance}. */
19380
19202
  [ZamaErrorCode.InsufficientAllowance]: InsufficientAllowanceError;
19203
+ /** Thrown for {@link ZamaErrorCode.BalanceCheckUnavailable}. */
19381
19204
  [ZamaErrorCode.BalanceCheckUnavailable]: BalanceCheckUnavailableError;
19205
+ /** Thrown for {@link ZamaErrorCode.ERC20ReadFailed}. */
19382
19206
  [ZamaErrorCode.ERC20ReadFailed]: ERC20ReadFailedError;
19207
+ /** Thrown for {@link ZamaErrorCode.DelegationExpiryUnchanged}. */
19383
19208
  [ZamaErrorCode.DelegationExpiryUnchanged]: DelegationExpiryUnchangedError;
19209
+ /** Thrown for {@link ZamaErrorCode.DelegationDelegateEqualsContract}. */
19384
19210
  [ZamaErrorCode.DelegationDelegateEqualsContract]: DelegationDelegateEqualsContractError;
19211
+ /** Thrown for {@link ZamaErrorCode.DelegationContractIsSelf}. */
19385
19212
  [ZamaErrorCode.DelegationContractIsSelf]: DelegationContractIsSelfError;
19213
+ /** Thrown for {@link ZamaErrorCode.AclPaused}. */
19386
19214
  [ZamaErrorCode.AclPaused]: AclPausedError;
19215
+ /** Thrown for {@link ZamaErrorCode.DelegationExpirationTooSoon}. */
19387
19216
  [ZamaErrorCode.DelegationExpirationTooSoon]: DelegationExpirationTooSoonError;
19217
+ /** Thrown for {@link ZamaErrorCode.DelegationNotPropagated}. */
19388
19218
  [ZamaErrorCode.DelegationNotPropagated]: DelegationNotPropagatedError;
19219
+ /** Thrown for {@link ZamaErrorCode.ChainMismatch}. */
19389
19220
  [ZamaErrorCode.ChainMismatch]: ChainMismatchError;
19221
+ /** Thrown for {@link ZamaErrorCode.SignerNotConfigured}. */
19390
19222
  [ZamaErrorCode.SignerNotConfigured]: SignerNotConfiguredError;
19223
+ /** Thrown for {@link ZamaErrorCode.WalletNotConnected}. */
19391
19224
  [ZamaErrorCode.WalletNotConnected]: WalletNotConnectedError;
19225
+ /** Thrown for {@link ZamaErrorCode.WalletAccountNotReady}. */
19392
19226
  [ZamaErrorCode.WalletAccountNotReady]: WalletAccountNotReadyError;
19393
- }>;
19227
+ }
19394
19228
  /**
19395
19229
  * Pattern-match on a {@link ZamaError} by its error code. Each handler receives the
19396
19230
  * error class for its code, so subclass fields are available without a cast.
@@ -19411,57 +19245,6 @@ declare function matchZamaError<R>(error: unknown, handlers: { [K in ZamaErrorCo
19411
19245
  _?: (error: unknown) => R;
19412
19246
  }): R | undefined;
19413
19247
  //#endregion
19414
- //#region src/services/caching-service.d.ts
19415
- /**
19416
- * Storage-backed cache for decrypted FHE plaintext values.
19417
- *
19418
- * Each entry is keyed by `(requester, contractAddress, handle)` so different
19419
- * signers cannot read each other's cached decryptions.
19420
- */
19421
- declare class CachingService {
19422
- #private;
19423
- constructor(storage: GenericStorage, logger: GenericLogger);
19424
- get(requester: Address, contractAddress: Address, encryptedValue: EncryptedValue): Promise<ClearValue | null>;
19425
- set(requester: Address, contractAddress: Address, encryptedValue: EncryptedValue, value: ClearValue): Promise<void>;
19426
- delete(requester: Address, contractAddress: Address, encryptedValue: EncryptedValue): Promise<void>;
19427
- clearForRequester(requester: Address): Promise<void>;
19428
- clearAll(): Promise<void>;
19429
- }
19430
- //#endregion
19431
- //#region src/services/delegation-service.d.ts
19432
- declare class DelegationService {
19433
- #private;
19434
- constructor({ provider, router, emitEvent, logger }: {
19435
- provider: GenericProvider;
19436
- router: ChainRouter;
19437
- logger: GenericLogger;
19438
- emitEvent?: (input: ZamaSDKEventInput, tokenAddress?: Address) => void;
19439
- });
19440
- delegateDecryption(signer: GenericSigner, { contractAddress, delegateAddress, delegatorAddress, expirationDate }: {
19441
- contractAddress: Address;
19442
- delegateAddress: Address;
19443
- delegatorAddress: Address;
19444
- expirationDate?: Date;
19445
- }): Promise<TransactionResult>;
19446
- revokeDelegation(signer: GenericSigner, { contractAddress, delegateAddress, delegatorAddress }: {
19447
- contractAddress: Address;
19448
- delegateAddress: Address;
19449
- delegatorAddress: Address;
19450
- }): Promise<TransactionResult>;
19451
- isDelegated(params: {
19452
- contractAddress: Address;
19453
- delegatorAddress: Address;
19454
- delegateAddress: Address;
19455
- }): Promise<boolean>;
19456
- getDelegationExpiry({ contractAddress, delegatorAddress, delegateAddress }: {
19457
- contractAddress: Address;
19458
- delegatorAddress: Address;
19459
- delegateAddress: Address;
19460
- }): Promise<bigint>;
19461
- findInactiveDelegations(contractAddresses: readonly Address[], delegatorAddress: Address, delegateAddress: Address): Promise<Map<Address, DelegationNotFoundError | DelegationExpiredError>>;
19462
- assertDelegationActive(contractAddress: Address, delegatorAddress: Address, delegateAddress: Address): Promise<void>;
19463
- }
19464
- //#endregion
19465
19248
  //#region src/services/decryption-service.d.ts
19466
19249
  /** Options shared by the delegated-decrypt entry points. */
19467
19250
  interface DelegatedDecryptOptions {
@@ -19473,35 +19256,22 @@ interface DelegatedDecryptOptions {
19473
19256
  */
19474
19257
  waitForPropagation?: boolean;
19475
19258
  }
19259
+ /** Per-handle outcome of a batch decrypt: the decrypted value, or a per-item error. */
19476
19260
  interface BatchDecryptItem {
19261
+ /** The encrypted value (handle) being decrypted. */
19477
19262
  encryptedValue: EncryptedValue;
19263
+ /** Address of the contract the handle belongs to. */
19478
19264
  contractAddress: Address;
19265
+ /** Decrypted clear value; set when this item succeeded. */
19479
19266
  value?: ClearValue;
19267
+ /** Error for this item; set when this item failed. */
19480
19268
  error?: ZamaError;
19481
19269
  }
19270
+ /** Result of a batch decrypt: one entry per requested handle, in input order. */
19482
19271
  interface BatchDecryptResult {
19272
+ /** Per-handle outcomes. */
19483
19273
  items: BatchDecryptItem[];
19484
19274
  }
19485
- declare class DecryptionService {
19486
- #private;
19487
- constructor({ cache, credentialService, delegationService, router, emitEvent }: {
19488
- cache: CachingService;
19489
- credentialService: CredentialService;
19490
- delegationService: DelegationService;
19491
- router: ChainRouter;
19492
- emitEvent: (input: ZamaSDKEventInput) => void;
19493
- });
19494
- decryptValues(handles: EncryptedInput[], signerAddress: Address, opts?: Pick<FhevmRelayerOptions, "signal" | "timeout">): Promise<Record<EncryptedValue, ClearValue>>;
19495
- delegatedDecryptValues(encryptedInputs: EncryptedInput[], delegatorAddress: Address, delegateAddress: Address, accountAddress: Address, opts?: DelegatedDecryptOptions): Promise<Record<EncryptedValue, ClearValue>>;
19496
- delegatedBatchDecryptHandlesAs({ encryptedInputs, delegatorAddress, delegateAddress, accountAddress, maxConcurrency, waitForPropagation }: {
19497
- encryptedInputs: EncryptedInput[];
19498
- delegatorAddress: Address;
19499
- delegateAddress: Address;
19500
- accountAddress: Address;
19501
- maxConcurrency?: number;
19502
- waitForPropagation?: boolean;
19503
- }): Promise<BatchDecryptResult>;
19504
- }
19505
19275
  //#endregion
19506
19276
  //#region src/namespaces/decryption.d.ts
19507
19277
  /**
@@ -19529,13 +19299,6 @@ declare class DecryptionService {
19529
19299
  */
19530
19300
  declare class Decryption {
19531
19301
  #private;
19532
- /** @internal */
19533
- constructor(opts: {
19534
- signer: GenericSigner | undefined;
19535
- provider: GenericProvider;
19536
- router: ChainRouter;
19537
- decryptionService: DecryptionService | undefined;
19538
- });
19539
19302
  /**
19540
19303
  * Decrypt one or more FHE encrypted values. Results are cached — repeated calls
19541
19304
  * for the same encrypted value skip the relayer round-trip.
@@ -19647,6 +19410,15 @@ declare class Decryption {
19647
19410
  } & DelegatedDecryptOptions): Promise<BatchDecryptResult>;
19648
19411
  }
19649
19412
  //#endregion
19413
+ //#region src/services/delegation-service.d.ts
19414
+ /** Delegation activity and expiry, resolved from a single expiry read. */
19415
+ interface DelegationStatus {
19416
+ /** Whether the delegation is currently active (exists and not expired). */
19417
+ isActive: boolean;
19418
+ /** Unix timestamp (seconds) when the delegation expires; `0n` if none exists. */
19419
+ expiryTimestamp: bigint;
19420
+ }
19421
+ //#endregion
19650
19422
  //#region src/namespaces/delegations.d.ts
19651
19423
  /**
19652
19424
  * Public namespace for on-chain decryption-delegation management.
@@ -19662,12 +19434,6 @@ declare class Decryption {
19662
19434
  */
19663
19435
  declare class Delegations {
19664
19436
  #private;
19665
- /** @internal */
19666
- constructor(opts: {
19667
- signer: GenericSigner | undefined;
19668
- provider: GenericProvider;
19669
- delegationService: DelegationService;
19670
- });
19671
19437
  /**
19672
19438
  * Delegate decryption rights for a confidential contract to another address.
19673
19439
  * Calls `ACL.delegateForUserDecryption()` on-chain.
@@ -19741,6 +19507,22 @@ declare class Delegations {
19741
19507
  delegatorAddress: Address;
19742
19508
  delegateAddress: Address;
19743
19509
  }): Promise<bigint>;
19510
+ /**
19511
+ * Get activity and expiry together in a single on-chain read, instead of
19512
+ * calling {@link isActive} and {@link getExpiry} separately.
19513
+ *
19514
+ * Signer-independent: works without a configured signer.
19515
+ *
19516
+ * @param contractAddress - The confidential contract address.
19517
+ * @param delegatorAddress - The address that granted the delegation.
19518
+ * @param delegateAddress - The address that received delegation rights.
19519
+ * @returns `{ isActive, expiryTimestamp }` — activity and the raw expiry timestamp together.
19520
+ */
19521
+ getStatus(params: {
19522
+ contractAddress: Address;
19523
+ delegatorAddress: Address;
19524
+ delegateAddress: Address;
19525
+ }): Promise<DelegationStatus>;
19744
19526
  }
19745
19527
  //#endregion
19746
19528
  //#region src/namespaces/permits.d.ts
@@ -19764,14 +19546,6 @@ declare class Delegations {
19764
19546
  */
19765
19547
  declare class Permits {
19766
19548
  #private;
19767
- /** @internal */
19768
- constructor(opts: {
19769
- signer: GenericSigner | undefined;
19770
- provider: GenericProvider;
19771
- cachingService: CachingService;
19772
- credentialService: CredentialService | undefined;
19773
- logger: GenericLogger;
19774
- });
19775
19549
  /**
19776
19550
  * Sign and store an EIP-712 permit authorising direct decryption for the
19777
19551
  * given contract addresses.
@@ -19930,7 +19704,9 @@ interface BatchBalancesResult {
19930
19704
  */
19931
19705
  declare class Token {
19932
19706
  #private;
19707
+ /** The SDK instance this token operates through. */
19933
19708
  readonly sdk: ZamaSDK;
19709
+ /** Checksummed address of the confidential token contract. */
19934
19710
  readonly address: Address;
19935
19711
  constructor(sdk: ZamaSDK, address: Address);
19936
19712
  /** Read the token name from the contract. */
@@ -20175,39 +19951,6 @@ declare class Token {
20175
19951
  * ```
20176
19952
  */
20177
19953
  isOperator(holder: Address, spender: Address): Promise<boolean>;
20178
- /**
20179
- * Read the on-chain encrypted balance for a given owner.
20180
- *
20181
- * @internal
20182
- */
20183
- protected readConfidentialBalanceOf(owner: Address): Promise<EncryptedValue>;
20184
- /**
20185
- * Pre-flight check: decrypt the confidential balance and compare against the
20186
- * requested amount. If credentials are cached the decrypt happens silently;
20187
- * if not, throws {@link BalanceCheckUnavailableError} instead of triggering
20188
- * a surprise EIP-712 popup.
20189
- *
20190
- * @internal
20191
- */
20192
- protected assertConfidentialBalance(amount: bigint): Promise<void>;
20193
- /**
20194
- * Emit a token-scoped event through the owning {@link ZamaSDK} so that
20195
- * subscribers see a unified stream.
20196
- *
20197
- * @internal
20198
- */
20199
- protected emit(input: ZamaSDKEventInput): void;
20200
- /**
20201
- * Submit a token-scoped write transaction through the shared SDK transaction
20202
- * pipeline. Callers keep pre-flight and operation-specific work local.
20203
- *
20204
- * @internal
20205
- */
20206
- protected submitTransaction(params: {
20207
- operation: TransactionOperation;
20208
- config: WriteContractConfig;
20209
- onSubmitted?: (txHash: Hex) => void;
20210
- }): Promise<TransactionResult>;
20211
19954
  /** Verify all tokens share the same SDK instance and return it. */
20212
19955
  private static assertSameSdk;
20213
19956
  }
@@ -20430,6 +20173,84 @@ declare class WrappedToken extends Token {
20430
20173
  finalizeUnwrap(unwrapRequestId: EncryptedValue): Promise<TransactionResult>;
20431
20174
  }
20432
20175
  //#endregion
20176
+ //#region src/schemas/primitives.d.ts
20177
+ declare const checksummedTag: unique symbol;
20178
+ /** An EVM address that has been put through `getAddress` (EIP-55 checksum form). */
20179
+ type ChecksummedAddress = Address & {
20180
+ readonly [checksummedTag]: true;
20181
+ };
20182
+ //#endregion
20183
+ //#region src/credentials/types.d.ts
20184
+ /**
20185
+ * Serialized transport key pair — ML-KEM public + private key as hex, the shape
20186
+ * we persist and hand to the decrypt path. Mirrors `@fhevm/sdk`'s
20187
+ * `serializeTransportKeyPair` output; the private half is plaintext, so treat it
20188
+ * as sensitive.
20189
+ */
20190
+ interface SerializedTransportKeyPair {
20191
+ /** ML-KEM public key, hex-encoded. */
20192
+ publicKey: Hex;
20193
+ /** ML-KEM private key, hex-encoded (plaintext — treat as sensitive). */
20194
+ privateKey: Hex;
20195
+ /**
20196
+ * The TKMS version the key pair was generated under, passed back to
20197
+ * `parseTransportKeyPair` so the private key deserializes under the right
20198
+ * version after a KMS/TKMS rotation. Optional — key pairs serialized before
20199
+ * this tag existed carry none.
20200
+ */
20201
+ tkmsVersion?: string;
20202
+ }
20203
+ /** EIP-712 typed-data payload carried by a {@link SerializedPermit}. */
20204
+ interface SerializedPermitEip712 {
20205
+ /** EIP-712 domain separator fields. */
20206
+ domain: Record<string, unknown>;
20207
+ /** Name of the primary type being signed. */
20208
+ primaryType?: string;
20209
+ /** EIP-712 type definitions keyed by type name. */
20210
+ types: Record<string, {
20211
+ name: string;
20212
+ type: string;
20213
+ }[]>;
20214
+ /** The typed-data message being signed. */
20215
+ message: Record<string, unknown>;
20216
+ }
20217
+ /**
20218
+ * The reusable serialized `@fhevm/sdk` decryption permit persisted inside a
20219
+ * {@link Permission} — passed verbatim to `parseSignedDecryptionPermit`.
20220
+ *
20221
+ * Mirrors {@link SerializedPermitSchema}; kept in sync by a `.test-d.ts` guard.
20222
+ */
20223
+ interface SerializedPermit {
20224
+ /** Serialization format version. */
20225
+ version: number;
20226
+ /** The EIP-712 typed data that was signed. */
20227
+ eip712: SerializedPermitEip712;
20228
+ /** The signer's EIP-712 signature, hex-encoded. */
20229
+ signature: Hex;
20230
+ /** Address that produced the signature. */
20231
+ signerAddress: ChecksummedAddress;
20232
+ }
20233
+ /**
20234
+ * A signed EIP-712 permit binding a signer (and optional delegator) to a set of
20235
+ * contract addresses for a bounded time window. Wraps the serialized `@fhevm/sdk`
20236
+ * permit ({@link SerializedPermit}) alongside the scope/coverage metadata the
20237
+ * permission store indexes on.
20238
+ *
20239
+ * Mirrors {@link PermissionSchema}; kept in sync by a `.test-d.ts` guard.
20240
+ */
20241
+ interface Permission {
20242
+ /** Public key of the transport key pair this permit is bound to, hex-encoded. */
20243
+ keypairPublicKey: Hex;
20244
+ /** Contract addresses this permit grants decrypt access to. */
20245
+ contractAddresses: ChecksummedAddress[];
20246
+ /** The signed serialized permit. */
20247
+ serializedPermit: SerializedPermit;
20248
+ /** Unix timestamp (seconds) when the permit becomes valid. */
20249
+ startTimestamp: number;
20250
+ /** Validity window length in days from {@link Permission.startTimestamp}. */
20251
+ durationDays: number;
20252
+ }
20253
+ //#endregion
20433
20254
  //#region src/wrappers-registry.d.ts
20434
20255
  /**
20435
20256
  * Default wrappers registry addresses for known chains.
@@ -20501,6 +20322,7 @@ interface ListPairsOptions {
20501
20322
  */
20502
20323
  declare class WrappersRegistry {
20503
20324
  #private;
20325
+ /** Read-only chain access used for registry contract reads. */
20504
20326
  readonly provider: GenericProvider;
20505
20327
  constructor(config: WrappersRegistryConfig);
20506
20328
  /**
@@ -20550,6 +20372,7 @@ declare class WrappersRegistry {
20550
20372
  listPairs(options: ListPairsOptions & {
20551
20373
  metadata: true;
20552
20374
  }): Promise<PaginatedResult<TokenWrapperPairWithMetadata>>;
20375
+ /** Lists registered underlying/confidential token pairs; pass `{ metadata: true }` to include on-chain token metadata. */
20553
20376
  listPairs(options?: ListPairsOptions): Promise<PaginatedResult<TokenWrapperPair>>;
20554
20377
  /**
20555
20378
  * Look up the confidential token for a given plain ERC-20 address.
@@ -20655,8 +20478,11 @@ declare class WrappersRegistry {
20655
20478
  */
20656
20479
  declare class ZamaSDK {
20657
20480
  #private;
20481
+ /** Read-only chain access used for all contract reads. */
20658
20482
  readonly provider: GenericProvider;
20483
+ /** Wallet signer used for write operations, or `undefined` when the SDK is read-only. */
20659
20484
  readonly signer: GenericSigner | undefined;
20485
+ /** Storage for cached permits and transport key pairs. */
20660
20486
  readonly storage: GenericStorage;
20661
20487
  /**
20662
20488
  * A {@link WrappersRegistry} instance auto-configured for the current chain.
@@ -20670,43 +20496,10 @@ declare class ZamaSDK {
20670
20496
  /** FHE decryption (user, delegated user, public). */
20671
20497
  readonly decryption: Decryption;
20672
20498
  constructor(config: ZamaConfig);
20673
- /**
20674
- * Subscribe to wallet account transitions.
20675
- *
20676
- * @param listener - Called on each transition with a {@link WalletAccountChange} carrying
20677
- * `previous` and `next` wallet account snapshots; either may be `undefined` for
20678
- * connect and disconnect transitions.
20679
- * @returns An unsubscribe function; calling it removes the listener.
20680
- *
20681
- * @internal
20682
- */
20683
- onWalletAccountChange(listener: WalletAccountListener): () => void;
20684
- /**
20685
- * The SDK-wide logger, exposed so contract abstractions ({@link Token},
20686
- * {@link WrappedToken}) can route their best-effort failures through the
20687
- * same sink. Silent by default.
20688
- *
20689
- * @internal
20690
- */
20691
- get logger(): GenericLogger;
20692
20499
  /**
20693
20500
  * The single-chain relayer backend for the **currently active** chain.
20694
- *
20695
- * @internal
20696
- */
20697
- get relayer(): FhevmRelayerSDK;
20698
- /**
20699
- * Emit a structured SDK event into the unified SDK event stream.
20700
- *
20701
- * Listener exceptions are caught and logged so that a misbehaving subscriber
20702
- * can never corrupt SDK operations.
20703
- *
20704
- * Application code should subscribe via the `onEvent` config option, never
20705
- * call this directly.
20706
- *
20707
- * @internal
20708
20501
  */
20709
- emitEvent(input: ZamaSDKEventInput, tokenAddress?: Address): void;
20502
+ get relayer(): RelayerSDK;
20710
20503
  /**
20711
20504
  * Create a {@link WrappersRegistry} instance bound to this SDK's provider.
20712
20505
  * Inherits the registry addresses derived from the SDK's chain configs, so
@@ -20803,6 +20596,7 @@ declare class ZamaSDK {
20803
20596
  }
20804
20597
  //#endregion
20805
20598
  //#region src/utils/handles.d.ts
20599
+ /** All-zero encrypted-value sentinel — a 32-byte zero handle representing the cleartext value `0`. */
20806
20600
  declare const ZERO_ENCRYPTED_VALUE: "0x0000000000000000000000000000000000000000000000000000000000000000";
20807
20601
  /**
20808
20602
  * Check whether an encrypted value represents the zero value.
@@ -20813,8 +20607,14 @@ declare function isEncryptedValueZero(encryptedValue: string): boolean;
20813
20607
  /** In-memory credential store. Credentials are lost on page reload. */
20814
20608
  declare class MemoryStorage implements GenericStorage {
20815
20609
  #private;
20610
+ /**
20611
+ * Retrieve a value by key.
20612
+ * @returns The stored value, or `null` if the key does not exist.
20613
+ */
20816
20614
  get<T = unknown>(key: string): Promise<T | null>;
20615
+ /** Store a value under the given key, overwriting any existing entry. */
20817
20616
  set<T = unknown>(key: string, value: T): Promise<void>;
20617
+ /** Remove the entry for the given key (no-op if absent). */
20818
20618
  delete(key: string): Promise<void>;
20819
20619
  }
20820
20620
  /** Default singleton for application-wide use. */
@@ -20831,9 +20631,16 @@ declare const memoryStorage: MemoryStorage;
20831
20631
  declare class IndexedDBStorage implements GenericStorage {
20832
20632
  #private;
20833
20633
  constructor(dbName?: string, dbVersion?: number, storeName?: string);
20634
+ /**
20635
+ * Retrieve a value by key.
20636
+ * @returns The stored value, or `null` if the key does not exist.
20637
+ */
20834
20638
  get<T = unknown>(key: string): Promise<T | null>;
20639
+ /** Store a value under the given key, overwriting any existing entry. */
20835
20640
  set<T = unknown>(key: string, value: T): Promise<void>;
20641
+ /** Remove the entry for the given key (no-op if absent). */
20836
20642
  delete(key: string): Promise<void>;
20643
+ /** Remove all stored entries. */
20837
20644
  clear(): Promise<void>;
20838
20645
  }
20839
20646
  /** Default singleton for application-wide use. */
@@ -20864,12 +20671,18 @@ declare const indexedDBStorage: IndexedDBStorage;
20864
20671
  * ```
20865
20672
  */
20866
20673
  declare class ChromeSessionStorage implements GenericStorage {
20674
+ /**
20675
+ * Retrieve a value by key.
20676
+ * @returns The stored value, or `null` if the key does not exist.
20677
+ */
20867
20678
  get<T = unknown>(key: string): Promise<T | null>;
20679
+ /** Store a value under the given key, overwriting any existing entry. */
20868
20680
  set(key: string, value: unknown): Promise<void>;
20681
+ /** Remove the entry for the given key (no-op if absent). */
20869
20682
  delete(key: string): Promise<void>;
20870
20683
  }
20871
20684
  /** Default singleton for application-wide use. */
20872
20685
  declare const chromeSessionStorage: ChromeSessionStorage;
20873
20686
  //#endregion
20874
- export { DelegationNotFoundError as $, isOperatorContract as $t, SignerNotConfiguredError as A, delegateForUserDecryptionContract as At, ERC20ReadFailedError as B, supportsInterfaceContract as Bt, BatchDecryptItem as C, getConfidentialTokenAddressContract as Ct, TransactionRevertedError as D, getTokenPairsLengthContract as Dt, matchZamaError as E, getTokenPairsContract as Et, NotEntitledError as F, ERC1363_INTERFACE_ID as Ft, EncryptionFailedError as G, nameContract as Gt, InsufficientConfidentialBalanceError as H, approveContract as Ht, ConfigurationError as I, ERC7984_INTERFACE_ID as It, DelegationCooldownError as J, confidentialTotalSupplyContract as Jt, AclPausedError as K, symbolContract as Kt, RelayerRequestFailedError as L, ERC7984_WRAPPER_INTERFACE_ID as Lt, WalletAccountNotReadyError as M, isHandleDelegatedContract as Mt, WalletNotConnectedError as N, revokeDelegationContract as Nt, SigningFailedError as O, getTokenPairsSliceContract as Ot, RpcRateLimitError as P, transferAndCallContract as Pt, DelegationExpiryUnchangedError as Q, inferredTotalSupplyContract as Qt, BalanceCheckUnavailableError as R, isConfidentialTokenContract as Rt, Decryption as S, TokenWrapperPairWithMetadata as St, DelegatedDecryptOptions as T, getTokenPairContract as Tt, InsufficientERC20BalanceError as U, balanceOfContract as Ut, InsufficientAllowanceError as V, allowanceContract as Vt, DecryptionFailedError as W, decimalsContract as Wt, DelegationExpirationTooSoonError as X, confidentialTransferFromContract as Xt, DelegationDelegateEqualsContractError as Y, confidentialTransferContract as Yt, DelegationExpiredError as Z, finalizeUnwrapContract as Zt, BatchBalancesResult as _, zamaQueryKeys as _t, IndexedDBStorage as a, wrapContract as an, ChainMismatchError as at, Permits as b, PaginatedResult as bt, memoryStorage as c, resolveStorage as cn, isRetryable as ct, ZamaSDK as d, SerializedTransportKeyPair as dt, rateContract as en, DelegationNotPropagatedError as et, DefaultRegistryAddresses as f, StoredTransportKeyPair as ft, WrappedToken as g, SignerQueryContext as gt, WrappersRegistryConfig as h, decryptValuesQueryOptions as ht, chromeSessionStorage as i, unwrapFromBalanceContract as in, TransportKeyPairExpiredError as it, SignerRequiredError as j, getDelegationExpiryContract as jt, SigningRejectedError as k, isConfidentialTokenValidContract as kt, ZERO_ENCRYPTED_VALUE as l, createConfig as ln, retryAfterSeconds as lt, WrappersRegistry as m, EncryptedInput as mt, Hex$1 as n, underlyingContract as nn, InvalidTransportKeyPairError as nt, indexedDBStorage as o, ResolvedChainRelayer as on, ZamaError as ot, ListPairsOptions as p, DecryptResult as pt, DelegationContractIsSelfError as q, confidentialBalanceOfContract as qt, ChromeSessionStorage as r, unwrapContract as rn, NoCiphertextError as rt, MemoryStorage as s, resolveChainRelayers as sn, ZamaErrorCode as st, Address$1 as t, setOperatorContract as tn, DelegationSelfNotAllowedError as tt, isEncryptedValueZero as u, Permission as ut, BatchDecryptAsOptions as v, MutationFactoryOptions as vt, BatchDecryptResult as w, getTokenAddressContract as wt, Delegations as x, TokenWrapperPair as xt, Token as y, QueryFactoryOptions as yt, BalanceErrorDetails as z, isConfidentialWrapperContract as zt };
20875
- //# sourceMappingURL=index-C4Hn6K9c.d.ts.map
20687
+ export { AclPausedError as $, confidentialTransferContract as $t, BatchDecryptResult as A, getTokenPairsContract as At, WalletNotConnectedError as B, ERC7984_INTERFACE_ID as Bt, BatchDecryptAsOptions as C, QueryFactoryOptions as Ct, DelegationStatus as D, getConfidentialTokenAddressContract as Dt, Delegations as E, TokenWrapperPairWithMetadata as Et, SigningFailedError as F, getDelegationExpiryContract as Ft, BalanceCheckUnavailableError as G, allowanceContract as Gt, NotEntitledError as H, isConfidentialTokenContract as Ht, SigningRejectedError as I, isHandleDelegatedContract as It, InsufficientAllowanceError as J, decimalsContract as Jt, BalanceErrorDetails as K, approveContract as Kt, SignerNotConfiguredError as L, revokeDelegationContract as Lt, ErrorForCode as M, getTokenPairsSliceContract as Mt, matchZamaError as N, isConfidentialTokenValidContract as Nt, Decryption as O, getTokenAddressContract as Ot, TransactionRevertedError as P, delegateForUserDecryptionContract as Pt, EncryptionFailedError as Q, confidentialTotalSupplyContract as Qt, SignerRequiredError as R, transferAndCallContract as Rt, BatchBalancesResult as S, MutationFactoryOptions as St, Permits as T, TokenWrapperPair as Tt, ConfigurationError as U, isConfidentialWrapperContract as Ut, RpcRateLimitError as V, ERC7984_WRAPPER_INTERFACE_ID as Vt, RelayerRequestFailedError as W, supportsInterfaceContract as Wt, InsufficientERC20BalanceError as X, symbolContract as Xt, InsufficientConfidentialBalanceError as Y, nameContract as Yt, DecryptionFailedError as Z, confidentialBalanceOfContract as Zt, SerializedPermit as _, DecryptResult as _t, IndexedDBStorage as a, setOperatorContract as an, DelegationExpiryUnchangedError as at, ChecksummedAddress as b, SignerQueryContext as bt, memoryStorage as c, unwrapFromBalanceContract as cn, DelegationSelfNotAllowedError as ct, ZamaSDK as d, TransportKeyPairExpiredError as dt, confidentialTransferFromContract as en, DelegationContractIsSelfError as et, DefaultRegistryAddresses as f, ChainMismatchError as ft, Permission as g, retryAfterSeconds as gt, WrappersRegistryConfig as h, isRetryable as ht, chromeSessionStorage as i, rateContract as in, DelegationExpiredError as it, DelegatedDecryptOptions as j, getTokenPairsLengthContract as jt, BatchDecryptItem as k, getTokenPairContract as kt, ZERO_ENCRYPTED_VALUE as l, wrapContract as ln, InvalidTransportKeyPairError as lt, WrappersRegistry as m, ZamaErrorCode as mt, Hex$1 as n, inferredTotalSupplyContract as nn, DelegationDelegateEqualsContractError as nt, indexedDBStorage as o, underlyingContract as on, DelegationNotFoundError as ot, ListPairsOptions as p, ZamaError as pt, ERC20ReadFailedError as q, balanceOfContract as qt, ChromeSessionStorage as r, isOperatorContract as rn, DelegationExpirationTooSoonError as rt, MemoryStorage as s, unwrapContract as sn, DelegationNotPropagatedError as st, Address$1 as t, finalizeUnwrapContract as tn, DelegationCooldownError as tt, isEncryptedValueZero as u, createConfig as un, NoCiphertextError as ut, SerializedPermitEip712 as v, EncryptedInput as vt, Token as w, PaginatedResult as wt, WrappedToken as x, zamaQueryKeys as xt, SerializedTransportKeyPair as y, decryptValuesQueryOptions as yt, WalletAccountNotReadyError as z, ERC1363_INTERFACE_ID as zt };
20688
+ //# sourceMappingURL=index-DLaQtvYu.d.ts.map