@zama-fhe/sdk 3.5.0-alpha.8 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/chains/index.cjs +1 -1
- package/dist/cjs/chains.cjs +1 -1
- package/dist/cjs/chains.cjs.map +1 -1
- package/dist/cjs/fhevm-relayer.cjs +1 -1
- package/dist/cjs/fhevm-relayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/sdk-events.cjs +1 -1
- package/dist/cjs/sdk-events.cjs.map +1 -1
- package/dist/cjs/token.cjs +1 -1
- package/dist/cjs/token.cjs.map +1 -1
- package/dist/esm/{base-signer-CMcmGqJV.d.ts → base-signer-DttMQOKx.d.ts} +2 -2
- package/dist/esm/base-signer-GatxEuGN.js +2 -0
- package/dist/esm/base-signer-GatxEuGN.js.map +1 -0
- package/dist/esm/chains/index.d.ts +2 -2
- package/dist/esm/chains/index.js +1 -1
- package/dist/esm/chains-ByyCdrrd.js +2 -0
- package/dist/esm/chains-ByyCdrrd.js.map +1 -0
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-BWibWaD8.js → cleartext-BwzD7uJa.js} +2 -2
- package/dist/esm/{cleartext-BWibWaD8.js.map → cleartext-BwzD7uJa.js.map} +1 -1
- package/dist/esm/{cleartext-BEXEaFxR.d.ts → cleartext-Di1DDxqa.d.ts} +2 -2
- package/dist/esm/ethers/index.d.ts +4 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/fhevm-relayer-CTwFyl0v.js +2 -0
- package/dist/esm/{fhevm-relayer-BTab4pc9.js.map → fhevm-relayer-CTwFyl0v.js.map} +1 -1
- package/dist/esm/{index-DE92igPK.d.ts → index-C4xKY5Fw.d.ts} +4 -4
- package/dist/esm/{index-CLhOMZFu.d.ts → index-COrLsVKC.d.ts} +159 -10
- package/dist/esm/{index-B0XC8EfF.d.ts → index-ijgDL4IC.d.ts} +18 -3
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +5 -5
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +20 -5
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/relayer-DC1OKWzW.js +2 -0
- package/dist/esm/relayer-DC1OKWzW.js.map +1 -0
- package/dist/esm/sdk-events-B1sUunjZ.js +2 -0
- package/dist/esm/sdk-events-B1sUunjZ.js.map +1 -0
- package/dist/esm/token-DOYtYc7P.js +2 -0
- package/dist/esm/token-DOYtYc7P.js.map +1 -0
- package/dist/esm/{types-CViUZmxp.d.ts → types-BSRyQBTx.d.ts} +3 -3
- package/dist/esm/{types-CDEEf-TG.d.ts → types-BxJzdNur.d.ts} +3 -3
- package/dist/esm/{types-GctypAZx.d.ts → types-CuDiV0Wy.d.ts} +15 -2
- package/dist/esm/viem/index.d.ts +4 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/web/index.d.ts +1 -1
- package/dist/esm/web/index.js +1 -1
- package/package.json +2 -2
- package/dist/esm/base-signer-h-9UxLXW.js +0 -2
- package/dist/esm/base-signer-h-9UxLXW.js.map +0 -1
- package/dist/esm/chains-DkH7vYTf.js +0 -2
- package/dist/esm/chains-DkH7vYTf.js.map +0 -1
- package/dist/esm/fhevm-relayer-BTab4pc9.js +0 -2
- package/dist/esm/relayer-RDPkM3cB.js +0 -2
- package/dist/esm/relayer-RDPkM3cB.js.map +0 -1
- package/dist/esm/sdk-events-lFxSy5Zf.js +0 -2
- package/dist/esm/sdk-events-lFxSy5Zf.js.map +0 -1
- package/dist/esm/token-B0hgYraH.js +0 -2
- package/dist/esm/token-B0hgYraH.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fhevm-relayer-BTab4pc9.js","names":["#chain","#base","#decrypt","#encrypt","#defaultOptions","#encryptInitPromise","#initEncrypt"],"sources":["../../src/chains/to-fhevm-chain.ts","../../src/relayer/fhevm-relayer.ts"],"sourcesContent":["import type { FhevmChain } from \"@fhevm/sdk/chains\";\nimport type { FheChain } from \"./types\";\n\n/**\n * Derive an `@fhevm/sdk` {@link FhevmChain} from zama-sdk's richer\n * {@link FheChain}.\n *\n * `FheChain` carries fields `@fhevm/sdk` does not model (RPC `network`,\n * `registryAddress`, `executorAddress`, cleartext signer keys); those stay on\n * `FheChain` for the token layer. This adapter projects only the subset the\n * FHE runtime needs: contract addresses, relayer URL, and gateway.\n */\nexport function toFhevmChain(chain: FheChain): FhevmChain {\n return {\n id: chain.id,\n fhevm: {\n contracts: {\n acl: { address: chain.aclContractAddress },\n inputVerifier: { address: chain.inputVerifierContractAddress },\n kmsVerifier: { address: chain.kmsContractAddress },\n protocolConfig: undefined,\n },\n relayerUrl: chain.relayerUrl,\n gateway: {\n id: chain.gatewayChainId,\n contracts: {\n decryption: { address: chain.verifyingContractAddressDecryption },\n inputVerification: { address: chain.verifyingContractAddressInputVerification },\n },\n },\n },\n } satisfies FhevmChain;\n}\n","import {\n createFhevmBaseClient,\n createFhevmDecryptClient,\n createFhevmEncryptClient,\n} from \"@fhevm/sdk/viem\";\nimport {\n createFhevmCleartextBaseClient,\n createFhevmCleartextDecryptClient,\n createFhevmCleartextEncryptClient,\n} from \"@fhevm/sdk/viem/cleartext\";\nimport { createPublicClient, custom, http } from \"viem\";\nimport { toFhevmChain } from \"../chains/to-fhevm-chain\";\nimport type { FheChain } from \"../chains/types\";\nimport { ConfigurationError } from \"../errors\";\nimport type {\n FhevmBaseClient,\n FhevmClient,\n FhevmDecryptClient,\n FhevmEncryptClient,\n FhevmRelayerOptions,\n RelayerSDK,\n RelayerOptions,\n} from \"./types\";\n\n/** Construction config for {@link FhevmRelayer}. */\nexport interface FhevmRelayerConfig {\n /** FHE chain configuration. */\n chain: FheChain;\n /**\n * Cleartext mode for local dev/test chains without FHE infrastructure — reads\n * mock cleartexts from the on-chain executor (discovered automatically)\n * instead of calling the relayer.\n */\n cleartext?: boolean;\n /**\n * Per-transport {@link RelayerOptions}: `@fhevm/sdk` client options plus a\n * default request `timeout` applied to every relayer round-trip on the chain.\n */\n options?: RelayerOptions;\n}\n\n/**\n * Single-chain FHE backend that drives `@fhevm/sdk` on the calling thread with\n * capability-scoped lazy initialization.\n * EIP-712 signing is done by the signer layer; this backend builds the typed\n * data and, on decrypt, reassembles the new SDK's signed permit from the\n * interface's params + the previously returned signature.\n *\n * @remarks\n * Each method delegates to the narrowest base, decrypt, or encrypt client,\n * adding two cross-cutting behaviors that the delegated signatures don't\n * express:\n *\n * - **Lazy init.** Each operation initializes only the capability it requires.\n * Public decrypt avoids WASM, private decrypt loads TKMS only, and encryption\n * alone loads TFHE and the FHE encryption key.\n * - **Option merging.** The chain's default options (`auth`, `timeout`, `debug`)\n * are spread in first, then the per-call `options`, so a per-call value always\n * wins over the chain default. Serialization helpers make no relayer\n * round-trip, so they inject no options.\n *\n * @internal\n */\nexport class FhevmRelayer implements RelayerSDK {\n readonly #chain: FheChain;\n readonly #base: FhevmBaseClient;\n readonly #decrypt: FhevmDecryptClient;\n readonly #encrypt: FhevmEncryptClient;\n readonly #defaultOptions: Partial<FhevmRelayerOptions>;\n #encryptInitPromise: Promise<void> | undefined;\n\n /**\n * Builds capability-scoped `@fhevm/sdk` clients for the chain and captures\n * the chain's `auth`/`timeout`/`debug` as request defaults. Construction is\n * cheap; each client's one-time init is deferred to its first operation.\n */\n constructor(config: FhevmRelayerConfig) {\n this.#chain = config.chain;\n const { timeout, debug, batchRpcCalls, moduleVersions, fheEncryptionKey } =\n config.options ?? {};\n const auth = this.#chain.auth ? toFhevmAuth(this.#chain.auth) : undefined;\n const transport =\n typeof this.#chain.network === \"string\"\n ? http(this.#chain.network)\n : custom(this.#chain.network);\n const params = {\n publicClient: createPublicClient({ transport }),\n chain: toFhevmChain(this.#chain),\n options: { batchRpcCalls, moduleVersions, fheEncryptionKey },\n };\n if (config.cleartext) {\n this.#base = createFhevmCleartextBaseClient(params);\n this.#decrypt = createFhevmCleartextDecryptClient(params);\n this.#encrypt = createFhevmCleartextEncryptClient(params);\n } else {\n this.#base = createFhevmBaseClient(params);\n this.#decrypt = createFhevmDecryptClient(params);\n this.#encrypt = createFhevmEncryptClient(params);\n }\n this.#defaultOptions = {\n ...(auth !== undefined && { auth }),\n ...(timeout !== undefined && { timeout }),\n ...(debug !== undefined && { debug }),\n };\n }\n\n /** The FHE chain this backend is bound to. */\n get chain() {\n return this.#chain;\n }\n\n #initEncrypt = (): Promise<void> => {\n this.#encryptInitPromise ??= this.#base\n .fetchFheEncryptionKeyBytes({ options: this.#defaultOptions })\n .then(() => this.#encrypt.init());\n return this.#encryptInitPromise;\n };\n\n /**\n * Decrypts a single publicly-decryptable value — one whose contract granted\n * public access, so no permit or key pair is needed — into its typed clear\n * value.\n *\n * @example\n * ```ts\n * const { type, value } = await relayer.decryptPublicValue({\n * encryptedValue: handle, // a bytes32 ciphertext reference\n * });\n * ```\n */\n decryptPublicValue: FhevmClient[\"decryptPublicValue\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.decryptPublicValue({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Batch form of {@link decryptPublicValue}: decrypts many publicly-decryptable\n * values in one relayer round-trip, returning their typed clear values in\n * order.\n *\n * @example\n * ```ts\n * const values = await relayer.decryptPublicValues({\n * encryptedValues: [handleA, handleB],\n * });\n * ```\n */\n decryptPublicValues: FhevmClient[\"decryptPublicValues\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.decryptPublicValues({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Like {@link decryptPublicValues}, but also returns the KMS signature bundle —\n * the handles list, ABI-encoded cleartexts, and decryption proof — needed to\n * verify or replay the result on-chain.\n *\n * @example\n * ```ts\n * const { clearValues, checkSignaturesArgs } =\n * await relayer.decryptPublicValuesWithSignatures({ encryptedValues: [handle] });\n * // checkSignaturesArgs: { handlesList, abiEncodedCleartexts, decryptionProof }\n * ```\n */\n decryptPublicValuesWithSignatures: FhevmClient[\"decryptPublicValuesWithSignatures\"] = async (\n parameters,\n ) => {\n await this.#base.init();\n return this.#base.decryptPublicValuesWithSignatures({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Encrypts one typed input under the chain's FHE key, bound to the contract it\n * targets and the user submitting it, and returns the ciphertext handle plus\n * the input proof the contract verifies on-chain. `type` is the FHE type\n * with the `e` prefix (`\"euint64\"`, `\"ebool\"`, `\"eaddress\"`).\n *\n * @example\n * ```ts\n * const { encryptedValue, inputProof } = await relayer.encryptValue({\n * value: { type: \"euint64\", value: 1000n },\n * contractAddress: \"0xToken…\",\n * userAddress: \"0xUser…\",\n * });\n * ```\n */\n encryptValue: FhevmClient[\"encryptValue\"] = async (parameters) => {\n await this.#initEncrypt();\n return this.#encrypt.encryptValue({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Batch form of {@link encryptValue}: encrypts several inputs for the same\n * contract and user in one call, returning all ciphertext handles under a\n * single shared input proof.\n *\n * @example\n * ```ts\n * const { encryptedValues, inputProof } = await relayer.encryptValues({\n * values: [\n * { type: \"euint64\", value: 1000n },\n * { type: \"ebool\", value: true },\n * ],\n * contractAddress: \"0xToken…\",\n * userAddress: \"0xUser…\",\n * });\n * ```\n */\n encryptValues: FhevmClient[\"encryptValues\"] = async (parameters) => {\n await this.#initEncrypt();\n return this.#encrypt.encryptValues({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * User-decrypts a single access-controlled value: the relayer re-encrypts it\n * to the ephemeral transport key pair, gated by the signed permit, and this\n * returns the typed clear value. Build the key pair with\n * {@link generateTransportKeyPair} and the permit with\n * {@link signDecryptionPermit}.\n *\n * @example\n * ```ts\n * const { type, value } = await relayer.decryptValue({\n * encryptedValue: handle,\n * contractAddress: \"0xToken…\",\n * transportKeyPair,\n * signedPermit,\n * });\n * ```\n */\n decryptValue: FhevmClient[\"decryptValue\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.decryptValue({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Batch form of {@link decryptValue} for values that all belong to the same\n * contract; returns the typed clear values positionally. For values spanning\n * multiple contracts, use {@link decryptValuesFromPairs}.\n *\n * @example\n * ```ts\n * const values = await relayer.decryptValues({\n * encryptedValues: [handleA, handleB],\n * contractAddress: \"0xToken…\",\n * transportKeyPair,\n * signedPermit,\n * });\n * ```\n */\n decryptValues: FhevmClient[\"decryptValues\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.decryptValues({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * User-decrypts values that span multiple contracts: each pair carries its own\n * `contractAddress`, so one permit covering those contracts decrypts them all\n * in a single round-trip. Returns the typed clear values positionally.\n *\n * @example\n * ```ts\n * const values = await relayer.decryptValuesFromPairs({\n * pairs: [\n * { encryptedValue: handleA, contractAddress: \"0xTokenA…\" },\n * { encryptedValue: handleB, contractAddress: \"0xTokenB…\" },\n * ],\n * transportKeyPair,\n * signedPermit,\n * });\n * ```\n */\n decryptValuesFromPairs: FhevmClient[\"decryptValuesFromPairs\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.decryptValuesFromPairs({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Fetches the chain's raw FHE public-key bytes — the key encryption uses —\n * served from cache unless `ignoreCache` forces a refetch. Rarely called\n * directly: {@link encryptValue}/{@link encryptValues} fetch the key for you.\n *\n * @example\n * ```ts\n * const keyBytes = await relayer.fetchFheEncryptionKeyBytes();\n * const fresh = await relayer.fetchFheEncryptionKeyBytes({ ignoreCache: true });\n * ```\n */\n fetchFheEncryptionKeyBytes: FhevmClient[\"fetchFheEncryptionKeyBytes\"] = async (parameters) => {\n await this.#initEncrypt();\n return this.#encrypt.fetchFheEncryptionKeyBytes({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters?.options },\n });\n };\n\n /**\n * Builds the EIP-712 user-decrypt permit and signs it with the given signer,\n * authorizing the transport key pair to decrypt the listed contracts' values\n * for `durationSeconds` starting at `startTimestamp`. Pass `delegatorAddress`\n * to sign a delegated permit — decrypting values owned by that account instead\n * of the signer's own. Persist the result via\n * {@link serializeSignedDecryptionPermit}.\n *\n * @example\n * ```ts\n * const signedPermit = await relayer.signDecryptionPermit({\n * transportKeyPair,\n * contractAddresses: [\"0xToken…\"],\n * startTimestamp: Math.floor(Date.now() / 1000),\n * durationSeconds: 60 * 60 * 24,\n * signerAddress: \"0xUser…\",\n * signer,\n * // delegatorAddress: \"0xOwner…\", // omit for a self permit\n * });\n * ```\n */\n signDecryptionPermit: FhevmClient[\"signDecryptionPermit\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.signDecryptionPermit(parameters);\n };\n\n // Permit/key-pair helpers carry no request options. Parsing explicitly\n // initializes the capability that validates the restored value; serialization\n // resolves the frozen context internally (via initPublicAction), which reads\n // on-chain state.\n\n /**\n * Serializes a transport key pair to a hex `{ publicKey, privateKey }` pair for\n * storage or transport, so a decryption session can resume without regenerating\n * keys. Reverse of {@link parseTransportKeyPair}.\n *\n * @example\n * ```ts\n * const stored = await relayer.serializeTransportKeyPair({ transportKeyPair });\n * // { publicKey: \"0x…\", privateKey: \"0x…\" }\n * ```\n */\n serializeTransportKeyPair: FhevmClient[\"serializeTransportKeyPair\"] = (parameters) =>\n this.#decrypt.serializeTransportKeyPair(parameters);\n\n /**\n * Serializes a signed permit to a plain, JSON-stringifiable object (version,\n * EIP-712 payload, signature, signer) for caching or transport. Reverse of\n * {@link parseSignedDecryptionPermit}.\n *\n * @example\n * ```ts\n * const serialized = await relayer.serializeSignedDecryptionPermit({ signedPermit });\n * localStorage.setItem(\"permit\", JSON.stringify(serialized));\n * ```\n */\n serializeSignedDecryptionPermit: FhevmClient[\"serializeSignedDecryptionPermit\"] = (parameters) =>\n this.#base.serializeSignedDecryptionPermit(parameters);\n\n /**\n * Rebuilds a transport key pair from its serialized hex\n * `{ publicKey, privateKey }` form. Reverse of {@link serializeTransportKeyPair}.\n *\n * @example\n * ```ts\n * const transportKeyPair = await relayer.parseTransportKeyPair({\n * publicKey: stored.publicKey,\n * privateKey: stored.privateKey,\n * });\n * ```\n */\n parseTransportKeyPair: FhevmClient[\"parseTransportKeyPair\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.parseTransportKeyPair(parameters);\n };\n\n /**\n * Rebuilds a signed permit from its serialized form and validates it: checks\n * the EIP-712 structure, verifies the signature against the on-chain verifier,\n * and confirms the permit's public key matches `transportKeyPair`. Reverse of\n * {@link serializeSignedDecryptionPermit}.\n *\n * @throws if the permit is malformed, expired, or its signature is invalid.\n *\n * @example\n * ```ts\n * const signedPermit = await relayer.parseSignedDecryptionPermit({\n * serializedPermit,\n * transportKeyPair,\n * });\n * ```\n */\n parseSignedDecryptionPermit: FhevmClient[\"parseSignedDecryptionPermit\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.parseSignedDecryptionPermit(parameters);\n };\n\n /**\n * Generates a fresh ephemeral transport key pair for a user-decrypt session.\n * The relayer re-encrypts decrypted values to this pair's public key, so only\n * the holder of the private key can read them; bind it to a permit via\n * {@link signDecryptionPermit}.\n *\n * @example\n * ```ts\n * const transportKeyPair = await relayer.generateTransportKeyPair();\n * ```\n */\n generateTransportKeyPair: FhevmClient[\"generateTransportKeyPair\"] = async () => {\n await this.#decrypt.init();\n return this.#decrypt.generateTransportKeyPair();\n };\n}\n\n/**\n * Translates the SDK's public {@link FheChain.auth} shape (discriminated by\n * `__type`) into the `type`-discriminated `auth` that `@fhevm/sdk` expects.\n *\n * @throws if the auth discriminator is not one of the supported kinds.\n */\nfunction toFhevmAuth(\n auth: NonNullable<FheChain[\"auth\"]>,\n): NonNullable<FhevmRelayerOptions[\"auth\"]> {\n const type = auth[\"__type\"];\n switch (type) {\n case \"ApiKeyHeader\":\n return { type, value: auth.value, header: auth.header };\n case \"ApiKeyCookie\":\n return { type, value: auth.value, cookie: auth.cookie };\n case \"BearerToken\":\n return { type, token: auth.token };\n default:\n throw new ConfigurationError(`Unknown auth type: ${String(type)}`);\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"fhevm-relayer-CTwFyl0v.js","names":["#chain","#base","#decrypt","#encrypt","#defaultOptions","#encryptInitPromise","#initEncrypt","createUnsignedLegacyDecryptionPermitEip712Action"],"sources":["../../src/chains/to-fhevm-chain.ts","../../src/relayer/fhevm-relayer.ts"],"sourcesContent":["import type { FhevmChain } from \"@fhevm/sdk/chains\";\nimport type { FheChain } from \"./types\";\n\n/**\n * Derive an `@fhevm/sdk` {@link FhevmChain} from zama-sdk's richer\n * {@link FheChain}.\n *\n * `FheChain` carries fields `@fhevm/sdk` does not model (RPC `network`,\n * `registryAddress`, `executorAddress`, cleartext signer keys); those stay on\n * `FheChain` for the token layer. This adapter projects only the subset the\n * FHE runtime needs: contract addresses, relayer URL, and gateway.\n */\nexport function toFhevmChain(chain: FheChain): FhevmChain {\n return {\n id: chain.id,\n fhevm: {\n contracts: {\n acl: { address: chain.aclContractAddress },\n inputVerifier: { address: chain.inputVerifierContractAddress },\n kmsVerifier: { address: chain.kmsContractAddress },\n protocolConfig: undefined,\n },\n relayerUrl: chain.relayerUrl,\n gateway: {\n id: chain.gatewayChainId,\n contracts: {\n decryption: { address: chain.verifyingContractAddressDecryption },\n inputVerification: { address: chain.verifyingContractAddressInputVerification },\n },\n },\n },\n } satisfies FhevmChain;\n}\n","import { createUnsignedLegacyDecryptionPermitEip712 as createUnsignedLegacyDecryptionPermitEip712Action } from \"@fhevm/sdk/actions/base\";\nimport {\n createFhevmBaseClient,\n createFhevmDecryptClient,\n createFhevmEncryptClient,\n} from \"@fhevm/sdk/viem\";\nimport {\n createFhevmCleartextBaseClient,\n createFhevmCleartextDecryptClient,\n createFhevmCleartextEncryptClient,\n} from \"@fhevm/sdk/viem/cleartext\";\nimport { createPublicClient, custom, http } from \"viem\";\nimport { toFhevmChain } from \"../chains/to-fhevm-chain\";\nimport type { FheChain } from \"../chains/types\";\nimport { ConfigurationError } from \"../errors\";\nimport type {\n FhevmBaseClient,\n FhevmClient,\n FhevmDecryptClient,\n FhevmEncryptClient,\n FhevmRelayerOptions,\n RelayerSDK,\n RelayerOptions,\n} from \"./types\";\n\n/** Construction config for {@link FhevmRelayer}. */\nexport interface FhevmRelayerConfig {\n /** FHE chain configuration. */\n chain: FheChain;\n /**\n * Cleartext mode for local dev/test chains without FHE infrastructure — reads\n * mock cleartexts from the on-chain executor (discovered automatically)\n * instead of calling the relayer.\n */\n cleartext?: boolean;\n /**\n * Per-transport {@link RelayerOptions}: `@fhevm/sdk` client options plus a\n * default request `timeout` applied to every relayer round-trip on the chain.\n */\n options?: RelayerOptions;\n}\n\n/**\n * Single-chain FHE backend that drives `@fhevm/sdk` on the calling thread with\n * capability-scoped lazy initialization.\n * EIP-712 signing is done by the signer layer; this backend builds the typed\n * data and, on decrypt, reassembles the new SDK's signed permit from the\n * interface's params + the previously returned signature.\n *\n * @remarks\n * Each method delegates to the narrowest base, decrypt, or encrypt client,\n * adding two cross-cutting behaviors that the delegated signatures don't\n * express:\n *\n * - **Lazy init.** Each operation initializes only the capability it requires.\n * Public decrypt avoids WASM, private decrypt loads TKMS only, and encryption\n * alone loads TFHE and the FHE encryption key.\n * - **Option merging.** The chain's default options (`auth`, `timeout`, `debug`)\n * are spread in first, then the per-call `options`, so a per-call value always\n * wins over the chain default. Serialization helpers make no relayer\n * round-trip, so they inject no options.\n *\n * @internal\n */\nexport class FhevmRelayer implements RelayerSDK {\n readonly #chain: FheChain;\n readonly #base: FhevmBaseClient;\n readonly #decrypt: FhevmDecryptClient;\n readonly #encrypt: FhevmEncryptClient;\n readonly #defaultOptions: Partial<FhevmRelayerOptions>;\n #encryptInitPromise: Promise<void> | undefined;\n\n /**\n * Builds capability-scoped `@fhevm/sdk` clients for the chain and captures\n * the chain's `auth`/`timeout`/`debug` as request defaults. Construction is\n * cheap; each client's one-time init is deferred to its first operation.\n */\n constructor(config: FhevmRelayerConfig) {\n this.#chain = config.chain;\n const { timeout, debug, batchRpcCalls, moduleVersions, fheEncryptionKey } =\n config.options ?? {};\n const auth = this.#chain.auth ? toFhevmAuth(this.#chain.auth) : undefined;\n const transport =\n typeof this.#chain.network === \"string\"\n ? http(this.#chain.network)\n : custom(this.#chain.network);\n const params = {\n publicClient: createPublicClient({ transport }),\n chain: toFhevmChain(this.#chain),\n options: { batchRpcCalls, moduleVersions, fheEncryptionKey },\n };\n if (config.cleartext) {\n this.#base = createFhevmCleartextBaseClient(params);\n this.#decrypt = createFhevmCleartextDecryptClient(params);\n this.#encrypt = createFhevmCleartextEncryptClient(params);\n } else {\n this.#base = createFhevmBaseClient(params);\n this.#decrypt = createFhevmDecryptClient(params);\n this.#encrypt = createFhevmEncryptClient(params);\n }\n this.#defaultOptions = {\n ...(auth !== undefined && { auth }),\n ...(timeout !== undefined && { timeout }),\n ...(debug !== undefined && { debug }),\n };\n }\n\n /** The FHE chain this backend is bound to. */\n get chain() {\n return this.#chain;\n }\n\n #initEncrypt = (): Promise<void> => {\n this.#encryptInitPromise ??= this.#base\n .fetchFheEncryptionKeyBytes({ options: this.#defaultOptions })\n .then(() => this.#encrypt.init());\n return this.#encryptInitPromise;\n };\n\n /**\n * Decrypts a single publicly-decryptable value — one whose contract granted\n * public access, so no permit or key pair is needed — into its typed clear\n * value.\n *\n * @example\n * ```ts\n * const { type, value } = await relayer.decryptPublicValue({\n * encryptedValue: handle, // a bytes32 ciphertext reference\n * });\n * ```\n */\n decryptPublicValue: FhevmClient[\"decryptPublicValue\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.decryptPublicValue({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Batch form of {@link decryptPublicValue}: decrypts many publicly-decryptable\n * values in one relayer round-trip, returning their typed clear values in\n * order.\n *\n * @example\n * ```ts\n * const values = await relayer.decryptPublicValues({\n * encryptedValues: [handleA, handleB],\n * });\n * ```\n */\n decryptPublicValues: FhevmClient[\"decryptPublicValues\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.decryptPublicValues({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Like {@link decryptPublicValues}, but also returns the KMS signature bundle —\n * the handles list, ABI-encoded cleartexts, and decryption proof — needed to\n * verify or replay the result on-chain.\n *\n * @example\n * ```ts\n * const { clearValues, checkSignaturesArgs } =\n * await relayer.decryptPublicValuesWithSignatures({ encryptedValues: [handle] });\n * // checkSignaturesArgs: { handlesList, abiEncodedCleartexts, decryptionProof }\n * ```\n */\n decryptPublicValuesWithSignatures: FhevmClient[\"decryptPublicValuesWithSignatures\"] = async (\n parameters,\n ) => {\n await this.#base.init();\n return this.#base.decryptPublicValuesWithSignatures({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Encrypts one typed input under the chain's FHE key, bound to the contract it\n * targets and the user submitting it, and returns the ciphertext handle plus\n * the input proof the contract verifies on-chain. `type` is the FHE type\n * with the `e` prefix (`\"euint64\"`, `\"ebool\"`, `\"eaddress\"`).\n *\n * @example\n * ```ts\n * const { encryptedValue, inputProof } = await relayer.encryptValue({\n * value: { type: \"euint64\", value: 1000n },\n * contractAddress: \"0xToken…\",\n * userAddress: \"0xUser…\",\n * });\n * ```\n */\n encryptValue: FhevmClient[\"encryptValue\"] = async (parameters) => {\n await this.#initEncrypt();\n return this.#encrypt.encryptValue({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Batch form of {@link encryptValue}: encrypts several inputs for the same\n * contract and user in one call, returning all ciphertext handles under a\n * single shared input proof.\n *\n * @example\n * ```ts\n * const { encryptedValues, inputProof } = await relayer.encryptValues({\n * values: [\n * { type: \"euint64\", value: 1000n },\n * { type: \"ebool\", value: true },\n * ],\n * contractAddress: \"0xToken…\",\n * userAddress: \"0xUser…\",\n * });\n * ```\n */\n encryptValues: FhevmClient[\"encryptValues\"] = async (parameters) => {\n await this.#initEncrypt();\n return this.#encrypt.encryptValues({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * User-decrypts a single access-controlled value: the relayer re-encrypts it\n * to the ephemeral transport key pair, gated by the signed permit, and this\n * returns the typed clear value. Build the key pair with\n * {@link generateTransportKeyPair} and the permit with\n * {@link signDecryptionPermit}.\n *\n * @example\n * ```ts\n * const { type, value } = await relayer.decryptValue({\n * encryptedValue: handle,\n * contractAddress: \"0xToken…\",\n * transportKeyPair,\n * signedPermit,\n * });\n * ```\n */\n decryptValue: FhevmClient[\"decryptValue\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.decryptValue({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Batch form of {@link decryptValue} for values that all belong to the same\n * contract; returns the typed clear values positionally. For values spanning\n * multiple contracts, use {@link decryptValuesFromPairs}.\n *\n * @example\n * ```ts\n * const values = await relayer.decryptValues({\n * encryptedValues: [handleA, handleB],\n * contractAddress: \"0xToken…\",\n * transportKeyPair,\n * signedPermit,\n * });\n * ```\n */\n decryptValues: FhevmClient[\"decryptValues\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.decryptValues({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * User-decrypts values that span multiple contracts: each pair carries its own\n * `contractAddress`, so one permit covering those contracts decrypts them all\n * in a single round-trip. Returns the typed clear values positionally.\n *\n * @example\n * ```ts\n * const values = await relayer.decryptValuesFromPairs({\n * pairs: [\n * { encryptedValue: handleA, contractAddress: \"0xTokenA…\" },\n * { encryptedValue: handleB, contractAddress: \"0xTokenB…\" },\n * ],\n * transportKeyPair,\n * signedPermit,\n * });\n * ```\n */\n decryptValuesFromPairs: FhevmClient[\"decryptValuesFromPairs\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.decryptValuesFromPairs({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters.options },\n });\n };\n\n /**\n * Fetches the chain's raw FHE public-key bytes — the key encryption uses —\n * served from cache unless `ignoreCache` forces a refetch. Rarely called\n * directly: {@link encryptValue}/{@link encryptValues} fetch the key for you.\n *\n * @example\n * ```ts\n * const keyBytes = await relayer.fetchFheEncryptionKeyBytes();\n * const fresh = await relayer.fetchFheEncryptionKeyBytes({ ignoreCache: true });\n * ```\n */\n fetchFheEncryptionKeyBytes: FhevmClient[\"fetchFheEncryptionKeyBytes\"] = async (parameters) => {\n await this.#initEncrypt();\n return this.#encrypt.fetchFheEncryptionKeyBytes({\n ...parameters,\n options: { ...this.#defaultOptions, ...parameters?.options },\n });\n };\n\n /**\n * Builds the EIP-712 user-decrypt permit and signs it with the given signer,\n * authorizing the transport key pair to decrypt the listed contracts' values\n * for `durationSeconds` starting at `startTimestamp`. Pass `delegatorAddress`\n * to sign a delegated permit — decrypting values owned by that account instead\n * of the signer's own. Persist the result via\n * {@link serializeSignedDecryptionPermit}.\n *\n * @example\n * ```ts\n * const signedPermit = await relayer.signDecryptionPermit({\n * transportKeyPair,\n * contractAddresses: [\"0xToken…\"],\n * startTimestamp: Math.floor(Date.now() / 1000),\n * durationSeconds: 60 * 60 * 24,\n * signerAddress: \"0xUser…\",\n * signer,\n * // delegatorAddress: \"0xOwner…\", // omit for a self permit\n * });\n * ```\n */\n signDecryptionPermit: FhevmClient[\"signDecryptionPermit\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.signDecryptionPermit(parameters);\n };\n\n /**\n * Builds the unsigned EIP-712 typed data for a V1 decryption permit, without\n * signing it — the signer-less counterpart to {@link signDecryptionPermit}.\n * Hand the result to an out-of-process signer for `eth_signTypedData_v4`,\n * then verify the returned signature via {@link parseSignedDecryptionPermit}.\n *\n * Not on `@fhevm/sdk`'s client decorator, so it's called directly against\n * the base client rather than through a decorated method.\n *\n * @example\n * ```ts\n * const eip712 = await relayer.createUnsignedLegacyDecryptionPermitEip712({\n * transportKeyPair,\n * contractAddresses: [\"0xToken…\"],\n * startTimestamp: Math.floor(Date.now() / 1000),\n * durationSeconds: 60 * 60 * 24,\n * // delegatorAddress: \"0xOwner…\", // omit for a self permit\n * });\n * ```\n */\n createUnsignedLegacyDecryptionPermitEip712: RelayerSDK[\"createUnsignedLegacyDecryptionPermitEip712\"] =\n (parameters) => createUnsignedLegacyDecryptionPermitEip712Action(this.#base, parameters);\n\n // Permit/key-pair helpers carry no request options. Parsing explicitly\n // initializes the capability that validates the restored value; serialization\n // resolves the frozen context internally (via initPublicAction), which reads\n // on-chain state.\n\n /**\n * Serializes a transport key pair to a hex `{ publicKey, privateKey }` pair for\n * storage or transport, so a decryption session can resume without regenerating\n * keys. Reverse of {@link parseTransportKeyPair}.\n *\n * @example\n * ```ts\n * const stored = await relayer.serializeTransportKeyPair({ transportKeyPair });\n * // { publicKey: \"0x…\", privateKey: \"0x…\" }\n * ```\n */\n serializeTransportKeyPair: FhevmClient[\"serializeTransportKeyPair\"] = (parameters) =>\n this.#decrypt.serializeTransportKeyPair(parameters);\n\n /**\n * Serializes a signed permit to a plain, JSON-stringifiable object (version,\n * EIP-712 payload, signature, signer) for caching or transport. Reverse of\n * {@link parseSignedDecryptionPermit}.\n *\n * @example\n * ```ts\n * const serialized = await relayer.serializeSignedDecryptionPermit({ signedPermit });\n * localStorage.setItem(\"permit\", JSON.stringify(serialized));\n * ```\n */\n serializeSignedDecryptionPermit: FhevmClient[\"serializeSignedDecryptionPermit\"] = (parameters) =>\n this.#base.serializeSignedDecryptionPermit(parameters);\n\n /**\n * Rebuilds a transport key pair from its serialized hex\n * `{ publicKey, privateKey }` form. Reverse of {@link serializeTransportKeyPair}.\n *\n * @example\n * ```ts\n * const transportKeyPair = await relayer.parseTransportKeyPair({\n * publicKey: stored.publicKey,\n * privateKey: stored.privateKey,\n * });\n * ```\n */\n parseTransportKeyPair: FhevmClient[\"parseTransportKeyPair\"] = async (parameters) => {\n await this.#decrypt.init();\n return this.#decrypt.parseTransportKeyPair(parameters);\n };\n\n /**\n * Rebuilds a signed permit from its serialized form and validates it: checks\n * the EIP-712 structure, verifies the signature against the on-chain verifier,\n * and confirms the permit's public key matches `transportKeyPair`. Reverse of\n * {@link serializeSignedDecryptionPermit}.\n *\n * @throws if the permit is malformed, expired, or its signature is invalid.\n *\n * @example\n * ```ts\n * const signedPermit = await relayer.parseSignedDecryptionPermit({\n * serializedPermit,\n * transportKeyPair,\n * });\n * ```\n */\n parseSignedDecryptionPermit: FhevmClient[\"parseSignedDecryptionPermit\"] = async (parameters) => {\n await this.#base.init();\n return this.#base.parseSignedDecryptionPermit(parameters);\n };\n\n /**\n * Generates a fresh ephemeral transport key pair for a user-decrypt session.\n * The relayer re-encrypts decrypted values to this pair's public key, so only\n * the holder of the private key can read them; bind it to a permit via\n * {@link signDecryptionPermit}.\n *\n * @example\n * ```ts\n * const transportKeyPair = await relayer.generateTransportKeyPair();\n * ```\n */\n generateTransportKeyPair: FhevmClient[\"generateTransportKeyPair\"] = async () => {\n await this.#decrypt.init();\n return this.#decrypt.generateTransportKeyPair();\n };\n}\n\n/**\n * Translates the SDK's public {@link FheChain.auth} shape (discriminated by\n * `__type`) into the `type`-discriminated `auth` that `@fhevm/sdk` expects.\n *\n * @throws if the auth discriminator is not one of the supported kinds.\n */\nfunction toFhevmAuth(\n auth: NonNullable<FheChain[\"auth\"]>,\n): NonNullable<FhevmRelayerOptions[\"auth\"]> {\n const type = auth[\"__type\"];\n switch (type) {\n case \"ApiKeyHeader\":\n return { type, value: auth.value, header: auth.header };\n case \"ApiKeyCookie\":\n return { type, value: auth.value, cookie: auth.cookie };\n case \"BearerToken\":\n return { type, token: auth.token };\n default:\n throw new ConfigurationError(`Unknown auth type: ${String(type)}`);\n }\n}\n"],"mappings":"4cAYA,SAAgB,EAAa,EAA6B,CACxD,MAAO,CACL,GAAI,EAAM,GACV,MAAO,CACL,UAAW,CACT,IAAK,CAAE,QAAS,EAAM,kBAAmB,EACzC,cAAe,CAAE,QAAS,EAAM,4BAA6B,EAC7D,YAAa,CAAE,QAAS,EAAM,kBAAmB,EACjD,eAAgB,IAAA,EAClB,EACA,WAAY,EAAM,WAClB,QAAS,CACP,GAAI,EAAM,eACV,UAAW,CACT,WAAY,CAAE,QAAS,EAAM,kCAAmC,EAChE,kBAAmB,CAAE,QAAS,EAAM,yCAA0C,CAChF,CACF,CACF,CACF,CACF,CCgCA,IAAa,EAAb,KAAgD,CAC9C,GACA,GACA,GACA,GACA,GACA,GAOA,YAAY,EAA4B,CACtC,KAAKA,GAAS,EAAO,MACrB,GAAM,CAAE,UAAS,QAAO,gBAAe,iBAAgB,oBACrD,EAAO,SAAW,CAAC,EACf,EAAO,KAAKA,GAAO,KAAO,EAAY,KAAKA,GAAO,IAAI,EAAI,IAAA,GAK1D,EAAS,CACb,aAAc,EAAmB,CAAE,UAJnC,OAAO,KAAKA,GAAO,SAAY,SAC3B,EAAK,KAAKA,GAAO,OAAO,EACxB,EAAO,KAAKA,GAAO,OAAO,CAEe,CAAC,EAC9C,MAAO,EAAa,KAAKA,EAAM,EAC/B,QAAS,CAAE,gBAAe,iBAAgB,kBAAiB,CAC7D,EACI,EAAO,WACT,KAAKC,GAAQ,EAA+B,CAAM,EAClD,KAAKC,GAAW,EAAkC,CAAM,EACxD,KAAKC,GAAW,EAAkC,CAAM,IAExD,KAAKF,GAAQ,EAAsB,CAAM,EACzC,KAAKC,GAAW,EAAyB,CAAM,EAC/C,KAAKC,GAAW,EAAyB,CAAM,GAEjD,KAAKC,GAAkB,CACrB,GAAI,IAAS,IAAA,IAAa,CAAE,MAAK,EACjC,GAAI,IAAY,IAAA,IAAa,CAAE,SAAQ,EACvC,GAAI,IAAU,IAAA,IAAa,CAAE,OAAM,CACrC,CACF,CAGA,IAAI,OAAQ,CACV,OAAO,KAAKJ,EACd,CAEA,QACE,KAAKK,KAAwB,KAAKJ,GAC/B,2BAA2B,CAAE,QAAS,KAAKG,EAAgB,CAAC,CAAC,CAC7D,SAAW,KAAKD,GAAS,KAAK,CAAC,EAC3B,KAAKE,IAed,mBAAwD,KAAO,KAC7D,MAAM,KAAKJ,GAAM,KAAK,EACf,KAAKA,GAAM,mBAAmB,CACnC,GAAG,EACH,QAAS,CAAE,GAAG,KAAKG,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAeH,oBAA0D,KAAO,KAC/D,MAAM,KAAKH,GAAM,KAAK,EACf,KAAKA,GAAM,oBAAoB,CACpC,GAAG,EACH,QAAS,CAAE,GAAG,KAAKG,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAeH,kCAAsF,KACpF,KAEA,MAAM,KAAKH,GAAM,KAAK,EACf,KAAKA,GAAM,kCAAkC,CAClD,GAAG,EACH,QAAS,CAAE,GAAG,KAAKG,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAkBH,aAA4C,KAAO,KACjD,MAAM,KAAKE,GAAa,EACjB,KAAKH,GAAS,aAAa,CAChC,GAAG,EACH,QAAS,CAAE,GAAG,KAAKC,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAoBH,cAA8C,KAAO,KACnD,MAAM,KAAKE,GAAa,EACjB,KAAKH,GAAS,cAAc,CACjC,GAAG,EACH,QAAS,CAAE,GAAG,KAAKC,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAoBH,aAA4C,KAAO,KACjD,MAAM,KAAKF,GAAS,KAAK,EAClB,KAAKA,GAAS,aAAa,CAChC,GAAG,EACH,QAAS,CAAE,GAAG,KAAKE,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAkBH,cAA8C,KAAO,KACnD,MAAM,KAAKF,GAAS,KAAK,EAClB,KAAKA,GAAS,cAAc,CACjC,GAAG,EACH,QAAS,CAAE,GAAG,KAAKE,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAoBH,uBAAgE,KAAO,KACrE,MAAM,KAAKF,GAAS,KAAK,EAClB,KAAKA,GAAS,uBAAuB,CAC1C,GAAG,EACH,QAAS,CAAE,GAAG,KAAKE,GAAiB,GAAG,EAAW,OAAQ,CAC5D,CAAC,GAcH,2BAAwE,KAAO,KAC7E,MAAM,KAAKE,GAAa,EACjB,KAAKH,GAAS,2BAA2B,CAC9C,GAAG,EACH,QAAS,CAAE,GAAG,KAAKC,GAAiB,GAAG,GAAY,OAAQ,CAC7D,CAAC,GAwBH,qBAA4D,KAAO,KACjE,MAAM,KAAKH,GAAM,KAAK,EACf,KAAKA,GAAM,qBAAqB,CAAU,GAuBnD,2CACG,GAAeM,EAAiD,KAAKN,GAAO,CAAU,EAkBzF,0BAAuE,GACrE,KAAKC,GAAS,0BAA0B,CAAU,EAapD,gCAAmF,GACjF,KAAKD,GAAM,gCAAgC,CAAU,EAcvD,sBAA8D,KAAO,KACnE,MAAM,KAAKC,GAAS,KAAK,EAClB,KAAKA,GAAS,sBAAsB,CAAU,GAmBvD,4BAA0E,KAAO,KAC/E,MAAM,KAAKD,GAAM,KAAK,EACf,KAAKA,GAAM,4BAA4B,CAAU,GAc1D,yBAAoE,UAClE,MAAM,KAAKC,GAAS,KAAK,EAClB,KAAKA,GAAS,yBAAyB,EAElD,EAQA,SAAS,EACP,EAC0C,CAC1C,IAAM,EAAO,EAAK,OAClB,OAAQ,EAAR,CACE,IAAK,eACH,MAAO,CAAE,OAAM,MAAO,EAAK,MAAO,OAAQ,EAAK,MAAO,EACxD,IAAK,eACH,MAAO,CAAE,OAAM,MAAO,EAAK,MAAO,OAAQ,EAAK,MAAO,EACxD,IAAK,cACH,MAAO,CAAE,OAAM,MAAO,EAAK,KAAM,EACnC,QACE,MAAM,IAAI,EAAmB,sBAAsB,OAAO,CAAI,GAAG,CACrE,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { c as GenericStorage, ln as RelayerOptions, n as RelayerConfig } from "./types-
|
|
3
|
-
import "./cleartext-
|
|
1
|
+
import "./index-ijgDL4IC.js";
|
|
2
|
+
import { c as GenericStorage, ln as RelayerOptions, n as RelayerConfig } from "./types-CuDiV0Wy.js";
|
|
3
|
+
import "./cleartext-Di1DDxqa.js";
|
|
4
4
|
//#region src/node/config.d.ts
|
|
5
5
|
/** Node transport — drives the FHE backend directly on the calling thread. */
|
|
6
6
|
interface NodeRelayerConfig extends RelayerConfig {
|
|
@@ -58,4 +58,4 @@ declare class AsyncLocalMapStorage implements GenericStorage {
|
|
|
58
58
|
declare const asyncLocalStorage: AsyncLocalMapStorage;
|
|
59
59
|
//#endregion
|
|
60
60
|
export { node as i, asyncLocalStorage as n, NodeRelayerConfig as r, AsyncLocalMapStorage as t };
|
|
61
|
-
//# sourceMappingURL=index-
|
|
61
|
+
//# sourceMappingURL=index-C4xKY5Fw.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as GenericSigner, O as WalletAccount, Qt as DecryptPublicValuesResult, S as TransactionKind, Xt as TransactionResult, Zt as ClearValue, _ as PrepareTransactionRequest, _t as UnwrapResult, bt as TransferCallbacks, c as GenericStorage, g as PrepareOptions, gt as UnshieldOptions, ht as TransferOptions, i as ZamaConfig, in as EncryptedValue, l as GenericProvider, nn as EncryptParams, o as ZamaConfigGeneric, pt as ShieldOptions, rn as EncryptResult, sn as FhevmRelayerOptions, un as RelayerSDK, v as PreparedFor, vt as WrapOptions, xt as UnshieldCallbacks } from "./types-
|
|
3
|
-
import "./cleartext-
|
|
4
|
-
import "./types-
|
|
5
|
-
import "./base-signer-
|
|
6
|
-
import "./types-
|
|
1
|
+
import { f as FheChain } from "./index-ijgDL4IC.js";
|
|
2
|
+
import { D as GenericSigner, O as WalletAccount, Qt as DecryptPublicValuesResult, S as TransactionKind, Xt as TransactionResult, Zt as ClearValue, _ as PrepareTransactionRequest, _t as UnwrapResult, bt as TransferCallbacks, c as GenericStorage, g as PrepareOptions, gt as UnshieldOptions, ht as TransferOptions, i as ZamaConfig, in as EncryptedValue, l as GenericProvider, nn as EncryptParams, o as ZamaConfigGeneric, pt as ShieldOptions, rn as EncryptResult, sn as FhevmRelayerOptions, un as RelayerSDK, v as PreparedFor, vt as WrapOptions, xt as UnshieldCallbacks } from "./types-CuDiV0Wy.js";
|
|
3
|
+
import "./cleartext-Di1DDxqa.js";
|
|
4
|
+
import "./types-BxJzdNur.js";
|
|
5
|
+
import "./base-signer-DttMQOKx.js";
|
|
6
|
+
import "./types-BSRyQBTx.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";
|
|
@@ -18535,6 +18535,46 @@ interface Permission {
|
|
|
18535
18535
|
/** Validity window length in days from {@link Permission.startTimestamp}. */
|
|
18536
18536
|
durationDays: number;
|
|
18537
18537
|
}
|
|
18538
|
+
/**
|
|
18539
|
+
* Offline `preparePermit` request — `grantPermit`'s parameters split around
|
|
18540
|
+
* the wallet signature. `signer` and `delegator` are explicit addresses, not
|
|
18541
|
+
* read from a connected wallet: preparing works without a configured signer,
|
|
18542
|
+
* which is the point of the offline flow.
|
|
18543
|
+
*/
|
|
18544
|
+
interface PreparePermitRequest {
|
|
18545
|
+
/** Address that will sign the returned EIP-712 typed data. */
|
|
18546
|
+
signer: Address;
|
|
18547
|
+
/** Contract addresses to authorize. Maximum {@link MAX_CONTRACTS_PER_PERMIT} — no chunking. */
|
|
18548
|
+
contracts: readonly Address[];
|
|
18549
|
+
/** Delegator address, for a delegated permit. Omit for a self permit. */
|
|
18550
|
+
delegator?: Address;
|
|
18551
|
+
/** Permit validity window in days. Defaults to the SDK's configured `permitTTL`. */
|
|
18552
|
+
durationDays?: number;
|
|
18553
|
+
}
|
|
18554
|
+
/**
|
|
18555
|
+
* Offline permit flow, phase 1 output — the unsigned EIP-712 typed data
|
|
18556
|
+
* {@link registerPermit} needs to verify and persist the signature an
|
|
18557
|
+
* out-of-process signer returns for it.
|
|
18558
|
+
*
|
|
18559
|
+
* Deliberately minimal: `chainId`, `contracts`, `startTimestamp`,
|
|
18560
|
+
* `durationDays`, and the transport public key are all readable off
|
|
18561
|
+
* {@link eip712}'s `domain`/`message` directly (and, once registered, off the
|
|
18562
|
+
* signature-verified payload) — carrying separate top-level copies would only
|
|
18563
|
+
* create two sources of truth that could disagree. Read them from `eip712`
|
|
18564
|
+
* for display/logging use.
|
|
18565
|
+
*
|
|
18566
|
+
* `version` pins the permit shape (`1` while the SDK targets protocol ≤0.13)
|
|
18567
|
+
* so a future V2 flow is additive, not breaking. JSON-safe — ships across a
|
|
18568
|
+
* process boundary as-is.
|
|
18569
|
+
*/
|
|
18570
|
+
interface PreparedPermit {
|
|
18571
|
+
/** Permit format version. Always `1` while the SDK targets protocol ≤0.13. */
|
|
18572
|
+
version: 1;
|
|
18573
|
+
/** The EIP-712 typed data to sign with `eth_signTypedData_v4`. */
|
|
18574
|
+
eip712: SerializedPermitEip712;
|
|
18575
|
+
/** Address expected to sign {@link eip712}. */
|
|
18576
|
+
signerAddress: ChecksummedAddress;
|
|
18577
|
+
}
|
|
18538
18578
|
//#endregion
|
|
18539
18579
|
//#region src/errors/base.d.ts
|
|
18540
18580
|
/**
|
|
@@ -18567,6 +18607,8 @@ declare const ZamaErrorCode: {
|
|
|
18567
18607
|
readonly TransportKeyPairExpired: "KEYPAIR_EXPIRED";
|
|
18568
18608
|
/** Relayer rejected transport key pair (stale, expired, or malformed). */
|
|
18569
18609
|
readonly InvalidTransportKeyPair: "INVALID_KEYPAIR";
|
|
18610
|
+
/** The permit's KMS context was revoked on-chain; the SDK's evict-and-regrant retry also failed. */
|
|
18611
|
+
readonly RevokedKmsContext: "REVOKED_KMS_CONTEXT";
|
|
18570
18612
|
/** No FHE ciphertext exists for this account (never shielded). */
|
|
18571
18613
|
readonly NoCiphertext: "NO_CIPHERTEXT";
|
|
18572
18614
|
/** Relayer HTTP request failed. */
|
|
@@ -18617,6 +18659,12 @@ declare const ZamaErrorCode: {
|
|
|
18617
18659
|
readonly WalletAccountNotReady: "WALLET_ACCOUNT_NOT_READY";
|
|
18618
18660
|
/** Wrapping or unwrapping the transport private key with `transportKeyPairDerivationSecret` failed. */
|
|
18619
18661
|
readonly KeyWrappingFailed: "KEY_WRAPPING_FAILED";
|
|
18662
|
+
/** The transport key pair changed between `preparePermit` and `registerPermit`. */
|
|
18663
|
+
readonly TransportKeyPairChanged: "TRANSPORT_KEY_PAIR_CHANGED";
|
|
18664
|
+
/** A prepared permit's `chainId` does not match the chain `registerPermit` is running against. */
|
|
18665
|
+
readonly PreparedPermitChainMismatch: "PREPARED_PERMIT_CHAIN_MISMATCH";
|
|
18666
|
+
/** A prepared permit's validity window elapsed before its signature was registered. */
|
|
18667
|
+
readonly PreparedPermitExpired: "PREPARED_PERMIT_EXPIRED";
|
|
18620
18668
|
};
|
|
18621
18669
|
/** Union of all {@link ZamaErrorCode} string values. */
|
|
18622
18670
|
type ZamaErrorCode = (typeof ZamaErrorCode)[keyof typeof ZamaErrorCode];
|
|
@@ -18720,6 +18768,19 @@ declare class TransportKeyPairExpiredError extends ZamaError {
|
|
|
18720
18768
|
declare class InvalidTransportKeyPairError extends ZamaError {
|
|
18721
18769
|
constructor(message: string, options?: ErrorOptions);
|
|
18722
18770
|
}
|
|
18771
|
+
/**
|
|
18772
|
+
* The permit's KMS context has been revoked on-chain, so the permit (and every
|
|
18773
|
+
* other permit signed under that context) is permanently unusable. The SDK
|
|
18774
|
+
* already tried to self-heal before surfacing this. Check `cause` to tell why
|
|
18775
|
+
* it failed: a `SigningFailedError` means the configured signer could not
|
|
18776
|
+
* produce a new permit, waiting will not help, establish a new permit with a
|
|
18777
|
+
* working signer. Any other cause means the retry hit the same revoked
|
|
18778
|
+
* context, typically because the upstream validity check caches a stale
|
|
18779
|
+
* "valid" verdict for up to 15 minutes; wait out that window and retry.
|
|
18780
|
+
*/
|
|
18781
|
+
declare class RevokedKmsContextError extends ZamaError {
|
|
18782
|
+
constructor(message: string, options?: ErrorOptions);
|
|
18783
|
+
}
|
|
18723
18784
|
/** No FHE ciphertext exists for this account (never shielded). */
|
|
18724
18785
|
declare class NoCiphertextError extends ZamaError {
|
|
18725
18786
|
constructor(message: string, options?: ErrorOptions);
|
|
@@ -18733,6 +18794,36 @@ declare class NoCiphertextError extends ZamaError {
|
|
|
18733
18794
|
declare class KeyWrappingError extends ZamaError {
|
|
18734
18795
|
constructor(message: string, options?: ErrorOptions);
|
|
18735
18796
|
}
|
|
18797
|
+
/**
|
|
18798
|
+
* The transport key pair changed between `preparePermit` and `registerPermit`
|
|
18799
|
+
* (expired, evicted, or rotated in between). The prepared EIP-712 payload was
|
|
18800
|
+
* signed against the old key pair's public key — registering it under a
|
|
18801
|
+
* different one would persist a permit bound to the wrong key. Call
|
|
18802
|
+
* `preparePermit` again to rebind the signature request to the current key pair.
|
|
18803
|
+
*/
|
|
18804
|
+
declare class TransportKeyPairChangedError extends ZamaError {
|
|
18805
|
+
constructor(message: string, options?: ErrorOptions);
|
|
18806
|
+
}
|
|
18807
|
+
/**
|
|
18808
|
+
* A prepared permit's `chainId` doesn't match the chain `registerPermit` is
|
|
18809
|
+
* running against. The EIP-712 payload's domain is bound to the chain it was
|
|
18810
|
+
* prepared for; registering it under a different chain would persist a permit
|
|
18811
|
+
* whose signed payload disagrees with its storage scope.
|
|
18812
|
+
*/
|
|
18813
|
+
declare class PreparedPermitChainMismatchError extends ZamaError {
|
|
18814
|
+
/** Chain ID the permit was prepared for. */
|
|
18815
|
+
readonly preparedChainId: number;
|
|
18816
|
+
/** Chain ID `registerPermit` is currently running against. */
|
|
18817
|
+
readonly activeChainId: number;
|
|
18818
|
+
constructor({ preparedChainId, activeChainId }: {
|
|
18819
|
+
preparedChainId: number;
|
|
18820
|
+
activeChainId: number;
|
|
18821
|
+
}, options?: ErrorOptions);
|
|
18822
|
+
}
|
|
18823
|
+
/** A prepared permit's validity window elapsed before its signature was registered. */
|
|
18824
|
+
declare class PreparedPermitExpiredError extends ZamaError {
|
|
18825
|
+
constructor(message: string, options?: ErrorOptions);
|
|
18826
|
+
}
|
|
18736
18827
|
//#endregion
|
|
18737
18828
|
//#region src/errors/delegation.d.ts
|
|
18738
18829
|
/** Delegation cannot target self (delegate === msg.sender). */
|
|
@@ -19023,6 +19114,8 @@ interface ErrorForCode {
|
|
|
19023
19114
|
[ZamaErrorCode.TransportKeyPairExpired]: TransportKeyPairExpiredError;
|
|
19024
19115
|
/** Thrown for {@link ZamaErrorCode.InvalidTransportKeyPair}. */
|
|
19025
19116
|
[ZamaErrorCode.InvalidTransportKeyPair]: InvalidTransportKeyPairError;
|
|
19117
|
+
/** Thrown for {@link ZamaErrorCode.RevokedKmsContext}. */
|
|
19118
|
+
[ZamaErrorCode.RevokedKmsContext]: RevokedKmsContextError;
|
|
19026
19119
|
/** Thrown for {@link ZamaErrorCode.NoCiphertext}. */
|
|
19027
19120
|
[ZamaErrorCode.NoCiphertext]: NoCiphertextError;
|
|
19028
19121
|
/** Thrown for {@link ZamaErrorCode.RelayerRequestFailed}. */
|
|
@@ -19073,6 +19166,12 @@ interface ErrorForCode {
|
|
|
19073
19166
|
[ZamaErrorCode.WalletAccountNotReady]: WalletAccountNotReadyError;
|
|
19074
19167
|
/** Thrown for {@link ZamaErrorCode.KeyWrappingFailed}. */
|
|
19075
19168
|
[ZamaErrorCode.KeyWrappingFailed]: KeyWrappingError;
|
|
19169
|
+
/** Thrown for {@link ZamaErrorCode.TransportKeyPairChanged}. */
|
|
19170
|
+
[ZamaErrorCode.TransportKeyPairChanged]: TransportKeyPairChangedError;
|
|
19171
|
+
/** Thrown for {@link ZamaErrorCode.PreparedPermitChainMismatch}. */
|
|
19172
|
+
[ZamaErrorCode.PreparedPermitChainMismatch]: PreparedPermitChainMismatchError;
|
|
19173
|
+
/** Thrown for {@link ZamaErrorCode.PreparedPermitExpired}. */
|
|
19174
|
+
[ZamaErrorCode.PreparedPermitExpired]: PreparedPermitExpiredError;
|
|
19076
19175
|
}
|
|
19077
19176
|
/**
|
|
19078
19177
|
* Pattern-match on a {@link ZamaError} by its error code. Each handler receives the
|
|
@@ -19179,6 +19278,23 @@ declare class Permits {
|
|
|
19179
19278
|
* unwrap. {@link KeyWrappingError}
|
|
19180
19279
|
*/
|
|
19181
19280
|
warmTransportKeyPair(): Promise<void>;
|
|
19281
|
+
/**
|
|
19282
|
+
* Offline permit flow, phase 2: verify and persist the signature an
|
|
19283
|
+
* out-of-process signer produced for a `sdk.offline.preparePermit` payload.
|
|
19284
|
+
*
|
|
19285
|
+
* No wallet account required: the permit is scoped by `prepared.signerAddress`
|
|
19286
|
+
* (and `prepared.delegatorAddress`, if present), not a connected signer.
|
|
19287
|
+
*
|
|
19288
|
+
* @param prepared - The payload `sdk.offline.preparePermit` returned.
|
|
19289
|
+
* @param signature - The 65-byte `eth_signTypedData_v4` signature over `prepared.eip712`.
|
|
19290
|
+
* @throws if `prepared` doesn't match the `PreparedPermit` shape (e.g. it crossed a
|
|
19291
|
+
* process boundary and was corrupted). {@link ConfigurationError}
|
|
19292
|
+
* @throws if the chain embedded in `prepared.eip712` doesn't match the active chain. {@link PreparedPermitChainMismatchError}
|
|
19293
|
+
* @throws if the permit's validity window has already elapsed. {@link PreparedPermitExpiredError}
|
|
19294
|
+
* @throws if the transport key pair changed since prepare. {@link TransportKeyPairChangedError}
|
|
19295
|
+
* @throws if the signature is invalid or malformed. {@link SigningFailedError}
|
|
19296
|
+
*/
|
|
19297
|
+
registerPermit(prepared: PreparedPermit, signature: Hex): Promise<void>;
|
|
19182
19298
|
/**
|
|
19183
19299
|
* Wipe FHE permits for the current signer.
|
|
19184
19300
|
*
|
|
@@ -19387,6 +19503,31 @@ declare class Offline {
|
|
|
19387
19503
|
prepare<K extends TransactionKind>(request: Extract<PrepareTransactionRequest, {
|
|
19388
19504
|
kind: K;
|
|
19389
19505
|
}>, options?: PrepareOptions): Promise<PreparedFor<K>>;
|
|
19506
|
+
/**
|
|
19507
|
+
* Build the offline-signing payload for a decryption permit: the unsigned
|
|
19508
|
+
* EIP-712 typed data plus everything `sdk.permits.registerPermit` needs to
|
|
19509
|
+
* verify and persist the signature an out-of-process signer returns for it.
|
|
19510
|
+
*
|
|
19511
|
+
* Not a `prepare()` transaction kind: a permit is not a transaction —
|
|
19512
|
+
* nothing is broadcast, and registering the signature is a local operation,
|
|
19513
|
+
* not a relayer round-trip.
|
|
19514
|
+
*
|
|
19515
|
+
* Signer-optional, like {@link prepare}: `request.signer` is an explicit
|
|
19516
|
+
* address, not a connected wallet account. Building the typed data still
|
|
19517
|
+
* reads the chain's KMS signers context on-chain — signer-offline, not
|
|
19518
|
+
* network-offline.
|
|
19519
|
+
*
|
|
19520
|
+
* One permit per call: unlike `sdk.permits.grantPermit`, this never widens
|
|
19521
|
+
* an existing permit or chunks over 10 contracts — `request.contracts` maps
|
|
19522
|
+
* to exactly one signature.
|
|
19523
|
+
*
|
|
19524
|
+
* @throws if `request.contracts` is empty or exceeds 10 addresses, `request.delegator`
|
|
19525
|
+
* equals `request.signer`, or `request.durationDays` exceeds the V1 permit maximum
|
|
19526
|
+
* of 365 days. {@link ConfigurationError}
|
|
19527
|
+
* @throws if a concurrent `permits.revokeTransportKeyPair()` rotates the transport key
|
|
19528
|
+
* pair while this call is generating one. {@link TransportKeyPairChangedError}
|
|
19529
|
+
*/
|
|
19530
|
+
preparePermit(request: PreparePermitRequest): Promise<PreparedPermit>;
|
|
19390
19531
|
}
|
|
19391
19532
|
//#endregion
|
|
19392
19533
|
//#region src/token/token.d.ts
|
|
@@ -19516,12 +19657,14 @@ declare class Token {
|
|
|
19516
19657
|
* addresses in a single wallet signature, then delegates each decrypt to
|
|
19517
19658
|
* `sdk.decryption.decryptValues`.
|
|
19518
19659
|
*
|
|
19519
|
-
* Tokens that fail to decrypt land in `errors
|
|
19520
|
-
* whole batch — caller decides how to surface them.
|
|
19660
|
+
* Tokens that fail to decrypt land in `errors`; the batch keeps going.
|
|
19521
19661
|
*
|
|
19522
19662
|
* @param tokens - Array of {@link Token} instances bound to the same SDK.
|
|
19523
19663
|
* @param owner - Balance owner address.
|
|
19524
19664
|
* @returns `{ results, errors }` partitioning the per-token outcomes.
|
|
19665
|
+
* @throws A failure that affects the whole session (rejected signature,
|
|
19666
|
+
* misconfiguration, RPC rate limit, key unwrapping failure, revoked KMS
|
|
19667
|
+
* context) rejects the call instead of landing in `errors`.
|
|
19525
19668
|
*
|
|
19526
19669
|
* @example
|
|
19527
19670
|
* ```ts
|
|
@@ -19545,6 +19688,9 @@ declare class Token {
|
|
|
19545
19688
|
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
19546
19689
|
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
19547
19690
|
* @throws if any decryption fails and no `onError` is provided. {@link DecryptionFailedError}
|
|
19691
|
+
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
19692
|
+
* rate limit, revoked KMS context) rejects the call even when `onError` is
|
|
19693
|
+
* provided.
|
|
19548
19694
|
*
|
|
19549
19695
|
* @example
|
|
19550
19696
|
* ```ts
|
|
@@ -20642,6 +20788,9 @@ declare class Decryption {
|
|
|
20642
20788
|
* @returns Per-entry results, each with a value or an error.
|
|
20643
20789
|
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
20644
20790
|
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
20791
|
+
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
20792
|
+
* rate limit, revoked KMS context) rejects the call instead of landing in a
|
|
20793
|
+
* per-entry error.
|
|
20645
20794
|
*
|
|
20646
20795
|
* @example
|
|
20647
20796
|
* ```ts
|
|
@@ -20756,5 +20905,5 @@ declare const ZERO_ENCRYPTED_VALUE: "0x00000000000000000000000000000000000000000
|
|
|
20756
20905
|
*/
|
|
20757
20906
|
declare function isEncryptedValueZero(encryptedValue: string): boolean;
|
|
20758
20907
|
//#endregion
|
|
20759
|
-
export { InsufficientConfidentialBalanceError as $,
|
|
20760
|
-
//# sourceMappingURL=index-
|
|
20908
|
+
export { InsufficientConfidentialBalanceError as $, supportsInterfaceContract as $t, BatchDecryptAsOptions as A, SerializedPermitEip712 as At, SigningRejectedError as B, getTokenPairsLengthContract as Bt, ZamaSDKOptions as C, ZamaErrorCode as Ct, WrappersRegistryConfig as D, PreparePermitRequest as Dt, WrappersRegistry as E, Permission as Et, Permits as F, TokenWrapperPairWithMetadata as Ft, RpcRateLimitError as G, isHandleDelegatedContract as Gt, SignerRequiredError as H, isConfidentialTokenValidContract as Ht, ErrorForCode as I, getConfidentialTokenAddressContract as It, RelayerRequestFailedError as J, ERC1363_INTERFACE_ID as Jt, NotEntitledError as K, revokeDelegationContract as Kt, matchZamaError as L, getTokenAddressContract as Lt, Offline as M, ChecksummedAddress as Mt, Delegations as N, PaginatedResult as Nt, WrappedToken as O, PreparedPermit as Ot, DelegationStatus as P, TokenWrapperPair as Pt, InsufficientAllowanceError as Q, isConfidentialWrapperContract as Qt, TransactionRevertedError as R, getTokenPairContract as Rt, ZamaSDK as S, ZamaError as St, ListPairsOptions as T, retryAfterSeconds as Tt, WalletAccountNotReadyError as U, delegateForUserDecryptionContract as Ut, SignerNotConfiguredError as V, getTokenPairsSliceContract as Vt, WalletNotConnectedError as W, getDelegationExpiryContract as Wt, BalanceErrorDetails as X, ERC7984_WRAPPER_INTERFACE_ID as Xt, BalanceCheckUnavailableError as Y, ERC7984_INTERFACE_ID as Yt, ERC20ReadFailedError as Z, isConfidentialTokenContract as Zt, decryptValuesQueryOptions as _, unwrapFromBalanceContract as _n, PreparedPermitExpiredError as _t, ChromeSessionStorage as a, symbolContract as an, DelegationCooldownError as at, MutationFactoryOptions as b, TransportKeyPairExpiredError as bt, indexedDBStorage as c, confidentialTransferContract as cn, DelegationExpiredError as ct, Decryption as d, inferredTotalSupplyContract as dn, DelegationNotPropagatedError as dt, allowanceContract as en, InsufficientERC20BalanceError as et, BatchDecryptItem as f, isOperatorContract as fn, DelegationSelfNotAllowedError as ft, EncryptedInput as g, unwrapContract as gn, PreparedPermitChainMismatchError as gt, DecryptResult as h, underlyingContract as hn, NoCiphertextError as ht, isEncryptedValueZero as i, nameContract as in, DelegationContractIsSelfError as it, Token as j, SerializedTransportKeyPair as jt, BatchBalancesResult as k, SerializedPermit as kt, MemoryStorage as l, confidentialTransferFromContract as ln, DelegationExpiryUnchangedError as lt, DelegatedDecryptOptions as m, setOperatorContract as mn, KeyWrappingError as mt, Hex$1 as n, balanceOfContract as nn, EncryptionFailedError as nt, chromeSessionStorage as o, confidentialBalanceOfContract as on, DelegationDelegateEqualsContractError as ot, BatchDecryptResult as p, rateContract as pn, InvalidTransportKeyPairError as pt, ConfigurationError as q, transferAndCallContract as qt, ZERO_ENCRYPTED_VALUE as r, decimalsContract as rn, AclPausedError as rt, IndexedDBStorage as s, confidentialTotalSupplyContract as sn, DelegationExpirationTooSoonError as st, Address$1 as t, approveContract as tn, DecryptionFailedError as tt, memoryStorage as u, finalizeUnwrapContract as un, DelegationNotFoundError as ut, SignerQueryContext as v, wrapContract as vn, RevokedKmsContextError as vt, DefaultRegistryAddresses as w, isRetryable as wt, QueryFactoryOptions as x, ChainMismatchError as xt, zamaQueryKeys as y, createConfig as yn, TransportKeyPairChangedError as yt, SigningFailedError as z, getTokenPairsContract as zt };
|
|
20909
|
+
//# sourceMappingURL=index-COrLsVKC.d.ts.map
|
|
@@ -17,7 +17,7 @@ type FheChainAuth = {
|
|
|
17
17
|
* Complete chain configuration — the single source of truth for
|
|
18
18
|
* per-chain FHE contract addresses and network settings.
|
|
19
19
|
*
|
|
20
|
-
* All built-in presets (`mainnet`, `sepolia`, `polygonAmoy`, `hoodi`,
|
|
20
|
+
* All built-in presets (`mainnet`, `polygon`, `sepolia`, `polygonAmoy`, `hoodi`,
|
|
21
21
|
* `ingenTestnet`, `bscTestnet`, `hardhat`) are `FheChain` objects exported from
|
|
22
22
|
* `@zama-fhe/sdk/chains`.
|
|
23
23
|
*/
|
|
@@ -77,6 +77,21 @@ declare const mainnet: {
|
|
|
77
77
|
readonly verifyingContractAddressInputVerification: "0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287";
|
|
78
78
|
readonly registryAddress: "0xeb5015fF021DB115aCe010f23F55C2591059bBA0";
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Polygon mainnet network configuration (chainId 137).
|
|
82
|
+
*/
|
|
83
|
+
declare const polygon: {
|
|
84
|
+
readonly id: 137;
|
|
85
|
+
readonly gatewayChainId: 261131;
|
|
86
|
+
readonly relayerUrl: "https://relayer.mainnet.zama.org";
|
|
87
|
+
readonly network: "https://polygon-bor-rpc.publicnode.com";
|
|
88
|
+
readonly aclContractAddress: "0x6737F17e31cf26a1b62fb0362acC5a16CB156F49";
|
|
89
|
+
readonly kmsContractAddress: "0x14e609595474874Dd6b6128376E336EfADfdBE37";
|
|
90
|
+
readonly inputVerifierContractAddress: "0xf40BD204B035522EaAc8E5afAdc55113Acac96ca";
|
|
91
|
+
readonly verifyingContractAddressDecryption: "0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24";
|
|
92
|
+
readonly verifyingContractAddressInputVerification: "0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287";
|
|
93
|
+
readonly registryAddress: "0xc8908569868758dAF814B5a8b96bBc44D1653d54";
|
|
94
|
+
};
|
|
80
95
|
/**
|
|
81
96
|
* Sepolia testnet network configuration (chainId 11155111).
|
|
82
97
|
*/
|
|
@@ -201,5 +216,5 @@ declare const anvil: {
|
|
|
201
216
|
*/
|
|
202
217
|
declare const chains: Record<number, FheChain>;
|
|
203
218
|
//#endregion
|
|
204
|
-
export { hoodi as a,
|
|
205
|
-
//# sourceMappingURL=index-
|
|
219
|
+
export { hoodi as a, polygon as c, AtLeastOneChain as d, FheChain as f, hardhat as i, polygonAmoy as l, bscTestnet as n, ingenTestnet as o, FheChainAuth as p, chains as r, mainnet as s, anvil as t, sepolia as u };
|
|
220
|
+
//# sourceMappingURL=index-ijgDL4IC.d.ts.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as hoodi, c as
|
|
2
|
-
import { $ as TransactionErrorEvent, $t as DecryptValuesParameters, A as WalletAccountListener, At as Topics, B as ApproveUnderlyingSubmittedEvent, Bt as decodeRevokedDelegationForUserDecryption, C as TransferAndCallRequest, Ct as AclEvent, D as GenericSigner, Dt as OnChainEvent, E as WrapRequest, Et as DelegatedForUserDecryptionEvent, F as ReadContractReturnType, Ft as decodeAclEvents, G as DelegationSubmittedEvent, Gt as findRevokedDelegationForUserDecryption, H as DecryptEndEvent, Ht as decodeUnwrapRequested, I as ReadFunctionName, It as decodeConfidentialTransfer, J as EncryptStartEvent, Jt as RawLog, K as EncryptEndEvent, Kt as findUnwrapRequested, L as WriteContractArgs, Lt as decodeDelegatedForUserDecryption, M as ContractAbi, Mt as UnwrapRequestedEvent, N as ReadContractArgs, Nt as WrapEvent, O as WalletAccount, Ot as RevokedDelegationForUserDecryptionEvent, P as ReadContractConfig, Pt as decodeAclEvent, Q as ShieldSubmittedEvent, Qt as DecryptPublicValuesResult, R as WriteContractConfig, Rt as decodeOnChainEvent, S as TransactionKind, St as ACL_TOPICS, T as UnwrapRequest, Tt as ConfidentialTransferEvent, U as DecryptErrorEvent, Ut as decodeWrap, V as BaseEvent, Vt as decodeUnwrapFinalized, W as DecryptStartEvent, Wt as findDelegatedForUserDecryption, X as RevokeDelegationSubmittedEvent, Xt as TransactionResult, Y as FinalizeUnwrapSubmittedEvent, Yt as TransactionReceipt, Z as SetOperatorSubmittedEvent, Zt as ClearValue, _ as PrepareTransactionRequest, _t as UnwrapResult, a as ZamaConfigBase, an as FhevmClient, at as UnshieldPhase2SubmittedEvent, b as RevokeDelegationRequest, bt as TransferCallbacks, c as GenericStorage, cn as FhevmRuntimeConfig, ct as ZamaSDKEvent, d as ConfidentialTransferFromRequest, dn as TypedValue, dt as ZamaSDKEvents, en as EIP712TypedData, et as TransactionOperation, f as ConfidentialTransferRequest, ft as ApprovalStrategy, g as PrepareOptions, gt as UnshieldOptions, h as PrepareFees, ht as TransferOptions, i as ZamaConfig, in as EncryptedValue, it as UnshieldPhase2StartedEvent, j as WalletAccountStore, jt as UnwrapFinalizedEvent, k as WalletAccountChange, kt as TOKEN_TOPICS, l as GenericProvider, ln as RelayerOptions, lt as ZamaSDKEventListener, m as FinalizeUnwrapRequest, mt as ShieldPath, n as RelayerConfig, nn as EncryptParams, nt as TransferSubmittedEvent, o as ZamaConfigGeneric, on as FhevmClientOptions, ot as UnwrapSubmittedEvent, p as DelegateDecryptionRequest, pt as ShieldOptions, q as EncryptErrorEvent, qt as findWrap, rn as EncryptResult, rt as UnshieldPhase1SubmittedEvent, s as GenericLogger, sn as FhevmRelayerOptions, st as WrapSubmittedEvent, t as CleartextRelayerConfig, tn as EncryptInput, tt as TransferFromSubmittedEvent, u as ApproveUnderlyingRequest, un as RelayerSDK, ut as ZamaSDKEventType, v as PreparedFor, vt as WrapOptions, w as UnwrapAllRequest, wt as AclTopics, x as SetOperatorRequest, xt as UnshieldCallbacks, y as PreparedTransaction, yt as ShieldCallbacks, z as WriteFunctionName, zt as decodeOnChainEvents } from "./types-
|
|
3
|
-
import { t as cleartext } from "./cleartext-
|
|
4
|
-
import { t as ZamaConfigEthers } from "./types-
|
|
5
|
-
import { n as MutableWalletAccountStore, r as createWalletAccountStore, t as BaseSigner } from "./base-signer-
|
|
6
|
-
import { $ as InsufficientConfidentialBalanceError, $t as
|
|
7
|
-
import { t as ZamaConfigViem } from "./types-
|
|
8
|
-
export { ACL_TOPICS, type AclEvent, AclPausedError, AclTopics, type Address, type ApprovalStrategy, type ApproveUnderlyingRequest, type ApproveUnderlyingSubmittedEvent, type AtLeastOneChain, BalanceCheckUnavailableError, type BalanceErrorDetails, type BaseEvent, BaseSigner, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptItem, type BatchDecryptResult, ChainMismatchError, type ChecksummedAddress, ChromeSessionStorage, type ClearValue, type CleartextRelayerConfig, type ConfidentialTransferEvent, type ConfidentialTransferFromRequest, type ConfidentialTransferRequest, ConfigurationError, type ContractAbi, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type DecryptValuesParameters, Decryption, DecryptionFailedError, DefaultRegistryAddresses, type DelegateDecryptionRequest, type DelegatedDecryptOptions, type DelegatedForUserDecryptionEvent, DelegationContractIsSelfError, DelegationCooldownError, DelegationDelegateEqualsContractError, DelegationExpirationTooSoonError, DelegationExpiredError, DelegationExpiryUnchangedError, DelegationNotFoundError, DelegationNotPropagatedError, DelegationSelfNotAllowedError, type DelegationStatus, type DelegationSubmittedEvent, Delegations, type EIP712TypedData, ERC1363_INTERFACE_ID, ERC20ReadFailedError, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, EncryptionFailedError, type ErrorForCode, type FheChain, type FheChainAuth, type FhevmClient, type FhevmClientOptions, type FhevmRelayerOptions, type FhevmRuntimeConfig, type FinalizeUnwrapRequest, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type Hex, IndexedDBStorage, InsufficientAllowanceError, InsufficientConfidentialBalanceError, InsufficientERC20BalanceError, InvalidTransportKeyPairError, KeyWrappingError, type ListPairsOptions, MemoryStorage, MutableWalletAccountStore, NoCiphertextError, NotEntitledError, Offline, type OnChainEvent, type PaginatedResult, type Permission, Permits, type PrepareFees, type PrepareOptions, type PrepareTransactionRequest, type PreparedFor, type PreparedTransaction, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RelayerConfig, type RelayerOptions, RelayerRequestFailedError, type RelayerSDK, type RevokeDelegationRequest, type RevokeDelegationSubmittedEvent, type RevokedDelegationForUserDecryptionEvent, RpcRateLimitError, type SerializedPermit, type SerializedPermitEip712, type SerializedTransportKeyPair, type SetOperatorRequest, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldPath, type ShieldSubmittedEvent, SignerNotConfiguredError, SignerRequiredError, SigningFailedError, SigningRejectedError, TOKEN_TOPICS, Token, type TokenWrapperPair, type TokenWrapperPairWithMetadata, Topics, type TransactionErrorEvent, type TransactionKind, type TransactionOperation, type TransactionReceipt, type TransactionResult, TransactionRevertedError, type TransferAndCallRequest, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, TransportKeyPairExpiredError, type TypedValue, type UnshieldCallbacks, type UnshieldOptions, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapAllRequest, type UnwrapFinalizedEvent, type UnwrapRequest, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, WalletAccountNotReadyError, type WalletAccountStore, WalletNotConnectedError, type WrapEvent, type WrapOptions, type WrapRequest, type WrapSubmittedEvent, WrappedToken, WrappersRegistry, type WrappersRegistryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, ZERO_ENCRYPTED_VALUE, type ZamaConfig, type ZamaConfigBase, type ZamaConfigEthers, type ZamaConfigGeneric, type ZamaConfigViem, ZamaError, ZamaErrorCode, ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, type ZamaSDKOptions, allowanceContract, anvil, approveContract, balanceOfContract, bscTestnet, chains, chromeSessionStorage, cleartext, confidentialBalanceOfContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, createConfig, createWalletAccountStore, decimalsContract, decodeAclEvent, decodeAclEvents, decodeConfidentialTransfer, decodeDelegatedForUserDecryption, decodeOnChainEvent, decodeOnChainEvents, decodeRevokedDelegationForUserDecryption, decodeUnwrapFinalized, decodeUnwrapRequested, decodeWrap, delegateForUserDecryptionContract, finalizeUnwrapContract, findDelegatedForUserDecryption, findRevokedDelegationForUserDecryption, findUnwrapRequested, findWrap, getConfidentialTokenAddressContract, getDelegationExpiryContract, getTokenAddressContract, getTokenPairContract, getTokenPairsContract, getTokenPairsLengthContract, getTokenPairsSliceContract, hardhat, hoodi, indexedDBStorage, inferredTotalSupplyContract, ingenTestnet, isConfidentialTokenContract, isConfidentialTokenValidContract, isConfidentialWrapperContract, isEncryptedValueZero, isHandleDelegatedContract, isOperatorContract, isRetryable, mainnet, matchZamaError, memoryStorage, nameContract, polygonAmoy, rateContract, retryAfterSeconds, revokeDelegationContract, sepolia, setOperatorContract, supportsInterfaceContract, symbolContract, transferAndCallContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract };
|
|
1
|
+
import { a as hoodi, c as polygon, d as AtLeastOneChain, f as FheChain, i as hardhat, l as polygonAmoy, n as bscTestnet, o as ingenTestnet, p as FheChainAuth, r as chains, s as mainnet, t as anvil, u as sepolia } from "./index-ijgDL4IC.js";
|
|
2
|
+
import { $ as TransactionErrorEvent, $t as DecryptValuesParameters, A as WalletAccountListener, At as Topics, B as ApproveUnderlyingSubmittedEvent, Bt as decodeRevokedDelegationForUserDecryption, C as TransferAndCallRequest, Ct as AclEvent, D as GenericSigner, Dt as OnChainEvent, E as WrapRequest, Et as DelegatedForUserDecryptionEvent, F as ReadContractReturnType, Ft as decodeAclEvents, G as DelegationSubmittedEvent, Gt as findRevokedDelegationForUserDecryption, H as DecryptEndEvent, Ht as decodeUnwrapRequested, I as ReadFunctionName, It as decodeConfidentialTransfer, J as EncryptStartEvent, Jt as RawLog, K as EncryptEndEvent, Kt as findUnwrapRequested, L as WriteContractArgs, Lt as decodeDelegatedForUserDecryption, M as ContractAbi, Mt as UnwrapRequestedEvent, N as ReadContractArgs, Nt as WrapEvent, O as WalletAccount, Ot as RevokedDelegationForUserDecryptionEvent, P as ReadContractConfig, Pt as decodeAclEvent, Q as ShieldSubmittedEvent, Qt as DecryptPublicValuesResult, R as WriteContractConfig, Rt as decodeOnChainEvent, S as TransactionKind, St as ACL_TOPICS, T as UnwrapRequest, Tt as ConfidentialTransferEvent, U as DecryptErrorEvent, Ut as decodeWrap, V as BaseEvent, Vt as decodeUnwrapFinalized, W as DecryptStartEvent, Wt as findDelegatedForUserDecryption, X as RevokeDelegationSubmittedEvent, Xt as TransactionResult, Y as FinalizeUnwrapSubmittedEvent, Yt as TransactionReceipt, Z as SetOperatorSubmittedEvent, Zt as ClearValue, _ as PrepareTransactionRequest, _t as UnwrapResult, a as ZamaConfigBase, an as FhevmClient, at as UnshieldPhase2SubmittedEvent, b as RevokeDelegationRequest, bt as TransferCallbacks, c as GenericStorage, cn as FhevmRuntimeConfig, ct as ZamaSDKEvent, d as ConfidentialTransferFromRequest, dn as TypedValue, dt as ZamaSDKEvents, en as EIP712TypedData, et as TransactionOperation, f as ConfidentialTransferRequest, ft as ApprovalStrategy, g as PrepareOptions, gt as UnshieldOptions, h as PrepareFees, ht as TransferOptions, i as ZamaConfig, in as EncryptedValue, it as UnshieldPhase2StartedEvent, j as WalletAccountStore, jt as UnwrapFinalizedEvent, k as WalletAccountChange, kt as TOKEN_TOPICS, l as GenericProvider, ln as RelayerOptions, lt as ZamaSDKEventListener, m as FinalizeUnwrapRequest, mt as ShieldPath, n as RelayerConfig, nn as EncryptParams, nt as TransferSubmittedEvent, o as ZamaConfigGeneric, on as FhevmClientOptions, ot as UnwrapSubmittedEvent, p as DelegateDecryptionRequest, pt as ShieldOptions, q as EncryptErrorEvent, qt as findWrap, rn as EncryptResult, rt as UnshieldPhase1SubmittedEvent, s as GenericLogger, sn as FhevmRelayerOptions, st as WrapSubmittedEvent, t as CleartextRelayerConfig, tn as EncryptInput, tt as TransferFromSubmittedEvent, u as ApproveUnderlyingRequest, un as RelayerSDK, ut as ZamaSDKEventType, v as PreparedFor, vt as WrapOptions, w as UnwrapAllRequest, wt as AclTopics, x as SetOperatorRequest, xt as UnshieldCallbacks, y as PreparedTransaction, yt as ShieldCallbacks, z as WriteFunctionName, zt as decodeOnChainEvents } from "./types-CuDiV0Wy.js";
|
|
3
|
+
import { t as cleartext } from "./cleartext-Di1DDxqa.js";
|
|
4
|
+
import { t as ZamaConfigEthers } from "./types-BxJzdNur.js";
|
|
5
|
+
import { n as MutableWalletAccountStore, r as createWalletAccountStore, t as BaseSigner } from "./base-signer-DttMQOKx.js";
|
|
6
|
+
import { $ as InsufficientConfidentialBalanceError, $t as supportsInterfaceContract, A as BatchDecryptAsOptions, At as SerializedPermitEip712, B as SigningRejectedError, Bt as getTokenPairsLengthContract, C as ZamaSDKOptions, Ct as ZamaErrorCode, D as WrappersRegistryConfig, Dt as PreparePermitRequest, E as WrappersRegistry, Et as Permission, F as Permits, Ft as TokenWrapperPairWithMetadata, G as RpcRateLimitError, Gt as isHandleDelegatedContract, H as SignerRequiredError, Ht as isConfidentialTokenValidContract, I as ErrorForCode, It as getConfidentialTokenAddressContract, J as RelayerRequestFailedError, Jt as ERC1363_INTERFACE_ID, K as NotEntitledError, Kt as revokeDelegationContract, L as matchZamaError, Lt as getTokenAddressContract, M as Offline, Mt as ChecksummedAddress, N as Delegations, Nt as PaginatedResult, O as WrappedToken, Ot as PreparedPermit, P as DelegationStatus, Pt as TokenWrapperPair, Q as InsufficientAllowanceError, Qt as isConfidentialWrapperContract, R as TransactionRevertedError, Rt as getTokenPairContract, S as ZamaSDK, St as ZamaError, T as ListPairsOptions, Tt as retryAfterSeconds, U as WalletAccountNotReadyError, Ut as delegateForUserDecryptionContract, V as SignerNotConfiguredError, Vt as getTokenPairsSliceContract, W as WalletNotConnectedError, Wt as getDelegationExpiryContract, X as BalanceErrorDetails, Xt as ERC7984_WRAPPER_INTERFACE_ID, Y as BalanceCheckUnavailableError, Yt as ERC7984_INTERFACE_ID, Z as ERC20ReadFailedError, Zt as isConfidentialTokenContract, _n as unwrapFromBalanceContract, _t as PreparedPermitExpiredError, a as ChromeSessionStorage, an as symbolContract, at as DelegationCooldownError, bt as TransportKeyPairExpiredError, c as indexedDBStorage, cn as confidentialTransferContract, ct as DelegationExpiredError, d as Decryption, dn as inferredTotalSupplyContract, dt as DelegationNotPropagatedError, en as allowanceContract, et as InsufficientERC20BalanceError, f as BatchDecryptItem, fn as isOperatorContract, ft as DelegationSelfNotAllowedError, g as EncryptedInput, gn as unwrapContract, gt as PreparedPermitChainMismatchError, h as DecryptResult, hn as underlyingContract, ht as NoCiphertextError, i as isEncryptedValueZero, in as nameContract, it as DelegationContractIsSelfError, j as Token, jt as SerializedTransportKeyPair, k as BatchBalancesResult, kt as SerializedPermit, l as MemoryStorage, ln as confidentialTransferFromContract, lt as DelegationExpiryUnchangedError, m as DelegatedDecryptOptions, mn as setOperatorContract, mt as KeyWrappingError, n as Hex, nn as balanceOfContract, nt as EncryptionFailedError, o as chromeSessionStorage, on as confidentialBalanceOfContract, ot as DelegationDelegateEqualsContractError, p as BatchDecryptResult, pn as rateContract, pt as InvalidTransportKeyPairError, q as ConfigurationError, qt as transferAndCallContract, r as ZERO_ENCRYPTED_VALUE, rn as decimalsContract, rt as AclPausedError, s as IndexedDBStorage, sn as confidentialTotalSupplyContract, st as DelegationExpirationTooSoonError, t as Address, tn as approveContract, tt as DecryptionFailedError, u as memoryStorage, un as finalizeUnwrapContract, ut as DelegationNotFoundError, vn as wrapContract, vt as RevokedKmsContextError, w as DefaultRegistryAddresses, wt as isRetryable, xt as ChainMismatchError, yn as createConfig, yt as TransportKeyPairChangedError, z as SigningFailedError, zt as getTokenPairsContract } from "./index-COrLsVKC.js";
|
|
7
|
+
import { t as ZamaConfigViem } from "./types-BSRyQBTx.js";
|
|
8
|
+
export { ACL_TOPICS, type AclEvent, AclPausedError, AclTopics, type Address, type ApprovalStrategy, type ApproveUnderlyingRequest, type ApproveUnderlyingSubmittedEvent, type AtLeastOneChain, BalanceCheckUnavailableError, type BalanceErrorDetails, type BaseEvent, BaseSigner, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptItem, type BatchDecryptResult, ChainMismatchError, type ChecksummedAddress, ChromeSessionStorage, type ClearValue, type CleartextRelayerConfig, type ConfidentialTransferEvent, type ConfidentialTransferFromRequest, type ConfidentialTransferRequest, ConfigurationError, type ContractAbi, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type DecryptValuesParameters, Decryption, DecryptionFailedError, DefaultRegistryAddresses, type DelegateDecryptionRequest, type DelegatedDecryptOptions, type DelegatedForUserDecryptionEvent, DelegationContractIsSelfError, DelegationCooldownError, DelegationDelegateEqualsContractError, DelegationExpirationTooSoonError, DelegationExpiredError, DelegationExpiryUnchangedError, DelegationNotFoundError, DelegationNotPropagatedError, DelegationSelfNotAllowedError, type DelegationStatus, type DelegationSubmittedEvent, Delegations, type EIP712TypedData, ERC1363_INTERFACE_ID, ERC20ReadFailedError, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, EncryptionFailedError, type ErrorForCode, type FheChain, type FheChainAuth, type FhevmClient, type FhevmClientOptions, type FhevmRelayerOptions, type FhevmRuntimeConfig, type FinalizeUnwrapRequest, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type Hex, IndexedDBStorage, InsufficientAllowanceError, InsufficientConfidentialBalanceError, InsufficientERC20BalanceError, InvalidTransportKeyPairError, KeyWrappingError, type ListPairsOptions, MemoryStorage, MutableWalletAccountStore, NoCiphertextError, NotEntitledError, Offline, type OnChainEvent, type PaginatedResult, type Permission, Permits, type PrepareFees, type PrepareOptions, type PreparePermitRequest, type PrepareTransactionRequest, type PreparedFor, type PreparedPermit, PreparedPermitChainMismatchError, PreparedPermitExpiredError, type PreparedTransaction, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RelayerConfig, type RelayerOptions, RelayerRequestFailedError, type RelayerSDK, type RevokeDelegationRequest, type RevokeDelegationSubmittedEvent, type RevokedDelegationForUserDecryptionEvent, RevokedKmsContextError, RpcRateLimitError, type SerializedPermit, type SerializedPermitEip712, type SerializedTransportKeyPair, type SetOperatorRequest, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldPath, type ShieldSubmittedEvent, SignerNotConfiguredError, SignerRequiredError, SigningFailedError, SigningRejectedError, TOKEN_TOPICS, Token, type TokenWrapperPair, type TokenWrapperPairWithMetadata, Topics, type TransactionErrorEvent, type TransactionKind, type TransactionOperation, type TransactionReceipt, type TransactionResult, TransactionRevertedError, type TransferAndCallRequest, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, TransportKeyPairChangedError, TransportKeyPairExpiredError, type TypedValue, type UnshieldCallbacks, type UnshieldOptions, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapAllRequest, type UnwrapFinalizedEvent, type UnwrapRequest, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, WalletAccountNotReadyError, type WalletAccountStore, WalletNotConnectedError, type WrapEvent, type WrapOptions, type WrapRequest, type WrapSubmittedEvent, WrappedToken, WrappersRegistry, type WrappersRegistryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, ZERO_ENCRYPTED_VALUE, type ZamaConfig, type ZamaConfigBase, type ZamaConfigEthers, type ZamaConfigGeneric, type ZamaConfigViem, ZamaError, ZamaErrorCode, ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, type ZamaSDKOptions, allowanceContract, anvil, approveContract, balanceOfContract, bscTestnet, chains, chromeSessionStorage, cleartext, confidentialBalanceOfContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, createConfig, createWalletAccountStore, decimalsContract, decodeAclEvent, decodeAclEvents, decodeConfidentialTransfer, decodeDelegatedForUserDecryption, decodeOnChainEvent, decodeOnChainEvents, decodeRevokedDelegationForUserDecryption, decodeUnwrapFinalized, decodeUnwrapRequested, decodeWrap, delegateForUserDecryptionContract, finalizeUnwrapContract, findDelegatedForUserDecryption, findRevokedDelegationForUserDecryption, findUnwrapRequested, findWrap, getConfidentialTokenAddressContract, getDelegationExpiryContract, getTokenAddressContract, getTokenPairContract, getTokenPairsContract, getTokenPairsLengthContract, getTokenPairsSliceContract, hardhat, hoodi, indexedDBStorage, inferredTotalSupplyContract, ingenTestnet, isConfidentialTokenContract, isConfidentialTokenValidContract, isConfidentialWrapperContract, isEncryptedValueZero, isHandleDelegatedContract, isOperatorContract, isRetryable, mainnet, matchZamaError, memoryStorage, nameContract, polygon, polygonAmoy, rateContract, retryAfterSeconds, revokeDelegationContract, sepolia, setOperatorContract, supportsInterfaceContract, symbolContract, transferAndCallContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract };
|