@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
package/dist/esm/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as hoodi, c as
|
|
2
|
-
import { Qt as DecryptPublicValuesResult, Zt as ClearValue, c as GenericStorage, cn as FhevmRuntimeConfig, en as EIP712TypedData, in as EncryptedValue, ln as RelayerOptions, n as RelayerConfig, nn as EncryptParams, on as FhevmClientOptions, s as GenericLogger, sn as FhevmRelayerOptions, t as CleartextRelayerConfig, tn as EncryptInput } from "../types-
|
|
3
|
-
import { t as cleartext } from "../cleartext-
|
|
4
|
-
import { i as node, n as asyncLocalStorage, r as NodeRelayerConfig, t as AsyncLocalMapStorage } from "../index-
|
|
5
|
-
export { AsyncLocalMapStorage, type ClearValue, type CleartextRelayerConfig, type DecryptPublicValuesResult, type EIP712TypedData, type EncryptInput, type EncryptParams, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClientOptions, type FhevmRelayerOptions, type FhevmRuntimeConfig, type GenericLogger, type GenericStorage, type NodeRelayerConfig, type RelayerConfig, type RelayerOptions, anvil, asyncLocalStorage, bscTestnet, chains, cleartext, hardhat, hoodi, ingenTestnet, mainnet, node, polygonAmoy, sepolia };
|
|
1
|
+
import { a as hoodi, c as polygon, 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 { Qt as DecryptPublicValuesResult, Zt as ClearValue, c as GenericStorage, cn as FhevmRuntimeConfig, en as EIP712TypedData, in as EncryptedValue, ln as RelayerOptions, n as RelayerConfig, nn as EncryptParams, on as FhevmClientOptions, s as GenericLogger, sn as FhevmRelayerOptions, t as CleartextRelayerConfig, tn as EncryptInput } from "../types-CuDiV0Wy.js";
|
|
3
|
+
import { t as cleartext } from "../cleartext-Di1DDxqa.js";
|
|
4
|
+
import { i as node, n as asyncLocalStorage, r as NodeRelayerConfig, t as AsyncLocalMapStorage } from "../index-C4xKY5Fw.js";
|
|
5
|
+
export { AsyncLocalMapStorage, type ClearValue, type CleartextRelayerConfig, type DecryptPublicValuesResult, type EIP712TypedData, type EncryptInput, type EncryptParams, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClientOptions, type FhevmRelayerOptions, type FhevmRuntimeConfig, type GenericLogger, type GenericStorage, type NodeRelayerConfig, type RelayerConfig, type RelayerOptions, anvil, asyncLocalStorage, bscTestnet, chains, cleartext, hardhat, hoodi, ingenTestnet, mainnet, node, polygon, polygonAmoy, sepolia };
|
package/dist/esm/node/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../fhevm-relayer-
|
|
1
|
+
import{t as e}from"../fhevm-relayer-CTwFyl0v.js";import{t}from"../cleartext-BwzD7uJa.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../chains-ByyCdrrd.js";import{AsyncLocalStorage as f}from"node:async_hooks";function p(t){return{type:`node`,createRelayer:n=>new e({chain:n,options:t})}}var m=class{#e=new f;run(e){return this.#e.run(new Map,e)}async get(e){return this.#e.getStore()?.get(e)??null}async set(e,t){this.#e.getStore()?.set(e,t)}async delete(e){this.#e.getStore()?.delete(e)}};const h=new m;export{m as AsyncLocalMapStorage,u as anvil,h as asyncLocalStorage,o as bscTestnet,c as chains,t as cleartext,i as hardhat,n as hoodi,s as ingenTestnet,l as mainnet,p as node,r as polygon,a as polygonAmoy,d as sepolia};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["#als"],"sources":["../../../src/node/config.ts","../../../src/storage/async-local-storage.ts"],"sourcesContent":["import type { FheChain } from \"../chains/types\";\nimport type { RelayerConfig } from \"../config/types\";\nimport { FhevmRelayer } from \"../relayer/fhevm-relayer\";\nimport type { RelayerOptions } from \"../relayer/types\";\n\n/** Node transport — drives the FHE backend directly on the calling thread. */\nexport interface NodeRelayerConfig extends RelayerConfig {\n /** Discriminant for the node transport. */\n readonly type: \"node\";\n /** @internal */\n readonly createRelayer: (chain: FheChain) => FhevmRelayer;\n}\n\n/**\n * Node.js transport — drives `@fhevm/sdk` via {@link FhevmRelayer} on the calling thread.\n *\n * @example\n * ```ts\n * relayers: {\n * [sepolia.id]: node({ timeout: 5 * 60_000 }),\n * [mainnet.id]: node({ batchRpcCalls: true }),\n * }\n * ```\n */\nexport function node(options?: RelayerOptions): NodeRelayerConfig {\n return { type: \"node\", createRelayer: (chain) => new FhevmRelayer({ chain, options }) };\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { GenericStorage } from \"../types\";\n\n/**\n * {@link GenericStorage} backed by Node.js {@link AsyncLocalStorage}.\n *\n * Each async context (e.g. HTTP request) gets its own isolated `Map`,\n * so credentials from one request never leak into another.\n *\n * Call {@link run} to establish a context before using the SDK:\n *\n * ```ts\n * import { asyncLocalStorage } from \"@zama-fhe/sdk/node\";\n *\n * app.post(\"/api/transfer\", (req, res) => {\n * asyncLocalStorage.run(async () => {\n * const sdk = new ZamaSDK({ relayer, signer, storage: asyncLocalStorage });\n * // credentials are scoped to this request\n * });\n * });\n * ```\n */\nexport class AsyncLocalMapStorage implements GenericStorage {\n readonly #als = new AsyncLocalStorage<Map<string, unknown>>();\n\n /** Execute `fn` within an isolated storage context. */\n run<R>(fn: () => R | Promise<R>): R | Promise<R> {\n return this.#als.run(new Map(), fn);\n }\n\n /**\n * Retrieve a value by key.\n * @returns The stored value, or `null` if the key does not exist.\n */\n async get<T = unknown>(key: string): Promise<T | null> {\n return (this.#als.getStore()?.get(key) as T) ?? null;\n }\n\n /** Store a value under the given key, overwriting any existing entry. */\n async set<T = unknown>(key: string, value: T): Promise<void> {\n this.#als.getStore()?.set(key, value);\n }\n\n /** Remove the entry for the given key (no-op if absent). */\n async delete(key: string): Promise<void> {\n this.#als.getStore()?.delete(key);\n }\n}\n\n/** Default singleton for application-wide use. */\nexport const asyncLocalStorage = new AsyncLocalMapStorage();\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["#als"],"sources":["../../../src/node/config.ts","../../../src/storage/async-local-storage.ts"],"sourcesContent":["import type { FheChain } from \"../chains/types\";\nimport type { RelayerConfig } from \"../config/types\";\nimport { FhevmRelayer } from \"../relayer/fhevm-relayer\";\nimport type { RelayerOptions } from \"../relayer/types\";\n\n/** Node transport — drives the FHE backend directly on the calling thread. */\nexport interface NodeRelayerConfig extends RelayerConfig {\n /** Discriminant for the node transport. */\n readonly type: \"node\";\n /** @internal */\n readonly createRelayer: (chain: FheChain) => FhevmRelayer;\n}\n\n/**\n * Node.js transport — drives `@fhevm/sdk` via {@link FhevmRelayer} on the calling thread.\n *\n * @example\n * ```ts\n * relayers: {\n * [sepolia.id]: node({ timeout: 5 * 60_000 }),\n * [mainnet.id]: node({ batchRpcCalls: true }),\n * }\n * ```\n */\nexport function node(options?: RelayerOptions): NodeRelayerConfig {\n return { type: \"node\", createRelayer: (chain) => new FhevmRelayer({ chain, options }) };\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { GenericStorage } from \"../types\";\n\n/**\n * {@link GenericStorage} backed by Node.js {@link AsyncLocalStorage}.\n *\n * Each async context (e.g. HTTP request) gets its own isolated `Map`,\n * so credentials from one request never leak into another.\n *\n * Call {@link run} to establish a context before using the SDK:\n *\n * ```ts\n * import { asyncLocalStorage } from \"@zama-fhe/sdk/node\";\n *\n * app.post(\"/api/transfer\", (req, res) => {\n * asyncLocalStorage.run(async () => {\n * const sdk = new ZamaSDK({ relayer, signer, storage: asyncLocalStorage });\n * // credentials are scoped to this request\n * });\n * });\n * ```\n */\nexport class AsyncLocalMapStorage implements GenericStorage {\n readonly #als = new AsyncLocalStorage<Map<string, unknown>>();\n\n /** Execute `fn` within an isolated storage context. */\n run<R>(fn: () => R | Promise<R>): R | Promise<R> {\n return this.#als.run(new Map(), fn);\n }\n\n /**\n * Retrieve a value by key.\n * @returns The stored value, or `null` if the key does not exist.\n */\n async get<T = unknown>(key: string): Promise<T | null> {\n return (this.#als.getStore()?.get(key) as T) ?? null;\n }\n\n /** Store a value under the given key, overwriting any existing entry. */\n async set<T = unknown>(key: string, value: T): Promise<void> {\n this.#als.getStore()?.set(key, value);\n }\n\n /** Remove the entry for the given key (no-op if absent). */\n async delete(key: string): Promise<void> {\n this.#als.getStore()?.delete(key);\n }\n}\n\n/** Default singleton for application-wide use. */\nexport const asyncLocalStorage = new AsyncLocalMapStorage();\n"],"mappings":"kPAwBA,SAAgB,EAAK,EAA6C,CAChE,MAAO,CAAE,KAAM,OAAQ,cAAgB,GAAU,IAAI,EAAa,CAAE,QAAO,SAAQ,CAAC,CAAE,CACxF,CCJA,IAAa,EAAb,KAA4D,CAC1D,GAAgB,IAAI,EAGpB,IAAO,EAA0C,CAC/C,OAAO,KAAKA,GAAK,IAAI,IAAI,IAAO,CAAE,CACpC,CAMA,MAAM,IAAiB,EAAgC,CACrD,OAAQ,KAAKA,GAAK,SAAS,CAAC,EAAE,IAAI,CAAG,GAAW,IAClD,CAGA,MAAM,IAAiB,EAAa,EAAyB,CAC3D,KAAKA,GAAK,SAAS,CAAC,EAAE,IAAI,EAAK,CAAK,CACtC,CAGA,MAAM,OAAO,EAA4B,CACvC,KAAKA,GAAK,SAAS,CAAC,EAAE,OAAO,CAAG,CAClC,CACF,EAGA,MAAa,EAAoB,IAAI"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as TransactionErrorEvent, A as WalletAccountListener, B as ApproveUnderlyingSubmittedEvent, C as TransferAndCallRequest, D as GenericSigner, Dt as OnChainEvent, E as WrapRequest, F as ReadContractReturnType, G as DelegationSubmittedEvent, H as DecryptEndEvent, I as ReadFunctionName, J as EncryptStartEvent, Jt as RawLog, K as EncryptEndEvent, L as WriteContractArgs, M as ContractAbi, Mt as UnwrapRequestedEvent, N as ReadContractArgs, Nt as WrapEvent, O as WalletAccount, P as ReadContractConfig, Q as ShieldSubmittedEvent, Qt as DecryptPublicValuesResult, R as WriteContractConfig, S as TransactionKind, T as UnwrapRequest, Tt as ConfidentialTransferEvent, U as DecryptErrorEvent, V as BaseEvent, W as DecryptStartEvent, X as RevokeDelegationSubmittedEvent, Xt as TransactionResult, Y as FinalizeUnwrapSubmittedEvent, Yt as TransactionReceipt, Z as SetOperatorSubmittedEvent, Zt as ClearValue, _ as PrepareTransactionRequest, _t as UnwrapResult, an as FhevmClient, at as UnshieldPhase2SubmittedEvent, b as RevokeDelegationRequest, bt as TransferCallbacks, c as GenericStorage, cn as FhevmRuntimeConfig, ct as ZamaSDKEvent, d as ConfidentialTransferFromRequest, 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, l as GenericProvider, lt as ZamaSDKEventListener, m as FinalizeUnwrapRequest, mt as ShieldPath, nn as EncryptParams, nt as TransferSubmittedEvent, ot as UnwrapSubmittedEvent, p as DelegateDecryptionRequest, pt as ShieldOptions, q as EncryptErrorEvent, rn as EncryptResult, rt as UnshieldPhase1SubmittedEvent, s as GenericLogger, sn as FhevmRelayerOptions, st as WrapSubmittedEvent, tn as EncryptInput, tt as TransferFromSubmittedEvent, u as ApproveUnderlyingRequest, un as RelayerSDK, v as PreparedFor, vt as WrapOptions, w as UnwrapAllRequest, x as SetOperatorRequest, xt as UnshieldCallbacks, y as PreparedTransaction, yt as ShieldCallbacks, z as WriteFunctionName } from "../types-
|
|
3
|
-
import { A as BatchDecryptAsOptions, C as ZamaSDKOptions, D as WrappersRegistryConfig, Dt as
|
|
4
|
-
import "../index-
|
|
1
|
+
import { f as FheChain, p as FheChainAuth } from "../index-ijgDL4IC.js";
|
|
2
|
+
import { $ as TransactionErrorEvent, A as WalletAccountListener, B as ApproveUnderlyingSubmittedEvent, C as TransferAndCallRequest, D as GenericSigner, Dt as OnChainEvent, E as WrapRequest, F as ReadContractReturnType, G as DelegationSubmittedEvent, H as DecryptEndEvent, I as ReadFunctionName, J as EncryptStartEvent, Jt as RawLog, K as EncryptEndEvent, L as WriteContractArgs, M as ContractAbi, Mt as UnwrapRequestedEvent, N as ReadContractArgs, Nt as WrapEvent, O as WalletAccount, P as ReadContractConfig, Q as ShieldSubmittedEvent, Qt as DecryptPublicValuesResult, R as WriteContractConfig, S as TransactionKind, T as UnwrapRequest, Tt as ConfidentialTransferEvent, U as DecryptErrorEvent, V as BaseEvent, W as DecryptStartEvent, X as RevokeDelegationSubmittedEvent, Xt as TransactionResult, Y as FinalizeUnwrapSubmittedEvent, Yt as TransactionReceipt, Z as SetOperatorSubmittedEvent, Zt as ClearValue, _ as PrepareTransactionRequest, _t as UnwrapResult, an as FhevmClient, at as UnshieldPhase2SubmittedEvent, b as RevokeDelegationRequest, bt as TransferCallbacks, c as GenericStorage, cn as FhevmRuntimeConfig, ct as ZamaSDKEvent, d as ConfidentialTransferFromRequest, 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, l as GenericProvider, lt as ZamaSDKEventListener, m as FinalizeUnwrapRequest, mt as ShieldPath, nn as EncryptParams, nt as TransferSubmittedEvent, ot as UnwrapSubmittedEvent, p as DelegateDecryptionRequest, pt as ShieldOptions, q as EncryptErrorEvent, rn as EncryptResult, rt as UnshieldPhase1SubmittedEvent, s as GenericLogger, sn as FhevmRelayerOptions, st as WrapSubmittedEvent, tn as EncryptInput, tt as TransferFromSubmittedEvent, u as ApproveUnderlyingRequest, un as RelayerSDK, v as PreparedFor, vt as WrapOptions, w as UnwrapAllRequest, x as SetOperatorRequest, xt as UnshieldCallbacks, y as PreparedTransaction, yt as ShieldCallbacks, z as WriteFunctionName } from "../types-CuDiV0Wy.js";
|
|
3
|
+
import { A as BatchDecryptAsOptions, At as SerializedPermitEip712, C as ZamaSDKOptions, Ct as ZamaErrorCode, D as WrappersRegistryConfig, Dt as PreparePermitRequest, E as WrappersRegistry, F as Permits, Ft as TokenWrapperPairWithMetadata, M as Offline, Mt as ChecksummedAddress, N as Delegations, Nt as PaginatedResult, O as WrappedToken, Ot as PreparedPermit, P as DelegationStatus, Pt as TokenWrapperPair, S as ZamaSDK, St as ZamaError, T as ListPairsOptions, _ as decryptValuesQueryOptions, b as MutationFactoryOptions, d as Decryption, f as BatchDecryptItem, g as EncryptedInput, h as DecryptResult, j as Token, jt as SerializedTransportKeyPair, k as BatchBalancesResult, m as DelegatedDecryptOptions, p as BatchDecryptResult, v as SignerQueryContext, x as QueryFactoryOptions, y as zamaQueryKeys } from "../index-COrLsVKC.js";
|
|
4
|
+
import "../index-C4xKY5Fw.js";
|
|
5
5
|
import { Address, Hex } from "viem";
|
|
6
6
|
//#region src/query/utils.d.ts
|
|
7
7
|
/** Union of TanStack Query option keys stripped by {@link filterQueryOptions}, leaving only domain parameters. */
|
|
@@ -443,6 +443,21 @@ declare function decryptPublicValuesMutationOptions(sdk: ZamaSDK): MutationFacto
|
|
|
443
443
|
/** Builds TanStack Query mutation options for {@link Permits.grantPermit | granting} decryption permits for the given contract addresses. */
|
|
444
444
|
declare function grantPermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.grantPermit"], Address[], void>;
|
|
445
445
|
//#endregion
|
|
446
|
+
//#region src/query/prepare-permit.d.ts
|
|
447
|
+
/** Builds TanStack Query mutation options for {@link Offline.preparePermit | preparing} an offline decryption permit. */
|
|
448
|
+
declare function preparePermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.preparePermit"], PreparePermitRequest, PreparedPermit>;
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region src/query/register-permit.d.ts
|
|
451
|
+
/** Parameters for {@link registerPermitMutationOptions}. */
|
|
452
|
+
interface RegisterPermitParams {
|
|
453
|
+
/** The payload `sdk.offline.preparePermit` returned. */
|
|
454
|
+
prepared: PreparedPermit;
|
|
455
|
+
/** The `eth_signTypedData_v4` signature over `prepared.eip712`. */
|
|
456
|
+
signature: Hex;
|
|
457
|
+
}
|
|
458
|
+
/** Builds TanStack Query mutation options for {@link Permits.registerPermit | registering} a signed offline permit. */
|
|
459
|
+
declare function registerPermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.registerPermit"], RegisterPermitParams, void>;
|
|
460
|
+
//#endregion
|
|
446
461
|
//#region src/query/has-permit.d.ts
|
|
447
462
|
/** Configuration for {@link hasPermitQueryOptions}. */
|
|
448
463
|
interface HasPermitQueryConfig {
|
|
@@ -518,5 +533,5 @@ interface DelegationStatusQueryConfig {
|
|
|
518
533
|
/** Builds TanStack Query options for reading the decryption-delegation status between a delegator and a delegate on a contract. */
|
|
519
534
|
declare function delegationStatusQueryOptions(sdk: ZamaSDK, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatus, Error, DelegationStatus, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
520
535
|
//#endregion
|
|
521
|
-
export { type ApprovalStrategy, type ApproveUnderlyingParams, type ApproveUnderlyingRequest, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptItem, type BatchDecryptResult, type ClearValue, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesQueryConfig, type ConfidentialIsOperatorQueryConfig, type ConfidentialSetOperatorParams, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferAndCallParams, type ConfidentialTransferEvent, type ConfidentialTransferFromAndCallParams, type ConfidentialTransferFromParams, type ConfidentialTransferFromRequest, type ConfidentialTransferParams, type ConfidentialTransferRequest, type ContractAbi, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type Decryption, type DelegateDecryptionParams, type DelegateDecryptionRequest, type DelegatedDecryptOptions, type DelegatedDecryptValuesMutationParams, type DelegationStatus, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type Delegations, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClient, type FhevmRelayerOptions, type FhevmRuntimeConfig, type FinalizeUnwrapParams, type FinalizeUnwrapRequest, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type HasPermitQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsOptions, type ListPairsQueryConfig, type MutationFactoryOptions, type Offline, type OnChainEvent, type PaginatedResult, type PendingUnshieldQueryConfig, type Permits, type PrepareFees, type PrepareOptions, type PrepareTransactionRequest, type PreparedFor, type PreparedTransaction, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationRequest, type RevokeDelegationSubmittedEvent, type SerializedTransportKeyPair, type SetOperatorRequest, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldPath, type ShieldSubmittedEvent, type SignerQueryContext, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TokenWrapperPair, type TokenWrapperPairWithMetadata, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionKind, type TransactionOperation, type TransactionReceipt, type TransactionResult, type TransferAndCallRequest, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnderlyingAllowanceQueryConfig, type UnshieldAllParams, type UnshieldCallbacks, type UnshieldOptions, type UnshieldParams, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapAllRequest, type UnwrapFinalizedEvent, type UnwrapParams, type UnwrapRequest, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, type WalletAccountStore, type WrapEvent, type WrapOptions, type WrapParams, type WrapRequest, type WrapSubmittedEvent, type WrappedToken, type WrapperDiscoveryQueryConfig, type WrappersRegistry, type WrappersRegistryConfig, type WrappersRegistryQueryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, type ZamaConfig, type ZamaError, type ZamaErrorCode, type ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventListener, ZamaSDKEvents, type ZamaSDKOptions, approveUnderlyingMutationOptions, batchDecryptBalancesAsMutationOptions, clearCredentialsMutationOptions, confidentialBalanceQueryOptions, confidentialBalancesQueryOptions, confidentialIsOperatorQueryOptions, confidentialSetOperatorMutationOptions, confidentialTokenAddressQueryOptions, confidentialTransferAndCallMutationOptions, confidentialTransferFromAndCallMutationOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, decryptBalanceAsMutationOptions, decryptPublicValuesMutationOptions, decryptValuesQueryOptions, delegateDecryptionMutationOptions, delegatedDecryptValuesMutationOptions, delegationStatusQueryOptions, encryptMutationOptions, filterQueryOptions, finalizeUnwrapMutationOptions, grantPermitMutationOptions, hasPermitQueryOptions, hashFn, invalidateAfterApproveUnderlying, invalidateAfterSetOperator, invalidateAfterShield, invalidateAfterTransfer, invalidateAfterUnshield, invalidateAfterUnshieldSettled, invalidateAfterUnwrap, invalidateAfterWrap, invalidateBalanceQueries, invalidateWagmiBalanceQueries, invalidateWalletLifecycleQueries, isConfidentialQueryOptions, isConfidentialTokenValidQueryOptions, isWrapperQueryOptions, listPairsQueryOptions, pendingUnshieldQueryOptions, resumeUnshieldMutationOptions, revokeDelegationMutationOptions, revokePermitsMutationOptions, shieldMutationOptions, tokenAddressQueryOptions, tokenMetadataQueryOptions, tokenPairQueryOptions, tokenPairsLengthQueryOptions, tokenPairsQueryOptions, tokenPairsSliceQueryOptions, totalSupplyQueryOptions, underlyingAllowanceQueryOptions, unshieldAllMutationOptions, unshieldMutationOptions, unwrapAllMutationOptions, unwrapMutationOptions, wrapMutationOptions, wrapperDiscoveryQueryOptions, zamaQueryKeys };
|
|
536
|
+
export { type ApprovalStrategy, type ApproveUnderlyingParams, type ApproveUnderlyingRequest, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptItem, type BatchDecryptResult, type ChecksummedAddress, type ClearValue, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesQueryConfig, type ConfidentialIsOperatorQueryConfig, type ConfidentialSetOperatorParams, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferAndCallParams, type ConfidentialTransferEvent, type ConfidentialTransferFromAndCallParams, type ConfidentialTransferFromParams, type ConfidentialTransferFromRequest, type ConfidentialTransferParams, type ConfidentialTransferRequest, type ContractAbi, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type Decryption, type DelegateDecryptionParams, type DelegateDecryptionRequest, type DelegatedDecryptOptions, type DelegatedDecryptValuesMutationParams, type DelegationStatus, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type Delegations, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClient, type FhevmRelayerOptions, type FhevmRuntimeConfig, type FinalizeUnwrapParams, type FinalizeUnwrapRequest, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type HasPermitQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsOptions, type ListPairsQueryConfig, type MutationFactoryOptions, type Offline, type OnChainEvent, type PaginatedResult, type PendingUnshieldQueryConfig, type Permits, type PrepareFees, type PrepareOptions, type PreparePermitRequest, type PrepareTransactionRequest, type PreparedFor, type PreparedPermit, type PreparedTransaction, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RegisterPermitParams, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationRequest, type RevokeDelegationSubmittedEvent, type SerializedPermitEip712, type SerializedTransportKeyPair, type SetOperatorRequest, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldPath, type ShieldSubmittedEvent, type SignerQueryContext, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TokenWrapperPair, type TokenWrapperPairWithMetadata, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionKind, type TransactionOperation, type TransactionReceipt, type TransactionResult, type TransferAndCallRequest, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnderlyingAllowanceQueryConfig, type UnshieldAllParams, type UnshieldCallbacks, type UnshieldOptions, type UnshieldParams, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapAllRequest, type UnwrapFinalizedEvent, type UnwrapParams, type UnwrapRequest, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, type WalletAccountStore, type WrapEvent, type WrapOptions, type WrapParams, type WrapRequest, type WrapSubmittedEvent, type WrappedToken, type WrapperDiscoveryQueryConfig, type WrappersRegistry, type WrappersRegistryConfig, type WrappersRegistryQueryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, type ZamaConfig, type ZamaError, type ZamaErrorCode, type ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventListener, ZamaSDKEvents, type ZamaSDKOptions, approveUnderlyingMutationOptions, batchDecryptBalancesAsMutationOptions, clearCredentialsMutationOptions, confidentialBalanceQueryOptions, confidentialBalancesQueryOptions, confidentialIsOperatorQueryOptions, confidentialSetOperatorMutationOptions, confidentialTokenAddressQueryOptions, confidentialTransferAndCallMutationOptions, confidentialTransferFromAndCallMutationOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, decryptBalanceAsMutationOptions, decryptPublicValuesMutationOptions, decryptValuesQueryOptions, delegateDecryptionMutationOptions, delegatedDecryptValuesMutationOptions, delegationStatusQueryOptions, encryptMutationOptions, filterQueryOptions, finalizeUnwrapMutationOptions, grantPermitMutationOptions, hasPermitQueryOptions, hashFn, invalidateAfterApproveUnderlying, invalidateAfterSetOperator, invalidateAfterShield, invalidateAfterTransfer, invalidateAfterUnshield, invalidateAfterUnshieldSettled, invalidateAfterUnwrap, invalidateAfterWrap, invalidateBalanceQueries, invalidateWagmiBalanceQueries, invalidateWalletLifecycleQueries, isConfidentialQueryOptions, isConfidentialTokenValidQueryOptions, isWrapperQueryOptions, listPairsQueryOptions, pendingUnshieldQueryOptions, preparePermitMutationOptions, registerPermitMutationOptions, resumeUnshieldMutationOptions, revokeDelegationMutationOptions, revokePermitsMutationOptions, shieldMutationOptions, tokenAddressQueryOptions, tokenMetadataQueryOptions, tokenPairQueryOptions, tokenPairsLengthQueryOptions, tokenPairsQueryOptions, tokenPairsSliceQueryOptions, totalSupplyQueryOptions, underlyingAllowanceQueryOptions, unshieldAllMutationOptions, unshieldMutationOptions, unwrapAllMutationOptions, unwrapMutationOptions, wrapMutationOptions, wrapperDiscoveryQueryOptions, zamaQueryKeys };
|
|
522
537
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/query/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e}from"../relayer-RDPkM3cB.js";import{C as t,F as n,M as r,S as i,_ as a,a as o,b as s,c,i as l,j as ee,l as te,m as u,o as d,p as f,r as p,s as m,t as h}from"../sdk-events-lFxSy5Zf.js";import{t as g}from"../token-B0hgYraH.js";import{r as _}from"../assertions-Ca1ePdRJ.js";import{getAddress as v,zeroAddress as y}from"viem";import{z as b}from"zod/mini";function x(e){if(!S(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!S(n)||!n.hasOwnProperty(`isPrototypeOf`))}function S(e){return Object.prototype.toString.call(e)===`[object Object]`}function C(e){let{gcTime:t,staleTime:n,enabled:r,select:i,refetchInterval:a,refetchOnMount:o,refetchOnWindowFocus:s,refetchOnReconnect:c,retry:l,retryDelay:ee,retryOnMount:te,queryFn:u,queryKey:d,queryKeyHashFn:f,initialData:p,initialDataUpdatedAt:m,placeholderData:h,structuralSharing:g,throwOnError:_,meta:v,query:y,pollingInterval:b,...x}=e;return x}function w(e){return JSON.stringify(e,(e,t)=>x(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const T=e=>e.map(e=>v(e)),E=e=>e===void 0?void 0:v(e),D=e=>e?{walletAddress:v(e.address),walletChainId:e.chainId}:{},O={confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:v(e)}],owner:(e,t,n)=>[`zama.confidentialBalance`,{tokenAddress:v(e),...D(n),...t?{owner:v(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t,n)=>[`zama.confidentialBalances`,{tokenAddresses:T(e),...D(n),...t?{owner:v(t)}:{}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:v(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:v(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:v(e)}]},wrapperDiscovery:{all:[`zama.wrapperDiscovery`],token:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.wrapperDiscovery`,{...r?{tokenAddress:r}:{},...i?{erc20Address:i}:{},...a?{registryAddress:a}:{}}]}},underlyingAllowance:{all:[`zama.underlyingAllowance`],token:e=>[`zama.underlyingAllowance`,{tokenAddress:v(e)}],scope:(e,t)=>[`zama.underlyingAllowance`,{tokenAddress:v(e),...t?{owner:v(t)}:{}}]},confidentialIsOperator:{all:[`zama.confidentialIsOperator`],token:e=>{let t=E(e);return[`zama.confidentialIsOperator`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.confidentialIsOperator`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:v(e)}]},pendingUnshield:{all:[`zama.pendingUnshield`],token:e=>[`zama.pendingUnshield`,{tokenAddress:v(e)}]},hasPermit:{all:[`zama.hasPermit`],scope:(e,t)=>[`zama.hasPermit`,{...D(t),contractAddresses:T(e).sort()}]},delegationStatus:{all:[`zama.delegationStatus`],contract:e=>{let t=E(e);return[`zama.delegationStatus`,t?{contractAddress:t}:{}]},scope:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.delegationStatus`,{...r?{contractAddress:r}:{},...i?{delegatorAddress:i}:{},...a?{delegateAddress:a}:{}}]}},decryption:{all:[`zama.decryption`],encryptedValue:(e,t)=>[`zama.decryption`,{encryptedValue:e,...t===void 0?{}:{contractAddress:v(t)}}],encryptedInputs:(e,t)=>[`zama.decryption`,{...D(t),encryptedInputs:[...e].sort((e,t)=>e.encryptedValue.localeCompare(t.encryptedValue)).map(e=>({encryptedValue:e.encryptedValue,contractAddress:v(e.contractAddress)}))}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:v(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:v(e),tokenAddress:v(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:v(e),confidentialTokenAddress:v(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:v(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:v(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:v(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:v(e),confidentialTokenAddress:v(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:v(e),page:t,pageSize:n,metadata:r}]}};function k(e,t){e.invalidateQueries({queryKey:O.underlyingAllowance.token(t)})}function A(e,t){e.invalidateQueries({queryKey:O.pendingUnshield.token(t)})}function j(e,t){N(e,t),k(e,t),A(e,t),K(e)}function M(e,t){N(e,t),k(e,t),K(e)}function N(e,t){e.invalidateQueries({queryKey:O.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:O.confidentialBalances.all})}function P(e,t){N(e,t),k(e,t),K(e)}function F(e,t){N(e,t),k(e,t),A(e,t),K(e)}function I(e,t){A(e,t)}function L(e,t){N(e,t)}function R(e,t){k(e,t)}function z(e,t){e.invalidateQueries({queryKey:O.confidentialIsOperator.token(t)})}function B(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}const V=b.enum([`balanceOf`,`confidentialBalanceOf`]),H=b.object({functionName:V}),U=b.object({contracts:b.array(b.unknown())});function W(e){if(H.safeParse(e).success)return!0;let t=U.safeParse(e);return t.success&&t.data.contracts.some(e=>H.safeParse(e).success)}function G(e){return Array.isArray(e.queryKey)&&e.queryKey.some(W)}function K(e){e.invalidateQueries({predicate:G})}function q(e){e.removeQueries({queryKey:O.decryption.all}),e.removeQueries({queryKey:O.hasPermit.all}),e.invalidateQueries({predicate:B}),K(e)}function J(e,n,r){let a=O.tokenMetadata.token(n);return{...C(r?.query??{}),queryKey:a,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey,[a,o,c]=await Promise.all([e.provider.readContract(i(r)),e.provider.readContract(t(r)),e.provider.readContract(s(r))]);return{name:a,symbol:o,decimals:c}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function Y(t,n,r){let i=O.isConfidential.token(n);return{...C(r?.query??{}),queryKey:i,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey;try{return await t.provider.readContract(f(r))}catch(t){if(e(t))return!1;throw t}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function X(t,n,r){let i=O.isWrapper.token(n);return{...C(r?.query??{}),queryKey:i,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey;try{return await t.provider.readContract(u(r))}catch(t){if(e(t))return!1;throw t}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function Z(e,t,n){let r=O.totalSupply.token(t);return{...C(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.provider.readContract(ee(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function Q(e,t){let n=O.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...C(t.query??{}),queryKey:n,queryFn:async t=>{let[,{erc20Address:n}]=t.queryKey;_(n,`wrapperDiscoveryQueryOptions: erc20Address`);let r=await e.getConfidentialToken(n);return r?r.confidentialTokenAddress:null},staleTime:1/0,enabled:!!(t.tokenAddress&&t.erc20Address&&t.registryAddress)&&t.query?.enabled!==!1}}function ne(e,t,r){let i=r.owner,o=r.query?.enabled!==!1,s=O.underlyingAllowance.scope(t,i);return{...C(r.query??{}),queryKey:s,queryFn:async t=>{let[,{tokenAddress:r,owner:i}]=t.queryKey;_(i,`underlyingAllowanceQueryOptions: owner`);let o=await e.provider.readContract(n(r));return e.provider.readContract(a(o,i,r))},staleTime:3e4,enabled:!!i&&o}}function re(e,t,n){let r=O.pendingUnshield.token(t);return{...C(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.createWrappedToken(n).getPendingUnshield()},staleTime:0,enabled:n?.query?.enabled!==!1}}function ie(e,t,n){let i=n.holder,a=n.spender,o=n.query?.enabled!==!1,s=O.confidentialIsOperator.scope(t,i,a);return{...C(n.query??{}),queryKey:s,queryFn:async t=>{let[,{tokenAddress:n,holder:i,spender:a}]=t.queryKey;return _(n,`confidentialIsOperatorQueryOptions: tokenAddress`),_(i,`confidentialIsOperatorQueryOptions: holder`),_(a,`confidentialIsOperatorQueryOptions: spender`),e.provider.readContract(r(n,i,a))},staleTime:3e4,enabled:!!(t&&i&&a)&&o}}function ae(e,t,n={}){let r=t.query??{};return{...C(r),queryKey:O.confidentialBalance.owner(t.tokenAddress,t.account,n.walletAccount),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return _(n,`confidentialBalanceQueryOptions: owner`),e.balanceOf(n)},enabled:!!t.account&&n.walletAccount!==void 0&&r?.enabled!==!1}}function oe(e,t,n={}){let r=t?.account,i=n.walletAccount,a=t?.query??{},o=e.map(e=>e.address);return{...C(a),queryKey:O.confidentialBalances.tokens(o,r,i),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return _(n,`confidentialBalancesQueryOptions: owner`),g.batchBalancesOf(e,n)},enabled:!!r&&e.length>0&&i!==void 0&&a?.enabled!==!1}}function se(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPairs(t.registryAddress??y);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.provider.readContract(d(n))},staleTime:e.registry.ttlMs,enabled:n}}function $(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.confidentialTokenAddress(t.registryAddress??y,t.tokenAddress??y);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.provider.readContract(p(n,r))},staleTime:e.registry.ttlMs,enabled:n}}function ce(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenAddress(t.registryAddress??y,t.confidentialTokenAddress??y);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.provider.readContract(l(n,r))},staleTime:e.registry.ttlMs,enabled:n}}function le(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPairsLength(t.registryAddress??y);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.provider.readContract(m(n))},staleTime:e.registry.ttlMs,enabled:n}}function ue(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPairsSlice(t.registryAddress??y,String(t.fromIndex??0n),String(t.toIndex??0n));return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.provider.readContract(c(n,BigInt(r),BigInt(i)))},staleTime:e.registry.ttlMs,enabled:n}}function de(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPair(t.registryAddress??y,String(t.index??0n));return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.provider.readContract(o(n,BigInt(r)))},staleTime:e.registry.ttlMs,enabled:n}}function fe(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??y,t.confidentialTokenAddress??y);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.provider.readContract(te(n,r))},staleTime:e.registry.ttlMs,enabled:n}}function pe(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.listPairs(t.registryAddress??y,t.page??1,t.pageSize??100,t.metadata??!1);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{page:n,pageSize:r,metadata:i}]=t.queryKey;return e.listPairs({page:n,pageSize:r,metadata:i})},staleTime:e.ttlMs,enabled:n}}function me(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function he(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function ge(e){return{mutationKey:[`zama.confidentialTransferAndCall`,e.address],mutationFn:async({to:t,amount:n,data:r,...i})=>e.confidentialTransferAndCall(t,n,r,i)}}function _e(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function ve(e){return{mutationKey:[`zama.confidentialTransferFromAndCall`,e.address],mutationFn:async({from:t,to:n,amount:r,data:i,callbacks:a})=>e.confidentialTransferFromAndCall(t,n,r,i,a)}}function ye(e){return{mutationKey:[`zama.confidentialSetOperator`,e.address],mutationFn:async({operator:t,until:n})=>e.setOperator(t,n)}}function be(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function xe(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function Se(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function Ce(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function we(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function Te(e){return{mutationKey:[`zama.wrap`,e.address],mutationFn:async({amount:t,...n})=>e.wrap(t,n)}}function Ee(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function De(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({unwrapRequestId:t})=>e.finalizeUnwrap(t)}}function Oe(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.encrypt(t)}}function ke(e){return{mutationKey:[`zama.delegatedDecryptValues`],mutationFn:async t=>e.decryption.delegatedDecryptValues(t.encryptedInputs,t.delegatorAddress)}}function Ae(e){return{mutationKey:[`zama.decryptPublicValues`],mutationFn:async t=>e.decryption.decryptPublicValues(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(O.decryption.encryptedValue(t),n)}}}function je(e){return{mutationKey:[`zama.grantPermit`],mutationFn:t=>e.permits.grantPermit(t)}}function Me(e,t,n={}){let r=t.query?.enabled!==!1;return{...C(t?.query??{}),queryKey:O.hasPermit.scope(t.contractAddresses,n.walletAccount),queryFn:t=>{let[,{contractAddresses:n}]=t.queryKey;return e.permits.hasPermit(n)},staleTime:0,gcTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,enabled:r&&n.walletAccount!==void 0&&t.contractAddresses.length>0}}function Ne(e){return{mutationKey:[`zama.revokePermits`],mutationFn:t=>t===void 0?e.permits.revokePermits():e.permits.revokePermits(t)}}function Pe(e){return{mutationKey:[`zama.clearCredentials`],mutationFn:()=>e.permits.clear()}}function Fe(e,t){return{mutationKey:[`zama.delegateDecryption`,t],mutationFn:async({delegateAddress:n,expirationDate:r})=>e.delegations.delegateDecryption({contractAddress:t,delegateAddress:n,expirationDate:r})}}function Ie(e,t,n={}){return{queryKey:O.decryption.encryptedInputs(t,n.walletAccount),queryFn:t=>{let[,{encryptedInputs:n}]=t.queryKey;return e.decryption.decryptValues(n)},staleTime:1/0,enabled:t.length>0&&n.walletAccount!==void 0}}function Le(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,accountAddress:n})=>e.decryptBalanceAs({delegatorAddress:t,accountAddress:n})}}function Re(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>g.batchDecryptBalancesAs(e,t)}}function ze(e,t){return{mutationKey:[`zama.revokeDelegation`,t],mutationFn:async({delegateAddress:n})=>e.delegations.revokeDelegation({contractAddress:t,delegateAddress:n})}}function Be(e,t){return{...C(t.query??{}),queryKey:O.delegationStatus.scope(t.contractAddress,t.delegatorAddress,t.delegateAddress),queryFn:async t=>{let[,{contractAddress:n,delegatorAddress:r,delegateAddress:i}]=t.queryKey;return _(n,`delegationStatusQueryOptions: contractAddress`),_(r,`delegationStatusQueryOptions: delegatorAddress`),_(i,`delegationStatusQueryOptions: delegateAddress`),e.delegations.getStatus({contractAddress:n,delegatorAddress:r,delegateAddress:i})},enabled:!!(t.contractAddress&&t.delegatorAddress&&t.delegateAddress)&&t.query?.enabled!==!1}}export{h as ZamaSDKEvents,be as approveUnderlyingMutationOptions,Re as batchDecryptBalancesAsMutationOptions,Pe as clearCredentialsMutationOptions,ae as confidentialBalanceQueryOptions,oe as confidentialBalancesQueryOptions,ie as confidentialIsOperatorQueryOptions,ye as confidentialSetOperatorMutationOptions,$ as confidentialTokenAddressQueryOptions,ge as confidentialTransferAndCallMutationOptions,ve as confidentialTransferFromAndCallMutationOptions,_e as confidentialTransferFromMutationOptions,he as confidentialTransferMutationOptions,Le as decryptBalanceAsMutationOptions,Ae as decryptPublicValuesMutationOptions,Ie as decryptValuesQueryOptions,Fe as delegateDecryptionMutationOptions,ke as delegatedDecryptValuesMutationOptions,Be as delegationStatusQueryOptions,Oe as encryptMutationOptions,C as filterQueryOptions,De as finalizeUnwrapMutationOptions,je as grantPermitMutationOptions,Me as hasPermitQueryOptions,w as hashFn,R as invalidateAfterApproveUnderlying,z as invalidateAfterSetOperator,P as invalidateAfterShield,L as invalidateAfterTransfer,F as invalidateAfterUnshield,I as invalidateAfterUnshieldSettled,j as invalidateAfterUnwrap,M as invalidateAfterWrap,N as invalidateBalanceQueries,K as invalidateWagmiBalanceQueries,q as invalidateWalletLifecycleQueries,Y as isConfidentialQueryOptions,fe as isConfidentialTokenValidQueryOptions,X as isWrapperQueryOptions,pe as listPairsQueryOptions,re as pendingUnshieldQueryOptions,Ce as resumeUnshieldMutationOptions,ze as revokeDelegationMutationOptions,Ne as revokePermitsMutationOptions,me as shieldMutationOptions,ce as tokenAddressQueryOptions,J as tokenMetadataQueryOptions,de as tokenPairQueryOptions,le as tokenPairsLengthQueryOptions,se as tokenPairsQueryOptions,ue as tokenPairsSliceQueryOptions,Z as totalSupplyQueryOptions,ne as underlyingAllowanceQueryOptions,Se as unshieldAllMutationOptions,xe as unshieldMutationOptions,Ee as unwrapAllMutationOptions,we as unwrapMutationOptions,Te as wrapMutationOptions,Q as wrapperDiscoveryQueryOptions,O as zamaQueryKeys};
|
|
1
|
+
import{u as e}from"../relayer-DC1OKWzW.js";import{C as t,F as n,M as r,S as i,_ as a,a as o,b as s,c,i as l,j as u,l as d,m as f,o as p,p as m,r as h,s as g,t as ee}from"../sdk-events-B1sUunjZ.js";import{t as _}from"../token-DOYtYc7P.js";import{r as v}from"../assertions-Ca1ePdRJ.js";import{getAddress as y,zeroAddress as b}from"viem";import{z as x}from"zod/mini";function S(e){if(!C(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!C(n)||!n.hasOwnProperty(`isPrototypeOf`))}function C(e){return Object.prototype.toString.call(e)===`[object Object]`}function w(e){let{gcTime:t,staleTime:n,enabled:r,select:i,refetchInterval:a,refetchOnMount:o,refetchOnWindowFocus:s,refetchOnReconnect:c,retry:l,retryDelay:u,retryOnMount:d,queryFn:f,queryKey:p,queryKeyHashFn:m,initialData:h,initialDataUpdatedAt:g,placeholderData:ee,structuralSharing:_,throwOnError:v,meta:y,query:b,pollingInterval:x,...S}=e;return S}function te(e){return JSON.stringify(e,(e,t)=>S(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const T=e=>e.map(e=>y(e)),E=e=>e===void 0?void 0:y(e),D=e=>e?{walletAddress:y(e.address),walletChainId:e.chainId}:{},O={confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:y(e)}],owner:(e,t,n)=>[`zama.confidentialBalance`,{tokenAddress:y(e),...D(n),...t?{owner:y(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t,n)=>[`zama.confidentialBalances`,{tokenAddresses:T(e),...D(n),...t?{owner:y(t)}:{}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:y(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:y(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:y(e)}]},wrapperDiscovery:{all:[`zama.wrapperDiscovery`],token:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.wrapperDiscovery`,{...r?{tokenAddress:r}:{},...i?{erc20Address:i}:{},...a?{registryAddress:a}:{}}]}},underlyingAllowance:{all:[`zama.underlyingAllowance`],token:e=>[`zama.underlyingAllowance`,{tokenAddress:y(e)}],scope:(e,t)=>[`zama.underlyingAllowance`,{tokenAddress:y(e),...t?{owner:y(t)}:{}}]},confidentialIsOperator:{all:[`zama.confidentialIsOperator`],token:e=>{let t=E(e);return[`zama.confidentialIsOperator`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.confidentialIsOperator`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:y(e)}]},pendingUnshield:{all:[`zama.pendingUnshield`],token:e=>[`zama.pendingUnshield`,{tokenAddress:y(e)}]},hasPermit:{all:[`zama.hasPermit`],scope:(e,t)=>[`zama.hasPermit`,{...D(t),contractAddresses:T(e).sort()}]},delegationStatus:{all:[`zama.delegationStatus`],contract:e=>{let t=E(e);return[`zama.delegationStatus`,t?{contractAddress:t}:{}]},scope:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.delegationStatus`,{...r?{contractAddress:r}:{},...i?{delegatorAddress:i}:{},...a?{delegateAddress:a}:{}}]}},decryption:{all:[`zama.decryption`],encryptedValue:(e,t)=>[`zama.decryption`,{encryptedValue:e,...t===void 0?{}:{contractAddress:y(t)}}],encryptedInputs:(e,t)=>[`zama.decryption`,{...D(t),encryptedInputs:[...e].sort((e,t)=>e.encryptedValue.localeCompare(t.encryptedValue)).map(e=>({encryptedValue:e.encryptedValue,contractAddress:y(e.contractAddress)}))}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:y(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:y(e),tokenAddress:y(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:y(e),confidentialTokenAddress:y(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:y(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:y(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:y(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:y(e),confidentialTokenAddress:y(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:y(e),page:t,pageSize:n,metadata:r}]}};function k(e,t){e.invalidateQueries({queryKey:O.underlyingAllowance.token(t)})}function A(e,t){e.invalidateQueries({queryKey:O.pendingUnshield.token(t)})}function j(e,t){N(e,t),k(e,t),A(e,t),K(e)}function M(e,t){N(e,t),k(e,t),K(e)}function N(e,t){e.invalidateQueries({queryKey:O.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:O.confidentialBalances.all})}function P(e,t){N(e,t),k(e,t),K(e)}function F(e,t){N(e,t),k(e,t),A(e,t),K(e)}function I(e,t){A(e,t)}function L(e,t){N(e,t)}function R(e,t){k(e,t)}function z(e,t){e.invalidateQueries({queryKey:O.confidentialIsOperator.token(t)})}function B(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}const V=x.enum([`balanceOf`,`confidentialBalanceOf`]),H=x.object({functionName:V}),U=x.object({contracts:x.array(x.unknown())});function W(e){if(H.safeParse(e).success)return!0;let t=U.safeParse(e);return t.success&&t.data.contracts.some(e=>H.safeParse(e).success)}function G(e){return Array.isArray(e.queryKey)&&e.queryKey.some(W)}function K(e){e.invalidateQueries({predicate:G})}function q(e){e.removeQueries({queryKey:O.decryption.all}),e.removeQueries({queryKey:O.hasPermit.all}),e.invalidateQueries({predicate:B}),K(e)}function J(e,n,r){let a=O.tokenMetadata.token(n);return{...w(r?.query??{}),queryKey:a,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey,[a,o,c]=await Promise.all([e.provider.readContract(i(r)),e.provider.readContract(t(r)),e.provider.readContract(s(r))]);return{name:a,symbol:o,decimals:c}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function Y(t,n,r){let i=O.isConfidential.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey;try{return await t.provider.readContract(m(r))}catch(t){if(e(t))return!1;throw t}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function X(t,n,r){let i=O.isWrapper.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey;try{return await t.provider.readContract(f(r))}catch(t){if(e(t))return!1;throw t}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function Z(e,t,n){let r=O.totalSupply.token(t);return{...w(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.provider.readContract(u(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function Q(e,t){let n=O.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...w(t.query??{}),queryKey:n,queryFn:async t=>{let[,{erc20Address:n}]=t.queryKey;v(n,`wrapperDiscoveryQueryOptions: erc20Address`);let r=await e.getConfidentialToken(n);return r?r.confidentialTokenAddress:null},staleTime:1/0,enabled:!!(t.tokenAddress&&t.erc20Address&&t.registryAddress)&&t.query?.enabled!==!1}}function ne(e,t,r){let i=r.owner,o=r.query?.enabled!==!1,s=O.underlyingAllowance.scope(t,i);return{...w(r.query??{}),queryKey:s,queryFn:async t=>{let[,{tokenAddress:r,owner:i}]=t.queryKey;v(i,`underlyingAllowanceQueryOptions: owner`);let o=await e.provider.readContract(n(r));return e.provider.readContract(a(o,i,r))},staleTime:3e4,enabled:!!i&&o}}function re(e,t,n){let r=O.pendingUnshield.token(t);return{...w(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.createWrappedToken(n).getPendingUnshield()},staleTime:0,enabled:n?.query?.enabled!==!1}}function ie(e,t,n){let i=n.holder,a=n.spender,o=n.query?.enabled!==!1,s=O.confidentialIsOperator.scope(t,i,a);return{...w(n.query??{}),queryKey:s,queryFn:async t=>{let[,{tokenAddress:n,holder:i,spender:a}]=t.queryKey;return v(n,`confidentialIsOperatorQueryOptions: tokenAddress`),v(i,`confidentialIsOperatorQueryOptions: holder`),v(a,`confidentialIsOperatorQueryOptions: spender`),e.provider.readContract(r(n,i,a))},staleTime:3e4,enabled:!!(t&&i&&a)&&o}}function ae(e,t,n={}){let r=t.query??{};return{...w(r),queryKey:O.confidentialBalance.owner(t.tokenAddress,t.account,n.walletAccount),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return v(n,`confidentialBalanceQueryOptions: owner`),e.balanceOf(n)},enabled:!!t.account&&n.walletAccount!==void 0&&r?.enabled!==!1}}function oe(e,t,n={}){let r=t?.account,i=n.walletAccount,a=t?.query??{},o=e.map(e=>e.address);return{...w(a),queryKey:O.confidentialBalances.tokens(o,r,i),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return v(n,`confidentialBalancesQueryOptions: owner`),_.batchBalancesOf(e,n)},enabled:!!r&&e.length>0&&i!==void 0&&a?.enabled!==!1}}function se(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPairs(t.registryAddress??b);return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.provider.readContract(p(n))},staleTime:e.registry.ttlMs,enabled:n}}function ce(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.confidentialTokenAddress(t.registryAddress??b,t.tokenAddress??b);return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.provider.readContract(h(n,r))},staleTime:e.registry.ttlMs,enabled:n}}function le(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenAddress(t.registryAddress??b,t.confidentialTokenAddress??b);return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.provider.readContract(l(n,r))},staleTime:e.registry.ttlMs,enabled:n}}function ue(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPairsLength(t.registryAddress??b);return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.provider.readContract(g(n))},staleTime:e.registry.ttlMs,enabled:n}}function de(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPairsSlice(t.registryAddress??b,String(t.fromIndex??0n),String(t.toIndex??0n));return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.provider.readContract(c(n,BigInt(r),BigInt(i)))},staleTime:e.registry.ttlMs,enabled:n}}function fe(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=O.wrappersRegistry.tokenPair(t.registryAddress??b,String(t.index??0n));return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.provider.readContract(o(n,BigInt(r)))},staleTime:e.registry.ttlMs,enabled:n}}function pe(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??b,t.confidentialTokenAddress??b);return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.provider.readContract(d(n,r))},staleTime:e.registry.ttlMs,enabled:n}}function me(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=O.wrappersRegistry.listPairs(t.registryAddress??b,t.page??1,t.pageSize??100,t.metadata??!1);return{...w(t.query??{}),queryKey:r,queryFn:async t=>{let[,{page:n,pageSize:r,metadata:i}]=t.queryKey;return e.listPairs({page:n,pageSize:r,metadata:i})},staleTime:e.ttlMs,enabled:n}}function he(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function ge(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function _e(e){return{mutationKey:[`zama.confidentialTransferAndCall`,e.address],mutationFn:async({to:t,amount:n,data:r,...i})=>e.confidentialTransferAndCall(t,n,r,i)}}function ve(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function ye(e){return{mutationKey:[`zama.confidentialTransferFromAndCall`,e.address],mutationFn:async({from:t,to:n,amount:r,data:i,callbacks:a})=>e.confidentialTransferFromAndCall(t,n,r,i,a)}}function be(e){return{mutationKey:[`zama.confidentialSetOperator`,e.address],mutationFn:async({operator:t,until:n})=>e.setOperator(t,n)}}function xe(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function Se(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function Ce(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function we(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function Te(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function Ee(e){return{mutationKey:[`zama.wrap`,e.address],mutationFn:async({amount:t,...n})=>e.wrap(t,n)}}function De(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Oe(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({unwrapRequestId:t})=>e.finalizeUnwrap(t)}}function ke(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.encrypt(t)}}function Ae(e){return{mutationKey:[`zama.delegatedDecryptValues`],mutationFn:async t=>e.decryption.delegatedDecryptValues(t.encryptedInputs,t.delegatorAddress)}}function je(e){return{mutationKey:[`zama.decryptPublicValues`],mutationFn:async t=>e.decryption.decryptPublicValues(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(O.decryption.encryptedValue(t),n)}}}function Me(e){return{mutationKey:[`zama.grantPermit`],mutationFn:t=>e.permits.grantPermit(t)}}function Ne(e){return{mutationKey:[`zama.preparePermit`],mutationFn:t=>e.offline.preparePermit(t)}}function Pe(e){return{mutationKey:[`zama.registerPermit`],mutationFn:({prepared:t,signature:n})=>e.permits.registerPermit(t,n)}}function $(e,t,n={}){let r=t.query?.enabled!==!1;return{...w(t?.query??{}),queryKey:O.hasPermit.scope(t.contractAddresses,n.walletAccount),queryFn:t=>{let[,{contractAddresses:n}]=t.queryKey;return e.permits.hasPermit(n)},staleTime:0,gcTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,enabled:r&&n.walletAccount!==void 0&&t.contractAddresses.length>0}}function Fe(e){return{mutationKey:[`zama.revokePermits`],mutationFn:t=>t===void 0?e.permits.revokePermits():e.permits.revokePermits(t)}}function Ie(e){return{mutationKey:[`zama.clearCredentials`],mutationFn:()=>e.permits.clear()}}function Le(e,t){return{mutationKey:[`zama.delegateDecryption`,t],mutationFn:async({delegateAddress:n,expirationDate:r})=>e.delegations.delegateDecryption({contractAddress:t,delegateAddress:n,expirationDate:r})}}function Re(e,t,n={}){return{queryKey:O.decryption.encryptedInputs(t,n.walletAccount),queryFn:t=>{let[,{encryptedInputs:n}]=t.queryKey;return e.decryption.decryptValues(n)},staleTime:1/0,enabled:t.length>0&&n.walletAccount!==void 0}}function ze(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,accountAddress:n})=>e.decryptBalanceAs({delegatorAddress:t,accountAddress:n})}}function Be(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>_.batchDecryptBalancesAs(e,t)}}function Ve(e,t){return{mutationKey:[`zama.revokeDelegation`,t],mutationFn:async({delegateAddress:n})=>e.delegations.revokeDelegation({contractAddress:t,delegateAddress:n})}}function He(e,t){return{...w(t.query??{}),queryKey:O.delegationStatus.scope(t.contractAddress,t.delegatorAddress,t.delegateAddress),queryFn:async t=>{let[,{contractAddress:n,delegatorAddress:r,delegateAddress:i}]=t.queryKey;return v(n,`delegationStatusQueryOptions: contractAddress`),v(r,`delegationStatusQueryOptions: delegatorAddress`),v(i,`delegationStatusQueryOptions: delegateAddress`),e.delegations.getStatus({contractAddress:n,delegatorAddress:r,delegateAddress:i})},enabled:!!(t.contractAddress&&t.delegatorAddress&&t.delegateAddress)&&t.query?.enabled!==!1}}export{ee as ZamaSDKEvents,xe as approveUnderlyingMutationOptions,Be as batchDecryptBalancesAsMutationOptions,Ie as clearCredentialsMutationOptions,ae as confidentialBalanceQueryOptions,oe as confidentialBalancesQueryOptions,ie as confidentialIsOperatorQueryOptions,be as confidentialSetOperatorMutationOptions,ce as confidentialTokenAddressQueryOptions,_e as confidentialTransferAndCallMutationOptions,ye as confidentialTransferFromAndCallMutationOptions,ve as confidentialTransferFromMutationOptions,ge as confidentialTransferMutationOptions,ze as decryptBalanceAsMutationOptions,je as decryptPublicValuesMutationOptions,Re as decryptValuesQueryOptions,Le as delegateDecryptionMutationOptions,Ae as delegatedDecryptValuesMutationOptions,He as delegationStatusQueryOptions,ke as encryptMutationOptions,w as filterQueryOptions,Oe as finalizeUnwrapMutationOptions,Me as grantPermitMutationOptions,$ as hasPermitQueryOptions,te as hashFn,R as invalidateAfterApproveUnderlying,z as invalidateAfterSetOperator,P as invalidateAfterShield,L as invalidateAfterTransfer,F as invalidateAfterUnshield,I as invalidateAfterUnshieldSettled,j as invalidateAfterUnwrap,M as invalidateAfterWrap,N as invalidateBalanceQueries,K as invalidateWagmiBalanceQueries,q as invalidateWalletLifecycleQueries,Y as isConfidentialQueryOptions,pe as isConfidentialTokenValidQueryOptions,X as isWrapperQueryOptions,me as listPairsQueryOptions,re as pendingUnshieldQueryOptions,Ne as preparePermitMutationOptions,Pe as registerPermitMutationOptions,we as resumeUnshieldMutationOptions,Ve as revokeDelegationMutationOptions,Fe as revokePermitsMutationOptions,he as shieldMutationOptions,le as tokenAddressQueryOptions,J as tokenMetadataQueryOptions,fe as tokenPairQueryOptions,ue as tokenPairsLengthQueryOptions,se as tokenPairsQueryOptions,de as tokenPairsSliceQueryOptions,Z as totalSupplyQueryOptions,ne as underlyingAllowanceQueryOptions,Ce as unshieldAllMutationOptions,Se as unshieldMutationOptions,De as unwrapAllMutationOptions,Te as unwrapMutationOptions,Ee as wrapMutationOptions,Q as wrapperDiscoveryQueryOptions,O as zamaQueryKeys};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|