@zama-fhe/sdk 3.9.0-beta.9 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/configs.cjs +1 -1
- package/dist/cjs/configs.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/public-decrypt.cjs +2 -0
- package/dist/cjs/public-decrypt.cjs.map +1 -0
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/telemetry.cjs +1 -1
- package/dist/cjs/telemetry.cjs.map +1 -1
- package/dist/cjs/unshield.cjs +2 -0
- package/dist/cjs/unshield.cjs.map +1 -0
- package/dist/cjs/vaults/index.cjs +1 -1
- package/dist/cjs/vaults/index.cjs.map +1 -1
- package/dist/esm/{base-signer-DuHym9wR.d.ts → base-signer-C3_eu3aC.d.ts} +1 -1
- package/dist/esm/{base-signer-C6h8RUMT.js → base-signer-CD9a2hyy.js} +2 -2
- package/dist/esm/{base-signer-C6h8RUMT.js.map → base-signer-CD9a2hyy.js.map} +1 -1
- package/dist/esm/chains/index.d.ts +1 -1
- package/dist/esm/chains/index.js +1 -1
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-4VgPwU6v.js → cleartext-Bmwhc1xE.js} +2 -2
- package/dist/esm/{cleartext-4VgPwU6v.js.map → cleartext-Bmwhc1xE.js.map} +1 -1
- package/dist/esm/{cleartext-DydTYxOw.d.ts → cleartext-BxZphbB4.d.ts} +1 -1
- package/dist/esm/{configs-C65OaOKz.js → configs-9EL-DJHq.js} +2 -2
- package/dist/esm/{configs-C65OaOKz.js.map → configs-9EL-DJHq.js.map} +1 -1
- package/dist/esm/{decryption-DVfeQvb9.d.ts → decryption-BvvhpFM2.d.ts} +10 -4
- package/dist/esm/{encrypt-worker-client-BJJbrdZB.d.ts → encrypt-worker-client-Dt_x4FZd.d.ts} +1 -1
- package/dist/esm/encrypt.worker.js +47 -45
- package/dist/esm/ethers/index.d.ts +4 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/{fhevm-relayer-B6Xs5fOl.js → fhevm-relayer-ClfJ8FQG.js} +2 -2
- package/dist/esm/{fhevm-relayer-B6Xs5fOl.js.map → fhevm-relayer-ClfJ8FQG.js.map} +1 -1
- package/dist/esm/{index-BL2fvV8e.d.ts → index-B7M2GEtA.d.ts} +6 -6
- package/dist/esm/{index-O1xwLjWX.d.ts → index-BSkvEzGu.d.ts} +25 -11
- package/dist/esm/{index-8R-9woWN.d.ts → index-DTLVaNIj.d.ts} +3 -3
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/index.d.ts +4 -4
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/{invalidation-IBiMIXGB.d.ts → invalidation-BpkhN3Qu.d.ts} +3 -1
- package/dist/esm/node/index.d.ts +4 -4
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/public-decrypt-Bec9uoNY.js +2 -0
- package/dist/esm/public-decrypt-Bec9uoNY.js.map +1 -0
- package/dist/esm/query/index.d.ts +7 -7
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/relayer-Cki3j_Ba.js.map +1 -1
- package/dist/esm/{telemetry-CUO0AOiR.js → telemetry-B0ypjU_K.js} +2 -2
- package/dist/esm/{telemetry-CUO0AOiR.js.map → telemetry-B0ypjU_K.js.map} +1 -1
- package/dist/esm/{types-gKZ_zPFn.d.ts → types-BGMWYQds.d.ts} +2 -2
- package/dist/esm/{types-NmMfCGuC.d.ts → types-CHA7Mcqr.d.ts} +1 -1
- package/dist/esm/{types-D1kIafm6.d.ts → types-CoI5slhu.d.ts} +2 -2
- package/dist/esm/unshield-xO66p_da.js +2 -0
- package/dist/esm/unshield-xO66p_da.js.map +1 -0
- package/dist/esm/vaults/index.d.ts +20 -17
- package/dist/esm/vaults/index.js +1 -1
- package/dist/esm/vaults/index.js.map +1 -1
- package/dist/esm/viem/index.d.ts +4 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/web/index.d.ts +2 -2
- package/dist/esm/web/index.js +1 -1
- package/package.json +12 -2
- package/dist/cjs/log-decoding.cjs +0 -2
- package/dist/cjs/log-decoding.cjs.map +0 -1
- package/dist/esm/log-decoding-Cl4zZCe8.js +0 -2
- package/dist/esm/log-decoding-Cl4zZCe8.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Unstable bridge API for SDK integrations. */
|
|
2
|
-
import { Xt as ZamaErrorCode, Yt as ZamaError, f as ZamaSDK } from "../decryption-
|
|
3
|
-
import { f as FheChain } from "../index-
|
|
4
|
-
import "../encrypt-worker-client-
|
|
5
|
-
import { A as WalletAccountListener, an as EIP712TypedData, fn as FhevmRelayerOptions } from "../types-
|
|
2
|
+
import { Xt as ZamaErrorCode, Yt as ZamaError, f as ZamaSDK } from "../decryption-BvvhpFM2.js";
|
|
3
|
+
import { f as FheChain } from "../index-BSkvEzGu.js";
|
|
4
|
+
import "../encrypt-worker-client-Dt_x4FZd.js";
|
|
5
|
+
import { A as WalletAccountListener, an as EIP712TypedData, fn as FhevmRelayerOptions } from "../types-CHA7Mcqr.js";
|
|
6
6
|
import { TypedDataDefinition } from "viem";
|
|
7
7
|
/** Restores callback failures whose class identity controls batch termination. */
|
|
8
8
|
export declare function reviveZamaError(code: ZamaErrorCode, message: string, options: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e,i as t,r as n}from"../relayer-Cki3j_Ba.js";import{t as r}from"../fatal-batch-CI0ESPnd.js";import{n as i}from"../fhevm-relayer-
|
|
1
|
+
import{b as e,i as t,r as n}from"../relayer-Cki3j_Ba.js";import{t as r}from"../fatal-batch-CI0ESPnd.js";import{n as i}from"../fhevm-relayer-ClfJ8FQG.js";import{t as a}from"../typed-data-eAgGr9V-.js";const o=r;function s(r,i,a){let s=o[r],c=s?new s(i):new n(r,i,r===t.RelayerRequestFailed?{retryable:a.retryable}:void 0);return c.retryable&&e(a.retryAfter)?Object.assign(c,{retryAfter:a.retryAfter}):c}function c(e,t){return e.onWalletAccountChange(t)}export{s as reviveZamaError,c as subscribeWalletAccountChanges,i as toFhevmAuth,a as toViemTypedData};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -30,6 +30,8 @@ declare function invalidateAfterShield(queryClient: QueryClientLike, tokenAddres
|
|
|
30
30
|
declare function invalidateAfterUnshield(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
31
31
|
/** Invalidates the pending-unshield cache once an unshield has settled on-chain. */
|
|
32
32
|
declare function invalidateAfterUnshieldSettled(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
33
|
+
/** Invalidates the caches a failed unshield touched; `UnshieldAlreadyFinalizedError` counts as completion. */
|
|
34
|
+
declare function invalidateAfterUnshieldError(queryClient: QueryClientLike, tokenAddress: Address, error: unknown): void;
|
|
33
35
|
/** Invalidates the confidential balance caches affected by a transfer. */
|
|
34
36
|
declare function invalidateAfterTransfer(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
35
37
|
/** Invalidates the underlying-allowance cache after approving the underlying ERC-20. */
|
|
@@ -40,4 +42,4 @@ declare function invalidateAfterSetOperator(queryClient: QueryClientLike, tokenA
|
|
|
40
42
|
declare function invalidateWagmiBalanceQueries(queryClient: QueryClientLike): void;
|
|
41
43
|
/** Clears wallet-local caches (decryption, permits) and invalidates all Zama queries — call on wallet connect/disconnect so a stale entitlement can't leak across accounts. */
|
|
42
44
|
declare function invalidateWalletLifecycleQueries(queryClient: QueryClientLike): void;
|
|
43
|
-
export { invalidateAfterSetOperator as a, invalidateAfterUnshield as c,
|
|
45
|
+
export { invalidateAfterSetOperator as a, invalidateAfterUnshield as c, invalidateAfterUnwrap as d, invalidateAfterWrap as f, invalidateWalletLifecycleQueries as h, invalidateAfterApproveUnderlying as i, invalidateAfterUnshieldError as l, invalidateWagmiBalanceQueries as m, QueryFilterLike as n, invalidateAfterShield as o, invalidateBalanceQueries as p, QueryLike as r, invalidateAfterTransfer as s, QueryClientLike as t, invalidateAfterUnshieldSettled as u };
|
package/dist/esm/node/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
import { a as hoodi, c as polygonAmoy, f as FheChain, i as hardhat, l as sepolia, n as bscTestnet, o as mainnet, p as FheChainAuth, r as chains, s as polygon, t as anvil, u as zenithTrexTestnet } from "../index-
|
|
10
|
-
import { an as EIP712TypedData, c as GenericStorage, dn as FhevmClientOptions, fn as FhevmRelayerOptions, ln as EncryptedValue, mn as RelayerOptions, n as RelayerConfig, nn as ClearValue, on as EncryptInput, pn as FhevmRuntimeConfig, rn as DecryptPublicValuesResult, s as GenericLogger, sn as EncryptParams, t as CleartextRelayerConfig } from "../types-
|
|
11
|
-
import { t as cleartext } from "../cleartext-
|
|
12
|
-
import { i as node, n as asyncLocalStorage, r as NodeRelayerConfig, t as AsyncLocalMapStorage } from "../index-
|
|
9
|
+
import { a as hoodi, c as polygonAmoy, f as FheChain, i as hardhat, l as sepolia, n as bscTestnet, o as mainnet, p as FheChainAuth, r as chains, s as polygon, t as anvil, u as zenithTrexTestnet } from "../index-BSkvEzGu.js";
|
|
10
|
+
import { an as EIP712TypedData, c as GenericStorage, dn as FhevmClientOptions, fn as FhevmRelayerOptions, ln as EncryptedValue, mn as RelayerOptions, n as RelayerConfig, nn as ClearValue, on as EncryptInput, pn as FhevmRuntimeConfig, rn as DecryptPublicValuesResult, s as GenericLogger, sn as EncryptParams, t as CleartextRelayerConfig } from "../types-CHA7Mcqr.js";
|
|
11
|
+
import { t as cleartext } from "../cleartext-BxZphbB4.js";
|
|
12
|
+
import { i as node, n as asyncLocalStorage, r as NodeRelayerConfig, t as AsyncLocalMapStorage } from "../index-DTLVaNIj.js";
|
|
13
13
|
export { AsyncLocalMapStorage, type ClearValue, type CleartextRelayerConfig, type DecryptPublicValuesResult, type EIP712TypedData, type EncryptInput, type EncryptParams, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClientOptions, type FhevmRelayerOptions, type FhevmRuntimeConfig, type GenericLogger, type GenericStorage, type NodeRelayerConfig, type RelayerConfig, type RelayerOptions, anvil, asyncLocalStorage, bscTestnet, chains, cleartext, hardhat, hoodi, mainnet, node, polygon, polygonAmoy, sepolia, zenithTrexTestnet };
|
package/dist/esm/node/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../fhevm-relayer-
|
|
1
|
+
import{t as e}from"../fhevm-relayer-ClfJ8FQG.js";import{t}from"../telemetry-B0ypjU_K.js";import{t as n}from"../cleartext-Bmwhc1xE.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f}from"../configs-9EL-DJHq.js";import{AsyncLocalStorage as p}from"node:async_hooks";function m(n){return{type:`node`,createRelayer:(r,i,a)=>{let o=t(globalThis.process?.env?.ZAMA_SDK_TELEMETRY)??a?.mode;return new e({chain:r,options:n,logger:i,telemetry:a&&o!==void 0&&o!==`off`?{state:a,runtime:`node`,mode:o}:void 0})}}}var h=class{#e=new p;run(e){return this.#e.run(/* @__PURE__ */ new Map,e)}async get(e){return this.#e.getStore()?.get(e)??null}async set(e,t){this.#e.getStore()?.set(e,t)}async delete(e){this.#e.getStore()?.delete(e)}};const g=new h;export{h as AsyncLocalMapStorage,d as anvil,g as asyncLocalStorage,s as bscTestnet,l as chains,n as cleartext,a as hardhat,r as hoodi,c as mainnet,m as node,u as polygon,i as polygonAmoy,o as sepolia,f as zenithTrexTestnet};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,a as t,c as n,f as r,g as i,h as a,i as o,m as s,n as c,r as l,s as u,v as d,x as f,y as p}from"./relayer-Cki3j_Ba.js";import{i as m,l as h,n as g,o as _,t as v}from"./signing-DX-xyved.js";import{t as y}from"./encryption-QHaWnnx-.js";import{r as b}from"./fatal-batch-CI0ESPnd.js";import{getAddress as x,keccak256 as S,toBytes as C}from"viem";var w=class extends l{encryptedValue;contractAddress;account;constructor(e,t){super(o.NotEntitled,`Account ${e.account} is not entitled to decrypt encrypted value ${e.encryptedValue} on contract ${e.contractAddress}. This is not a transient failure — the account needs an on-chain ACL grant before it can decrypt this encrypted value.`,t),this.name=`NotEntitledError`,this.encryptedValue=e.encryptedValue,this.contractAddress=e.contractAddress,this.account=e.account}},T=class extends l{constructor(e,t){super(o.DelegationSelfNotAllowed,e,t),this.name=`DelegationSelfNotAllowedError`}},E=class extends l{constructor(e,t){super(o.DelegationCooldown,e,t),this.name=`DelegationCooldownError`}},D=class extends l{constructor(e,t){super(o.DelegationNotFound,e,t),this.name=`DelegationNotFoundError`}},O=class extends l{constructor(e,t){super(o.DelegationExpired,e,t),this.name=`DelegationExpiredError`}},k=class extends l{constructor(e,t){super(o.DelegationExpiryUnchanged,e,t),this.name=`DelegationExpiryUnchangedError`}},A=class extends l{constructor(e,t){super(o.DelegationDelegateEqualsContract,e,t),this.name=`DelegationDelegateEqualsContractError`}},j=class extends l{constructor(e,t){super(o.DelegationDelegateCannotBeWildcard,e,t),this.name=`DelegationDelegateCannotBeWildcardError`}},M=class extends l{constructor(e,t){super(o.DelegationContractIsSelf,e,t),this.name=`DelegationContractIsSelfError`}},N=class extends l{constructor(e,t){super(o.AclPaused,e,t),this.name=`AclPausedError`}},P=class extends l{constructor(e,t){super(o.DelegationExpirationTooSoon,e,t),this.name=`DelegationExpirationTooSoonError`}},F=class extends l{constructor(e,t){super(o.DelegationNotPropagated,e,t),this.name=`DelegationNotPropagatedError`}},I=class extends l{batcher;vaultId;constructor(e,t,n){super(o.VaultBatcherPaused,e,n),this.name=`VaultBatcherPausedError`,this.batcher=t.batcher,this.vaultId=t.vaultId}},L=class extends l{batcher;vaultId;constructor(e,n,r){super(o.VaultBatcherReadFailed,e,{...r,retryable:r?.retryable??(t(r?.cause)||p(r?.cause))}),this.name=`VaultBatcherReadFailedError`,this.batcher=n.batcher,this.vaultId=n.vaultId}},R=class extends l{batcher;batchId;state;constructor(e,t,n){super(o.VaultBatchNotDispatched,e,n),this.name=`VaultBatchNotDispatchedError`,this.batcher=t.batcher,this.batchId=t.batchId,this.state=t.state}},z=class extends l{txHash;receipt;unconfirmedVaultIds;constructor(e,t,n){super(o.VaultJoinUnconfirmed,e,n),this.name=`VaultJoinUnconfirmedError`,this.txHash=t.txHash,this.receipt=t.receipt,this.unconfirmedVaultIds=t.unconfirmedVaultIds}};const B=[y,_,c,F,g,v,w,b,m,h];function V(t,o,l={}){if(B.some(e=>t instanceof e))return t;let g=t instanceof Error?t.message:o;if(t instanceof Error&&s(t.message))return new m(t.message,{cause:t});if(d(t))return new h(`The permit's KMS context has been revoked on-chain, so the permit is no longer usable. The SDK evicts the permit and re-grants automatically; if this error surfaced, the retry failed the same way. The on-chain validity check is cached for up to 15 minutes, so a just-revoked context can keep failing across that window. Retry after the window; the SDK re-runs the recovery on the next decrypt, no manual cleanup is needed.`,{cause:t});if(t instanceof Error&&a(t.message))return l.isDelegated?new F(`Delegated decryption was denied by the on-chain ACL check. This is most commonly caused by the delegation not having propagated yet, or by the RPC node serving a stale block. Propagation usually completes within ~10 blocks (a few seconds) and the SDK retries across that window; seeing this means it did not sync in time. Retry shortly (and prefer a fresh, low-lag RPC endpoint). If it persists, the delegator may genuinely lack the on-chain ACL grant.`,{cause:t}):new w({encryptedValue:f(t.message)??``,contractAddress:l.contractAddress??``,account:l.account??``},{cause:t});if(r(t))return new b(g,{cause:t,retryAfter:n(t)});let v=u(t);return v===void 0&&p(t)?new b(g,{cause:t,retryAfter:n(t)}):v===400?new _(t instanceof Error?t.message:`No ciphertext for this account`,{cause:t}):l.isDelegated&&v===500?new F(`Delegated decryption failed with a server error. This is most commonly caused by the delegation not having propagated to the gateway yet. Cross-chain sync usually completes within ~10 blocks (a few seconds) and the SDK retries across that window; seeing this means it did not sync in time — retry shortly. If the error persists, the gateway or relayer may be experiencing an unrelated issue.`,{cause:t}):i(t)||v!==void 0?new c(g,v,{cause:t,retryAfter:n(t),retryable:e(t)||void 0}):new y(o,{cause:t})}function H(e){return e.startsWith(`0x`)?e:`0x${e}`}function U(e){return S(C(e))}function W(e){return x(H(e.slice(-40)))}function G(e){return e}function K(e,t){let n=2+t*64,r=e.slice(n,n+64);return r.length===64?r:r.padEnd(64,`0`)}function q(e,t){return x(H(K(e,t).slice(-40)))}function J(e,t){return BigInt(`0x`+K(e,t))}function Y(e,t){return H(K(e,t))}async function X(e,t,n){let r=await e.decryptPublicValuesWithSignatures({encryptedValues:[t],options:n}).catch(e=>{throw V(e,`Public decryption failed`)}),i=r.checkSignaturesArgs.handlesList[0];if(i?.toLowerCase()!==t.toLowerCase())throw new y(`Public decryption of ${t} returned values for ${i??`no handle`}`);let a=r.clearValues[0]?.value;if(typeof a!=`bigint`)throw new y(`Public decryption of ${t} returned ${a===void 0?`no value`:`a ${typeof a}`}, not a bigint`);return{value:a,decryptionProof:r.checkSignaturesArgs.decryptionProof}}export{T as C,F as S,A as _,q as a,k as b,V as c,L as d,z as f,j as g,E as h,G as i,R as l,M as m,U as n,J as o,N as p,W as r,Y as s,X as t,I as u,P as v,w,D as x,O as y};
|
|
2
|
+
//# sourceMappingURL=public-decrypt-Bec9uoNY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-decrypt-Bec9uoNY.js","names":["isRelayerTimeoutError","isRetryable","extractRetryAfter","hasStructuredRpcRateLimitSignal","isRelayerError","isNotEntitledMessage","ZamaErrorCode","isInvalidTransportKeyPairMessage","RelayerRequestFailedError","ZamaError","extractHttpStatus","isRevokedKmsContextError","parseHandleFromMessage","isRpcRateLimitError","InvalidTransportKeyPairError","RevokedKmsContextError","SigningRejectedError","NoCiphertextError","SigningFailedError","DecryptionFailedError","RpcRateLimitError","NotEntitledError","args","options","DelegationSelfNotAllowedError","message","DelegationCooldownError","DelegationNotFoundError","DelegationExpiredError","DelegationExpiryUnchangedError","DelegationDelegateEqualsContractError","DelegationDelegateCannotBeWildcardError","DelegationContractIsSelfError","AclPausedError","DelegationExpirationTooSoonError","DelegationNotPropagatedError","VaultBatcherPausedError","details","VaultBatcherReadFailedError","VaultBatchNotDispatchedError","VaultJoinUnconfirmedError","DECRYPT_PASSTHROUGH_ERROR_TYPES","wrapDecryptError","error","ErrorType","fallbackMessage","ctx","statusCode","prefixHex","value","eventTopic","keccak256","toBytes","signature","topicToAddress","getAddress","topic","topicToBytes32","wordAt","start","index","word","data","wordToAddress","wordToBigInt","wordToBytes32","decryptPublicUint","result","relayer","encryptedValue","returnedHandle"],"sources":["../../src/errors/entitlement.ts","../../src/errors/delegation.ts","../../src/errors/vaults.ts","../../src/errors/decrypt.ts","../../src/utils/hex.ts","../../src/events/log-decoding.ts","../../src/relayer/public-decrypt.ts"],"sourcesContent":["import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * The signer (or delegator) lacks ACL permission to decrypt the encrypted value —\n * `persistAllowed` returned `false`. Terminal and **non-retryable**: the fix is\n * an on-chain grant (`FHE.allow`), or for indexers, to wait for a backfill once\n * the grant lands. Distinct from transient failures like {@link RpcRateLimitError}.\n *\n * @example\n * ```ts\n * try {\n * await sdk.decryption.decryptValues([{ encryptedValue, contractAddress }]);\n * } catch (e) {\n * if (e instanceof NotEntitledError) {\n * // don't retry — wait for an ACL grant / backfill\n * }\n * }\n * ```\n */\nexport class NotEntitledError extends ZamaError {\n /** The encrypted value the actor is not entitled to decrypt. */\n readonly encryptedValue: string;\n /** The contract the encrypted value belongs to. */\n readonly contractAddress: string;\n /** The actor (signer or delegator) that lacks ACL permission. */\n readonly account: string;\n\n constructor(\n args: { encryptedValue: string; contractAddress: string; account: string },\n options?: ErrorOptions,\n ) {\n super(\n ZamaErrorCode.NotEntitled,\n `Account ${args.account} is not entitled to decrypt encrypted value ${args.encryptedValue} ` +\n `on contract ${args.contractAddress}. This is not a transient failure — ` +\n `the account needs an on-chain ACL grant before it can decrypt this encrypted value.`,\n options,\n );\n this.name = \"NotEntitledError\";\n this.encryptedValue = args.encryptedValue;\n this.contractAddress = args.contractAddress;\n this.account = args.account;\n }\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n// Delegation errors — thrown by SDK pre-flight checks and by delegation\n// transaction callsites when they map ACL Solidity revert reasons.\n\n/** Delegation cannot target self (delegate === msg.sender). */\nexport class DelegationSelfNotAllowedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationSelfNotAllowed, message, options);\n this.name = \"DelegationSelfNotAllowedError\";\n }\n}\n\n/** Only one delegate/revoke per (delegator, delegate, contract) per block. */\nexport class DelegationCooldownError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationCooldown, message, options);\n this.name = \"DelegationCooldownError\";\n }\n}\n\n/** No active delegation found for this (delegator, delegate, contract) tuple. */\nexport class DelegationNotFoundError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationNotFound, message, options);\n this.name = \"DelegationNotFoundError\";\n }\n}\n\n/** The delegation has expired. */\nexport class DelegationExpiredError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationExpired, message, options);\n this.name = \"DelegationExpiredError\";\n }\n}\n\n/** The new expiration date equals the current one. */\nexport class DelegationExpiryUnchangedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationExpiryUnchanged, message, options);\n this.name = \"DelegationExpiryUnchangedError\";\n }\n}\n\n/** Delegate address cannot be the contract address. */\nexport class DelegationDelegateEqualsContractError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationDelegateEqualsContract, message, options);\n this.name = \"DelegationDelegateEqualsContractError\";\n }\n}\n\n/** Delegate address cannot be the wildcard address — it's only valid as `contractAddress`. */\nexport class DelegationDelegateCannotBeWildcardError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationDelegateCannotBeWildcard, message, options);\n this.name = \"DelegationDelegateCannotBeWildcardError\";\n }\n}\n\n/** Contract address cannot be the sender address. */\nexport class DelegationContractIsSelfError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationContractIsSelf, message, options);\n this.name = \"DelegationContractIsSelfError\";\n }\n}\n\n/** The ACL contract is paused. */\nexport class AclPausedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.AclPaused, message, options);\n this.name = \"AclPausedError\";\n }\n}\n\n/** Expiration date is too soon (must be at least 1 hour in the future). */\nexport class DelegationExpirationTooSoonError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationExpirationTooSoon, message, options);\n this.name = \"DelegationExpirationTooSoonError\";\n }\n}\n\n/**\n * Delegation exists on L1 but hasn't propagated to the gateway yet.\n *\n * After calling `delegateForUserDecryption()`, the delegation is recorded on-chain\n * immediately. However, the gateway (deployed on Arbitrum) must sync this state\n * via cross-chain event propagation, which usually completes within ~10 blocks\n * (a few seconds).\n *\n * Calling `decryptBalanceAs` during this window will fail because the gateway's\n * `isHandleDelegatedForUserDecryption()` check reads from its own synced copy\n * of the ACL state, which hasn't been updated yet.\n *\n * **You rarely need to handle this directly:** the delegated-decrypt path rides\n * out the propagation window with a bounded internal retry (~30s), so a decrypt\n * issued right after the grant simply waits for sync. This error only surfaces\n * if the window outlasts the retry budget, or when retries are disabled via\n * `waitForPropagation: false`.\n *\n * **Note:** This error is raised as a best-effort heuristic — when a delegated\n * decryption receives an HTTP 500 from the relayer, the most likely cause is a\n * propagation delay. However, the same status code can occur if the gateway or\n * relayer experiences an unrelated internal error.\n */\nexport class DelegationNotPropagatedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.DelegationNotPropagated, message, options);\n this.name = \"DelegationNotPropagatedError\";\n }\n}\n","import type { Address, Hex } from \"viem\";\nimport type { TransactionReceipt } from \"../types/transaction\";\nimport type { BatchState } from \"../vaults/types\";\nimport { isRpcRateLimitError } from \"../utils/error\";\nimport { isRetryable, ZamaError, ZamaErrorCode } from \"./base\";\n\n/** What a {@link VaultBatcherPausedError} carries. */\nexport interface VaultBatcherPausedDetails {\n /** A paused or closed batcher of the vault. */\n readonly batcher: Address;\n /** The vault whose leg needs the batcher. */\n readonly vaultId: string;\n}\n\n/** No batcher of a vault is open: each one is paused or closed. */\nexport class VaultBatcherPausedError extends ZamaError {\n /** A paused or closed batcher of the vault. */\n readonly batcher: Address;\n /** The vault whose leg needs the batcher. */\n readonly vaultId: string;\n\n constructor(message: string, details: VaultBatcherPausedDetails, options?: ErrorOptions) {\n super(ZamaErrorCode.VaultBatcherPaused, message, options);\n this.name = \"VaultBatcherPausedError\";\n this.batcher = details.batcher;\n this.vaultId = details.vaultId;\n }\n}\n\n/** What a {@link VaultBatcherReadFailedError} carries. */\nexport interface VaultBatcherReadFailedDetails {\n /** The batcher that could not be read. */\n readonly batcher: Address;\n /** The vault that lists the batcher. */\n readonly vaultId: string;\n}\n\n/**\n * A batcher of a vault could not be read, so the SDK cannot tell which batch a join reaches.\n * Retryable when its `cause` is, or when RPC nodes returned reads from different blocks.\n */\nexport class VaultBatcherReadFailedError extends ZamaError {\n /** The batcher that could not be read. */\n readonly batcher: Address;\n /** The vault that lists the batcher. */\n readonly vaultId: string;\n\n constructor(\n message: string,\n details: VaultBatcherReadFailedDetails,\n options?: ErrorOptions & { retryable?: boolean },\n ) {\n super(ZamaErrorCode.VaultBatcherReadFailed, message, {\n ...options,\n // Providers pass an RPC rate limit through as a raw viem or ethers error, not an SDK one.\n retryable:\n options?.retryable ?? (isRetryable(options?.cause) || isRpcRateLimitError(options?.cause)),\n });\n this.name = \"VaultBatcherReadFailedError\";\n this.batcher = details.batcher;\n this.vaultId = details.vaultId;\n }\n}\n\n/** What a {@link VaultBatchNotDispatchedError} carries. */\nexport interface VaultBatchNotDispatchedDetails {\n /** The batcher the batch belongs to. */\n readonly batcher: Address;\n /** The batch that was to be finalized. */\n readonly batchId: bigint;\n /** The state the batch is in instead. */\n readonly state: BatchState;\n}\n\n/** The batch to finalize is not dispatched. */\nexport class VaultBatchNotDispatchedError extends ZamaError {\n /** The batcher the batch belongs to. */\n readonly batcher: Address;\n /** The batch that was to be finalized. */\n readonly batchId: bigint;\n /** The state the batch is in instead. */\n readonly state: BatchState;\n\n constructor(message: string, details: VaultBatchNotDispatchedDetails, options?: ErrorOptions) {\n super(ZamaErrorCode.VaultBatchNotDispatched, message, options);\n this.name = \"VaultBatchNotDispatchedError\";\n this.batcher = details.batcher;\n this.batchId = details.batchId;\n this.state = details.state;\n }\n}\n\n/** What a {@link VaultJoinUnconfirmedError} carries. */\nexport interface VaultJoinUnconfirmedDetails {\n /** The mined join transaction. */\n readonly txHash: Hex;\n /** Its receipt, to inspect the logs. */\n readonly receipt: TransactionReceipt;\n /** The vaults whose `Joined` log the SDK could not match. Not a list of legs that did not join. */\n readonly unconfirmedVaultIds: readonly string[];\n}\n\n/**\n * A join was mined, but the SDK could not match a `Joined` log to every leg.\n */\nexport class VaultJoinUnconfirmedError extends ZamaError {\n /** The mined join transaction. */\n readonly txHash: Hex;\n /** Its receipt, to inspect the logs. */\n readonly receipt: TransactionReceipt;\n /** The vaults whose `Joined` log the SDK could not match. Not a list of legs that did not join. */\n readonly unconfirmedVaultIds: readonly string[];\n\n constructor(message: string, details: VaultJoinUnconfirmedDetails, options?: ErrorOptions) {\n super(ZamaErrorCode.VaultJoinUnconfirmed, message, options);\n this.name = \"VaultJoinUnconfirmedError\";\n this.txHash = details.txHash;\n this.receipt = details.receipt;\n this.unconfirmedVaultIds = details.unconfirmedVaultIds;\n }\n}\n","import type { ZamaError } from \"./base\";\nimport { DecryptionFailedError } from \"./encryption\";\nimport {\n InvalidTransportKeyPairError,\n NoCiphertextError,\n RevokedKmsContextError,\n} from \"./credential\";\nimport { RelayerRequestFailedError } from \"./relayer\";\nimport { DelegationNotPropagatedError } from \"./delegation\";\nimport { NotEntitledError } from \"./entitlement\";\nimport { RpcRateLimitError } from \"./rpc\";\nimport { SigningRejectedError, SigningFailedError } from \"./signing\";\nimport {\n extractHttpStatus,\n extractRetryAfter,\n hasStructuredRpcRateLimitSignal,\n isInvalidTransportKeyPairMessage,\n isNotEntitledMessage,\n isRelayerError,\n isRelayerTimeoutError,\n isRevokedKmsContextError,\n isRpcRateLimitError,\n parseHandleFromMessage,\n} from \"../utils/error\";\n\n/**\n * Context the caller supplies so a not-entitled / delegation failure can be\n * mapped precisely. The request context (`contractAddress` / `account`) is not\n * present on the raw error, so it is injected here.\n */\nexport interface DecryptErrorContext {\n isDelegated?: boolean;\n contractAddress?: string;\n /** The ACL actor (signer, or delegator for delegated decrypt). */\n account?: string;\n}\n\n/**\n * Every typed SDK error `wrapDecryptError` may see on its way in (from a prior\n * classification, a worker rethrow, or a caller-level retry) and must pass\n * through unchanged rather than collapse into terminal `DecryptionFailedError`.\n * A single source of truth for the early-return check below and for the\n * `errors.test.ts` \"every typed cause passes through unchanged\" test — so a\n * class dropped from this array is caught by that test instead of silently\n * falling through to the generic fallback.\n *\n * This is a fixed, decrypt-scoped subset of the taxonomy maintained by hand\n * (unlike {@link RETRYABLE_BY_CODE} in `base.ts`, it has no `Complete<>` tie\n * to `ZamaErrorCode`) — a new decrypt-path error class must be added here\n * explicitly, since there's no compiler check forcing it.\n */\nexport const DECRYPT_PASSTHROUGH_ERROR_TYPES = [\n DecryptionFailedError,\n NoCiphertextError,\n RelayerRequestFailedError,\n DelegationNotPropagatedError,\n SigningRejectedError,\n SigningFailedError,\n NotEntitledError,\n RpcRateLimitError,\n InvalidTransportKeyPairError,\n RevokedKmsContextError,\n] as const;\n\n/**\n * The single decryption-error classifier. Maps a caught error to the right typed\n * SDK error: not-entitled (ACL), consumer RPC rate-limit, NoCiphertext (400),\n * DelegationNotPropagated (delegated 500 *or* a delegated ACL denial, which is\n * transient), RelayerRequestFailed (other HTTP), or the generic DecryptionFailed\n * fallback.\n *\n * Errors that are already typed SDK errors are returned as-is so callers can\n * still match the original cause. All structured signals (codes, status, cause\n * chain) are read from the error itself.\n */\nexport function wrapDecryptError(\n error: unknown,\n fallbackMessage: string,\n ctx: DecryptErrorContext = {},\n): ZamaError {\n if (DECRYPT_PASSTHROUGH_ERROR_TYPES.some((ErrorType) => error instanceof ErrorType)) {\n return error as ZamaError;\n }\n\n const message = error instanceof Error ? error.message : fallbackMessage;\n\n // Stale transport key pair the relayer can't re-derive (post KMS/TKMS rotation).\n // Typed so the decrypt path can evict the vault entry and regenerate on retry.\n if (error instanceof Error && isInvalidTransportKeyPairMessage(error.message)) {\n return new InvalidTransportKeyPairError(error.message, { cause: error });\n }\n\n // The permit's KMS context was revoked on-chain (InvalidKmsContext revert).\n // Typed so the decrypt path can evict the dead permit, re-grant, and retry once.\n if (isRevokedKmsContextError(error)) {\n return new RevokedKmsContextError(\n \"The permit's KMS context has been revoked on-chain, so the permit is no longer usable. \" +\n \"The SDK evicts the permit and re-grants automatically; if this error surfaced, the retry \" +\n \"failed the same way. The on-chain validity check is cached for up to 15 minutes, so a \" +\n \"just-revoked context can keep failing across that window. Retry after the window; the \" +\n \"SDK re-runs the recovery on the next decrypt, no manual cleanup is needed.\",\n { cause: error },\n );\n }\n\n // Actor not entitled (ACL). The relayer throws a message-only Error; the handle\n // is parseable from it and the contract/account come from the request context\n // the caller holds.\n if (error instanceof Error && isNotEntitledMessage(error.message)) {\n // On the delegated path the \"not entitled\" verdict comes from the\n // *delegator's* `persistAllowed` L1 read, which has no staleness tolerance:\n // it returns false *transiently* when the delegation has just landed or the\n // consumer's RPC serves a lagging block. Terminal `NotEntitledError` (\"never\n // retry\") would be the wrong signal for that propagation window, so — mirroring\n // the delegated-500 branch below — surface the retryable\n // `DelegationNotPropagatedError` instead. A direct signer denial (non-\n // delegated) stays terminal `NotEntitledError`.\n if (ctx.isDelegated) {\n return new DelegationNotPropagatedError(\n \"Delegated decryption was denied by the on-chain ACL check. \" +\n \"This is most commonly caused by the delegation not having propagated yet, or by the \" +\n \"RPC node serving a stale block. Propagation usually completes within ~10 blocks (a few \" +\n \"seconds) and the SDK retries across that window; seeing this means it did not sync in time. \" +\n \"Retry shortly (and prefer a fresh, low-lag RPC endpoint). If it persists, the delegator may \" +\n \"genuinely lack the on-chain ACL grant.\",\n { cause: error },\n );\n }\n return new NotEntitledError(\n {\n encryptedValue: parseHandleFromMessage(error.message) ?? \"\",\n contractAddress: ctx.contractAddress ?? \"\",\n account: ctx.account ?? \"\",\n },\n { cause: error },\n );\n }\n\n // Consumer's RPC provider throttling an on-chain read. An unambiguous\n // structured signal (-32005 / viem `status: 429`) wins over any HTTP status;\n // relayer-origin errors are `@fhevm/sdk` `Relayer*` classes and are excluded by\n // `isRelayerError`, staying RelayerRequestFailedError below.\n if (hasStructuredRpcRateLimitSignal(error)) {\n return new RpcRateLimitError(message, { cause: error, retryAfter: extractRetryAfter(error) });\n }\n\n const statusCode = extractHttpStatus(error);\n\n // A message-only throttle (\"Too Many Requests\" / \"rate limit\") is trusted only\n // when no HTTP status is present — otherwise the status classification (e.g. a\n // relayer error whose body mentions a rate limit) takes precedence.\n if (statusCode === undefined && isRpcRateLimitError(error)) {\n return new RpcRateLimitError(message, { cause: error, retryAfter: extractRetryAfter(error) });\n }\n\n if (statusCode === 400) {\n return new NoCiphertextError(\n error instanceof Error ? error.message : \"No ciphertext for this account\",\n { cause: error },\n );\n }\n\n if (ctx.isDelegated && statusCode === 500) {\n return new DelegationNotPropagatedError(\n \"Delegated decryption failed with a server error. \" +\n \"This is most commonly caused by the delegation not having propagated to the gateway yet. \" +\n \"Cross-chain sync usually completes within ~10 blocks (a few seconds) and the SDK retries \" +\n \"across that window; seeing this means it did not sync in time — retry shortly. \" +\n \"If the error persists, the gateway or relayer may be experiencing an unrelated issue.\",\n { cause: error },\n );\n }\n\n if (isRelayerError(error) || statusCode !== undefined) {\n return new RelayerRequestFailedError(message, statusCode, {\n cause: error,\n retryAfter: extractRetryAfter(error),\n // A relayer timeout carries no HTTP status but is safe to retry; force\n // `retryable` so it isn't misclassified as terminal. Other relayer errors\n // fall back to the status-based default (429 → retryable).\n retryable: isRelayerTimeoutError(error) || undefined,\n });\n }\n\n return new DecryptionFailedError(fallbackMessage, { cause: error });\n}\n","import type { Hex } from \"viem\";\nimport { assertCondition } from \"./assertions\";\n\n/** Normalize a un-prefixed hex payload to a 0x-prefixed `Hex` value. */\nexport function prefixHex(value: string): Hex {\n return (value.startsWith(\"0x\") ? value : `0x${value}`) as Hex;\n}\n\n/** Convert a public `Hex` value back an unprefixed format. */\nexport function unprefixHex(value: Hex): string {\n assertCondition(value.startsWith(\"0x\"), `Expected 0x-prefixed hex, got: ${value}`);\n return value.slice(2);\n}\n","/**\n * Primitives for decoding raw EVM logs without an ABI decoder.\n *\n * @internal\n */\n\nimport { getAddress, keccak256, toBytes, type Address, type Hex } from \"viem\";\nimport type { EncryptedValue } from \"../relayer/types\";\nimport { prefixHex } from \"../utils\";\n\n/** Hashes the canonical signature — `Joined(uint256,address,bytes32)`, not the declaration with parameter names. */\nexport function eventTopic(signature: string): Hex {\n return keccak256(toBytes(signature));\n}\n\nexport function topicToAddress(topic: Hex): Address {\n return getAddress(prefixHex(topic.slice(-40)));\n}\n\nexport function topicToBytes32(topic: Hex): EncryptedValue {\n // EVM topics are already 32-byte 0x-prefixed hex — cast directly\n return topic as EncryptedValue;\n}\n\nexport function wordAt(data: Hex, index: number): string {\n // data starts with \"0x\", each word is 64 hex chars (32 bytes)\n const start = 2 + index * 64;\n const word = data.slice(start, start + 64);\n return word.length === 64 ? word : word.padEnd(64, \"0\");\n}\n\nexport function wordToAddress(data: Hex, index: number): Address {\n return getAddress(prefixHex(wordAt(data, index).slice(-40)));\n}\n\nexport function wordToBigInt(data: Hex, index: number): bigint {\n return BigInt(\"0x\" + wordAt(data, index));\n}\n\nexport function wordToBytes32(data: Hex, index: number): EncryptedValue {\n // wordAt returns exactly 64 hex chars — prefix and cast directly\n return prefixHex(wordAt(data, index)) as EncryptedValue;\n}\n","import type { Hex } from \"viem\";\nimport { DecryptionFailedError, wrapDecryptError } from \"../errors\";\nimport type { EncryptedValue, RelayerRequestOptions, RelayerSDK } from \"./types\";\n\n/**\n * Publicly decrypt one euint64-or-wider handle, such as an unwrap amount, for an on-chain finalize call.\n *\n * @throws if public decryption fails, including when the relayer returns no bigint for `encryptedValue`. {@link DecryptionFailedError}\n */\nexport async function decryptPublicUint(\n relayer: Pick<RelayerSDK, \"decryptPublicValuesWithSignatures\">,\n encryptedValue: EncryptedValue,\n options: RelayerRequestOptions,\n): Promise<{ value: bigint; decryptionProof: Hex }> {\n const result = await relayer\n .decryptPublicValuesWithSignatures({ encryptedValues: [encryptedValue], options })\n .catch((error: unknown) => {\n throw wrapDecryptError(error, \"Public decryption failed\");\n });\n const returnedHandle = result.checkSignaturesArgs.handlesList[0];\n if (returnedHandle?.toLowerCase() !== encryptedValue.toLowerCase()) {\n throw new DecryptionFailedError(\n `Public decryption of ${encryptedValue} returned values for ${returnedHandle ?? \"no handle\"}`,\n );\n }\n const value = result.clearValues[0]?.value;\n if (typeof value !== \"bigint\") {\n throw new DecryptionFailedError(\n `Public decryption of ${encryptedValue} returned ${value === undefined ? \"no value\" : `a ${typeof value}`}, not a bigint`,\n );\n }\n return { value, decryptionProof: result.checkSignaturesArgs.decryptionProof };\n}\n"],"mappings":"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"}
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
-
import { C as Delegations, S as Offline, T as Permits, Xt as ZamaErrorCode, Yt as ZamaError, _ as WrappersRegistryConfig, a as DecryptResult, an as SerializedTransportKeyPair, b as BatchDecryptAsOptions, c as SignerQueryContext, cn as PaginatedResult, d as QueryFactoryOptions, f as ZamaSDK, g as WrappersRegistry, h as ListPairsOptions, i as DelegatedDecryptOptions, in as SerializedPermitEip712, l as zamaQueryKeys, ln as TokenWrapperPair, n as BatchDecryptItem, nn as PreparedPermit, o as EncryptedInput, on as SignedPreparedPermit, p as ZamaSDKOptions, r as BatchDecryptResult, s as decryptValuesQueryOptions, sn as ChecksummedAddress, t as Decryption, tn as PreparePermitRequest, u as MutationFactoryOptions, un as TokenWrapperPairWithMetadata, v as WrappedToken, w as DelegationStatus, x as Token, y as BatchBalancesResult } from "../decryption-
|
|
13
|
-
import { a as invalidateAfterSetOperator, c as invalidateAfterUnshield, d as
|
|
14
|
-
import "../index-
|
|
15
|
-
import { $ as RevokeDelegationSubmittedEvent, $t as RawLog, A as WalletAccountListener, At as ConfidentialTransferEvent, B as WriteFunctionName, C as TransferAndCallRequest, Ct as WrapOptions, D as GenericSigner, E as WrapRequest, Et as UnshieldCallbacks, F as ReadContractConfig, G as DecryptStartEvent, H as BaseEvent, I as ReadContractReturnType, It as UnwrapFinalizedEvent, J as EncryptErrorEvent, K as DelegationSubmittedEvent, L as ReadFunctionName, Lt as UnwrapRequestedEvent, M as ContractAbi, Mt as OnChainEvent, N as MulticallReturnType, O as WalletAccount, P as ReadContractArgs, Q as PermitOperation, R as WriteContractArgs, Rt as WrapEvent, S as TransactionKind, St as UnwrapResult, T as UnwrapRequest, Tt as TransferCallbacks, U as DecryptEndEvent, V as ApproveUnderlyingSubmittedEvent, W as DecryptErrorEvent, X as FinalizeUnwrapSubmittedEvent, Y as EncryptStartEvent, Z as PermitErrorEvent, _ as PrepareTransactionRequest, _t as ApprovalStrategy, an as EIP712TypedData, at as TransferSubmittedEvent, b as RevokeDelegationRequest, bt as TransferOptions, c as GenericStorage, cn as EncryptResult, ct as UnshieldPhase2SubmittedEvent, d as ConfidentialTransferFromRequest, en as TransactionReceipt, et as SetOperatorSubmittedEvent, f as ConfidentialTransferRequest, fn as FhevmRelayerOptions, ft as WrapSubmittedEvent, g as PrepareOptions, gn as RelayerSDK, gt as ZamaSDKEvents, h as PrepareFees, hn as RelayerRequestOptions, i as ZamaConfig, it as TransferFromSubmittedEvent, j as WalletAccountStore, k as WalletAccountChange, l as GenericProvider, ln as EncryptedValue, lt as UnwrapSubmittedEvent, m as FinalizeUnwrapRequest, mt as ZamaSDKEventListener, nn as ClearValue, nt as TransactionErrorEvent, on as EncryptInput, ot as UnshieldPhase1SubmittedEvent, p as DelegateDecryptionRequest, pn as FhevmRuntimeConfig, pt as ZamaSDKEvent, q as EncryptEndEvent, rn as DecryptPublicValuesResult, rt as TransactionOperation, s as GenericLogger, sn as EncryptParams, st as UnshieldPhase2StartedEvent, tn as TransactionResult, tt as ShieldSubmittedEvent, u as ApproveUnderlyingRequest, un as FhevmClient, v as PreparedFor, vt as ShieldOptions, w as UnwrapAllRequest, wt as ShieldCallbacks, x as SetOperatorRequest, xt as UnshieldOptions, y as PreparedTransaction, yt as ShieldPath, z as WriteContractConfig } from "../types-
|
|
16
|
-
import "../index-
|
|
17
|
-
import { f as FheChain, p as FheChainAuth } from "../index-
|
|
12
|
+
import { C as Delegations, S as Offline, T as Permits, Xt as ZamaErrorCode, Yt as ZamaError, _ as WrappersRegistryConfig, a as DecryptResult, an as SerializedTransportKeyPair, b as BatchDecryptAsOptions, c as SignerQueryContext, cn as PaginatedResult, d as QueryFactoryOptions, f as ZamaSDK, g as WrappersRegistry, h as ListPairsOptions, i as DelegatedDecryptOptions, in as SerializedPermitEip712, l as zamaQueryKeys, ln as TokenWrapperPair, n as BatchDecryptItem, nn as PreparedPermit, o as EncryptedInput, on as SignedPreparedPermit, p as ZamaSDKOptions, r as BatchDecryptResult, s as decryptValuesQueryOptions, sn as ChecksummedAddress, t as Decryption, tn as PreparePermitRequest, u as MutationFactoryOptions, un as TokenWrapperPairWithMetadata, v as WrappedToken, w as DelegationStatus, x as Token, y as BatchBalancesResult } from "../decryption-BvvhpFM2.js";
|
|
13
|
+
import { a as invalidateAfterSetOperator, c as invalidateAfterUnshield, d as invalidateAfterUnwrap, f as invalidateAfterWrap, h as invalidateWalletLifecycleQueries, i as invalidateAfterApproveUnderlying, l as invalidateAfterUnshieldError, m as invalidateWagmiBalanceQueries, n as QueryFilterLike, o as invalidateAfterShield, p as invalidateBalanceQueries, r as QueryLike, s as invalidateAfterTransfer, t as QueryClientLike, u as invalidateAfterUnshieldSettled } from "../invalidation-BpkhN3Qu.js";
|
|
14
|
+
import "../index-B7M2GEtA.js";
|
|
15
|
+
import { $ as RevokeDelegationSubmittedEvent, $t as RawLog, A as WalletAccountListener, At as ConfidentialTransferEvent, B as WriteFunctionName, C as TransferAndCallRequest, Ct as WrapOptions, D as GenericSigner, E as WrapRequest, Et as UnshieldCallbacks, F as ReadContractConfig, G as DecryptStartEvent, H as BaseEvent, I as ReadContractReturnType, It as UnwrapFinalizedEvent, J as EncryptErrorEvent, K as DelegationSubmittedEvent, L as ReadFunctionName, Lt as UnwrapRequestedEvent, M as ContractAbi, Mt as OnChainEvent, N as MulticallReturnType, O as WalletAccount, P as ReadContractArgs, Q as PermitOperation, R as WriteContractArgs, Rt as WrapEvent, S as TransactionKind, St as UnwrapResult, T as UnwrapRequest, Tt as TransferCallbacks, U as DecryptEndEvent, V as ApproveUnderlyingSubmittedEvent, W as DecryptErrorEvent, X as FinalizeUnwrapSubmittedEvent, Y as EncryptStartEvent, Z as PermitErrorEvent, _ as PrepareTransactionRequest, _t as ApprovalStrategy, an as EIP712TypedData, at as TransferSubmittedEvent, b as RevokeDelegationRequest, bt as TransferOptions, c as GenericStorage, cn as EncryptResult, ct as UnshieldPhase2SubmittedEvent, d as ConfidentialTransferFromRequest, en as TransactionReceipt, et as SetOperatorSubmittedEvent, f as ConfidentialTransferRequest, fn as FhevmRelayerOptions, ft as WrapSubmittedEvent, g as PrepareOptions, gn as RelayerSDK, gt as ZamaSDKEvents, h as PrepareFees, hn as RelayerRequestOptions, i as ZamaConfig, it as TransferFromSubmittedEvent, j as WalletAccountStore, k as WalletAccountChange, l as GenericProvider, ln as EncryptedValue, lt as UnwrapSubmittedEvent, m as FinalizeUnwrapRequest, mt as ZamaSDKEventListener, nn as ClearValue, nt as TransactionErrorEvent, on as EncryptInput, ot as UnshieldPhase1SubmittedEvent, p as DelegateDecryptionRequest, pn as FhevmRuntimeConfig, pt as ZamaSDKEvent, q as EncryptEndEvent, rn as DecryptPublicValuesResult, rt as TransactionOperation, s as GenericLogger, sn as EncryptParams, st as UnshieldPhase2StartedEvent, tn as TransactionResult, tt as ShieldSubmittedEvent, u as ApproveUnderlyingRequest, un as FhevmClient, v as PreparedFor, vt as ShieldOptions, w as UnwrapAllRequest, wt as ShieldCallbacks, x as SetOperatorRequest, xt as UnshieldOptions, y as PreparedTransaction, yt as ShieldPath, z as WriteContractConfig } from "../types-CHA7Mcqr.js";
|
|
16
|
+
import "../index-DTLVaNIj.js";
|
|
17
|
+
import { f as FheChain, p as FheChainAuth } from "../index-BSkvEzGu.js";
|
|
18
18
|
import { Address, Hex } from "viem";
|
|
19
19
|
/** Union of TanStack Query option keys stripped by {@link filterQueryOptions}, leaving only domain parameters. */
|
|
20
20
|
type StrippedQueryOptionKeys = "gcTime" | "staleTime" | "enabled" | "select" | "refetchInterval" | "refetchOnMount" | "refetchOnWindowFocus" | "refetchOnReconnect" | "retry" | "retryDelay" | "retryOnMount" | "queryFn" | "queryKey" | "queryKeyHashFn" | "initialData" | "initialDataUpdatedAt" | "placeholderData" | "structuralSharing" | "throwOnError" | "meta" | "query" | "pollingInterval";
|
|
@@ -424,4 +424,4 @@ interface DelegationStatusQueryConfig {
|
|
|
424
424
|
}
|
|
425
425
|
/** Builds TanStack Query options for reading the decryption-delegation status between a delegator and a delegate on a contract. */
|
|
426
426
|
export declare function delegationStatusQueryOptions(sdk: ZamaSDK, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatus, Error, DelegationStatus, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
427
|
-
export { type ApprovalStrategy, type ApproveUnderlyingParams, type ApproveUnderlyingRequest, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptItem, type BatchDecryptResult, type ChecksummedAddress, type ClearValue, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesQueryConfig, type ConfidentialIsOperatorQueryConfig, type ConfidentialSetOperatorParams, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferAndCallParams, type ConfidentialTransferEvent, type ConfidentialTransferFromAndCallParams, type ConfidentialTransferFromParams, type ConfidentialTransferFromRequest, type ConfidentialTransferParams, type ConfidentialTransferRequest, type ContractAbi, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type Decryption, type DelegateDecryptionParams, type DelegateDecryptionRequest, type DelegatedDecryptOptions, type DelegatedDecryptValuesMutationParams, type DelegationStatus, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type Delegations, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClient, type FhevmRelayerOptions, type FhevmRuntimeConfig, type FinalizeUnwrapParams, type FinalizeUnwrapRequest, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type HasPermitQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsOptions, type ListPairsQueryConfig, type MulticallReturnType, type MutationFactoryOptions, type Offline, type OnChainEvent, type PaginatedResult, type PendingUnshieldQueryConfig, type PermitErrorEvent, type PermitOperation, type Permits, type PrepareFees, type PrepareOptions, type PreparePermitRequest, type PrepareTransactionRequest, type PreparedFor, type PreparedPermit, type PreparedTransaction, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RegisterPermitParams, type RelayerRequestOptions, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationRequest, type RevokeDelegationSubmittedEvent, type SerializedPermitEip712, type SerializedTransportKeyPair, type SetOperatorRequest, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldPath, type ShieldSubmittedEvent, type SignedPreparedPermit, type SignerQueryContext, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TokenWrapperPair, type TokenWrapperPairWithMetadata, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionKind, type TransactionOperation, type TransactionReceipt, type TransactionResult, type TransferAndCallRequest, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnderlyingAllowanceQueryConfig, type UnshieldAllParams, type UnshieldCallbacks, type UnshieldOptions, type UnshieldParams, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapAllRequest, type UnwrapFinalizedEvent, type UnwrapParams, type UnwrapRequest, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, type WalletAccountStore, type WrapEvent, type WrapOptions, type WrapParams, type WrapRequest, type WrapSubmittedEvent, type WrappedToken, type WrapperDiscoveryQueryConfig, type WrappersRegistry, type WrappersRegistryConfig, type WrappersRegistryQueryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, type ZamaConfig, type ZamaError, type ZamaErrorCode, type ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventListener, ZamaSDKEvents, type ZamaSDKOptions, decryptValuesQueryOptions, invalidateAfterApproveUnderlying, invalidateAfterSetOperator, invalidateAfterShield, invalidateAfterTransfer, invalidateAfterUnshield, invalidateAfterUnshieldSettled, invalidateAfterUnwrap, invalidateAfterWrap, invalidateBalanceQueries, invalidateWagmiBalanceQueries, invalidateWalletLifecycleQueries, zamaQueryKeys };
|
|
427
|
+
export { type ApprovalStrategy, type ApproveUnderlyingParams, type ApproveUnderlyingRequest, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptItem, type BatchDecryptResult, type ChecksummedAddress, type ClearValue, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesQueryConfig, type ConfidentialIsOperatorQueryConfig, type ConfidentialSetOperatorParams, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferAndCallParams, type ConfidentialTransferEvent, type ConfidentialTransferFromAndCallParams, type ConfidentialTransferFromParams, type ConfidentialTransferFromRequest, type ConfidentialTransferParams, type ConfidentialTransferRequest, type ContractAbi, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type Decryption, type DelegateDecryptionParams, type DelegateDecryptionRequest, type DelegatedDecryptOptions, type DelegatedDecryptValuesMutationParams, type DelegationStatus, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type Delegations, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, type FheChain, type FheChainAuth, type FhevmClient, type FhevmRelayerOptions, type FhevmRuntimeConfig, type FinalizeUnwrapParams, type FinalizeUnwrapRequest, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type HasPermitQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsOptions, type ListPairsQueryConfig, type MulticallReturnType, type MutationFactoryOptions, type Offline, type OnChainEvent, type PaginatedResult, type PendingUnshieldQueryConfig, type PermitErrorEvent, type PermitOperation, type Permits, type PrepareFees, type PrepareOptions, type PreparePermitRequest, type PrepareTransactionRequest, type PreparedFor, type PreparedPermit, type PreparedTransaction, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RegisterPermitParams, type RelayerRequestOptions, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationRequest, type RevokeDelegationSubmittedEvent, type SerializedPermitEip712, type SerializedTransportKeyPair, type SetOperatorRequest, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldParams, type ShieldPath, type ShieldSubmittedEvent, type SignedPreparedPermit, type SignerQueryContext, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TokenWrapperPair, type TokenWrapperPairWithMetadata, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionKind, type TransactionOperation, type TransactionReceipt, type TransactionResult, type TransferAndCallRequest, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnderlyingAllowanceQueryConfig, type UnshieldAllParams, type UnshieldCallbacks, type UnshieldOptions, type UnshieldParams, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapAllRequest, type UnwrapFinalizedEvent, type UnwrapParams, type UnwrapRequest, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, type WalletAccountStore, type WrapEvent, type WrapOptions, type WrapParams, type WrapRequest, type WrapSubmittedEvent, type WrappedToken, type WrapperDiscoveryQueryConfig, type WrappersRegistry, type WrappersRegistryConfig, type WrappersRegistryQueryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, type ZamaConfig, type ZamaError, type ZamaErrorCode, type ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventListener, ZamaSDKEvents, type ZamaSDKOptions, decryptValuesQueryOptions, invalidateAfterApproveUnderlying, invalidateAfterSetOperator, invalidateAfterShield, invalidateAfterTransfer, invalidateAfterUnshield, invalidateAfterUnshieldError, invalidateAfterUnshieldSettled, invalidateAfterUnwrap, invalidateAfterWrap, invalidateBalanceQueries, invalidateWagmiBalanceQueries, invalidateWalletLifecycleQueries, zamaQueryKeys };
|
package/dist/esm/query/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../query-keys-CSPxPLBB.js";import{A as t,B as n,D as r,E as i,_ as a,c as o,f as s,h as c,l as ee,v as l,z as u}from"../alignment-D1cVCzw8.js";import{p as d}from"../relayer-Cki3j_Ba.js";import{t as f}from"../token-DnriE-3y.js";import{a as te,i as p,n as m,o as h,r as g,s as _,t as v}from"../wrappers-registry-Cm3JJeqx.js";import{zeroAddress as y}from"viem";import{z as b}from"zod/mini";function x(e){if(!S(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!S(n)||!n.hasOwnProperty(`isPrototypeOf`))}function S(e){return Object.prototype.toString.call(e)===`[object Object]`}function C(e){let{gcTime:t,staleTime:n,enabled:r,select:i,refetchInterval:a,refetchOnMount:o,refetchOnWindowFocus:s,refetchOnReconnect:c,retry:ee,retryDelay:l,retryOnMount:u,queryFn:d,queryKey:f,queryKeyHashFn:te,initialData:p,initialDataUpdatedAt:m,placeholderData:h,structuralSharing:g,throwOnError:_,meta:v,query:y,pollingInterval:b,...x}=e;return x}function w(e){return JSON.stringify(e,(e,t)=>x(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}function T(t,n){t.invalidateQueries({queryKey:e.underlyingAllowance.token(n)})}function E(t,n){t.invalidateQueries({queryKey:e.pendingUnshield.token(n)})}function D(e,t){k(e,t),T(e,t),E(e,t),H(e)}function O(e,t){k(e,t),T(e,t),H(e)}function k(t,n){t.invalidateQueries({queryKey:e.confidentialBalance.token(n)}),t.invalidateQueries({queryKey:e.confidentialBalances.all})}function A(e,t){k(e,t),T(e,t),H(e)}function j(e,t){k(e,t),T(e,t),E(e,t),H(e)}function M(e,t){E(e,t)}function N(e,t){k(e,t)}function P(e,t){T(e,t)}function F(t,n){t.invalidateQueries({queryKey:e.confidentialIsOperator.token(n)})}function I(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}const L=b.enum([`balanceOf`,`confidentialBalanceOf`]),R=b.object({functionName:L}),z=b.object({contracts:b.array(b.unknown())});function B(e){if(R.safeParse(e).success)return!0;let t=z.safeParse(e);return t.success&&t.data.contracts.some(e=>R.safeParse(e).success)}function V(e){return Array.isArray(e.queryKey)&&e.queryKey.some(B)}function H(e){e.invalidateQueries({predicate:V})}function U(t){t.removeQueries({queryKey:e.decryption.all}),t.removeQueries({queryKey:e.hasPermit.all}),t.invalidateQueries({predicate:I}),H(t)}function W(t,n,r){let i=e.tokenMetadata.token(n);return{...C(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey,[r,i,o]=await Promise.all([t.provider.readContract(a(n)),t.provider.readContract(l(n)),t.provider.readContract(c(n))]);return{name:r,symbol:i,decimals:o}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function G(t,n,r){let i=e.isConfidential.token(n);return{...C(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;try{return await t.provider.readContract(o(n))}catch(e){if(d(e))return!1;throw e}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function K(t,n,r){let i=e.isWrapper.token(n);return{...C(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;try{return await t.provider.readContract(ee(n))}catch(e){if(d(e))return!1;throw e}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function q(t,n,r){let a=e.totalSupply.token(n);return{...C(r?.query??{}),queryKey:a,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;return t.provider.readContract(i(n))},staleTime:3e4,enabled:r?.query?.enabled!==!1}}function J(t,n){let r=e.wrapperDiscovery.token(n.tokenAddress,n.erc20Address,n.registryAddress);return{...C(n.query??{}),queryKey:r,queryFn:async e=>{let[,{erc20Address:n}]=e.queryKey;u(n,`wrapperDiscoveryQueryOptions: erc20Address`);let r=await t.getConfidentialToken(n);return r?.isValid?r.confidentialTokenAddress:null},staleTime:t.ttlMs,enabled:!!(n.tokenAddress&&n.erc20Address&&n.registryAddress)&&n.query?.enabled!==!1}}function Y(n,r,i){let a=i.owner,o=i.query?.enabled!==!1,c=e.underlyingAllowance.scope(r,a);return{...C(i.query??{}),queryKey:c,queryFn:async e=>{let[,{tokenAddress:r,owner:i}]=e.queryKey;u(i,`underlyingAllowanceQueryOptions: owner`);let a=await n.provider.readContract(t(r));return n.provider.readContract(s(a,i,r))},staleTime:3e4,enabled:!!a&&o}}function X(t,n,r){let i=e.pendingUnshield.token(n);return{...C(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;return t.createWrappedToken(n).getPendingUnshield()},staleTime:0,enabled:r?.query?.enabled!==!1}}function Z(t,n,i){let a=i.holder,o=i.spender,s=i.query?.enabled!==!1,c=e.confidentialIsOperator.scope(n,a,o);return{...C(i.query??{}),queryKey:c,queryFn:async e=>{let[,{tokenAddress:n,holder:i,spender:a}]=e.queryKey;return u(n,`confidentialIsOperatorQueryOptions: tokenAddress`),u(i,`confidentialIsOperatorQueryOptions: holder`),u(a,`confidentialIsOperatorQueryOptions: spender`),t.provider.readContract(r(n,i,a))},staleTime:3e4,enabled:!!(n&&a&&o)&&s}}function Q(t,n,r={}){let i=n.query??{};return{...C(i),queryKey:e.confidentialBalance.owner(n.tokenAddress,n.account,r.walletAccount),queryFn:async e=>{let[,{owner:n}]=e.queryKey;return u(n,`confidentialBalanceQueryOptions: owner`),t.balanceOf(n)},enabled:!!n.account&&r.walletAccount!==void 0&&i?.enabled!==!1}}function ne(t,n,r={}){let i=n?.account,a=r.walletAccount,o=n?.query??{},s=t.map(e=>e.address);return{...C(o),queryKey:e.confidentialBalances.tokens(s,i,a),queryFn:async e=>{let[,{owner:n}]=e.queryKey;return u(n,`confidentialBalancesQueryOptions: owner`),f.batchBalancesOf(t,n)},enabled:!!i&&t.length>0&&a!==void 0&&o?.enabled!==!1}}function re(t,n){let r=!!n.registryAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPairs(n.registryAddress??y);return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n}]=e.queryKey;return t.provider.readContract(p(n))},staleTime:t.registry.ttlMs,enabled:r}}function ie(t,n){let r=!!n.registryAddress&&!!n.tokenAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.confidentialTokenAddress(n.registryAddress??y,n.tokenAddress??y);return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,tokenAddress:r}]=e.queryKey;return t.provider.readContract(v(n,r))},staleTime:t.registry.ttlMs,enabled:r}}function ae(t,n){let r=!!n.registryAddress&&!!n.confidentialTokenAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenAddress(n.registryAddress??y,n.confidentialTokenAddress??y);return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=e.queryKey;return t.provider.readContract(m(n,r))},staleTime:t.registry.ttlMs,enabled:r}}function oe(t,n){let r=!!n.registryAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPairsLength(n.registryAddress??y);return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n}]=e.queryKey;return t.provider.readContract(te(n))},staleTime:t.registry.ttlMs,enabled:r}}function se(t,n){let r=!!n.registryAddress&&n.fromIndex!==void 0&&n.toIndex!==void 0&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPairsSlice(n.registryAddress??y,String(n.fromIndex??0n),String(n.toIndex??0n));return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=e.queryKey;return t.provider.readContract(h(n,BigInt(r),BigInt(i)))},staleTime:t.registry.ttlMs,enabled:r}}function ce(t,n){let r=!!n.registryAddress&&n.index!==void 0&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPair(n.registryAddress??y,String(n.index??0n));return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,index:r}]=e.queryKey;return t.provider.readContract(g(n,BigInt(r)))},staleTime:t.registry.ttlMs,enabled:r}}function le(t,n){let r=!!n.registryAddress&&!!n.confidentialTokenAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.isConfidentialTokenValid(n.registryAddress??y,n.confidentialTokenAddress??y);return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=e.queryKey;return t.provider.readContract(_(n,r))},staleTime:t.registry.ttlMs,enabled:r}}function ue(t,n){let r=!!n.registryAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.listPairs(n.registryAddress??y,n.page??1,n.pageSize??100,n.metadata??!1);return{...C(n.query??{}),queryKey:i,queryFn:async e=>{let[,{page:n,pageSize:r,metadata:i}]=e.queryKey;return t.listPairs({page:n,pageSize:r,metadata:i})},staleTime:t.ttlMs,enabled:r}}function de(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function fe(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function pe(e){return{mutationKey:[`zama.confidentialTransferAndCall`,e.address],mutationFn:async({to:t,amount:n,data:r,...i})=>e.confidentialTransferAndCall(t,n,r,i)}}function me(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function he(e){return{mutationKey:[`zama.confidentialTransferFromAndCall`,e.address],mutationFn:async({from:t,to:n,amount:r,data:i,callbacks:a})=>e.confidentialTransferFromAndCall(t,n,r,i,a)}}function ge(e){return{mutationKey:[`zama.confidentialSetOperator`,e.address],mutationFn:async({operator:t,until:n})=>e.setOperator(t,n)}}function _e(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function ve(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function ye(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function be(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function xe(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function Se(e){return{mutationKey:[`zama.wrap`,e.address],mutationFn:async({amount:t,...n})=>e.wrap(t,n)}}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.encrypt(t)}}function Ee(e){return{mutationKey:[`zama.delegatedDecryptValues`],mutationFn:async t=>e.decryption.delegatedDecryptValues(t.encryptedInputs,t.delegatorAddress)}}function De(t){return{mutationKey:[`zama.decryptPublicValues`],mutationFn:async e=>t.decryption.decryptPublicValues(e),onSuccess:(t,n,r,i)=>{for(let[n,r]of Object.entries(t.clearValues))i.client.setQueryData(e.decryption.encryptedValue(n),r)}}}function $(e){return{mutationKey:[`zama.grantPermit`],mutationFn:t=>e.permits.grantPermit(t)}}function Oe(e){return{mutationKey:[`zama.preparePermit`],mutationFn:t=>e.offline.preparePermit(t)}}function ke(e){return{mutationKey:[`zama.batchPreparePermits`],mutationFn:t=>e.offline.batchPreparePermits(t)}}function Ae(e){return{mutationKey:[`zama.registerPermit`],mutationFn:({prepared:t,signature:n})=>e.permits.registerPermit(t,n)}}function je(e){return{mutationKey:[`zama.batchRegisterPermits`],mutationFn:t=>e.permits.batchRegisterPermits(t)}}function Me(t,n,r={}){let i=n.query?.enabled!==!1;return{...C(n?.query??{}),queryKey:e.hasPermit.scope(n.contractAddresses,r.walletAccount),queryFn:e=>{let[,{contractAddresses:n}]=e.queryKey;return t.permits.hasPermit(n)},staleTime:0,gcTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,enabled:i&&r.walletAccount!==void 0&&n.contractAddresses.length>0}}function Ne(e){return{mutationKey:[`zama.revokePermits`],mutationFn:t=>t===void 0?e.permits.revokePermits():e.permits.revokePermits(t)}}function Pe(e){return{mutationKey:[`zama.clearCredentials`],mutationFn:()=>e.permits.clear()}}function Fe(e,t){return{mutationKey:[`zama.delegateDecryption`,t],mutationFn:async({delegateAddress:n,expirationDate:r})=>e.delegations.delegateDecryption({contractAddress:t,delegateAddress:n,expirationDate:r})}}function Ie(t,n,r={}){return{queryKey:e.decryption.encryptedInputs(n,r.walletAccount),queryFn:e=>{let[,{encryptedInputs:n}]=e.queryKey;return t.decryption.decryptValues(n)},staleTime:1/0,enabled:n.length>0&&r.walletAccount!==void 0}}function Le(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,accountAddress:n})=>e.decryptBalanceAs({delegatorAddress:t,accountAddress:n})}}function Re(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>f.batchDecryptBalancesAs(e,t)}}function ze(e,t){return{mutationKey:[`zama.revokeDelegation`,t],mutationFn:async({delegateAddress:n})=>e.delegations.revokeDelegation({contractAddress:t,delegateAddress:n})}}function Be(t,n){return{...C(n.query??{}),queryKey:e.delegationStatus.scope(n.contractAddress,n.delegatorAddress,n.delegateAddress),queryFn:async e=>{let[,{contractAddress:n,delegatorAddress:r,delegateAddress:i}]=e.queryKey;return u(n,`delegationStatusQueryOptions: contractAddress`),u(r,`delegationStatusQueryOptions: delegatorAddress`),u(i,`delegationStatusQueryOptions: delegateAddress`),t.delegations.getStatus({contractAddress:n,delegatorAddress:r,delegateAddress:i})},enabled:!!(n.contractAddress&&n.delegatorAddress&&n.delegateAddress)&&n.query?.enabled!==!1}}export{n as ZamaSDKEvents,_e as approveUnderlyingMutationOptions,Re as batchDecryptBalancesAsMutationOptions,ke as batchPreparePermitsMutationOptions,je as batchRegisterPermitsMutationOptions,Pe as clearCredentialsMutationOptions,Q as confidentialBalanceQueryOptions,ne as confidentialBalancesQueryOptions,Z as confidentialIsOperatorQueryOptions,ge as confidentialSetOperatorMutationOptions,ie as confidentialTokenAddressQueryOptions,pe as confidentialTransferAndCallMutationOptions,he as confidentialTransferFromAndCallMutationOptions,me as confidentialTransferFromMutationOptions,fe as confidentialTransferMutationOptions,Le as decryptBalanceAsMutationOptions,De as decryptPublicValuesMutationOptions,Ie as decryptValuesQueryOptions,Fe as delegateDecryptionMutationOptions,Ee as delegatedDecryptValuesMutationOptions,Be as delegationStatusQueryOptions,Te as encryptMutationOptions,C as filterQueryOptions,we as finalizeUnwrapMutationOptions,$ as grantPermitMutationOptions,Me as hasPermitQueryOptions,w as hashFn,P as invalidateAfterApproveUnderlying,F as invalidateAfterSetOperator,A as invalidateAfterShield,N as invalidateAfterTransfer,j as invalidateAfterUnshield,M as invalidateAfterUnshieldSettled,D as invalidateAfterUnwrap,O as invalidateAfterWrap,k as invalidateBalanceQueries,H as invalidateWagmiBalanceQueries,U as invalidateWalletLifecycleQueries,G as isConfidentialQueryOptions,le as isConfidentialTokenValidQueryOptions,K as isWrapperQueryOptions,ue as listPairsQueryOptions,X as pendingUnshieldQueryOptions,Oe as preparePermitMutationOptions,Ae as registerPermitMutationOptions,be as resumeUnshieldMutationOptions,ze as revokeDelegationMutationOptions,Ne as revokePermitsMutationOptions,de as shieldMutationOptions,ae as tokenAddressQueryOptions,W as tokenMetadataQueryOptions,ce as tokenPairQueryOptions,oe as tokenPairsLengthQueryOptions,re as tokenPairsQueryOptions,se as tokenPairsSliceQueryOptions,q as totalSupplyQueryOptions,Y as underlyingAllowanceQueryOptions,ye as unshieldAllMutationOptions,ve as unshieldMutationOptions,Ce as unwrapAllMutationOptions,xe as unwrapMutationOptions,Se as wrapMutationOptions,J as wrapperDiscoveryQueryOptions,e as zamaQueryKeys};
|
|
1
|
+
import{t as e}from"../query-keys-CSPxPLBB.js";import{t}from"../unshield-xO66p_da.js";import{A as n,B as r,D as i,E as a,_ as o,c as s,f as c,h as l,l as ee,v as u,z as d}from"../alignment-D1cVCzw8.js";import{p as f}from"../relayer-Cki3j_Ba.js";import{t as p}from"../token-DnriE-3y.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"../wrappers-registry-Cm3JJeqx.js";import{zeroAddress as x}from"viem";import{z as S}from"zod/mini";function te(e){if(!C(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!C(n)||!n.hasOwnProperty(`isPrototypeOf`))}function C(e){return Object.prototype.toString.call(e)===`[object Object]`}function w(e){let{gcTime:t,staleTime:n,enabled:r,select:i,refetchInterval:a,refetchOnMount:o,refetchOnWindowFocus:s,refetchOnReconnect:c,retry:l,retryDelay:ee,retryOnMount:u,queryFn:d,queryKey:f,queryKeyHashFn:p,initialData:m,initialDataUpdatedAt:h,placeholderData:g,structuralSharing:_,throwOnError:v,meta:y,query:b,pollingInterval:x,...S}=e;return S}function T(e){return JSON.stringify(e,(e,t)=>te(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}function E(t,n){t.invalidateQueries({queryKey:e.underlyingAllowance.token(n)})}function D(t,n){t.invalidateQueries({queryKey:e.pendingUnshield.token(n)})}function O(e,t){A(e,t),E(e,t),D(e,t),W(e)}function k(e,t){A(e,t),E(e,t),W(e)}function A(t,n){t.invalidateQueries({queryKey:e.confidentialBalance.token(n)}),t.invalidateQueries({queryKey:e.confidentialBalances.all})}function j(e,t){A(e,t),E(e,t),W(e)}function M(e,t){A(e,t),E(e,t),D(e,t),W(e)}function N(e,t){D(e,t)}function P(e,n,r){r instanceof t?M(e,n):N(e,n)}function F(e,t){A(e,t)}function I(e,t){E(e,t)}function L(t,n){t.invalidateQueries({queryKey:e.confidentialIsOperator.token(n)})}function R(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}const z=S.enum([`balanceOf`,`confidentialBalanceOf`]),B=S.object({functionName:z}),V=S.object({contracts:S.array(S.unknown())});function H(e){if(B.safeParse(e).success)return!0;let t=V.safeParse(e);return t.success&&t.data.contracts.some(e=>B.safeParse(e).success)}function U(e){return Array.isArray(e.queryKey)&&e.queryKey.some(H)}function W(e){e.invalidateQueries({predicate:U})}function G(t){t.removeQueries({queryKey:e.decryption.all}),t.removeQueries({queryKey:e.hasPermit.all}),t.invalidateQueries({predicate:R}),W(t)}function K(t,n,r){let i=e.tokenMetadata.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey,[r,i,a]=await Promise.all([t.provider.readContract(o(n)),t.provider.readContract(u(n)),t.provider.readContract(l(n))]);return{name:r,symbol:i,decimals:a}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function q(t,n,r){let i=e.isConfidential.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;try{return await t.provider.readContract(s(n))}catch(e){if(f(e))return!1;throw e}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function J(t,n,r){let i=e.isWrapper.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;try{return await t.provider.readContract(ee(n))}catch(e){if(f(e))return!1;throw e}},staleTime:1/0,enabled:r?.query?.enabled!==!1}}function Y(t,n,r){let i=e.totalSupply.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;return t.provider.readContract(a(n))},staleTime:3e4,enabled:r?.query?.enabled!==!1}}function X(t,n){let r=e.wrapperDiscovery.token(n.tokenAddress,n.erc20Address,n.registryAddress);return{...w(n.query??{}),queryKey:r,queryFn:async e=>{let[,{erc20Address:n}]=e.queryKey;d(n,`wrapperDiscoveryQueryOptions: erc20Address`);let r=await t.getConfidentialToken(n);return r?.isValid?r.confidentialTokenAddress:null},staleTime:t.ttlMs,enabled:!!(n.tokenAddress&&n.erc20Address&&n.registryAddress)&&n.query?.enabled!==!1}}function Z(t,r,i){let a=i.owner,o=i.query?.enabled!==!1,s=e.underlyingAllowance.scope(r,a);return{...w(i.query??{}),queryKey:s,queryFn:async e=>{let[,{tokenAddress:r,owner:i}]=e.queryKey;d(i,`underlyingAllowanceQueryOptions: owner`);let a=await t.provider.readContract(n(r));return t.provider.readContract(c(a,i,r))},staleTime:3e4,enabled:!!a&&o}}function Q(t,n,r){let i=e.pendingUnshield.token(n);return{...w(r?.query??{}),queryKey:i,queryFn:async e=>{let[,{tokenAddress:n}]=e.queryKey;return t.createWrappedToken(n).getPendingUnshield()},staleTime:0,enabled:r?.query?.enabled!==!1}}function ne(t,n,r){let a=r.holder,o=r.spender,s=r.query?.enabled!==!1,c=e.confidentialIsOperator.scope(n,a,o);return{...w(r.query??{}),queryKey:c,queryFn:async e=>{let[,{tokenAddress:n,holder:r,spender:a}]=e.queryKey;return d(n,`confidentialIsOperatorQueryOptions: tokenAddress`),d(r,`confidentialIsOperatorQueryOptions: holder`),d(a,`confidentialIsOperatorQueryOptions: spender`),t.provider.readContract(i(n,r,a))},staleTime:3e4,enabled:!!(n&&a&&o)&&s}}function re(t,n,r={}){let i=n.query??{};return{...w(i),queryKey:e.confidentialBalance.owner(n.tokenAddress,n.account,r.walletAccount),queryFn:async e=>{let[,{owner:n}]=e.queryKey;return d(n,`confidentialBalanceQueryOptions: owner`),t.balanceOf(n)},enabled:!!n.account&&r.walletAccount!==void 0&&i?.enabled!==!1}}function ie(t,n,r={}){let i=n?.account,a=r.walletAccount,o=n?.query??{},s=t.map(e=>e.address);return{...w(o),queryKey:e.confidentialBalances.tokens(s,i,a),queryFn:async e=>{let[,{owner:n}]=e.queryKey;return d(n,`confidentialBalancesQueryOptions: owner`),p.batchBalancesOf(t,n)},enabled:!!i&&t.length>0&&a!==void 0&&o?.enabled!==!1}}function ae(t,n){let r=!!n.registryAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPairs(n.registryAddress??x);return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n}]=e.queryKey;return t.provider.readContract(h(n))},staleTime:t.registry.ttlMs,enabled:r}}function oe(t,n){let r=!!n.registryAddress&&!!n.tokenAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.confidentialTokenAddress(n.registryAddress??x,n.tokenAddress??x);return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,tokenAddress:r}]=e.queryKey;return t.provider.readContract(b(n,r))},staleTime:t.registry.ttlMs,enabled:r}}function se(t,n){let r=!!n.registryAddress&&!!n.confidentialTokenAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenAddress(n.registryAddress??x,n.confidentialTokenAddress??x);return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=e.queryKey;return t.provider.readContract(g(n,r))},staleTime:t.registry.ttlMs,enabled:r}}function ce(t,n){let r=!!n.registryAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPairsLength(n.registryAddress??x);return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n}]=e.queryKey;return t.provider.readContract(m(n))},staleTime:t.registry.ttlMs,enabled:r}}function le(t,n){let r=!!n.registryAddress&&n.fromIndex!==void 0&&n.toIndex!==void 0&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPairsSlice(n.registryAddress??x,String(n.fromIndex??0n),String(n.toIndex??0n));return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=e.queryKey;return t.provider.readContract(_(n,BigInt(r),BigInt(i)))},staleTime:t.registry.ttlMs,enabled:r}}function ue(t,n){let r=!!n.registryAddress&&n.index!==void 0&&n.query?.enabled!==!1,i=e.wrappersRegistry.tokenPair(n.registryAddress??x,String(n.index??0n));return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,index:r}]=e.queryKey;return t.provider.readContract(v(n,BigInt(r)))},staleTime:t.registry.ttlMs,enabled:r}}function de(t,n){let r=!!n.registryAddress&&!!n.confidentialTokenAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.isConfidentialTokenValid(n.registryAddress??x,n.confidentialTokenAddress??x);return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=e.queryKey;return t.provider.readContract(y(n,r))},staleTime:t.registry.ttlMs,enabled:r}}function fe(t,n){let r=!!n.registryAddress&&n.query?.enabled!==!1,i=e.wrappersRegistry.listPairs(n.registryAddress??x,n.page??1,n.pageSize??100,n.metadata??!1);return{...w(n.query??{}),queryKey:i,queryFn:async e=>{let[,{page:n,pageSize:r,metadata:i}]=e.queryKey;return t.listPairs({page:n,pageSize:r,metadata:i})},staleTime:t.ttlMs,enabled:r}}function pe(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function me(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function he(e){return{mutationKey:[`zama.confidentialTransferAndCall`,e.address],mutationFn:async({to:t,amount:n,data:r,...i})=>e.confidentialTransferAndCall(t,n,r,i)}}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.confidentialTransferFromAndCall`,e.address],mutationFn:async({from:t,to:n,amount:r,data:i,callbacks:a})=>e.confidentialTransferFromAndCall(t,n,r,i,a)}}function ve(e){return{mutationKey:[`zama.confidentialSetOperator`,e.address],mutationFn:async({operator:t,until:n})=>e.setOperator(t,n)}}function ye(e){return{mutationKey:[`zama.approveUnderlying`,e.address],mutationFn:async({amount:t})=>e.approveUnderlying(t)}}function be(e){return{mutationKey:[`zama.unshield`,e.address],mutationFn:async({amount:t,...n})=>e.unshield(t,n)}}function xe(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function Se(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function Ce(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function we(e){return{mutationKey:[`zama.wrap`,e.address],mutationFn:async({amount:t,...n})=>e.wrap(t,n)}}function Te(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Ee(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({unwrapRequestId:t})=>e.finalizeUnwrap(t)}}function De(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.encrypt(t)}}function Oe(e){return{mutationKey:[`zama.delegatedDecryptValues`],mutationFn:async t=>e.decryption.delegatedDecryptValues(t.encryptedInputs,t.delegatorAddress)}}function ke(t){return{mutationKey:[`zama.decryptPublicValues`],mutationFn:async e=>t.decryption.decryptPublicValues(e),onSuccess:(t,n,r,i)=>{for(let[n,r]of Object.entries(t.clearValues))i.client.setQueryData(e.decryption.encryptedValue(n),r)}}}function Ae(e){return{mutationKey:[`zama.grantPermit`],mutationFn:t=>e.permits.grantPermit(t)}}function je(e){return{mutationKey:[`zama.preparePermit`],mutationFn:t=>e.offline.preparePermit(t)}}function Me(e){return{mutationKey:[`zama.batchPreparePermits`],mutationFn:t=>e.offline.batchPreparePermits(t)}}function Ne(e){return{mutationKey:[`zama.registerPermit`],mutationFn:({prepared:t,signature:n})=>e.permits.registerPermit(t,n)}}function Pe(e){return{mutationKey:[`zama.batchRegisterPermits`],mutationFn:t=>e.permits.batchRegisterPermits(t)}}function $(t,n,r={}){let i=n.query?.enabled!==!1;return{...w(n?.query??{}),queryKey:e.hasPermit.scope(n.contractAddresses,r.walletAccount),queryFn:e=>{let[,{contractAddresses:n}]=e.queryKey;return t.permits.hasPermit(n)},staleTime:0,gcTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,enabled:i&&r.walletAccount!==void 0&&n.contractAddresses.length>0}}function Fe(e){return{mutationKey:[`zama.revokePermits`],mutationFn:t=>t===void 0?e.permits.revokePermits():e.permits.revokePermits(t)}}function Ie(e){return{mutationKey:[`zama.clearCredentials`],mutationFn:()=>e.permits.clear()}}function Le(e,t){return{mutationKey:[`zama.delegateDecryption`,t],mutationFn:async({delegateAddress:n,expirationDate:r})=>e.delegations.delegateDecryption({contractAddress:t,delegateAddress:n,expirationDate:r})}}function Re(t,n,r={}){return{queryKey:e.decryption.encryptedInputs(n,r.walletAccount),queryFn:e=>{let[,{encryptedInputs:n}]=e.queryKey;return t.decryption.decryptValues(n)},staleTime:1/0,enabled:n.length>0&&r.walletAccount!==void 0}}function ze(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,accountAddress:n})=>e.decryptBalanceAs({delegatorAddress:t,accountAddress:n})}}function Be(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>p.batchDecryptBalancesAs(e,t)}}function Ve(e,t){return{mutationKey:[`zama.revokeDelegation`,t],mutationFn:async({delegateAddress:n})=>e.delegations.revokeDelegation({contractAddress:t,delegateAddress:n})}}function He(t,n){return{...w(n.query??{}),queryKey:e.delegationStatus.scope(n.contractAddress,n.delegatorAddress,n.delegateAddress),queryFn:async e=>{let[,{contractAddress:n,delegatorAddress:r,delegateAddress:i}]=e.queryKey;return d(n,`delegationStatusQueryOptions: contractAddress`),d(r,`delegationStatusQueryOptions: delegatorAddress`),d(i,`delegationStatusQueryOptions: delegateAddress`),t.delegations.getStatus({contractAddress:n,delegatorAddress:r,delegateAddress:i})},enabled:!!(n.contractAddress&&n.delegatorAddress&&n.delegateAddress)&&n.query?.enabled!==!1}}export{r as ZamaSDKEvents,ye as approveUnderlyingMutationOptions,Be as batchDecryptBalancesAsMutationOptions,Me as batchPreparePermitsMutationOptions,Pe as batchRegisterPermitsMutationOptions,Ie as clearCredentialsMutationOptions,re as confidentialBalanceQueryOptions,ie as confidentialBalancesQueryOptions,ne as confidentialIsOperatorQueryOptions,ve as confidentialSetOperatorMutationOptions,oe as confidentialTokenAddressQueryOptions,he as confidentialTransferAndCallMutationOptions,_e as confidentialTransferFromAndCallMutationOptions,ge as confidentialTransferFromMutationOptions,me as confidentialTransferMutationOptions,ze as decryptBalanceAsMutationOptions,ke as decryptPublicValuesMutationOptions,Re as decryptValuesQueryOptions,Le as delegateDecryptionMutationOptions,Oe as delegatedDecryptValuesMutationOptions,He as delegationStatusQueryOptions,De as encryptMutationOptions,w as filterQueryOptions,Ee as finalizeUnwrapMutationOptions,Ae as grantPermitMutationOptions,$ as hasPermitQueryOptions,T as hashFn,I as invalidateAfterApproveUnderlying,L as invalidateAfterSetOperator,j as invalidateAfterShield,F as invalidateAfterTransfer,M as invalidateAfterUnshield,P as invalidateAfterUnshieldError,N as invalidateAfterUnshieldSettled,O as invalidateAfterUnwrap,k as invalidateAfterWrap,A as invalidateBalanceQueries,W as invalidateWagmiBalanceQueries,G as invalidateWalletLifecycleQueries,q as isConfidentialQueryOptions,de as isConfidentialTokenValidQueryOptions,J as isWrapperQueryOptions,fe as listPairsQueryOptions,Q as pendingUnshieldQueryOptions,je as preparePermitMutationOptions,Ne as registerPermitMutationOptions,Se as resumeUnshieldMutationOptions,Ve as revokeDelegationMutationOptions,Fe as revokePermitsMutationOptions,pe as shieldMutationOptions,se as tokenAddressQueryOptions,K as tokenMetadataQueryOptions,ue as tokenPairQueryOptions,ce as tokenPairsLengthQueryOptions,ae as tokenPairsQueryOptions,le as tokenPairsSliceQueryOptions,Y as totalSupplyQueryOptions,Z as underlyingAllowanceQueryOptions,xe as unshieldAllMutationOptions,be as unshieldMutationOptions,Te as unwrapAllMutationOptions,Ce as unwrapMutationOptions,we as wrapMutationOptions,X as wrapperDiscoveryQueryOptions,e as zamaQueryKeys};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|