@zama-fhe/sdk 3.0.0-alpha.2 → 3.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -122
- package/dist/cjs/build.cjs +2 -0
- package/dist/cjs/build.cjs.map +1 -0
- package/dist/cjs/chains/index.cjs +1 -0
- package/dist/cjs/chains.cjs +2 -0
- package/dist/cjs/chains.cjs.map +1 -0
- package/dist/cjs/cleartext/index.cjs +1 -1
- package/dist/cjs/eip1193-subscribe.cjs +1 -1
- package/dist/cjs/eip1193-subscribe.cjs.map +1 -1
- package/dist/cjs/encryption.cjs +2 -0
- package/dist/cjs/encryption.cjs.map +1 -0
- package/dist/cjs/ethers/index.cjs +1 -1
- package/dist/cjs/ethers/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +73 -73
- 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/readonly-token.cjs +1 -1
- package/dist/cjs/readonly-token.cjs.map +1 -1
- package/dist/cjs/relayer-cleartext.cjs +2 -0
- package/dist/cjs/relayer-cleartext.cjs.map +1 -0
- package/dist/cjs/relayer-sdk.worker.js +71 -71
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/viem/index.cjs +1 -1
- package/dist/cjs/viem/index.cjs.map +1 -1
- package/dist/cjs/wrappers-registry.cjs +1 -1
- package/dist/cjs/wrappers-registry.cjs.map +1 -1
- package/dist/esm/{assertions-BARApuMj.js → assertions-CfqI3AJv.js} +1 -1
- package/dist/esm/{assertions-BARApuMj.js.map → assertions-CfqI3AJv.js.map} +1 -1
- package/dist/esm/build-CvenCk6R.js +2 -0
- package/dist/esm/build-CvenCk6R.js.map +1 -0
- package/dist/esm/chains/index.d.ts +3 -0
- package/dist/esm/chains/index.js +1 -0
- package/dist/esm/chains-aHmrozPh.js +2 -0
- package/dist/esm/chains-aHmrozPh.js.map +1 -0
- package/dist/esm/cleartext/index.d.ts +2 -86
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/cleartext-BHu6-LCv.d.ts +19 -0
- package/dist/esm/cleartext-I-etE_7S.js +2 -0
- package/dist/esm/cleartext-I-etE_7S.js.map +1 -0
- package/dist/esm/eip1193-subscribe-CcotSOIm.js +2 -0
- package/dist/esm/eip1193-subscribe-CcotSOIm.js.map +1 -0
- package/dist/esm/{encryption-CmIPBcfP.js → encryption-YS-Kb7qm.js} +2 -2
- package/dist/esm/{encryption-CmIPBcfP.js.map → encryption-YS-Kb7qm.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +53 -8
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/ethers/index.js.map +1 -1
- package/dist/esm/{hex-D_B-zoId.js → hex-BZVTzEK6.js} +2 -2
- package/dist/esm/{hex-D_B-zoId.js.map → hex-BZVTzEK6.js.map} +1 -1
- package/dist/esm/{relayer-utils-iSPis4x-.d.ts → index-BTY0MxOt.d.ts} +50 -23
- package/dist/esm/{onchain-events-2VNiL78c.d.ts → index-BdyljG1F.d.ts} +387 -1505
- package/dist/esm/index.d.ts +61 -93
- package/dist/esm/index.js +73 -73
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/memory-storage-CFXqXUcm.js +2 -0
- package/dist/esm/memory-storage-CFXqXUcm.js.map +1 -0
- package/dist/esm/node/index.d.ts +88 -110
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/node/relayer-sdk.node-worker.js +1 -1
- package/dist/esm/node/relayer-sdk.node-worker.js.map +1 -1
- package/dist/esm/query/index.d.ts +40 -50
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/readonly-token-DCLOYhws.js +2 -0
- package/dist/esm/readonly-token-DCLOYhws.js.map +1 -0
- package/dist/esm/{relayer-C6u3eOlN.js → relayer-7Hd00A6X.js} +2 -2
- package/dist/esm/relayer-7Hd00A6X.js.map +1 -0
- package/dist/esm/{relayer-sdk.types-CGfXwKcB.d.ts → relayer-cleartext-DJkSUlZ2.d.ts} +263 -106
- package/dist/esm/relayer-cleartext-SZCM9wTx.js +2 -0
- package/dist/esm/relayer-cleartext-SZCM9wTx.js.map +1 -0
- package/dist/esm/relayer-sdk.worker.js +71 -71
- package/dist/esm/types-C1S426x4.d.ts +48 -0
- package/dist/esm/types-CVyJHEya.d.ts +14 -0
- package/dist/esm/types-DePjTTbo.d.ts +30 -0
- package/dist/esm/types-FY7ciI37.d.ts +615 -0
- package/dist/esm/viem/index.d.ts +39 -11
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/viem/index.js.map +1 -1
- package/dist/esm/wrappers-registry-CXNs4eR0.js +2 -0
- package/dist/esm/wrappers-registry-CXNs4eR0.js.map +1 -0
- package/package.json +17 -3
- package/dist/cjs/cleartext.cjs +0 -2
- package/dist/cjs/cleartext.cjs.map +0 -1
- package/dist/esm/cleartext-Cs28cTsa.js +0 -2
- package/dist/esm/cleartext-Cs28cTsa.js.map +0 -1
- package/dist/esm/eip1193-subscribe-Cl_wlVuQ.js +0 -2
- package/dist/esm/eip1193-subscribe-Cl_wlVuQ.js.map +0 -1
- package/dist/esm/memory-storage-F8xjMzVy.js +0 -2
- package/dist/esm/memory-storage-F8xjMzVy.js.map +0 -1
- package/dist/esm/readonly-token-D4GjTj0q.js +0 -2
- package/dist/esm/readonly-token-D4GjTj0q.js.map +0 -1
- package/dist/esm/relayer-C6u3eOlN.js.map +0 -1
- package/dist/esm/relayer-sdk-DPqytEbO.d.ts +0 -44
- package/dist/esm/relayer-utils-BeoTNDM4.js +0 -2
- package/dist/esm/relayer-utils-BeoTNDM4.js.map +0 -1
- package/dist/esm/wrappers-registry-ydyySM9g.js +0 -2
- package/dist/esm/wrappers-registry-ydyySM9g.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { $
|
|
1
|
+
import { A as GenericSigner, C as ShieldCallbacks, D as StoredCredentials, F as TransactionReceipt, I as TransactionResult, M as SignerIdentityChange, N as SignerIdentityListener, O as GenericStorage, P as RawLog, S as UnshieldOptions, T as UnshieldCallbacks, _ as UserDecryptParams, a as EIP712TypedData, b as ShieldOptions, c as EncryptResult, d as PublicDecryptResult, f as PublicKeyData, i as DelegatedUserDecryptParams, j as SignerIdentity, l as Handle, n as RelayerSDK, o as EncryptInput, p as PublicParamsData, r as ClearValueType, s as EncryptParams, w as TransferCallbacks, x as TransferOptions } from "../relayer-cleartext-DJkSUlZ2.js";
|
|
2
|
+
import { A as EncryptStartEvent, B as UnshieldPhase2SubmittedEvent, C as CredentialsRevokedEvent, D as DelegationSubmittedEvent, E as DecryptStartEvent, F as TransactionErrorEvent, H as ZamaSDKEvent, I as TransferFromSubmittedEvent, K as ZamaSDKEvents, L as TransferSubmittedEvent, M as RevokeDelegationSubmittedEvent, N as SessionExpiredEvent, O as EncryptEndEvent, P as ShieldSubmittedEvent, Q as OnChainEvent, R as UnshieldPhase1SubmittedEvent, S as CredentialsPersistFailedEvent, T as DecryptErrorEvent, U as ZamaSDKEventInput, V as UnwrapSubmittedEvent, W as ZamaSDKEventListener, X as ConfidentialTransferEvent, _ as CredentialsCorruptedEvent, at as UnwrappedStartedEvent, b as CredentialsExpiredEvent, f as ApproveSubmittedEvent, g as CredentialsCachedEvent, h as CredentialsAllowedEvent, it as UnwrappedFinalizedEvent, j as FinalizeUnwrapSubmittedEvent, k as EncryptErrorEvent, m as BaseEvent, nt as UnwrapFinalizedEvent, ot as WrappedEvent, p as ApproveUnderlyingSubmittedEvent, rt as UnwrapRequestedEvent, v as CredentialsCreatedEvent, w as DecryptEndEvent, x as CredentialsLoadingEvent, y as CredentialsCreatingEvent, z as UnshieldPhase2StartedEvent } from "../types-FY7ciI37.js";
|
|
3
|
+
import { $ as zamaQueryKeys, Q as userDecryptQueryOptions, X as DecryptResult, Y as DecryptHandle, Z as UserDecryptQueryConfig, at as CredentialsManagerConfig, ct as TokenWrapperPair, et as MutationFactoryOptions, f as Token, h as ReadonlyToken, it as CredentialsManager, lt as TokenWrapperPairWithMetadata, m as BatchDecryptAsOptions, o as ZamaSDK, p as BatchBalancesResult, s as ZamaSDKConfig, st as PaginatedResult, tt as QueryFactoryOptions, u as WrappersRegistry } from "../index-BdyljG1F.js";
|
|
4
4
|
import { Address, Hex } from "viem";
|
|
5
|
-
import { InputProofBytesType, KeypairType, KmsDelegatedUserDecryptEIP712Type, ZKProofLike } from "@zama-fhe/relayer-sdk/bundle";
|
|
5
|
+
import { InputProofBytesType, KeypairType, KmsDelegatedUserDecryptEIP712Type, KmsUserDecryptEIP712UserArgsType, ZKProofLike } from "@zama-fhe/relayer-sdk/bundle";
|
|
6
6
|
|
|
7
7
|
//#region src/query/utils.d.ts
|
|
8
8
|
type StrippedQueryOptionKeys = "gcTime" | "staleTime" | "enabled" | "select" | "refetchInterval" | "refetchOnMount" | "refetchOnWindowFocus" | "refetchOnReconnect" | "retry" | "retryDelay" | "retryOnMount" | "queryFn" | "queryKey" | "queryKeyHashFn" | "initialData" | "initialDataUpdatedAt" | "placeholderData" | "structuralSharing" | "throwOnError" | "meta" | "query" | "pollingInterval";
|
|
@@ -55,10 +55,7 @@ declare function invalidateWagmiBalanceQueries(queryClient: QueryClientLike): vo
|
|
|
55
55
|
declare function invalidateWalletLifecycleQueries(queryClient: QueryClientLike): void;
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/query/signer-address.d.ts
|
|
58
|
-
|
|
59
|
-
query?: Record<string, unknown>;
|
|
60
|
-
}
|
|
61
|
-
declare function signerAddressQueryOptions(signer: GenericSigner, config?: SignerAddressQueryConfig): QueryFactoryOptions<Address, Error, Address, ReturnType<typeof zamaQueryKeys.signerAddress.scope>>;
|
|
58
|
+
declare function signerAddressQueryOptions(signer: GenericSigner): QueryFactoryOptions<Address, Error, Address, ReturnType<typeof zamaQueryKeys.signerAddress.scope>>;
|
|
62
59
|
//#endregion
|
|
63
60
|
//#region src/query/token-metadata.d.ts
|
|
64
61
|
/** ERC-20 token metadata returned by {@link tokenMetadataQueryOptions}. */
|
|
@@ -70,20 +67,20 @@ interface TokenMetadata {
|
|
|
70
67
|
interface TokenMetadataQueryConfig {
|
|
71
68
|
query?: Record<string, unknown>;
|
|
72
69
|
}
|
|
73
|
-
declare function tokenMetadataQueryOptions(
|
|
70
|
+
declare function tokenMetadataQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TokenMetadataQueryConfig): QueryFactoryOptions<TokenMetadata, Error, TokenMetadata, ReturnType<typeof zamaQueryKeys.tokenMetadata.token>>;
|
|
74
71
|
//#endregion
|
|
75
72
|
//#region src/query/is-confidential.d.ts
|
|
76
73
|
interface IsConfidentialQueryConfig {
|
|
77
74
|
query?: Record<string, unknown>;
|
|
78
75
|
}
|
|
79
|
-
declare function isConfidentialQueryOptions(
|
|
80
|
-
declare function isWrapperQueryOptions(
|
|
76
|
+
declare function isConfidentialQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isConfidential.token>>;
|
|
77
|
+
declare function isWrapperQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isWrapper.token>>;
|
|
81
78
|
//#endregion
|
|
82
79
|
//#region src/query/total-supply.d.ts
|
|
83
80
|
interface TotalSupplyQueryConfig {
|
|
84
81
|
query?: Record<string, unknown>;
|
|
85
82
|
}
|
|
86
|
-
declare function totalSupplyQueryOptions(
|
|
83
|
+
declare function totalSupplyQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TotalSupplyQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.totalSupply.token>>;
|
|
87
84
|
//#endregion
|
|
88
85
|
//#region src/query/wrapper-discovery.d.ts
|
|
89
86
|
interface WrapperDiscoveryQueryConfig {
|
|
@@ -115,7 +112,7 @@ interface UnderlyingAllowanceQueryConfig {
|
|
|
115
112
|
wrapperAddress?: Address;
|
|
116
113
|
query?: Record<string, unknown>;
|
|
117
114
|
}
|
|
118
|
-
declare function underlyingAllowanceQueryOptions(
|
|
115
|
+
declare function underlyingAllowanceQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config: UnderlyingAllowanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.underlyingAllowance.scope>>;
|
|
119
116
|
//#endregion
|
|
120
117
|
//#region src/query/confidential-is-approved.d.ts
|
|
121
118
|
interface ConfidentialIsApprovedQueryConfig {
|
|
@@ -123,43 +120,32 @@ interface ConfidentialIsApprovedQueryConfig {
|
|
|
123
120
|
spender?: Address;
|
|
124
121
|
query?: Record<string, unknown>;
|
|
125
122
|
}
|
|
126
|
-
declare function confidentialIsApprovedQueryOptions(
|
|
123
|
+
declare function confidentialIsApprovedQueryOptions(sdk: ZamaSDK, tokenAddress: Address | undefined, config: ConfidentialIsApprovedQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.confidentialIsApproved.scope>>;
|
|
127
124
|
//#endregion
|
|
128
125
|
//#region src/query/public-key.d.ts
|
|
129
126
|
interface PublicKeyQueryConfig {
|
|
130
127
|
query?: Record<string, unknown>;
|
|
131
128
|
}
|
|
132
|
-
declare function publicKeyQueryOptions(sdk: ZamaSDK, config?: PublicKeyQueryConfig): QueryFactoryOptions<
|
|
133
|
-
publicKeyId: string;
|
|
134
|
-
publicKey: Uint8Array;
|
|
135
|
-
} | null, Error, {
|
|
136
|
-
publicKeyId: string;
|
|
137
|
-
publicKey: Uint8Array;
|
|
138
|
-
} | null, typeof zamaQueryKeys.publicKey.all>;
|
|
129
|
+
declare function publicKeyQueryOptions(sdk: ZamaSDK, config?: PublicKeyQueryConfig): QueryFactoryOptions<PublicKeyData | null, Error, PublicKeyData | null, typeof zamaQueryKeys.publicKey.all>;
|
|
139
130
|
//#endregion
|
|
140
131
|
//#region src/query/public-params.d.ts
|
|
141
132
|
interface PublicParamsQueryConfig {
|
|
142
133
|
query?: Record<string, unknown>;
|
|
143
134
|
}
|
|
144
|
-
declare function publicParamsQueryOptions(sdk: ZamaSDK, bits: number, config?: PublicParamsQueryConfig): QueryFactoryOptions<
|
|
145
|
-
publicParams: Uint8Array;
|
|
146
|
-
publicParamsId: string;
|
|
147
|
-
} | null, Error, {
|
|
148
|
-
publicParams: Uint8Array;
|
|
149
|
-
publicParamsId: string;
|
|
150
|
-
} | null, ReturnType<typeof zamaQueryKeys.publicParams.bits>>;
|
|
135
|
+
declare function publicParamsQueryOptions(sdk: ZamaSDK, bits: number, config?: PublicParamsQueryConfig): QueryFactoryOptions<PublicParamsData | null, Error, PublicParamsData | null, ReturnType<typeof zamaQueryKeys.publicParams.bits>>;
|
|
151
136
|
//#endregion
|
|
152
137
|
//#region src/query/confidential-balance.d.ts
|
|
153
138
|
interface ConfidentialBalanceQueryConfig {
|
|
154
139
|
tokenAddress: Address;
|
|
155
|
-
|
|
140
|
+
account?: Address;
|
|
156
141
|
query?: Record<string, unknown>;
|
|
157
142
|
}
|
|
143
|
+
/** Query options for a single confidential token balance. Auto-gated on `account`. */
|
|
158
144
|
declare function confidentialBalanceQueryOptions(token: ReadonlyToken, config: ConfidentialBalanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.confidentialBalance.owner>>;
|
|
159
145
|
//#endregion
|
|
160
146
|
//#region src/query/confidential-balances.d.ts
|
|
161
147
|
interface ConfidentialBalancesQueryConfig {
|
|
162
|
-
|
|
148
|
+
account?: Address;
|
|
163
149
|
query?: Record<string, unknown>;
|
|
164
150
|
}
|
|
165
151
|
declare function confidentialBalancesQueryOptions(tokens: ReadonlyToken[], config?: ConfidentialBalancesQueryConfig): QueryFactoryOptions<BatchBalancesResult, Error, BatchBalancesResult, ReturnType<typeof zamaQueryKeys.confidentialBalances.tokens>>;
|
|
@@ -169,29 +155,29 @@ interface WrappersRegistryQueryConfig {
|
|
|
169
155
|
registryAddress: Address | undefined;
|
|
170
156
|
query?: Record<string, unknown>;
|
|
171
157
|
}
|
|
172
|
-
declare function tokenPairsQueryOptions(
|
|
158
|
+
declare function tokenPairsQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairs>>;
|
|
173
159
|
interface ConfidentialTokenAddressQueryConfig extends WrappersRegistryQueryConfig {
|
|
174
160
|
tokenAddress?: Address;
|
|
175
161
|
}
|
|
176
|
-
declare function confidentialTokenAddressQueryOptions(
|
|
162
|
+
declare function confidentialTokenAddressQueryOptions(sdk: ZamaSDK, config: ConfidentialTokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.confidentialTokenAddress>>;
|
|
177
163
|
interface TokenAddressQueryConfig extends WrappersRegistryQueryConfig {
|
|
178
164
|
confidentialTokenAddress?: Address;
|
|
179
165
|
}
|
|
180
|
-
declare function tokenAddressQueryOptions(
|
|
181
|
-
declare function tokenPairsLengthQueryOptions(
|
|
166
|
+
declare function tokenAddressQueryOptions(sdk: ZamaSDK, config: TokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenAddress>>;
|
|
167
|
+
declare function tokenPairsLengthQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsLength>>;
|
|
182
168
|
interface TokenPairsSliceQueryConfig extends WrappersRegistryQueryConfig {
|
|
183
169
|
fromIndex?: bigint;
|
|
184
170
|
toIndex?: bigint;
|
|
185
171
|
}
|
|
186
|
-
declare function tokenPairsSliceQueryOptions(
|
|
172
|
+
declare function tokenPairsSliceQueryOptions(sdk: ZamaSDK, config: TokenPairsSliceQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsSlice>>;
|
|
187
173
|
interface TokenPairQueryConfig extends WrappersRegistryQueryConfig {
|
|
188
174
|
index?: bigint;
|
|
189
175
|
}
|
|
190
|
-
declare function tokenPairQueryOptions(
|
|
176
|
+
declare function tokenPairQueryOptions(sdk: ZamaSDK, config: TokenPairQueryConfig): QueryFactoryOptions<TokenWrapperPair, Error, TokenWrapperPair, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPair>>;
|
|
191
177
|
interface IsConfidentialTokenValidQueryConfig extends WrappersRegistryQueryConfig {
|
|
192
178
|
confidentialTokenAddress?: Address;
|
|
193
179
|
}
|
|
194
|
-
declare function isConfidentialTokenValidQueryOptions(
|
|
180
|
+
declare function isConfidentialTokenValidQueryOptions(sdk: ZamaSDK, config: IsConfidentialTokenValidQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.wrappersRegistry.isConfidentialTokenValid>>;
|
|
195
181
|
interface ListPairsQueryConfig {
|
|
196
182
|
/**
|
|
197
183
|
* The registry address for this chain — used as a query key discriminator.
|
|
@@ -208,7 +194,7 @@ interface ListPairsQueryConfig {
|
|
|
208
194
|
/**
|
|
209
195
|
* Query options for paginated listing of token wrapper pairs.
|
|
210
196
|
*
|
|
211
|
-
* Accepts a {@link WrappersRegistry} instance rather than a raw
|
|
197
|
+
* Accepts a {@link WrappersRegistry} instance rather than a raw provider so that the
|
|
212
198
|
* class-level TTL cache is shared across multiple `queryFn` executions. Pass
|
|
213
199
|
* `sdk.registry` (the ZamaSDK lazy singleton) to ensure a single shared cache.
|
|
214
200
|
*/
|
|
@@ -289,9 +275,13 @@ declare function unwrapAllMutationOptions(token: Token): MutationFactoryOptions<
|
|
|
289
275
|
//#endregion
|
|
290
276
|
//#region src/query/finalize-unwrap.d.ts
|
|
291
277
|
/** Variables for {@link finalizeUnwrapMutationOptions}. */
|
|
292
|
-
|
|
278
|
+
type FinalizeUnwrapParams = /** Preferred input from upgraded `UnwrapRequested` events. */{
|
|
293
279
|
unwrapRequestId: Handle;
|
|
294
|
-
|
|
280
|
+
burnAmountHandle?: never;
|
|
281
|
+
} /** Legacy input from pre-upgrade `UnwrapRequested` events. */ | {
|
|
282
|
+
unwrapRequestId?: never;
|
|
283
|
+
burnAmountHandle: Handle;
|
|
284
|
+
};
|
|
295
285
|
declare function finalizeUnwrapMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.finalizeUnwrap", Address], FinalizeUnwrapParams, TransactionResult>;
|
|
296
286
|
//#endregion
|
|
297
287
|
//#region src/query/encrypt.d.ts
|
|
@@ -301,13 +291,16 @@ declare function encryptMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<re
|
|
|
301
291
|
declare function generateKeypairMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.generateKeypair"], void, KeypairType<Hex>>;
|
|
302
292
|
//#endregion
|
|
303
293
|
//#region src/query/create-eip712.d.ts
|
|
304
|
-
/**
|
|
305
|
-
|
|
294
|
+
/**
|
|
295
|
+
* Variables for {@link createEIP712MutationOptions}. Derived from
|
|
296
|
+
* {@link KmsUserDecryptEIP712UserArgsType} with stricter `publicKey`/`contractAddresses`
|
|
297
|
+
* typing and optional `durationDays`. `extraData` is computed internally and omitted.
|
|
298
|
+
*/
|
|
299
|
+
type CreateEIP712Params = Pick<KmsUserDecryptEIP712UserArgsType, "startTimestamp"> & {
|
|
306
300
|
publicKey: Hex;
|
|
307
301
|
contractAddresses: Address[];
|
|
308
|
-
startTimestamp: number;
|
|
309
302
|
durationDays?: number;
|
|
310
|
-
}
|
|
303
|
+
};
|
|
311
304
|
declare function createEIP712MutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.createEIP712"], CreateEIP712Params, EIP712TypedData>;
|
|
312
305
|
//#endregion
|
|
313
306
|
//#region src/query/create-delegated-user-decrypt-eip712.d.ts
|
|
@@ -360,7 +353,7 @@ declare function delegateDecryptionMutationOptions(token: Token): MutationFactor
|
|
|
360
353
|
/** Variables for {@link decryptBalanceAsMutationOptions}. */
|
|
361
354
|
interface DecryptBalanceAsParams {
|
|
362
355
|
delegatorAddress: Address;
|
|
363
|
-
|
|
356
|
+
accountAddress?: Address;
|
|
364
357
|
}
|
|
365
358
|
declare function decryptBalanceAsMutationOptions(readonlyToken: ReadonlyToken): MutationFactoryOptions<readonly ["zama.decryptBalanceAs", Address], DecryptBalanceAsParams, bigint>;
|
|
366
359
|
//#endregion
|
|
@@ -387,10 +380,7 @@ interface DelegationStatusQueryConfig {
|
|
|
387
380
|
delegateAddress?: Address;
|
|
388
381
|
query?: Record<string, unknown>;
|
|
389
382
|
}
|
|
390
|
-
declare function delegationStatusQueryOptions(sdk:
|
|
391
|
-
signer: GenericSigner;
|
|
392
|
-
relayer: RelayerSDK;
|
|
393
|
-
}, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatusData, Error, DelegationStatusData, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
383
|
+
declare function delegationStatusQueryOptions(sdk: ZamaSDK, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatusData, Error, DelegationStatusData, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
394
384
|
//#endregion
|
|
395
|
-
export { type ApproveSubmittedEvent, type ApproveUnderlyingParams, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type ClearValueType, type ConfidentialApproveParams, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesQueryConfig, 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 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 RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationSubmittedEvent, type SessionExpiredEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldSubmittedEvent, type
|
|
385
|
+
export { type ApproveSubmittedEvent, type ApproveUnderlyingParams, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type ClearValueType, type ConfidentialApproveParams, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesQueryConfig, 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 FinalizeUnwrapParams, type FinalizeUnwrapSubmittedEvent, type GenericSigner, type GenericStorage, type Handle, 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 RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationSubmittedEvent, type SessionExpiredEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldSubmittedEvent, type SignerIdentity, type SignerIdentityChange, type SignerIdentityListener, type StoredCredentials, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, 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 UnwrapFinalizedEvent, type UnwrapParams, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type UnwrappedFinalizedEvent, type UnwrappedStartedEvent, type UserDecryptParams, type UserDecryptQueryConfig, type WrappedEvent, type WrapperDiscoveryQueryConfig, type WrappersRegistryQueryConfig, type ZamaSDK, type ZamaSDKConfig, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, ZamaSDKEvents, allowMutationOptions, approveUnderlyingMutationOptions, batchDecryptBalancesAsMutationOptions, confidentialApproveMutationOptions, confidentialBalanceQueryOptions, confidentialBalancesQueryOptions, confidentialIsApprovedQueryOptions, confidentialTokenAddressQueryOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, createDelegatedUserDecryptEIP712MutationOptions, createEIP712MutationOptions, decryptBalanceAsMutationOptions, delegateDecryptionMutationOptions, delegatedUserDecryptMutationOptions, delegationStatusQueryOptions, 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 };
|
|
396
386
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/query/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as e,h as t,i as n,l as r,m as i,o as a,r as o,t as s}from"../readonly-token-D4GjTj0q.js";import{a as c}from"../assertions-BARApuMj.js";import{t as l}from"../error-B6H-mBAh.js";import{T as u,_ as ee,a as te,b as d,d as f,i as p,n as m,o as h,r as g,s as _,t as v,u as y}from"../wrappers-registry-ydyySM9g.js";import{getAddress as b,zeroAddress as x}from"viem";function ne(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:u,retryOnMount:ee,queryFn:te,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)=>ne(t)?Object.keys(t).toSorted().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const T=e=>e.map(e=>b(e)),E=e=>e===void 0?void 0:b(e),D={signerAddress:{all:[`zama.signerAddress`],scope:e=>[`zama.signerAddress`,{scope:e}],token:e=>[`zama.signerAddress`,{tokenAddress:b(e)}]},confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:b(e)}],owner:(e,t)=>[`zama.confidentialBalance`,{tokenAddress:b(e),...t?{owner:b(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t)=>[`zama.confidentialBalances`,{tokenAddresses:T(e),...t?{owner:b(t)}:{}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:b(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:b(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:b(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:b(e)}],scope:(e,t,n)=>[`zama.underlyingAllowance`,{tokenAddress:b(e),...t?{owner:b(t)}:{},...n?{wrapperAddress:b(n)}:{}}]},confidentialIsApproved:{all:[`zama.confidentialIsApproved`],token:e=>{let t=E(e);return[`zama.confidentialIsApproved`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=E(e),i=E(t),a=E(n);return[`zama.confidentialIsApproved`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:b(e)}]},isAllowed:{all:[`zama.isAllowed`],scope:(e,t)=>[`zama.isAllowed`,{account:b(e),contractAddresses:T(t).toSorted()}]},publicKey:{all:[`zama.publicKey`]},publicParams:{all:[`zama.publicParams`],bits:e=>[`zama.publicParams`,{bits:e}]},delegationStatus:{all:[`zama.delegationStatus`],token:e=>{let t=E(e);return[`zama.delegationStatus`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=E(e),i=E(t),a=E(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:b(t)}}],handles:e=>[`zama.decryption`,{handles:[...e].toSorted((e,t)=>e.handle.localeCompare(t.handle)).map(e=>({handle:e.handle,contractAddress:b(e.contractAddress)}))}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:b(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:b(e),tokenAddress:b(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:b(e),confidentialTokenAddress:b(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:b(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:b(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:b(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:b(e),confidentialTokenAddress:b(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:b(e),page:t,pageSize:n,metadata:r}]}};function O(e,t){e.invalidateQueries({queryKey:D.underlyingAllowance.token(t)})}function k(e,t){A(e,t),O(e,t),R(e)}function A(e,t){e.invalidateQueries({queryKey:D.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:D.confidentialBalances.all})}function j(e,t){A(e,t),O(e,t),R(e)}function M(e,t){A(e,t),O(e,t),R(e)}function N(e,t){A(e,t)}function P(e,t){O(e,t)}function F(e,t){e.invalidateQueries({queryKey:D.confidentialIsApproved.token(t)})}function I(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}function L(e){return Array.isArray(e.queryKey)&&e.queryKey.some(e=>typeof e!=`object`||!e||!(`functionName`in e)?!1:e.functionName===`balanceOf`)}function R(e){e.invalidateQueries({predicate:L})}function z(e){e.removeQueries({queryKey:D.signerAddress.all}),e.removeQueries({queryKey:D.decryption.all}),e.invalidateQueries({predicate:I}),R(e)}const B=new WeakMap;let V=1;function H(e){let t=B.get(e);if(t!==void 0)return t;let n=V++;return B.set(e,n),n}function U(e,t){return{...C(t?.query??{}),queryKey:D.signerAddress.scope(H(e)),queryFn:async()=>e.getAddress(),staleTime:3e4,enabled:t?.query?.enabled!==!1}}function W(n,r,a){let o=D.tokenMetadata.token(r);return{...C(a?.query??{}),queryKey:o,queryFn:async r=>{let[,{tokenAddress:a}]=r.queryKey,[o,s,c]=await Promise.all([n.readContract(i(a)),n.readContract(t(a)),n.readContract(e(a))]);return{name:o,symbol:s,decimals:c}},staleTime:1/0,enabled:a?.query?.enabled!==!1}}function G(e,t,n){let r=D.isConfidential.token(t);return{...C(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(y(n))}catch(e){if(l(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function K(e,t,n){let r=D.isWrapper.token(t);return{...C(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(f(n))}catch(e){if(l(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function q(e,t,n){let r=D.totalSupply.token(t);return{...C(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.readContract(d(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function J(e,t){let n=D.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...C(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 Y(e,t,n){let i=n.owner,a=n.wrapperAddress,o=n.query?.enabled!==!1,s=D.underlyingAllowance.scope(t,i,a);return{...C(n.query??{}),queryKey:s,queryFn:async t=>{let[,{owner:n,wrapperAddress:i}]=t.queryKey;c(n,`underlyingAllowanceQueryOptions: owner`),c(i,`underlyingAllowanceQueryOptions: wrapperAddress`);let a=await e.readContract(u(i));return e.readContract(r(a,n,i))},staleTime:3e4,enabled:!!(i&&a)&&o}}function X(e,t,n){let r=n.holder,i=n.spender,a=n.query?.enabled!==!1,o=D.confidentialIsApproved.scope(t,r,i);return{...C(n.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddress:n,holder:r,spender:i}]=t.queryKey;return c(n,`confidentialIsApprovedQueryOptions: tokenAddress`),c(r,`confidentialIsApprovedQueryOptions: holder`),c(i,`confidentialIsApprovedQueryOptions: spender`),e.readContract(ee(n,r,i))},staleTime:3e4,enabled:!!(t&&r&&i)&&a}}function Z(e,t){let n=D.publicKey.all;return{...C(t?.query??{}),queryKey:n,queryFn:async()=>e.relayer.getPublicKey(),staleTime:1/0,enabled:t?.query?.enabled!==!1}}function re(e,t,n){let r=D.publicParams.bits(t);return{...C(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 ie(e,t){let n=t.query??{};return{...C(n),queryKey:D.confidentialBalance.owner(t.tokenAddress,t.owner),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return e.balanceOf(n)},enabled:n?.enabled!==!1}}function ae(e,t){let n=t?.owner,r=t?.query??{},i=e.map(e=>e.address);return{...C(r),queryKey:D.confidentialBalances.tokens(i,n),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return s.batchBalancesOf(e,n)},enabled:e.length>0&&r?.enabled!==!1}}const Q=86400*1e3;function oe(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=D.wrappersRegistry.tokenPairs(t.registryAddress??x);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(p(n))},staleTime:Q,enabled:n}}function se(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=D.wrappersRegistry.confidentialTokenAddress(t.registryAddress??x,t.tokenAddress??x);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.readContract(v(n,r))},staleTime:Q,enabled:n}}function ce(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=D.wrappersRegistry.tokenAddress(t.registryAddress??x,t.confidentialTokenAddress??x);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(m(n,r))},staleTime:Q,enabled:n}}function le(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=D.wrappersRegistry.tokenPairsLength(t.registryAddress??x);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(te(n))},staleTime:Q,enabled:n}}function ue(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=D.wrappersRegistry.tokenPairsSlice(t.registryAddress??x,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.readContract(h(n,BigInt(r),BigInt(i)))},staleTime:Q,enabled:n}}function de(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=D.wrappersRegistry.tokenPair(t.registryAddress??x,String(t.index??0n));return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.readContract(g(n,BigInt(r)))},staleTime:Q,enabled:n}}function fe(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=D.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??x,t.confidentialTokenAddress??x);return{...C(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(_(n,r))},staleTime:Q,enabled:n}}function pe(e,t){let n=t.page??1,r=t.pageSize??100,i=t.metadata??!1,a=!!t.registryAddress&&t.query?.enabled!==!1,o=D.wrappersRegistry.listPairs(t.registryAddress??x,n,r,i);return{...C(t.query??{}),queryKey:o,queryFn:async()=>e.listPairs({page:n,pageSize:r,metadata:i}),staleTime:e.ttlMs,enabled:a}}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.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function _e(e){return{mutationKey:[`zama.confidentialApprove`,e.address],mutationFn:async({spender:t,until:n})=>e.approve(t,n)}}function ve(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function ye(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function be(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function xe(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function Se(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function Ce(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function we(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({unwrapRequestId:t})=>e.finalizeUnwrap(t)}}function Te(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.relayer.encrypt(t)}}function Ee(e){return{mutationKey:[`zama.generateKeypair`],mutationFn:async()=>e.relayer.generateKeypair()}}function De(e){return{mutationKey:[`zama.createEIP712`],mutationFn:async({publicKey:t,contractAddresses:n,startTimestamp:r,durationDays:i})=>e.relayer.createEIP712(t,n,r,i)}}function $(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 Oe(e){return{mutationKey:[`zama.delegatedUserDecrypt`],mutationFn:async t=>e.relayer.delegatedUserDecrypt(t)}}function ke(e){return{mutationKey:[`zama.publicDecrypt`],mutationFn:async t=>e.publicDecrypt(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(D.decryption.handle(t),n)}}}function Ae(e){return{mutationKey:[`zama.requestZKProofVerification`],mutationFn:async t=>e.relayer.requestZKProofVerification(t)}}function je(e){return{mutationKey:[`zama.allow`],mutationFn:t=>e.allow(t)}}function Me(e,t){return{...C(t?.query??{}),queryKey:D.isAllowed.scope(t.account,t.contractAddresses),queryFn:()=>e.credentials.isAllowed(t.contractAddresses),staleTime:3e4,enabled:t.query?.enabled!==!1}}function Ne(e){return{mutationKey:[`zama.revoke`],mutationFn:t=>e.credentials.revoke(...t)}}function Pe(e){return{mutationKey:[`zama.revokeSession`],mutationFn:()=>e.revokeSession()}}function Fe(e){return{mutationKey:[`zama.delegateDecryption`,e.address],mutationFn:async({delegateAddress:t,expirationDate:n})=>e.delegateDecryption({delegateAddress:t,expirationDate:n})}}function Ie(e,t){return{queryKey:D.decryption.handles(t.handles),queryFn:()=>e.userDecrypt(t.handles),staleTime:1/0,enabled:t.handles.length>0}}function Le(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,owner:n})=>e.decryptBalanceAs({delegatorAddress:t,owner:n})}}function Re(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>s.batchDecryptBalancesAs(e,t)}}function ze(e){return{mutationKey:[`zama.revokeDelegation`,e.address],mutationFn:async({delegateAddress:t})=>e.revokeDelegation({delegateAddress:t})}}function Be(e,t){return{...C(t.query??{}),queryKey:D.delegationStatus.scope(t.tokenAddress,t.delegatorAddress,t.delegateAddress),queryFn:async t=>{let[,{tokenAddress:r,delegatorAddress:i,delegateAddress:o}]=t.queryKey;c(r,`delegationStatusQueryOptions: tokenAddress`),c(i,`delegationStatusQueryOptions: delegatorAddress`),c(o,`delegationStatusQueryOptions: delegateAddress`);let s=await e.relayer.getAclAddress(),l=await e.signer.readContract(a(s,i,o,r)),u;return u=l===0n?!1:l===n?!0:l>await e.signer.getBlockTimestamp(),{isDelegated:u,expiryTimestamp:l}},enabled:!!(t.tokenAddress&&t.delegatorAddress&&t.delegateAddress)&&t.query?.enabled!==!1}}export{o as ZamaSDKEvents,je as allowMutationOptions,ve as approveUnderlyingMutationOptions,Re as batchDecryptBalancesAsMutationOptions,_e as confidentialApproveMutationOptions,ie as confidentialBalanceQueryOptions,ae as confidentialBalancesQueryOptions,X as confidentialIsApprovedQueryOptions,se as confidentialTokenAddressQueryOptions,ge as confidentialTransferFromMutationOptions,he as confidentialTransferMutationOptions,$ as createDelegatedUserDecryptEIP712MutationOptions,De as createEIP712MutationOptions,Le as decryptBalanceAsMutationOptions,Fe as delegateDecryptionMutationOptions,Oe as delegatedUserDecryptMutationOptions,Be as delegationStatusQueryOptions,Te as encryptMutationOptions,C as filterQueryOptions,we as finalizeUnwrapMutationOptions,Ee as generateKeypairMutationOptions,w as hashFn,F as invalidateAfterApprove,P as invalidateAfterApproveUnderlying,j as invalidateAfterShield,N as invalidateAfterTransfer,M as invalidateAfterUnshield,k as invalidateAfterUnwrap,A as invalidateBalanceQueries,R as invalidateWagmiBalanceQueries,z as invalidateWalletLifecycleQueries,Me as isAllowedQueryOptions,G as isConfidentialQueryOptions,fe as isConfidentialTokenValidQueryOptions,K as isWrapperQueryOptions,pe as listPairsQueryOptions,ke as publicDecryptMutationOptions,Z as publicKeyQueryOptions,re as publicParamsQueryOptions,Ae as requestZKProofVerificationMutationOptions,xe as resumeUnshieldMutationOptions,ze as revokeDelegationMutationOptions,Ne as revokeMutationOptions,Pe as revokeSessionMutationOptions,me as shieldMutationOptions,U as signerAddressQueryOptions,ce as tokenAddressQueryOptions,W as tokenMetadataQueryOptions,de as tokenPairQueryOptions,le as tokenPairsLengthQueryOptions,oe as tokenPairsQueryOptions,ue as tokenPairsSliceQueryOptions,q as totalSupplyQueryOptions,Y as underlyingAllowanceQueryOptions,be as unshieldAllMutationOptions,ye as unshieldMutationOptions,Ce as unwrapAllMutationOptions,Se as unwrapMutationOptions,Ie as userDecryptQueryOptions,J as wrapperDiscoveryQueryOptions,D as zamaQueryKeys};
|
|
1
|
+
import{t as e}from"../relayer-7Hd00A6X.js";import{f as t,h as n,i as r,l as i,m as a,o,r as s,t as c}from"../readonly-token-DCLOYhws.js";import{t as l}from"../error-B6H-mBAh.js";import{a as u}from"../assertions-CfqI3AJv.js";import{S as d,T as f,a as ee,d as te,f as p,g as m,h,i as g,l as _,n as v,o as y,p as b,r as x,s as S,t as ne}from"../wrappers-registry-CXNs4eR0.js";import{getAddress as C,zeroAddress as w}from"viem";function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`))}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function D(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:ee,queryKeyHashFn:te,initialData:p,initialDataUpdatedAt:m,placeholderData:h,structuralSharing:g,throwOnError:_,meta:v,query:y,pollingInterval:b,...x}=e;return x}function O(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).toSorted().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const k=e=>e.map(e=>C(e)),A=e=>e===void 0?void 0:C(e),j={signerAddress:{all:[`zama.signerAddress`],scope:e=>[`zama.signerAddress`,{scope:e}]},confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:C(e)}],owner:(e,t)=>[`zama.confidentialBalance`,{tokenAddress:C(e),...t?{owner:C(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t)=>[`zama.confidentialBalances`,{tokenAddresses:k(e),...t?{owner:C(t)}:{}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:C(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:C(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:C(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:C(e)}],scope:(e,t,n)=>[`zama.underlyingAllowance`,{tokenAddress:C(e),...t?{owner:C(t)}:{},...n?{wrapperAddress:C(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:C(e)}]},isAllowed:{all:[`zama.isAllowed`],scope:(e,t)=>[`zama.isAllowed`,{account:C(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:C(t)}}],handles:e=>[`zama.decryption`,{handles:[...e].toSorted((e,t)=>e.handle.localeCompare(t.handle)).map(e=>({handle:e.handle,contractAddress:C(e.contractAddress)}))}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:C(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:C(e),tokenAddress:C(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:C(e),confidentialTokenAddress:C(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:C(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:C(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:C(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:C(e),confidentialTokenAddress:C(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:C(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)}function P(e,t){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)}function I(e,t){P(e,t),M(e,t),H(e)}function L(e,t){P(e,t)}function R(e,t){M(e,t)}function z(e,t){e.invalidateQueries({queryKey:j.confidentialIsApproved.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){return{queryKey:j.signerAddress.scope(K(e)),queryFn:async()=>e.getAddress(),staleTime:3e4}}function J(e,r,i){let o=j.tokenMetadata.token(r);return{...D(i?.query??{}),queryKey:o,queryFn:async r=>{let[,{tokenAddress:i}]=r.queryKey,[o,s,c]=await Promise.all([e.provider.readContract(a(i)),e.provider.readContract(n(i)),e.provider.readContract(t(i))]);return{name:o,symbol:s,decimals:c}},staleTime:1/0,enabled:i?.query?.enabled!==!1}}function Y(e,t,n){let r=j.isConfidential.token(t);return{...D(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.provider.readContract(te(n))}catch(e){if(l(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{...D(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{let[t,r]=await Promise.all([e.provider.readContract(p(n)),e.provider.readContract(b(n,_))]);return t||r}catch(e){if(l(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}async function Z(e,t,n){try{return await e.readContract(b(t,n))}catch(e){if(l(e))return!1;throw e}}async function re(t,n){if(await Z(t,n,`0x1f1c62b2`))return`upgraded`;if(await Z(t,n,`0xd04584ba`))return`legacy`;throw new e(`Contract ${n} does not support a known ERC7984 wrapper interface`)}function ie(e,t,n){let r=j.totalSupply.token(t);return{...D(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return await re(e.provider,n)===`upgraded`?e.provider.readContract(h(n)):e.provider.readContract(f(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function ae(e,t){let n=j.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...D(t.query??{}),queryKey:n,queryFn:async t=>{let[,{erc20Address:n}]=t.queryKey;u(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 oe(e,t,n){let r=n.owner,a=n.wrapperAddress,o=n.query?.enabled!==!1,s=j.underlyingAllowance.scope(t,r,a);return{...D(n.query??{}),queryKey:s,queryFn:async t=>{let[,{owner:n,wrapperAddress:r}]=t.queryKey;u(n,`underlyingAllowanceQueryOptions: owner`),u(r,`underlyingAllowanceQueryOptions: wrapperAddress`);let a=await e.provider.readContract(m(r));return e.provider.readContract(i(a,n,r))},staleTime:3e4,enabled:!!(r&&a)&&o}}function se(e,t,n){let r=n.holder,i=n.spender,a=n.query?.enabled!==!1,o=j.confidentialIsApproved.scope(t,r,i);return{...D(n.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddress:n,holder:r,spender:i}]=t.queryKey;return u(n,`confidentialIsApprovedQueryOptions: tokenAddress`),u(r,`confidentialIsApprovedQueryOptions: holder`),u(i,`confidentialIsApprovedQueryOptions: spender`),e.provider.readContract(d(n,r,i))},staleTime:3e4,enabled:!!(t&&r&&i)&&a}}function ce(e,t){let n=j.publicKey.all;return{...D(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{...D(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){let n=t.query??{};return{...D(n),queryKey:j.confidentialBalance.owner(t.tokenAddress,t.account),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return u(n,`confidentialBalanceQueryOptions: owner`),e.balanceOf(n)},enabled:!!t.account&&n?.enabled!==!1}}function de(e,t){let n=t?.account,r=t?.query??{},i=e.map(e=>e.address);return{...D(r),queryKey:j.confidentialBalances.tokens(i,n),queryFn:async t=>{let[,{owner:n}]=t.queryKey;return u(n,`confidentialBalancesQueryOptions: owner`),c.batchBalancesOf(e,n)},enabled:!!n&&e.length>0&&r?.enabled!==!1}}const Q=86400*1e3;function fe(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPairs(t.registryAddress??w);return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.provider.readContract(g(n))},staleTime:Q,enabled:n}}function pe(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.confidentialTokenAddress(t.registryAddress??w,t.tokenAddress??w);return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.provider.readContract(ne(n,r))},staleTime:Q,enabled:n}}function me(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenAddress(t.registryAddress??w,t.confidentialTokenAddress??w);return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.provider.readContract(v(n,r))},staleTime:Q,enabled:n}}function he(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPairsLength(t.registryAddress??w);return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.provider.readContract(ee(n))},staleTime:Q,enabled:n}}function ge(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPairsSlice(t.registryAddress??w,String(t.fromIndex??0n),String(t.toIndex??0n));return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.provider.readContract(y(n,BigInt(r),BigInt(i)))},staleTime:Q,enabled:n}}function _e(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=j.wrappersRegistry.tokenPair(t.registryAddress??w,String(t.index??0n));return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.provider.readContract(x(n,BigInt(r)))},staleTime:Q,enabled:n}}function ve(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??w,t.confidentialTokenAddress??w);return{...D(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.provider.readContract(S(n,r))},staleTime:Q,enabled:n}}function ye(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=j.wrappersRegistry.listPairs(t.registryAddress??w,t.page??1,t.pageSize??100,t.metadata??!1);return{...D(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 be(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function xe(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function Se(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function Ce(e){return{mutationKey:[`zama.confidentialApprove`,e.address],mutationFn:async({spender:t,until:n})=>e.approve(t,n)}}function we(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function Te(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function Ee(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function De(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function Oe(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function ke(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Ae(t){return{mutationKey:[`zama.finalizeUnwrap`,t.address],mutationFn:async n=>{let r=n.unwrapRequestId??n.burnAmountHandle;if(!r)throw new e(`finalizeUnwrap requires unwrapRequestId or burnAmountHandle`);return t.finalizeUnwrap(r)}}}function je(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.relayer.encrypt(t)}}function Me(e){return{mutationKey:[`zama.generateKeypair`],mutationFn:async()=>e.relayer.generateKeypair()}}function Ne(e){return{mutationKey:[`zama.createEIP712`],mutationFn:async({publicKey:t,contractAddresses:n,startTimestamp:r,durationDays:i})=>e.relayer.createEIP712(t,n,r,i)}}function Pe(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 $(e){return{mutationKey:[`zama.delegatedUserDecrypt`],mutationFn:async t=>e.relayer.delegatedUserDecrypt(t)}}function Fe(e){return{mutationKey:[`zama.publicDecrypt`],mutationFn:async t=>e.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 Ie(e){return{mutationKey:[`zama.requestZKProofVerification`],mutationFn:async t=>e.relayer.requestZKProofVerification(t)}}function Le(e){return{mutationKey:[`zama.allow`],mutationFn:t=>e.allow(t)}}function Re(e,t){return{...D(t?.query??{}),queryKey:j.isAllowed.scope(t.account,t.contractAddresses),queryFn:t=>{let[,{contractAddresses:n}]=t.queryKey;return e.credentials.isAllowed(n)},staleTime:3e4,enabled:t.query?.enabled!==!1}}function ze(e){return{mutationKey:[`zama.revoke`],mutationFn:t=>e.credentials.revoke(...t)}}function Be(e){return{mutationKey:[`zama.revokeSession`],mutationFn:()=>e.revokeSession()}}function Ve(e){return{mutationKey:[`zama.delegateDecryption`,e.address],mutationFn:async({delegateAddress:t,expirationDate:n})=>e.delegateDecryption({delegateAddress:t,expirationDate:n})}}function He(e,t){return{queryKey:j.decryption.handles(t.handles),queryFn:t=>{let[,{handles:n}]=t.queryKey;return e.userDecrypt(n)},staleTime:1/0,enabled:t.handles.length>0}}function Ue(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,accountAddress:n})=>e.decryptBalanceAs({delegatorAddress:t,accountAddress:n})}}function We(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>c.batchDecryptBalancesAs(e,t)}}function Ge(e){return{mutationKey:[`zama.revokeDelegation`,e.address],mutationFn:async({delegateAddress:t})=>e.revokeDelegation({delegateAddress:t})}}function Ke(e,t){return{...D(t.query??{}),queryKey:j.delegationStatus.scope(t.tokenAddress,t.delegatorAddress,t.delegateAddress),queryFn:async t=>{let[,{tokenAddress:n,delegatorAddress:i,delegateAddress:a}]=t.queryKey;u(n,`delegationStatusQueryOptions: tokenAddress`),u(i,`delegationStatusQueryOptions: delegatorAddress`),u(a,`delegationStatusQueryOptions: delegateAddress`);let s=await e.relayer.getAclAddress(),c=await e.provider.readContract(o(s,i,a,n)),l;return l=c===0n?!1:c===r?!0:c>await e.provider.getBlockTimestamp(),{isDelegated:l,expiryTimestamp:c}},enabled:!!(t.tokenAddress&&t.delegatorAddress&&t.delegateAddress)&&t.query?.enabled!==!1}}export{s as ZamaSDKEvents,Le as allowMutationOptions,we as approveUnderlyingMutationOptions,We as batchDecryptBalancesAsMutationOptions,Ce as confidentialApproveMutationOptions,ue as confidentialBalanceQueryOptions,de as confidentialBalancesQueryOptions,se as confidentialIsApprovedQueryOptions,pe as confidentialTokenAddressQueryOptions,Se as confidentialTransferFromMutationOptions,xe as confidentialTransferMutationOptions,Pe as createDelegatedUserDecryptEIP712MutationOptions,Ne as createEIP712MutationOptions,Ue as decryptBalanceAsMutationOptions,Ve as delegateDecryptionMutationOptions,$ as delegatedUserDecryptMutationOptions,Ke as delegationStatusQueryOptions,je as encryptMutationOptions,D as filterQueryOptions,Ae as finalizeUnwrapMutationOptions,Me as generateKeypairMutationOptions,O 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,Re as isAllowedQueryOptions,Y as isConfidentialQueryOptions,ve as isConfidentialTokenValidQueryOptions,X as isWrapperQueryOptions,ye as listPairsQueryOptions,Fe as publicDecryptMutationOptions,ce as publicKeyQueryOptions,le as publicParamsQueryOptions,Ie as requestZKProofVerificationMutationOptions,De as resumeUnshieldMutationOptions,Ge as revokeDelegationMutationOptions,ze as revokeMutationOptions,Be as revokeSessionMutationOptions,be as shieldMutationOptions,q as signerAddressQueryOptions,me as tokenAddressQueryOptions,J as tokenMetadataQueryOptions,_e as tokenPairQueryOptions,he as tokenPairsLengthQueryOptions,fe as tokenPairsQueryOptions,ge as tokenPairsSliceQueryOptions,ie as totalSupplyQueryOptions,oe as underlyingAllowanceQueryOptions,Ee as unshieldAllMutationOptions,Te as unshieldMutationOptions,ke as unwrapAllMutationOptions,Oe as unwrapMutationOptions,He as userDecryptQueryOptions,ae as wrapperDiscoveryQueryOptions,j as zamaQueryKeys};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|