@zama-fhe/sdk 2.4.0 → 2.5.0-alpha.2
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/LICENSE +24 -20
- package/README.md +9 -8
- package/dist/cjs/activity.cjs +1 -1
- package/dist/cjs/activity.cjs.map +1 -1
- package/dist/cjs/ethers/index.cjs +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/viem/index.cjs +1 -1
- package/dist/cjs/wrappers-registry.cjs +1 -1
- package/dist/cjs/wrappers-registry.cjs.map +1 -1
- package/dist/esm/activity-CxGHb_3-.js +2 -0
- package/dist/esm/activity-CxGHb_3-.js.map +1 -0
- package/dist/esm/{activity-CAZLy9Lp.d.ts → activity-DySBgT7m.d.ts} +1395 -88
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +2 -2
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/wrappers-registry-DO0729Zi.js +2 -0
- package/dist/esm/wrappers-registry-DO0729Zi.js.map +1 -0
- package/package.json +1 -1
- package/dist/esm/activity-CCD_CGXh.js +0 -2
- package/dist/esm/activity-CCD_CGXh.js.map +0 -1
- package/dist/esm/wrappers-registry-BAz8Adry.js +0 -2
- package/dist/esm/wrappers-registry-BAz8Adry.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as GenericSigner, D as TransactionResult, E as TransactionReceipt, S as GenericStorage, T as RawLog, _ as ShieldCallbacks, a as EncryptParams, g as UnshieldOptions, h as TransferOptions, i as EncryptInput, l as PublicDecryptResult, m as ShieldOptions, n as DelegatedUserDecryptParams, o as EncryptResult, p as UserDecryptParams, r as EIP712TypedData, s as Handle, t as ClearValueType, v as TransferCallbacks, w as SignerLifecycleCallbacks, x as StoredCredentials, y as UnshieldCallbacks } from "../relayer-sdk.types-CGfXwKcB.js";
|
|
2
2
|
import { t as RelayerSDK } from "../relayer-sdk-DPqytEbO.js";
|
|
3
|
-
import { $t as
|
|
3
|
+
import { $t as DelegationSubmittedEvent, At as userDecryptQueryOptions, Bt as BaseEvent, Ct as BatchDecryptOptions, Dt as DecryptHandle, G as TokenConfig, Gt as CredentialsCreatingEvent, H as WrappersRegistry, Ht as CredentialsCachedEvent, It as CredentialsManager, Jt as CredentialsPersistFailedEvent, Kt as CredentialsExpiredEvent, Lt as CredentialsManagerConfig, Mt as MutationFactoryOptions, Nt as QueryFactoryOptions, Ot as DecryptResult, Qt as DecryptStartEvent, R as ZamaSDK, Rt as ApproveSubmittedEvent, S as WrappedEvent, Sn as TokenWrapperPairWithMetadata, St as BatchDecryptAsOptions, Tt as ReadonlyTokenConfig, Ut as CredentialsCorruptedEvent, Vt as CredentialsAllowedEvent, W as Token, Wt as CredentialsCreatedEvent, Xt as DecryptEndEvent, Yt as CredentialsRevokedEvent, Zt as DecryptErrorEvent, a as ActivityType, an as SessionExpiredEvent, b as UnwrappedFinalizedEvent, bn as PaginatedResult, cn as TransferFromSubmittedEvent, dn as UnshieldPhase2StartedEvent, en as EncryptEndEvent, fn as UnshieldPhase2SubmittedEvent, gn as ZamaSDKEventListener, h as OnChainEvent, hn as ZamaSDKEventInput, i as ActivityLogMetadata, in as RevokeDelegationSubmittedEvent, jt as zamaQueryKeys, kt as UserDecryptQueryConfig, ln as TransferSubmittedEvent, mn as ZamaSDKEvent, n as ActivityDirection, nn as EncryptStartEvent, on as ShieldSubmittedEvent, p as ConfidentialTransferEvent, pn as UnwrapSubmittedEvent, qt as CredentialsLoadingEvent, r as ActivityItem, rn as FinalizeUnwrapSubmittedEvent, sn as TransactionErrorEvent, t as ActivityAmount, tn as EncryptErrorEvent, un as UnshieldPhase1SubmittedEvent, vn as ZamaSDKEvents, wt as ReadonlyToken, x as UnwrappedStartedEvent, xn as TokenWrapperPair, y as UnwrapRequestedEvent, z as ZamaSDKConfig, zt as ApproveUnderlyingSubmittedEvent } from "../activity-DySBgT7m.js";
|
|
4
4
|
import { Address, Hex } from "viem";
|
|
5
5
|
import { InputProofBytesType, KeypairType, KmsDelegatedUserDecryptEIP712Type, ZKProofLike } from "@zama-fhe/relayer-sdk/bundle";
|
|
6
6
|
import { QueryObserverOptions } from "@tanstack/query-core";
|
|
@@ -455,5 +455,5 @@ declare function delegationStatusQueryOptions(sdk: {
|
|
|
455
455
|
relayer: RelayerSDK;
|
|
456
456
|
}, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatusData, Error, DelegationStatusData, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
457
457
|
//#endregion
|
|
458
|
-
export { type ActivityAmount, type ActivityDirection, type ActivityFeedConfig, type ActivityFeedQueryConfig, type ActivityItem, type ActivityLogMetadata, type ActivityType, type ApproveSubmittedEvent, type ApproveUnderlyingParams, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptOptions, type ClearValueType, type ConfidentialApproveParams, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesData, type ConfidentialBalancesQueryConfig, type ConfidentialHandleQueryConfig, type ConfidentialHandlesQueryConfig, type ConfidentialIsApprovedQueryConfig, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferEvent, type ConfidentialTransferFromParams, type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type CredentialsAllowedEvent, type CredentialsCachedEvent, type CredentialsCorruptedEvent, type CredentialsCreatedEvent, type CredentialsCreatingEvent, type CredentialsExpiredEvent, type CredentialsLoadingEvent, type CredentialsManager, type CredentialsManagerConfig, type CredentialsPersistFailedEvent, type CredentialsRevokedEvent, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type DecryptHandle, type
|
|
458
|
+
export { type ActivityAmount, type ActivityDirection, type ActivityFeedConfig, type ActivityFeedQueryConfig, type ActivityItem, type ActivityLogMetadata, type ActivityType, type ApproveSubmittedEvent, type ApproveUnderlyingParams, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptOptions, type ClearValueType, type ConfidentialApproveParams, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesData, type ConfidentialBalancesQueryConfig, type ConfidentialHandleQueryConfig, type ConfidentialHandlesQueryConfig, type ConfidentialIsApprovedQueryConfig, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferEvent, type ConfidentialTransferFromParams, type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type CredentialsAllowedEvent, type CredentialsCachedEvent, type CredentialsCorruptedEvent, type CredentialsCreatedEvent, type CredentialsCreatingEvent, type CredentialsExpiredEvent, type CredentialsLoadingEvent, type CredentialsManager, type CredentialsManagerConfig, type CredentialsPersistFailedEvent, type CredentialsRevokedEvent, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type DecryptHandle, type DecryptResult, type DecryptStartEvent, type DelegateDecryptionParams, type DelegatedUserDecryptParams, type DelegationStatusData, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedBalanceHandle, type FinalizeUnwrapParams, type FinalizeUnwrapSubmittedEvent, type GenericSigner, type GenericStorage, type IsAllowedQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsQueryConfig, type MutationFactoryOptions, type OnChainEvent, type PublicDecryptResult, type PublicKeyQueryConfig, type PublicParamsQueryConfig, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadonlyToken, type ReadonlyTokenConfig, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationSubmittedEvent, type SessionExpiredEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldSubmittedEvent, type SignerAddressQueryConfig, type SignerLifecycleCallbacks, type StoredCredentials, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionReceipt, type TransactionResult, 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 UnwrapParams, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type UnwrappedFinalizedEvent, type UnwrappedStartedEvent, type UserDecryptParams, type UserDecryptQueryConfig, type WrappedEvent, type WrapperDiscoveryQueryConfig, type WrappersRegistryQueryConfig, ZERO_HANDLE, type ZamaSDK, type ZamaSDKConfig, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, ZamaSDKEvents, activityFeedQueryOptions, allowMutationOptions, approveUnderlyingMutationOptions, batchDecryptBalancesAsMutationOptions, confidentialApproveMutationOptions, confidentialBalanceQueryOptions, confidentialBalancesQueryOptions, confidentialHandleQueryOptions, confidentialHandlesQueryOptions, confidentialIsApprovedQueryOptions, confidentialTokenAddressQueryOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, createDelegatedUserDecryptEIP712MutationOptions, createEIP712MutationOptions, decryptBalanceAsMutationOptions, delegateDecryptionMutationOptions, delegatedUserDecryptMutationOptions, delegationStatusQueryOptions, deriveActivityFeedLogsKey, encryptMutationOptions, filterQueryOptions, finalizeUnwrapMutationOptions, generateKeypairMutationOptions, hashFn, invalidateAfterApprove, invalidateAfterApproveUnderlying, invalidateAfterShield, invalidateAfterTransfer, invalidateAfterUnshield, invalidateAfterUnwrap, invalidateBalanceQueries, invalidateWagmiBalanceQueries, invalidateWalletLifecycleQueries, isAllowedQueryOptions, isConfidentialQueryOptions, isConfidentialTokenValidQueryOptions, isWrapperQueryOptions, listPairsQueryOptions, publicDecryptMutationOptions, publicKeyQueryOptions, publicParamsQueryOptions, requestZKProofVerificationMutationOptions, resumeUnshieldMutationOptions, revokeDelegationMutationOptions, revokeMutationOptions, revokeSessionMutationOptions, shieldMutationOptions, signerAddressQueryOptions, tokenAddressQueryOptions, tokenMetadataQueryOptions, tokenPairQueryOptions, tokenPairsLengthQueryOptions, tokenPairsQueryOptions, tokenPairsSliceQueryOptions, totalSupplyQueryOptions, underlyingAllowanceQueryOptions, unshieldAllMutationOptions, unshieldMutationOptions, unwrapAllMutationOptions, unwrapMutationOptions, userDecryptQueryOptions, wrapperDiscoveryQueryOptions, zamaQueryKeys };
|
|
459
459
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/query/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as e,B as t,F as n,M as r,O as i,R as a,V as o,i as s,n as c,r as l,t as u,w as d}from"../activity-CCD_CGXh.js";import{t as f}from"../encryption-CmIPBcfP.js";import{a as p}from"../assertions-BARApuMj.js";import{r as m}from"../memory-storage-B4_heQa5.js";import{C as h,a as ee,b as te,d as ne,g,i as _,m as v,n as y,o as b,r as x,s as S,t as C,u as w}from"../wrappers-registry-BAz8Adry.js";import{getAddress as T,zeroAddress as E}from"viem";function re(e){if(!D(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!D(n)||!n.hasOwnProperty(`isPrototypeOf`))}function D(e){return Object.prototype.toString.call(e)===`[object Object]`}const O=`0x0000000000000000000000000000000000000000000000000000000000000000`;function k(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:ee,placeholderData:te,structuralSharing:ne,throwOnError:g,meta:_,query:v,pollingInterval:y,...b}=e;return b}function A(e){return JSON.stringify(e,(e,t)=>re(t)?Object.keys(t).toSorted().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const j=e=>e.map(e=>T(e)),M=e=>e===void 0?void 0:T(e),N={signerAddress:{all:[`zama.signerAddress`],scope:e=>[`zama.signerAddress`,{scope:e}],token:e=>[`zama.signerAddress`,{tokenAddress:T(e)}]},confidentialHandle:{all:[`zama.confidentialHandle`],token:e=>[`zama.confidentialHandle`,{tokenAddress:T(e)}],owner:(e,t)=>[`zama.confidentialHandle`,{tokenAddress:T(e),...t?{owner:T(t)}:{}}]},confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:T(e)}],owner:(e,t,n)=>[`zama.confidentialBalance`,{tokenAddress:T(e),...t?{owner:T(t)}:{},...n===void 0?{}:{handle:n}}]},confidentialHandles:{all:[`zama.confidentialHandles`],tokens:(e,t)=>[`zama.confidentialHandles`,{tokenAddresses:j(e),...t?{owner:T(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t,n)=>[`zama.confidentialBalances`,{tokenAddresses:j(e),...t?{owner:T(t)}:{},...n===void 0?{}:{handles:n}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:T(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:T(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:T(e)}]},wrapperDiscovery:{all:[`zama.wrapperDiscovery`],token:(e,t,n)=>{let r=M(e),i=M(t),a=M(n);return[`zama.wrapperDiscovery`,{...r?{tokenAddress:r}:{},...i?{erc20Address:i}:{},...a?{registryAddress:a}:{}}]}},underlyingAllowance:{all:[`zama.underlyingAllowance`],token:e=>[`zama.underlyingAllowance`,{tokenAddress:T(e)}],scope:(e,t,n)=>[`zama.underlyingAllowance`,{tokenAddress:T(e),...t?{owner:T(t)}:{},...n?{wrapperAddress:T(n)}:{}}]},confidentialIsApproved:{all:[`zama.confidentialIsApproved`],token:e=>{let t=M(e);return[`zama.confidentialIsApproved`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=M(e),i=M(t),a=M(n);return[`zama.confidentialIsApproved`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:T(e)}]},activityFeed:{all:[`zama.activityFeed`],token:e=>[`zama.activityFeed`,{tokenAddress:T(e)}],scope:(e,t,n,r)=>[`zama.activityFeed`,{tokenAddress:T(e),...t?{userAddress:T(t)}:{},...n?{logsKey:n}:{},...r===void 0?{}:{decrypt:r}}]},isAllowed:{all:[`zama.isAllowed`],scope:(e,t)=>[`zama.isAllowed`,{account:T(e),contractAddresses:j(t).toSorted()}]},publicKey:{all:[`zama.publicKey`]},publicParams:{all:[`zama.publicParams`],bits:e=>[`zama.publicParams`,{bits:e}]},delegationStatus:{all:[`zama.delegationStatus`],token:e=>{let t=M(e);return[`zama.delegationStatus`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=M(e),i=M(t),a=M(n);return[`zama.delegationStatus`,{...r?{tokenAddress:r}:{},...i?{delegatorAddress:i}:{},...a?{delegateAddress:a}:{}}]}},decryption:{all:[`zama.decryption`],handle:(e,t)=>[`zama.decryption`,{handle:e,...t===void 0?{}:{contractAddress:T(t)}}],handles:e=>[`zama.decryption`,{handles:[...e].toSorted((e,t)=>e.handle.localeCompare(t.handle)).map(e=>({handle:e.handle,contractAddress:T(e.contractAddress)}))}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:T(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:T(e),tokenAddress:T(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:T(e),confidentialTokenAddress:T(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:T(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:T(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:T(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:T(e),confidentialTokenAddress:T(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:T(e),page:t,pageSize:n,metadata:r}]}};function P(e,t){e.invalidateQueries({queryKey:N.underlyingAllowance.token(t)})}function F(e,t){I(e,t),P(e,t),W(e),e.invalidateQueries({queryKey:N.activityFeed.token(t)})}function I(e,t){e.invalidateQueries({queryKey:N.confidentialHandle.token(t)}),e.invalidateQueries({queryKey:N.confidentialHandles.all}),e.invalidateQueries({queryKey:N.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:N.confidentialBalances.all})}function L(e,t){I(e,t),P(e,t),W(e),e.invalidateQueries({queryKey:N.activityFeed.token(t)})}function R(e,t){I(e,t),P(e,t),W(e),e.invalidateQueries({queryKey:N.activityFeed.token(t)})}function z(e,t){I(e,t),e.invalidateQueries({queryKey:N.activityFeed.token(t)})}function B(e,t){P(e,t)}function V(e,t){e.invalidateQueries({queryKey:N.confidentialIsApproved.token(t)}),e.invalidateQueries({queryKey:N.activityFeed.token(t)})}function H(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}function U(e){return Array.isArray(e.queryKey)&&e.queryKey.some(e=>typeof e!=`object`||!e||!(`functionName`in e)?!1:e.functionName===`balanceOf`)}function W(e){e.invalidateQueries({predicate:U})}function G(e){e.removeQueries({queryKey:N.signerAddress.all}),e.removeQueries({queryKey:N.decryption.all}),e.invalidateQueries({predicate:H}),W(e)}const K=new WeakMap;let q=1;function J(e){let t=K.get(e);if(t!==void 0)return t;let n=q++;return K.set(e,n),n}function Y(e,t){return{...k(t?.query??{}),queryKey:N.signerAddress.scope(J(e)),queryFn:async()=>e.getAddress(),staleTime:3e4,enabled:t?.query?.enabled!==!1}}function X(e,n,r){let i=N.tokenMetadata.token(n);return{...k(r?.query??{}),queryKey:i,queryFn:async n=>{let[,{tokenAddress:r}]=n.queryKey,[i,s,c]=await Promise.all([e.readContract(t(r)),e.readContract(o(r)),e.readContract(a(r))]);return{name:i,symbol:s,decimals:c}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function ie(e,t,n){let r=N.isConfidential.token(t);return{...k(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(w(n))}catch(e){if(m(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function ae(e,t,n){let r=N.isWrapper.token(t);return{...k(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(ne(n))}catch(e){if(m(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function oe(e,t,n){let r=N.totalSupply.token(t);return{...k(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.readContract(h(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function se(e,t){let n=N.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...k(t.query??{}),queryKey:n,queryFn:async()=>{if(!t.erc20Address)throw Error(`erc20Address is required for wrapper discovery query`);let n=await e.getConfidentialToken(t.erc20Address);return n?n.confidentialTokenAddress:null},staleTime:1/0,enabled:!!(t.tokenAddress&&t.erc20Address&&t.registryAddress)&&t.query?.enabled!==!1}}function ce(e,t,r){let i=r.owner,a=r.wrapperAddress,o=r.query?.enabled!==!1,s=N.underlyingAllowance.scope(t,i,a);return{...k(r.query??{}),queryKey:s,queryFn:async t=>{let[,{owner:r,wrapperAddress:i}]=t.queryKey;p(r,`underlyingAllowanceQueryOptions: owner`),p(i,`underlyingAllowanceQueryOptions: wrapperAddress`);let a=await e.readContract(v(i));return e.readContract(n(a,r,i))},staleTime:3e4,enabled:!!(i&&a)&&o}}function le(e,t,n){let r=n.holder,i=n.spender,a=n.query?.enabled!==!1,o=N.confidentialIsApproved.scope(t,r,i);return{...k(n.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddress:n,holder:r,spender:i}]=t.queryKey;return p(n,`confidentialIsApprovedQueryOptions: tokenAddress`),p(r,`confidentialIsApprovedQueryOptions: holder`),p(i,`confidentialIsApprovedQueryOptions: spender`),e.readContract(te(n,r,i))},staleTime:3e4,enabled:!!(t&&r&&i)&&a}}function ue(e,t){let n=N.publicKey.all;return{...k(t?.query??{}),queryKey:n,queryFn:async()=>e.relayer.getPublicKey(),staleTime:1/0,enabled:t?.query?.enabled!==!1}}function de(e,t,n){let r=N.publicParams.bits(t);return{...k(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{bits:n}]=t.queryKey;return e.relayer.getPublicParams(n)},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function fe(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,a=N.confidentialHandle.owner(t,r);return{...k(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddress:n,owner:r}]=t.queryKey;return p(r,`confidentialHandleQueryOptions: owner`),await e.readContract(g(n,r))},enabled:!!r&&i,refetchInterval:n?.pollingInterval??1e4}}function pe(e,t){let n=t?.owner,r=t?.handle,i=t?.query?.enabled!==!1,a=N.confidentialBalance.owner(e.address,n,r);return{...k(t?.query??{}),queryKey:a,queryFn:async t=>{let[,{owner:n,handle:r}]=t.queryKey;return p(n,`confidentialBalanceQueryOptions: owner`),p(r,`confidentialBalanceQueryOptions: handle`),e.decryptBalance(r,n)},enabled:!!(n&&r)&&i,staleTime:1/0}}function me(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,a=N.confidentialHandles.tokens(t,r);return{...k(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddresses:n,owner:r}]=t.queryKey;return p(r,`confidentialHandlesQueryOptions: owner`),Promise.all(n.map(async t=>await e.readContract(g(t,r))))},enabled:!!(r&&t.length>0)&&i,refetchInterval:n?.pollingInterval??1e4}}function he(e,t){let n=e.map(e=>e.address),r=t?.resultAddresses??n,i=t?.owner,a=t?.handles,o=t?.query?.enabled!==!1,s=Array.isArray(a)&&a.length===e.length&&a.every(e=>!!e),c=N.confidentialBalances.tokens(n,i,a);return{...k(t?.query??{}),queryKey:c,queryFn:async n=>{let[,{owner:i,handles:a}]=n.queryKey;p(i,`confidentialBalancesQueryOptions: owner`),p(a,`confidentialBalancesQueryOptions: handles`);let o=new Map,s=await d.batchDecryptBalances(e,{owner:i,handles:a,maxConcurrency:t?.maxConcurrency,onError:(e,t)=>(o.set(t,e),0n)}),c=new Map,l=new Map;for(let t=0;t<e.length;t++){let n=e[t].address,i=r[t],a=o.get(n);if(a)l.set(i,a);else{let e=s.get(n);e!==void 0&&c.set(i,e)}}if(l.size===e.length&&e.length>0)throw l.values().next().value??new f(`All token balance decryptions failed`);return{balances:c,errors:l,isPartialError:l.size>0}},enabled:r.length===e.length&&!!i&&e.length>0&&s&&o,staleTime:1/0}}function Z(e){if(e)return A([`zama.activityFeed.logs`,e.map(e=>({topics:[...e.topics],data:e.data,transactionHash:e.transactionHash,blockNumber:e.blockNumber,logIndex:e.logIndex}))])}function ge(e,t,n){let r=t.userAddress,i=t.decrypt??!0,a=t.logs,o=t.logsKey??Z(a),d=n?.query?.enabled!==!1,f=N.activityFeed.scope(e.address,r,o,i);return{...k(n?.query??{}),queryKey:f,queryFn:async t=>{let[,{userAddress:n,decrypt:r}]=t.queryKey;p(n,`activityFeedQueryOptions: userAddress`),p(a,`activityFeedQueryOptions: logs`);let i=l(a,n);if(!r)return s(i);let o=c(i);return o.length===0?s(i):s(u(i,await e.decryptHandles(o,n)))},staleTime:1/0,enabled:!!(r&&a)&&d}}const Q=86400*1e3;function _e(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=N.wrappersRegistry.tokenPairs(t.registryAddress??E);return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(_(n))},staleTime:Q,enabled:n}}function ve(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=N.wrappersRegistry.confidentialTokenAddress(t.registryAddress??E,t.tokenAddress??E);return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.readContract(C(n,r))},staleTime:Q,enabled:n}}function ye(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=N.wrappersRegistry.tokenAddress(t.registryAddress??E,t.confidentialTokenAddress??E);return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(y(n,r))},staleTime:Q,enabled:n}}function be(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=N.wrappersRegistry.tokenPairsLength(t.registryAddress??E);return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(ee(n))},staleTime:Q,enabled:n}}function xe(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=N.wrappersRegistry.tokenPairsSlice(t.registryAddress??E,String(t.fromIndex??0n),String(t.toIndex??0n));return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.readContract(b(n,BigInt(r),BigInt(i)))},staleTime:Q,enabled:n}}function Se(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=N.wrappersRegistry.tokenPair(t.registryAddress??E,String(t.index??0n));return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.readContract(x(n,BigInt(r)))},staleTime:Q,enabled:n}}function Ce(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=N.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??E,t.confidentialTokenAddress??E);return{...k(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(S(n,r))},staleTime:Q,enabled:n}}function we(e,t){let n=t.page??1,r=t.pageSize??100,i=t.metadata??!1,a=!!t.registryAddress&&t.query?.enabled!==!1,o=N.wrappersRegistry.listPairs(t.registryAddress??E,n,r,i);return{...k(t.query??{}),queryKey:o,queryFn:async()=>e.listPairs({page:n,pageSize:r,metadata:i}),staleTime:e.ttlMs,enabled:a}}function Te(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function Ee(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function De(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function Oe(e){return{mutationKey:[`zama.confidentialApprove`,e.address],mutationFn:async({spender:t,until:n})=>e.approve(t,n)}}function ke(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function Ae(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function je(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function Me(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function Ne(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function Pe(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Fe(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({burnAmountHandle:t})=>e.finalizeUnwrap(t)}}function Ie(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.relayer.encrypt(t)}}function Le(e){return{mutationKey:[`zama.generateKeypair`],mutationFn:async()=>e.relayer.generateKeypair()}}function Re(e){return{mutationKey:[`zama.createEIP712`],mutationFn:async({publicKey:t,contractAddresses:n,startTimestamp:r,durationDays:i})=>e.relayer.createEIP712(t,n,r,i)}}function ze(e){return{mutationKey:[`zama.createDelegatedUserDecryptEIP712`],mutationFn:async({publicKey:t,contractAddresses:n,delegatorAddress:r,startTimestamp:i,durationDays:a})=>e.relayer.createDelegatedUserDecryptEIP712(t,n,r,i,a)}}function Be(e){return{mutationKey:[`zama.delegatedUserDecrypt`],mutationFn:async t=>e.relayer.delegatedUserDecrypt(t)}}function Ve(e){return{mutationKey:[`zama.publicDecrypt`],mutationFn:async t=>e.relayer.publicDecrypt(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(N.decryption.handle(t),n)}}}function $(e){return{mutationKey:[`zama.requestZKProofVerification`],mutationFn:async t=>e.relayer.requestZKProofVerification(t)}}function He(e){return{mutationKey:[`zama.allow`],mutationFn:async t=>{await e.credentials.allow(...t)}}}function Ue(e,t){return{...k(t?.query??{}),queryKey:N.isAllowed.scope(t.account,t.contractAddresses),queryFn:()=>e.credentials.isAllowed(t.contractAddresses),staleTime:3e4,enabled:t.query?.enabled??!0}}function We(e){return{mutationKey:[`zama.revoke`],mutationFn:t=>e.credentials.revoke(...t)}}function Ge(e){return{mutationKey:[`zama.revokeSession`],mutationFn:()=>e.revokeSession()}}function Ke(e){return{mutationKey:[`zama.delegateDecryption`,e.address],mutationFn:async({delegateAddress:t,expirationDate:n})=>e.delegateDecryption({delegateAddress:t,expirationDate:n})}}function qe(e,t){return{queryKey:N.decryption.handles(t.handles),queryFn:()=>e.userDecrypt(t.handles),staleTime:1/0,enabled:t.handles.length>0}}function Je(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,owner:n})=>e.decryptBalanceAs({delegatorAddress:t,owner:n})}}function Ye(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>d.batchDecryptBalancesAs(e,t)}}function Xe(e){return{mutationKey:[`zama.revokeDelegation`,e.address],mutationFn:async({delegateAddress:t})=>e.revokeDelegation({delegateAddress:t})}}function Ze(t,n){return{...k(n.query??{}),queryKey:N.delegationStatus.scope(n.tokenAddress,n.delegatorAddress,n.delegateAddress),queryFn:async n=>{let[,{tokenAddress:i,delegatorAddress:a,delegateAddress:o}]=n.queryKey;p(i,`delegationStatusQueryOptions: tokenAddress`),p(a,`delegationStatusQueryOptions: delegatorAddress`),p(o,`delegationStatusQueryOptions: delegateAddress`);let s=await t.relayer.getAclAddress(),c=await t.signer.readContract(r(s,a,o,i)),l;return l=c===0n?!1:c===e?!0:c>await t.signer.getBlockTimestamp(),{isDelegated:l,expiryTimestamp:c}},enabled:!!(n.tokenAddress&&n.delegatorAddress&&n.delegateAddress)&&n.query?.enabled!==!1}}export{O as ZERO_HANDLE,i as ZamaSDKEvents,ge as activityFeedQueryOptions,He as allowMutationOptions,ke as approveUnderlyingMutationOptions,Ye as batchDecryptBalancesAsMutationOptions,Oe as confidentialApproveMutationOptions,pe as confidentialBalanceQueryOptions,he as confidentialBalancesQueryOptions,fe as confidentialHandleQueryOptions,me as confidentialHandlesQueryOptions,le as confidentialIsApprovedQueryOptions,ve as confidentialTokenAddressQueryOptions,De as confidentialTransferFromMutationOptions,Ee as confidentialTransferMutationOptions,ze as createDelegatedUserDecryptEIP712MutationOptions,Re as createEIP712MutationOptions,Je as decryptBalanceAsMutationOptions,Ke as delegateDecryptionMutationOptions,Be as delegatedUserDecryptMutationOptions,Ze as delegationStatusQueryOptions,Z as deriveActivityFeedLogsKey,Ie as encryptMutationOptions,k as filterQueryOptions,Fe as finalizeUnwrapMutationOptions,Le as generateKeypairMutationOptions,A as hashFn,V as invalidateAfterApprove,B as invalidateAfterApproveUnderlying,L as invalidateAfterShield,z as invalidateAfterTransfer,R as invalidateAfterUnshield,F as invalidateAfterUnwrap,I as invalidateBalanceQueries,W as invalidateWagmiBalanceQueries,G as invalidateWalletLifecycleQueries,Ue as isAllowedQueryOptions,ie as isConfidentialQueryOptions,Ce as isConfidentialTokenValidQueryOptions,ae as isWrapperQueryOptions,we as listPairsQueryOptions,Ve as publicDecryptMutationOptions,ue as publicKeyQueryOptions,de as publicParamsQueryOptions,$ as requestZKProofVerificationMutationOptions,Me as resumeUnshieldMutationOptions,Xe as revokeDelegationMutationOptions,We as revokeMutationOptions,Ge as revokeSessionMutationOptions,Te as shieldMutationOptions,Y as signerAddressQueryOptions,ye as tokenAddressQueryOptions,X as tokenMetadataQueryOptions,Se as tokenPairQueryOptions,be as tokenPairsLengthQueryOptions,_e as tokenPairsQueryOptions,xe as tokenPairsSliceQueryOptions,oe as totalSupplyQueryOptions,ce as underlyingAllowanceQueryOptions,je as unshieldAllMutationOptions,Ae as unshieldMutationOptions,Pe as unwrapAllMutationOptions,Ne as unwrapMutationOptions,qe as userDecryptQueryOptions,se as wrapperDiscoveryQueryOptions,N as zamaQueryKeys};
|
|
1
|
+
import{D as e,G as t,H as n,I as r,M as i,O as a,P as o,W as s,i as c,k as l,n as ee,r as u,t as d,w as f,z as p}from"../activity-CxGHb_3-.js";import{t as m}from"../encryption-CmIPBcfP.js";import{a as h}from"../assertions-BARApuMj.js";import{r as g}from"../memory-storage-B4_heQa5.js";import{T as _,_ as v,a as y,b,d as x,i as te,n as ne,o as re,p as S,r as C,s as w,t as T,u as E}from"../wrappers-registry-DO0729Zi.js";import{getAddress as D,zeroAddress as O}from"viem";const k=e=>e.map(e=>D(e)),A=e=>e===void 0?void 0:D(e),j={signerAddress:{all:[`zama.signerAddress`],scope:e=>[`zama.signerAddress`,{scope:e}],token:e=>[`zama.signerAddress`,{tokenAddress:D(e)}]},confidentialHandle:{all:[`zama.confidentialHandle`],token:e=>[`zama.confidentialHandle`,{tokenAddress:D(e)}],owner:(e,t)=>[`zama.confidentialHandle`,{tokenAddress:D(e),...t?{owner:D(t)}:{}}]},confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:D(e)}],owner:(e,t,n)=>[`zama.confidentialBalance`,{tokenAddress:D(e),...t?{owner:D(t)}:{},...n===void 0?{}:{handle:n}}]},confidentialHandles:{all:[`zama.confidentialHandles`],tokens:(e,t)=>[`zama.confidentialHandles`,{tokenAddresses:k(e),...t?{owner:D(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t,n)=>[`zama.confidentialBalances`,{tokenAddresses:k(e),...t?{owner:D(t)}:{},...n===void 0?{}:{handles:n}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:D(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:D(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:D(e)}]},wrapperDiscovery:{all:[`zama.wrapperDiscovery`],token:(e,t,n)=>{let r=A(e),i=A(t),a=A(n);return[`zama.wrapperDiscovery`,{...r?{tokenAddress:r}:{},...i?{erc20Address:i}:{},...a?{registryAddress:a}:{}}]}},underlyingAllowance:{all:[`zama.underlyingAllowance`],token:e=>[`zama.underlyingAllowance`,{tokenAddress:D(e)}],scope:(e,t,n)=>[`zama.underlyingAllowance`,{tokenAddress:D(e),...t?{owner:D(t)}:{},...n?{wrapperAddress:D(n)}:{}}]},confidentialIsApproved:{all:[`zama.confidentialIsApproved`],token:e=>{let t=A(e);return[`zama.confidentialIsApproved`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=A(e),i=A(t),a=A(n);return[`zama.confidentialIsApproved`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:D(e)}]},activityFeed:{all:[`zama.activityFeed`],token:e=>[`zama.activityFeed`,{tokenAddress:D(e)}],scope:(e,t,n,r)=>[`zama.activityFeed`,{tokenAddress:D(e),...t?{userAddress:D(t)}:{},...n?{logsKey:n}:{},...r===void 0?{}:{decrypt:r}}]},isAllowed:{all:[`zama.isAllowed`],scope:(e,t)=>[`zama.isAllowed`,{account:D(e),contractAddresses:k(t).toSorted()}]},publicKey:{all:[`zama.publicKey`]},publicParams:{all:[`zama.publicParams`],bits:e=>[`zama.publicParams`,{bits:e}]},delegationStatus:{all:[`zama.delegationStatus`],token:e=>{let t=A(e);return[`zama.delegationStatus`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=A(e),i=A(t),a=A(n);return[`zama.delegationStatus`,{...r?{tokenAddress:r}:{},...i?{delegatorAddress:i}:{},...a?{delegateAddress:a}:{}}]}},decryption:{all:[`zama.decryption`],handle:(e,t)=>[`zama.decryption`,{handle:e,...t===void 0?{}:{contractAddress:D(t)}}],handles:e=>[`zama.decryption`,{handles:[...e].toSorted((e,t)=>e.handle.localeCompare(t.handle)).map(e=>({handle:e.handle,contractAddress:D(e.contractAddress)}))}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:D(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:D(e),tokenAddress:D(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:D(e),confidentialTokenAddress:D(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:D(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:D(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:D(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:D(e),confidentialTokenAddress:D(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:D(e),page:t,pageSize:n,metadata:r}]}};function M(e,t){e.invalidateQueries({queryKey:j.underlyingAllowance.token(t)})}function N(e,t){P(e,t),M(e,t),H(e),e.invalidateQueries({queryKey:j.activityFeed.token(t)})}function P(e,t){e.invalidateQueries({queryKey:j.confidentialHandle.token(t)}),e.invalidateQueries({queryKey:j.confidentialHandles.all}),e.invalidateQueries({queryKey:j.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:j.confidentialBalances.all})}function F(e,t){P(e,t),M(e,t),H(e),e.invalidateQueries({queryKey:j.activityFeed.token(t)})}function I(e,t){P(e,t),M(e,t),H(e),e.invalidateQueries({queryKey:j.activityFeed.token(t)})}function L(e,t){P(e,t),e.invalidateQueries({queryKey:j.activityFeed.token(t)})}function R(e,t){M(e,t)}function z(e,t){e.invalidateQueries({queryKey:j.confidentialIsApproved.token(t)}),e.invalidateQueries({queryKey:j.activityFeed.token(t)})}function B(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}function V(e){return Array.isArray(e.queryKey)&&e.queryKey.some(e=>typeof e!=`object`||!e||!(`functionName`in e)?!1:e.functionName===`balanceOf`)}function H(e){e.invalidateQueries({predicate:V})}function U(e){e.removeQueries({queryKey:j.signerAddress.all}),e.removeQueries({queryKey:j.decryption.all}),e.invalidateQueries({predicate:B}),H(e)}const W=new WeakMap;let G=1;function K(e){let t=W.get(e);if(t!==void 0)return t;let n=G++;return W.set(e,n),n}function q(e,t){return{...a(t?.query??{}),queryKey:j.signerAddress.scope(K(e)),queryFn:async()=>e.getAddress(),staleTime:3e4,enabled:t?.query?.enabled!==!1}}function J(e,r,i){let o=j.tokenMetadata.token(r);return{...a(i?.query??{}),queryKey:o,queryFn:async r=>{let[,{tokenAddress:i}]=r.queryKey,[a,o,c]=await Promise.all([e.readContract(s(i)),e.readContract(t(i)),e.readContract(n(i))]);return{name:a,symbol:o,decimals:c}},staleTime:1/0,enabled:i?.query?.enabled!==!1}}function Y(e,t,n){let r=j.isConfidential.token(t);return{...a(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(E(n))}catch(e){if(g(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function X(e,t,n){let r=j.isWrapper.token(t);return{...a(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(x(n))}catch(e){if(g(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function ie(e,t,n){let r=j.totalSupply.token(t);return{...a(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.readContract(b(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function ae(e,t){let n=j.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...a(t.query??{}),queryKey:n,queryFn:async()=>{if(!t.erc20Address)throw Error(`erc20Address is required for wrapper discovery query`);let n=await e.getConfidentialToken(t.erc20Address);return n?n.confidentialTokenAddress:null},staleTime:1/0,enabled:!!(t.tokenAddress&&t.erc20Address&&t.registryAddress)&&t.query?.enabled!==!1}}function oe(e,t,n){let r=n.owner,i=n.wrapperAddress,o=n.query?.enabled!==!1,s=j.underlyingAllowance.scope(t,r,i);return{...a(n.query??{}),queryKey:s,queryFn:async t=>{let[,{owner:n,wrapperAddress:r}]=t.queryKey;h(n,`underlyingAllowanceQueryOptions: owner`),h(r,`underlyingAllowanceQueryOptions: wrapperAddress`);let i=await e.readContract(_(r));return e.readContract(p(i,n,r))},staleTime:3e4,enabled:!!(r&&i)&&o}}function se(e,t,n){let r=n.holder,i=n.spender,o=n.query?.enabled!==!1,s=j.confidentialIsApproved.scope(t,r,i);return{...a(n.query??{}),queryKey:s,queryFn:async t=>{let[,{tokenAddress:n,holder:r,spender:i}]=t.queryKey;return h(n,`confidentialIsApprovedQueryOptions: tokenAddress`),h(r,`confidentialIsApprovedQueryOptions: holder`),h(i,`confidentialIsApprovedQueryOptions: spender`),e.readContract(v(n,r,i))},staleTime:3e4,enabled:!!(t&&r&&i)&&o}}function ce(e,t){let n=j.publicKey.all;return{...a(t?.query??{}),queryKey:n,queryFn:async()=>e.relayer.getPublicKey(),staleTime:1/0,enabled:t?.query?.enabled!==!1}}function le(e,t,n){let r=j.publicParams.bits(t);return{...a(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{bits:n}]=t.queryKey;return e.relayer.getPublicParams(n)},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function ue(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,o=j.confidentialHandle.owner(t,r);return{...a(n?.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddress:n,owner:r}]=t.queryKey;return h(r,`confidentialHandleQueryOptions: owner`),await e.readContract(S(n,r))},enabled:!!r&&i,refetchInterval:n?.pollingInterval??1e4}}function de(e,t){let n=t?.owner,r=t?.handle,i=t?.query?.enabled!==!1,o=j.confidentialBalance.owner(e.address,n,r);return{...a(t?.query??{}),queryKey:o,queryFn:async t=>{let[,{owner:n,handle:r}]=t.queryKey;return h(n,`confidentialBalanceQueryOptions: owner`),h(r,`confidentialBalanceQueryOptions: handle`),e.decryptBalance(r,n)},enabled:!!(n&&r)&&i,staleTime:1/0}}function fe(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,o=j.confidentialHandles.tokens(t,r);return{...a(n?.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddresses:n,owner:r}]=t.queryKey;return h(r,`confidentialHandlesQueryOptions: owner`),Promise.all(n.map(async t=>await e.readContract(S(t,r))))},enabled:!!(r&&t.length>0)&&i,refetchInterval:n?.pollingInterval??1e4}}function pe(e,t){let n=e.map(e=>e.address),r=t?.resultAddresses??n,i=t?.owner,o=t?.handles,s=t?.query?.enabled!==!1,c=Array.isArray(o)&&o.length===e.length&&o.every(e=>!!e),l=j.confidentialBalances.tokens(n,i,o);return{...a(t?.query??{}),queryKey:l,queryFn:async n=>{let[,{owner:i,handles:a}]=n.queryKey;h(i,`confidentialBalancesQueryOptions: owner`),h(a,`confidentialBalancesQueryOptions: handles`);let o=new Map,s=await f.batchDecryptBalances(e,{owner:i,handles:a,maxConcurrency:t?.maxConcurrency,onError:(e,t)=>(o.set(t,e),0n)}),c=new Map,l=new Map;for(let t=0;t<e.length;t++){let n=e[t].address,i=r[t],a=o.get(n);if(a)l.set(i,a);else{let e=s.get(n);e!==void 0&&c.set(i,e)}}if(l.size===e.length&&e.length>0)throw l.values().next().value??new m(`All token balance decryptions failed`);return{balances:c,errors:l,isPartialError:l.size>0}},enabled:r.length===e.length&&!!i&&e.length>0&&c&&s,staleTime:1/0}}function Z(e){if(e)return l([`zama.activityFeed.logs`,e.map(e=>({topics:[...e.topics],data:e.data,transactionHash:e.transactionHash,blockNumber:e.blockNumber,logIndex:e.logIndex}))])}function me(e,t,n){let r=t.userAddress,i=t.decrypt??!0,o=t.logs,s=t.logsKey??Z(o),l=n?.query?.enabled!==!1,f=j.activityFeed.scope(e.address,r,s,i);return{...a(n?.query??{}),queryKey:f,queryFn:async t=>{let[,{userAddress:n,decrypt:r}]=t.queryKey;h(n,`activityFeedQueryOptions: userAddress`),h(o,`activityFeedQueryOptions: logs`);let i=u(o,n);if(!r)return c(i);let a=ee(i);return a.length===0?c(i):c(d(i,await e.decryptHandles(a,n)))},staleTime:1/0,enabled:!!(r&&o)&&l}}const Q=86400*1e3;function he(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPairs(t.registryAddress??O);return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(te(n))},staleTime:Q,enabled:n}}function ge(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.confidentialTokenAddress(t.registryAddress??O,t.tokenAddress??O);return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.readContract(T(n,r))},staleTime:Q,enabled:n}}function _e(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenAddress(t.registryAddress??O,t.confidentialTokenAddress??O);return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(ne(n,r))},staleTime:Q,enabled:n}}function ve(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPairsLength(t.registryAddress??O);return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(y(n))},staleTime:Q,enabled:n}}function ye(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPairsSlice(t.registryAddress??O,String(t.fromIndex??0n),String(t.toIndex??0n));return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.readContract(re(n,BigInt(r),BigInt(i)))},staleTime:Q,enabled:n}}function be(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPair(t.registryAddress??O,String(t.index??0n));return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.readContract(C(n,BigInt(r)))},staleTime:Q,enabled:n}}function xe(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??O,t.confidentialTokenAddress??O);return{...a(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(w(n,r))},staleTime:Q,enabled:n}}function Se(e,t){let n=t.page??1,r=t.pageSize??100,i=t.metadata??!1,o=!!t.registryAddress&&t.query?.enabled!==!1,s=j.wrappersRegistry.listPairs(t.registryAddress??O,n,r,i);return{...a(t.query??{}),queryKey:s,queryFn:async()=>e.listPairs({page:n,pageSize:r,metadata:i}),staleTime:e.ttlMs,enabled:o}}function Ce(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function we(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function Te(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function Ee(e){return{mutationKey:[`zama.confidentialApprove`,e.address],mutationFn:async({spender:t,until:n})=>e.approve(t,n)}}function De(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function Oe(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function ke(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function Ae(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function je(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function Me(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Ne(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({burnAmountHandle:t})=>e.finalizeUnwrap(t)}}function Pe(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.relayer.encrypt(t)}}function Fe(e){return{mutationKey:[`zama.generateKeypair`],mutationFn:async()=>e.relayer.generateKeypair()}}function Ie(e){return{mutationKey:[`zama.createEIP712`],mutationFn:async({publicKey:t,contractAddresses:n,startTimestamp:r,durationDays:i})=>e.relayer.createEIP712(t,n,r,i)}}function Le(e){return{mutationKey:[`zama.createDelegatedUserDecryptEIP712`],mutationFn:async({publicKey:t,contractAddresses:n,delegatorAddress:r,startTimestamp:i,durationDays:a})=>e.relayer.createDelegatedUserDecryptEIP712(t,n,r,i,a)}}function Re(e){return{mutationKey:[`zama.delegatedUserDecrypt`],mutationFn:async t=>e.relayer.delegatedUserDecrypt(t)}}function ze(e){return{mutationKey:[`zama.publicDecrypt`],mutationFn:async t=>e.relayer.publicDecrypt(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(j.decryption.handle(t),n)}}}function Be(e){return{mutationKey:[`zama.requestZKProofVerification`],mutationFn:async t=>e.relayer.requestZKProofVerification(t)}}function Ve(e){return{mutationKey:[`zama.allow`],mutationFn:async t=>{await e.credentials.allow(...t)}}}function $(e,t){return{...a(t?.query??{}),queryKey:j.isAllowed.scope(t.account,t.contractAddresses),queryFn:()=>e.credentials.isAllowed(t.contractAddresses),staleTime:3e4,enabled:t.query?.enabled??!0}}function He(e){return{mutationKey:[`zama.revoke`],mutationFn:t=>e.credentials.revoke(...t)}}function Ue(e){return{mutationKey:[`zama.revokeSession`],mutationFn:()=>e.revokeSession()}}function We(e){return{mutationKey:[`zama.delegateDecryption`,e.address],mutationFn:async({delegateAddress:t,expirationDate:n})=>e.delegateDecryption({delegateAddress:t,expirationDate:n})}}function Ge(e,t){return{queryKey:j.decryption.handles(t.handles),queryFn:()=>e.userDecrypt(t.handles),staleTime:1/0,enabled:t.handles.length>0}}function Ke(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,owner:n})=>e.decryptBalanceAs({delegatorAddress:t,owner:n})}}function qe(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>f.batchDecryptBalancesAs(e,t)}}function Je(e){return{mutationKey:[`zama.revokeDelegation`,e.address],mutationFn:async({delegateAddress:t})=>e.revokeDelegation({delegateAddress:t})}}function Ye(e,t){return{...a(t.query??{}),queryKey:j.delegationStatus.scope(t.tokenAddress,t.delegatorAddress,t.delegateAddress),queryFn:async t=>{let[,{tokenAddress:n,delegatorAddress:i,delegateAddress:a}]=t.queryKey;h(n,`delegationStatusQueryOptions: tokenAddress`),h(i,`delegationStatusQueryOptions: delegatorAddress`),h(a,`delegationStatusQueryOptions: delegateAddress`);let s=await e.relayer.getAclAddress(),c=await e.signer.readContract(r(s,i,a,n)),l;return l=c===0n?!1:c===o?!0:c>await e.signer.getBlockTimestamp(),{isDelegated:l,expiryTimestamp:c}},enabled:!!(t.tokenAddress&&t.delegatorAddress&&t.delegateAddress)&&t.query?.enabled!==!1}}export{e as ZERO_HANDLE,i as ZamaSDKEvents,me as activityFeedQueryOptions,Ve as allowMutationOptions,De as approveUnderlyingMutationOptions,qe as batchDecryptBalancesAsMutationOptions,Ee as confidentialApproveMutationOptions,de as confidentialBalanceQueryOptions,pe as confidentialBalancesQueryOptions,ue as confidentialHandleQueryOptions,fe as confidentialHandlesQueryOptions,se as confidentialIsApprovedQueryOptions,ge as confidentialTokenAddressQueryOptions,Te as confidentialTransferFromMutationOptions,we as confidentialTransferMutationOptions,Le as createDelegatedUserDecryptEIP712MutationOptions,Ie as createEIP712MutationOptions,Ke as decryptBalanceAsMutationOptions,We as delegateDecryptionMutationOptions,Re as delegatedUserDecryptMutationOptions,Ye as delegationStatusQueryOptions,Z as deriveActivityFeedLogsKey,Pe as encryptMutationOptions,a as filterQueryOptions,Ne as finalizeUnwrapMutationOptions,Fe as generateKeypairMutationOptions,l as hashFn,z as invalidateAfterApprove,R as invalidateAfterApproveUnderlying,F as invalidateAfterShield,L as invalidateAfterTransfer,I as invalidateAfterUnshield,N as invalidateAfterUnwrap,P as invalidateBalanceQueries,H as invalidateWagmiBalanceQueries,U as invalidateWalletLifecycleQueries,$ as isAllowedQueryOptions,Y as isConfidentialQueryOptions,xe as isConfidentialTokenValidQueryOptions,X as isWrapperQueryOptions,Se as listPairsQueryOptions,ze as publicDecryptMutationOptions,ce as publicKeyQueryOptions,le as publicParamsQueryOptions,Be as requestZKProofVerificationMutationOptions,Ae as resumeUnshieldMutationOptions,Je as revokeDelegationMutationOptions,He as revokeMutationOptions,Ue as revokeSessionMutationOptions,Ce as shieldMutationOptions,q as signerAddressQueryOptions,_e as tokenAddressQueryOptions,J as tokenMetadataQueryOptions,be as tokenPairQueryOptions,ve as tokenPairsLengthQueryOptions,he as tokenPairsQueryOptions,ye as tokenPairsSliceQueryOptions,ie as totalSupplyQueryOptions,oe as underlyingAllowanceQueryOptions,ke as unshieldAllMutationOptions,Oe as unshieldMutationOptions,Me as unwrapAllMutationOptions,je as unwrapMutationOptions,Ge as userDecryptQueryOptions,ae as wrapperDiscoveryQueryOptions,j as zamaQueryKeys};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|