@zama-fhe/sdk 2.3.0-alpha.4 → 2.3.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.
Files changed (34) hide show
  1. package/dist/cjs/activity.cjs +1 -1
  2. package/dist/cjs/index.cjs +2 -2
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/query/index.cjs +1 -1
  5. package/dist/cjs/query/index.cjs.map +1 -1
  6. package/dist/cjs/relayer.cjs +1 -1
  7. package/dist/cjs/relayer.cjs.map +1 -1
  8. package/dist/esm/{activity-CitpHeLO.d.ts → activity-DTBvolDB.d.ts} +195 -15
  9. package/dist/esm/{activity-CNU7ZLpc.js → activity-b2RsqKHW.js} +2 -2
  10. package/dist/esm/{activity-CNU7ZLpc.js.map → activity-b2RsqKHW.js.map} +1 -1
  11. package/dist/esm/cleartext/index.d.ts +2 -2
  12. package/dist/esm/cleartext/index.js +1 -1
  13. package/dist/esm/{cleartext-BO5OIem2.js → cleartext-Bzxet3H7.js} +2 -2
  14. package/dist/esm/{cleartext-BO5OIem2.js.map → cleartext-Bzxet3H7.js.map} +1 -1
  15. package/dist/esm/{encryption-UaXE1L_W.js → encryption-CmIPBcfP.js} +2 -2
  16. package/dist/esm/{encryption-UaXE1L_W.js.map → encryption-CmIPBcfP.js.map} +1 -1
  17. package/dist/esm/ethers/index.d.ts +2 -2
  18. package/dist/esm/{index-C3ELlhM8.d.ts → index-BXdXzzx4.d.ts} +2 -2
  19. package/dist/esm/index.d.ts +5 -128
  20. package/dist/esm/index.js +2 -2
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/node/index.d.ts +2 -2
  23. package/dist/esm/node/index.js +1 -1
  24. package/dist/esm/query/index.d.ts +10 -18
  25. package/dist/esm/query/index.js +1 -1
  26. package/dist/esm/query/index.js.map +1 -1
  27. package/dist/esm/relayer-C6u3eOlN.js +2 -0
  28. package/dist/esm/relayer-C6u3eOlN.js.map +1 -0
  29. package/dist/esm/{relayer-sdk-Cqx3HnZh.d.ts → relayer-sdk-C_4bkxxH.d.ts} +2 -2
  30. package/dist/esm/{relayer-sdk.types-BhV3n5qO.d.ts → relayer-sdk.types-C9GAgQ7q.d.ts} +23 -2
  31. package/dist/esm/viem/index.d.ts +2 -2
  32. package/package.json +1 -1
  33. package/dist/esm/relayer-DfjPWTBf.js +0 -2
  34. package/dist/esm/relayer-DfjPWTBf.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { $ as GetPublicParamsResponseData, B as DelegatedUserDecryptPayload, F as CreateDelegatedEIP712Request, G as EncryptResponseData, H as DelegatedUserDecryptResponseData, I as CreateDelegatedEIP712ResponseData, J as GenerateKeypairResponseData, K as ErrorResponse, L as CreateEIP712Payload, N as BaseRequest, P as CreateDelegatedEIP712Payload, Q as GetPublicParamsRequest, R as CreateEIP712Request, U as EncryptPayload, V as DelegatedUserDecryptRequest, W as EncryptRequest, X as GetPublicKeyRequest, Y as GenericLogger, Z as GetPublicKeyResponseData, a as EncryptParams, at as RequestZKProofVerificationResponseData, ct as UserDecryptPayload, dt as WorkerRequest, et as InitRequest, ft as WorkerRequestType, it as RequestZKProofVerificationRequest, l as PublicDecryptResult, lt as UserDecryptRequest, n as DelegatedUserDecryptParams, nt as PublicDecryptRequest, o as EncryptResult, ot as SuccessResponse, p as UserDecryptParams, pt as WorkerResponse, q as GenerateKeypairRequest, r as EIP712TypedData, rt as PublicDecryptResponseData, s as Handle, st as UpdateCsrfRequest, t as ClearValueType, tt as NodeInitRequest, ut as UserDecryptResponseData, y as GenericStorage, z as CreateEIP712ResponseData } from "../relayer-sdk.types-BhV3n5qO.js";
2
- import { t as RelayerSDK } from "../relayer-sdk-Cqx3HnZh.js";
1
+ import { $ as GetPublicKeyRequest, B as CreateEIP712Payload, G as DelegatedUserDecryptResponseData, H as CreateEIP712ResponseData, I as BaseRequest, J as EncryptResponseData, K as EncryptPayload, L as CreateDelegatedEIP712Payload, Q as GenericLogger, R as CreateDelegatedEIP712Request, S as GenericStorage, U as DelegatedUserDecryptPayload, V as CreateEIP712Request, W as DelegatedUserDecryptRequest, X as GenerateKeypairRequest, Y as ErrorResponse, Z as GenerateKeypairResponseData, a as EncryptParams, at as PublicDecryptRequest, ct as RequestZKProofVerificationResponseData, dt as UserDecryptPayload, et as GetPublicKeyResponseData, ft as UserDecryptRequest, gt as WorkerResponse, ht as WorkerRequestType, it as NodeInitRequest, l as PublicDecryptResult, lt as SuccessResponse, mt as WorkerRequest, n as DelegatedUserDecryptParams, nt as GetPublicParamsResponseData, o as EncryptResult, ot as PublicDecryptResponseData, p as UserDecryptParams, pt as UserDecryptResponseData, q as EncryptRequest, r as EIP712TypedData, rt as InitRequest, s as Handle, st as RequestZKProofVerificationRequest, t as ClearValueType, tt as GetPublicParamsRequest, ut as UpdateCsrfRequest, z as CreateDelegatedEIP712ResponseData } from "../relayer-sdk.types-C9GAgQ7q.js";
2
+ import { t as RelayerSDK } from "../relayer-sdk-C_4bkxxH.js";
3
3
  import { n as MainnetConfig, r as SepoliaConfig, t as HardhatConfig } from "../relayer-utils-BcTAyZOr.js";
4
4
  import { Address, Hex } from "viem";
5
5
  import { Worker } from "node:worker_threads";
@@ -1,2 +1,2 @@
1
- import{r as e,t}from"../relayer-DfjPWTBf.js";import{n,t as r}from"../fhe-artifact-cache-CyXna-Br.js";import{t as i}from"../memory-storage-B4_heQa5.js";import{a,i as o,n as s,o as c,r as l,t as u}from"../relayer-utils-BeoTNDM4.js";import{availableParallelism as d}from"node:os";import{Worker as f}from"node:worker_threads";import{randomUUID as p}from"node:crypto";import{AsyncLocalStorage as m}from"node:async_hooks";var h=class extends n{constructor(e){super(e,e.logger)}createWorker(){return new f(new URL(`relayer-sdk.node-worker.js`,import.meta.url))}wireEvents(e){e.on(`message`,e=>this.handleResponse(e)),e.on(`error`,e=>this.handleWorkerError(e.message)),e.on(`messageerror`,()=>this.handleWorkerMessageError())}postMessage(e,t){e.postMessage(t)}terminateWorker(e){e.terminate()}generateRequestId(){return p()}getInitPayload(){return{type:`NODE_INIT`,payload:{fhevmConfig:this.config.fhevmConfig}}}onWorkerReady(e){e.unref()}},g=class{#e=[];#t=[];#n;#r;#i=null;constructor(e){this.#n=e,this.#r=e.poolSize??Math.min(d(),4)}get poolSize(){return this.#r}async initPool(){if(!(this.#e.length>0))return this.#i||=this.#a().finally(()=>{this.#i=null}),this.#i}async#a(){for(let e=0;e<this.#r;e++)this.#e.push(new h(this.#n)),this.#t.push(0);try{await Promise.all(this.#e.map(e=>e.initWorker()))}catch(e){for(let e of this.#e)e.terminate();throw this.#e.length=0,this.#t.length=0,e}}terminate(){for(let e of this.#e)e.terminate();this.#e.length=0,this.#t.length=0}#o(){let e=0,t=this.#t[0];for(let n=1;n<this.#t.length;n++)this.#t[n]<t&&(t=this.#t[n],e=n);return e}async#s(e){if(this.#e.length===0)throw Error(`NodeWorkerPool not initialized. Call initPool() first.`);let t=this.#o();this.#t[t]++;try{return await e(this.#e[t])}finally{this.#t[t]--}}async generateKeypair(){return this.#s(e=>e.generateKeypair())}async createEIP712(e){return this.#s(t=>t.createEIP712(e))}async encrypt(e){return this.#s(t=>t.encrypt(e))}async userDecrypt(e){return this.#s(t=>t.userDecrypt(e))}async publicDecrypt(e){return this.#s(t=>t.publicDecrypt(e))}async createDelegatedUserDecryptEIP712(e){return this.#s(t=>t.createDelegatedUserDecryptEIP712(e))}async delegatedUserDecrypt(e){return this.#s(t=>t.delegatedUserDecrypt(e))}async requestZKProofVerification(e){return this.#s(t=>t.requestZKProofVerification(e))}async getPublicKey(){return this.#s(e=>e.getPublicKey())}async getPublicParams(e){return this.#s(t=>t.getPublicParams(e))}},_=class{#e;#t=null;#n=null;#r=null;#i=!1;#a=null;#o=null;constructor(e){this.#e={fheArtifactStorage:new i,...e}}async#s(){let e=await this.#e.getChainId(),{transports:t,poolSize:n}=this.#e;return{fhevmConfig:Object.assign({},u[e],t[e]),poolSize:n,logger:this.#e.logger}}async#c(){if(this.#r)return this.#r;this.#r=this.#u();try{return await this.#r}finally{this.#r=null}}#l(){this.#t?.terminate(),this.#t=null,this.#n=null,this.#o=null}async#u(){if(this.#i)throw new t(`RelayerNode has been terminated`);let n=await this.#e.getChainId();if(this.#a!==null&&n!==this.#a&&this.#l(),this.#a=n,!this.#o&&this.#e.fheArtifactStorage){let e=Object.assign({},u[n],this.#e.transports[n]);this.#o=new r({storage:this.#e.fheArtifactStorage,chainId:n,relayerUrl:e.relayerUrl,ttl:this.#e.fheArtifactCacheTTL,logger:this.#e.logger})}if(this.#o){let e=!1;try{e=await this.#o.revalidateIfDue()}catch(e){this.#e.logger?.warn(`Artifact revalidation failed, proceeding with potentially stale cache`,{error:e instanceof Error?e.message:String(e)})}e&&(this.#e.logger?.info(`Cached FHE artifacts are stale — reinitializing`),this.#l())}return this.#n||=this.#d().catch(n=>{throw this.#n=null,n instanceof e?n:new t(`Failed to initialize FHE worker pool`,{cause:n})}),this.#n}async#d(){let e=new g(await this.#s());if(await e.initPool(),this.#i)throw e.terminate(),Error(`RelayerNode was terminated during initialization`);return this.#t=e,e}terminate(){this.#i=!0,this.#t&&=(this.#t.terminate(),null),this.#n=null,this.#r=null}[Symbol.dispose](){this.terminate()}async generateKeypair(){let e=await(await this.#c()).generateKeypair();return{publicKey:e.publicKey,privateKey:e.privateKey}}async createEIP712(e,t,n,r=7){let i=await(await this.#c()).createEIP712({publicKey:e,contractAddresses:t,startTimestamp:n,durationDays:r}),o={name:i.domain.name,version:i.domain.version,chainId:i.domain.chainId,verifyingContract:i.domain.verifyingContract};return{domain:o,types:{EIP712Domain:a(o),UserDecryptRequestVerification:i.types.UserDecryptRequestVerification},message:{publicKey:i.message.publicKey,contractAddresses:i.message.contractAddresses,startTimestamp:i.message.startTimestamp,durationDays:i.message.durationDays,extraData:i.message.extraData}}}async encrypt(e){return c(async()=>{let t=await(await this.#c()).encrypt(e);return{handles:t.handles,inputProof:t.inputProof}})}async userDecrypt(e){return c(async()=>(await(await this.#c()).userDecrypt(e)).clearValues)}async publicDecrypt(e){return c(async()=>{let t=await(await this.#c()).publicDecrypt(e);return{clearValues:t.clearValues,abiEncodedClearValues:t.abiEncodedClearValues,decryptionProof:t.decryptionProof}})}async createDelegatedUserDecryptEIP712(e,t,n,r,i=7){return(await this.#c()).createDelegatedUserDecryptEIP712({publicKey:e,contractAddresses:t,delegatorAddress:n,startTimestamp:r,durationDays:i})}async delegatedUserDecrypt(e){return c(async()=>(await(await this.#c()).delegatedUserDecrypt(e)).clearValues)}async requestZKProofVerification(e){return c(async()=>(await this.#c()).requestZKProofVerification(e))}async getPublicKey(){let e=await this.#c();return this.#o?this.#o.getPublicKey(async()=>(await e.getPublicKey()).result):(await e.getPublicKey()).result}async getPublicParams(e){let t=await this.#c();return this.#o?this.#o.getPublicParams(e,async()=>(await t.getPublicParams(e)).result):(await t.getPublicParams(e)).result}async getAclAddress(){let e=await this.#e.getChainId(),n=Object.assign({},u[e],this.#e.transports[e]);if(!n.aclContractAddress)throw new t(`No ACL address configured for chain ${e}`);return n.aclContractAddress}},v=class{#e=new m;run(e){return this.#e.run(new Map,e)}async get(e){return this.#e.getStore()?.get(e)??null}async set(e,t){this.#e.getStore()?.set(e,t)}async delete(e){this.#e.getStore()?.delete(e)}};const y=new v;export{v as AsyncLocalMapStorage,n as BaseWorkerClient,s as HardhatConfig,l as MainnetConfig,h as NodeWorkerClient,g as NodeWorkerPool,_ as RelayerNode,o as SepoliaConfig,y as asyncLocalStorage};
1
+ import{r as e,t}from"../relayer-C6u3eOlN.js";import{n,t as r}from"../fhe-artifact-cache-CyXna-Br.js";import{t as i}from"../memory-storage-B4_heQa5.js";import{a,i as o,n as s,o as c,r as l,t as u}from"../relayer-utils-BeoTNDM4.js";import{availableParallelism as d}from"node:os";import{Worker as f}from"node:worker_threads";import{randomUUID as p}from"node:crypto";import{AsyncLocalStorage as m}from"node:async_hooks";var h=class extends n{constructor(e){super(e,e.logger)}createWorker(){return new f(new URL(`relayer-sdk.node-worker.js`,import.meta.url))}wireEvents(e){e.on(`message`,e=>this.handleResponse(e)),e.on(`error`,e=>this.handleWorkerError(e.message)),e.on(`messageerror`,()=>this.handleWorkerMessageError())}postMessage(e,t){e.postMessage(t)}terminateWorker(e){e.terminate()}generateRequestId(){return p()}getInitPayload(){return{type:`NODE_INIT`,payload:{fhevmConfig:this.config.fhevmConfig}}}onWorkerReady(e){e.unref()}},g=class{#e=[];#t=[];#n;#r;#i=null;constructor(e){this.#n=e,this.#r=e.poolSize??Math.min(d(),4)}get poolSize(){return this.#r}async initPool(){if(!(this.#e.length>0))return this.#i||=this.#a().finally(()=>{this.#i=null}),this.#i}async#a(){for(let e=0;e<this.#r;e++)this.#e.push(new h(this.#n)),this.#t.push(0);try{await Promise.all(this.#e.map(e=>e.initWorker()))}catch(e){for(let e of this.#e)e.terminate();throw this.#e.length=0,this.#t.length=0,e}}terminate(){for(let e of this.#e)e.terminate();this.#e.length=0,this.#t.length=0}#o(){let e=0,t=this.#t[0];for(let n=1;n<this.#t.length;n++)this.#t[n]<t&&(t=this.#t[n],e=n);return e}async#s(e){if(this.#e.length===0)throw Error(`NodeWorkerPool not initialized. Call initPool() first.`);let t=this.#o();this.#t[t]++;try{return await e(this.#e[t])}finally{this.#t[t]--}}async generateKeypair(){return this.#s(e=>e.generateKeypair())}async createEIP712(e){return this.#s(t=>t.createEIP712(e))}async encrypt(e){return this.#s(t=>t.encrypt(e))}async userDecrypt(e){return this.#s(t=>t.userDecrypt(e))}async publicDecrypt(e){return this.#s(t=>t.publicDecrypt(e))}async createDelegatedUserDecryptEIP712(e){return this.#s(t=>t.createDelegatedUserDecryptEIP712(e))}async delegatedUserDecrypt(e){return this.#s(t=>t.delegatedUserDecrypt(e))}async requestZKProofVerification(e){return this.#s(t=>t.requestZKProofVerification(e))}async getPublicKey(){return this.#s(e=>e.getPublicKey())}async getPublicParams(e){return this.#s(t=>t.getPublicParams(e))}},_=class{#e;#t=null;#n=null;#r=null;#i=!1;#a=null;#o=null;constructor(e){this.#e={fheArtifactStorage:new i,...e}}async#s(){let e=await this.#e.getChainId(),{transports:t,poolSize:n}=this.#e;return{fhevmConfig:Object.assign({},u[e],t[e]),poolSize:n,logger:this.#e.logger}}async#c(){if(this.#r)return this.#r;this.#r=this.#u();try{return await this.#r}finally{this.#r=null}}#l(){this.#t?.terminate(),this.#t=null,this.#n=null,this.#o=null}async#u(){if(this.#i)throw new t(`RelayerNode has been terminated`);let n=await this.#e.getChainId();if(this.#a!==null&&n!==this.#a&&this.#l(),this.#a=n,!this.#o&&this.#e.fheArtifactStorage){let e=Object.assign({},u[n],this.#e.transports[n]);this.#o=new r({storage:this.#e.fheArtifactStorage,chainId:n,relayerUrl:e.relayerUrl,ttl:this.#e.fheArtifactCacheTTL,logger:this.#e.logger})}if(this.#o){let e=!1;try{e=await this.#o.revalidateIfDue()}catch(e){this.#e.logger?.warn(`Artifact revalidation failed, proceeding with potentially stale cache`,{error:e instanceof Error?e.message:String(e)})}e&&(this.#e.logger?.info(`Cached FHE artifacts are stale — reinitializing`),this.#l())}return this.#n||=this.#d().catch(n=>{throw this.#n=null,n instanceof e?n:new t(`Failed to initialize FHE worker pool`,{cause:n})}),this.#n}async#d(){let e=new g(await this.#s());if(await e.initPool(),this.#i)throw e.terminate(),Error(`RelayerNode was terminated during initialization`);return this.#t=e,e}terminate(){this.#i=!0,this.#t&&=(this.#t.terminate(),null),this.#n=null,this.#r=null}[Symbol.dispose](){this.terminate()}async generateKeypair(){let e=await(await this.#c()).generateKeypair();return{publicKey:e.publicKey,privateKey:e.privateKey}}async createEIP712(e,t,n,r=7){let i=await(await this.#c()).createEIP712({publicKey:e,contractAddresses:t,startTimestamp:n,durationDays:r}),o={name:i.domain.name,version:i.domain.version,chainId:i.domain.chainId,verifyingContract:i.domain.verifyingContract};return{domain:o,types:{EIP712Domain:a(o),UserDecryptRequestVerification:i.types.UserDecryptRequestVerification},message:{publicKey:i.message.publicKey,contractAddresses:i.message.contractAddresses,startTimestamp:i.message.startTimestamp,durationDays:i.message.durationDays,extraData:i.message.extraData}}}async encrypt(e){return c(async()=>{let t=await(await this.#c()).encrypt(e);return{handles:t.handles,inputProof:t.inputProof}})}async userDecrypt(e){return c(async()=>(await(await this.#c()).userDecrypt(e)).clearValues)}async publicDecrypt(e){return c(async()=>{let t=await(await this.#c()).publicDecrypt(e);return{clearValues:t.clearValues,abiEncodedClearValues:t.abiEncodedClearValues,decryptionProof:t.decryptionProof}})}async createDelegatedUserDecryptEIP712(e,t,n,r,i=7){return(await this.#c()).createDelegatedUserDecryptEIP712({publicKey:e,contractAddresses:t,delegatorAddress:n,startTimestamp:r,durationDays:i})}async delegatedUserDecrypt(e){return c(async()=>(await(await this.#c()).delegatedUserDecrypt(e)).clearValues)}async requestZKProofVerification(e){return c(async()=>(await this.#c()).requestZKProofVerification(e))}async getPublicKey(){let e=await this.#c();return this.#o?this.#o.getPublicKey(async()=>(await e.getPublicKey()).result):(await e.getPublicKey()).result}async getPublicParams(e){let t=await this.#c();return this.#o?this.#o.getPublicParams(e,async()=>(await t.getPublicParams(e)).result):(await t.getPublicParams(e)).result}async getAclAddress(){let e=await this.#e.getChainId(),n=Object.assign({},u[e],this.#e.transports[e]);if(!n.aclContractAddress)throw new t(`No ACL address configured for chain ${e}`);return n.aclContractAddress}},v=class{#e=new m;run(e){return this.#e.run(new Map,e)}async get(e){return this.#e.getStore()?.get(e)??null}async set(e,t){this.#e.getStore()?.set(e,t)}async delete(e){this.#e.getStore()?.delete(e)}};const y=new v;export{v as AsyncLocalMapStorage,n as BaseWorkerClient,s as HardhatConfig,l as MainnetConfig,h as NodeWorkerClient,g as NodeWorkerPool,_ as RelayerNode,o as SepoliaConfig,y as asyncLocalStorage};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
- import { C as TransactionReceipt, S as RawLog, a as EncryptParams, b as GenericSigner, g as UnshieldCallbacks, h as TransferCallbacks, i as EncryptInput, l as PublicDecryptResult, m as ShieldCallbacks, n as DelegatedUserDecryptParams, o as EncryptResult, p as UserDecryptParams, r as EIP712TypedData, s as Handle, t as ClearValueType, v as StoredCredentials, w as TransactionResult, x as SignerLifecycleCallbacks, y as GenericStorage } from "../relayer-sdk.types-BhV3n5qO.js";
2
- import { n as TokenWrapperPair, r as TokenWrapperPairWithMetadata, t as PaginatedResult } from "../index-C3ELlhM8.js";
3
- import { t as RelayerSDK } from "../relayer-sdk-Cqx3HnZh.js";
4
- import { At as UnshieldPhase1SubmittedEvent, Ct as FinalizeUnwrapSubmittedEvent, Dt as TransactionErrorEvent, Et as ShieldSubmittedEvent, Ft as ZamaSDKEventInput, G as TokenConfig, H as WrappersRegistry, It as ZamaSDKEventListener, Mt as UnshieldPhase2SubmittedEvent, Nt as UnwrapSubmittedEvent, Ot as TransferFromSubmittedEvent, Pt as ZamaSDKEvent, Q as ReadonlyTokenConfig, R as ZamaSDK, Rt as ZamaSDKEvents, S as WrappedEvent, St as EncryptStartEvent, Tt as SessionExpiredEvent, W as Token, X as BatchDecryptOptions, Y as BatchDecryptAsOptions, Z as ReadonlyToken, _t as DecryptErrorEvent, a as ActivityType, at as ApproveUnderlyingSubmittedEvent, b as UnwrappedFinalizedEvent, bt as EncryptEndEvent, ct as CredentialsCachedEvent, dt as CredentialsCreatingEvent, ft as CredentialsExpiredEvent, gt as DecryptEndEvent, h as OnChainEvent, ht as CredentialsRevokedEvent, i as ActivityLogMetadata, it as ApproveSubmittedEvent, jt as UnshieldPhase2StartedEvent, kt as TransferSubmittedEvent, lt as CredentialsCorruptedEvent, mt as CredentialsPersistFailedEvent, n as ActivityDirection, nt as CredentialsManager, ot as BaseEvent, p as ConfidentialTransferEvent, pt as CredentialsLoadingEvent, r as ActivityItem, rt as CredentialsManagerConfig, st as CredentialsAllowedEvent, t as ActivityAmount, ut as CredentialsCreatedEvent, vt as DecryptStartEvent, wt as RevokeDelegationSubmittedEvent, x as UnwrappedStartedEvent, xt as EncryptErrorEvent, y as UnwrapRequestedEvent, yt as DelegationSubmittedEvent, z as ZamaSDKConfig } from "../activity-CitpHeLO.js";
1
+ import { C as GenericSigner, D as TransactionResult, E as TransactionReceipt, S as GenericStorage, T as RawLog, _ as ShieldCallbacks, a as EncryptParams, g as UnshieldOptions, h as TransferOptions, i as EncryptInput, l as PublicDecryptResult, m as ShieldOptions, n as DelegatedUserDecryptParams, o as EncryptResult, p as UserDecryptParams, r as EIP712TypedData, s as Handle, t as ClearValueType, v as TransferCallbacks, w as SignerLifecycleCallbacks, x as StoredCredentials, y as UnshieldCallbacks } from "../relayer-sdk.types-C9GAgQ7q.js";
2
+ import { n as TokenWrapperPair, r as TokenWrapperPairWithMetadata, t as PaginatedResult } from "../index-BXdXzzx4.js";
3
+ import { t as RelayerSDK } from "../relayer-sdk-C_4bkxxH.js";
4
+ import { $t as ShieldSubmittedEvent, At as CredentialsManagerConfig, Bt as CredentialsLoadingEvent, Ct as BatchDecryptOptions, Ft as CredentialsCachedEvent, G as TokenConfig, Gt as DecryptStartEvent, H as WrappersRegistry, Ht as CredentialsRevokedEvent, It as CredentialsCorruptedEvent, Jt as EncryptErrorEvent, Kt as DelegationSubmittedEvent, Lt as CredentialsCreatedEvent, Mt as ApproveUnderlyingSubmittedEvent, Nt as BaseEvent, Pt as CredentialsAllowedEvent, Qt as SessionExpiredEvent, R as ZamaSDK, Rt as CredentialsCreatingEvent, S as WrappedEvent, St as BatchDecryptAsOptions, Tt as ReadonlyTokenConfig, Ut as DecryptEndEvent, Vt as CredentialsPersistFailedEvent, W as Token, Wt as DecryptErrorEvent, Xt as FinalizeUnwrapSubmittedEvent, Yt as EncryptStartEvent, Zt as RevokeDelegationSubmittedEvent, a as ActivityType, an as UnshieldPhase2SubmittedEvent, b as UnwrappedFinalizedEvent, cn as ZamaSDKEventInput, dn as ZamaSDKEvents, en as TransactionErrorEvent, h as OnChainEvent, i as ActivityLogMetadata, in as UnshieldPhase2StartedEvent, jt as ApproveSubmittedEvent, kt as CredentialsManager, ln as ZamaSDKEventListener, n as ActivityDirection, nn as TransferSubmittedEvent, on as UnwrapSubmittedEvent, p as ConfidentialTransferEvent, qt as EncryptEndEvent, r as ActivityItem, rn as UnshieldPhase1SubmittedEvent, sn as ZamaSDKEvent, t as ActivityAmount, tn as TransferFromSubmittedEvent, wt as ReadonlyToken, x as UnwrappedStartedEvent, y as UnwrapRequestedEvent, z as ZamaSDKConfig, zt as CredentialsExpiredEvent } from "../activity-DTBvolDB.js";
5
5
  import { Address, Hex } from "viem";
6
6
  import { InputProofBytesType, KeypairType, KmsDelegatedUserDecryptEIP712Type, ZKProofLike } from "@zama-fhe/relayer-sdk/bundle";
7
7
  import { MutationFunctionContext, QueryKey, QueryObserverOptions, skipToken } from "@tanstack/query-core";
@@ -546,14 +546,12 @@ declare function listPairsQueryOptions(registry: WrappersRegistry, config: ListP
546
546
  //#endregion
547
547
  //#region src/query/shield.d.ts
548
548
  /** Variables for {@link shieldMutationOptions}. */
549
- interface ShieldParams {
549
+ interface ShieldParams extends ShieldCallbacks {
550
550
  amount: bigint;
551
551
  fees?: bigint;
552
552
  approvalStrategy?: "max" | "exact" | "skip";
553
553
  /** Recipient address for the shielded tokens. Defaults to the connected wallet. */
554
554
  to?: Address;
555
- /** Optional progress callbacks for the multi-step shield flow. */
556
- callbacks?: ShieldCallbacks;
557
555
  }
558
556
  declare function shieldMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.shield", Address], ShieldParams, TransactionResult>;
559
557
  //#endregion
@@ -567,11 +565,9 @@ declare function shieldETHMutationOptions(token: Token): MutationFactoryOptions<
567
565
  //#endregion
568
566
  //#region src/query/transfer.d.ts
569
567
  /** Variables for {@link confidentialTransferMutationOptions}. */
570
- interface ConfidentialTransferParams {
568
+ interface ConfidentialTransferParams extends TransferOptions {
571
569
  to: Address;
572
570
  amount: bigint;
573
- /** Optional progress callbacks for the multi-step transfer flow. */
574
- callbacks?: TransferCallbacks;
575
571
  }
576
572
  declare function confidentialTransferMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransfer", Address], ConfidentialTransferParams, TransactionResult>;
577
573
  //#endregion
@@ -603,24 +599,20 @@ declare function approveUnderlyingMutationOptions(token: Token): MutationFactory
603
599
  //#endregion
604
600
  //#region src/query/unshield.d.ts
605
601
  /** Variables for {@link unshieldMutationOptions}. */
606
- interface UnshieldParams {
602
+ interface UnshieldParams extends UnshieldOptions {
607
603
  amount: bigint;
608
- callbacks?: UnshieldCallbacks;
609
604
  }
610
605
  declare function unshieldMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.unshield", Address], UnshieldParams, TransactionResult>;
611
606
  //#endregion
612
607
  //#region src/query/unshield-all.d.ts
613
608
  /** Variables for {@link unshieldAllMutationOptions}. */
614
- interface UnshieldAllParams {
615
- callbacks?: UnshieldCallbacks;
616
- }
609
+ interface UnshieldAllParams extends UnshieldCallbacks {}
617
610
  declare function unshieldAllMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.unshieldAll", Address], UnshieldAllParams | void, TransactionResult>;
618
611
  //#endregion
619
612
  //#region src/query/resume-unshield.d.ts
620
613
  /** Variables for {@link resumeUnshieldMutationOptions}. */
621
- interface ResumeUnshieldParams {
614
+ interface ResumeUnshieldParams extends UnshieldCallbacks {
622
615
  unwrapTxHash: Hex;
623
- callbacks?: UnshieldCallbacks;
624
616
  }
625
617
  declare function resumeUnshieldMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.resumeUnshield", Address], ResumeUnshieldParams, TransactionResult>;
626
618
  //#endregion
@@ -756,5 +748,5 @@ declare function delegationStatusQueryOptions(sdk: {
756
748
  relayer: RelayerSDK;
757
749
  }, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatusData, Error, DelegationStatusData, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
758
750
  //#endregion
759
- export { type ActivityAmount, type ActivityDirection, type ActivityFeedConfig, type ActivityFeedQueryConfig, type ActivityItem, type ActivityLogMetadata, type ActivityType, type ApproveSubmittedEvent, type ApproveUnderlyingParams, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptOptions, type ClearValueType, type ConfidentialApproveParams, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesData, type ConfidentialBalancesQueryConfig, type ConfidentialHandleQueryConfig, type ConfidentialHandlesQueryConfig, type ConfidentialIsApprovedQueryConfig, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferEvent, type ConfidentialTransferFromParams, type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type CredentialsAllowedEvent, type CredentialsCachedEvent, type CredentialsCorruptedEvent, type CredentialsCreatedEvent, type CredentialsCreatingEvent, type CredentialsExpiredEvent, type CredentialsLoadingEvent, type CredentialsManager, type CredentialsManagerConfig, type CredentialsPersistFailedEvent, type CredentialsRevokedEvent, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type DecryptHandle, type DecryptStartEvent, type DelegateDecryptionParams, type DelegatedUserDecryptParams, type DelegationStatusData, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedBalanceHandle, type FeeQueryConfig, type FinalizeUnwrapParams, type FinalizeUnwrapSubmittedEvent, type GenericSigner, type GenericStorage, type IsAllowedQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsQueryConfig, type MutationFactoryOptions, type OnChainEvent, type PublicDecryptResult, type PublicKeyQueryConfig, type PublicParamsQueryConfig, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadonlyToken, type ReadonlyTokenConfig, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationSubmittedEvent, type SessionExpiredEvent, type ShieldCallbacks, type ShieldETHParams, type ShieldFeeQueryConfig, type ShieldParams, type ShieldSubmittedEvent, type SignerAddressQueryConfig, type SignerLifecycleCallbacks, type StoredCredentials, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionReceipt, type TransactionResult, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferSubmittedEvent, type UnderlyingAllowanceQueryConfig, type UnshieldAllParams, type UnshieldCallbacks, type UnshieldFeeQueryConfig, type UnshieldParams, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapParams, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type UnwrappedFinalizedEvent, type UnwrappedStartedEvent, type UserDecryptCallbacks, type UserDecryptMutationParams, type UserDecryptParams, type WrappedEvent, type WrapperDiscoveryQueryConfig, type WrappersRegistryQueryConfig, ZERO_HANDLE, type ZamaSDK, type ZamaSDKConfig, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, ZamaSDKEvents, activityFeedQueryOptions, allowMutationOptions, approveUnderlyingMutationOptions, batchDecryptBalancesAsMutationOptions, batchTransferFeeQueryOptions, confidentialApproveMutationOptions, confidentialBalanceQueryOptions, confidentialBalancesQueryOptions, confidentialHandleQueryOptions, confidentialHandlesQueryOptions, confidentialIsApprovedQueryOptions, confidentialTokenAddressQueryOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, createDelegatedUserDecryptEIP712MutationOptions, createEIP712MutationOptions, decryptBalanceAsMutationOptions, delegateDecryptionMutationOptions, delegatedUserDecryptMutationOptions, delegationStatusQueryOptions, deriveActivityFeedLogsKey, encryptMutationOptions, feeRecipientQueryOptions, 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, shieldETHMutationOptions, shieldFeeQueryOptions, shieldMutationOptions, signerAddressQueryOptions, tokenAddressQueryOptions, tokenMetadataQueryOptions, tokenPairQueryOptions, tokenPairsLengthQueryOptions, tokenPairsQueryOptions, tokenPairsSliceQueryOptions, totalSupplyQueryOptions, underlyingAllowanceQueryOptions, unshieldAllMutationOptions, unshieldFeeQueryOptions, unshieldMutationOptions, unwrapAllMutationOptions, unwrapMutationOptions, userDecryptMutationOptions, wrapperDiscoveryQueryOptions, zamaQueryKeys };
751
+ export { type ActivityAmount, type ActivityDirection, type ActivityFeedConfig, type ActivityFeedQueryConfig, type ActivityItem, type ActivityLogMetadata, type ActivityType, type ApproveSubmittedEvent, type ApproveUnderlyingParams, type ApproveUnderlyingSubmittedEvent, type BaseEvent, type BatchDecryptAsOptions, type BatchDecryptBalancesAsParams, type BatchDecryptOptions, type ClearValueType, type ConfidentialApproveParams, type ConfidentialBalanceQueryConfig, type ConfidentialBalancesData, type ConfidentialBalancesQueryConfig, type ConfidentialHandleQueryConfig, type ConfidentialHandlesQueryConfig, type ConfidentialIsApprovedQueryConfig, type ConfidentialTokenAddressQueryConfig, type ConfidentialTransferEvent, type ConfidentialTransferFromParams, type ConfidentialTransferParams, type CreateDelegatedUserDecryptEIP712Params, type CreateEIP712Params, type CredentialsAllowedEvent, type CredentialsCachedEvent, type CredentialsCorruptedEvent, type CredentialsCreatedEvent, type CredentialsCreatingEvent, type CredentialsExpiredEvent, type CredentialsLoadingEvent, type CredentialsManager, type CredentialsManagerConfig, type CredentialsPersistFailedEvent, type CredentialsRevokedEvent, type DecryptBalanceAsParams, type DecryptEndEvent, type DecryptErrorEvent, type DecryptHandle, type DecryptStartEvent, type DelegateDecryptionParams, type DelegatedUserDecryptParams, type DelegationStatusData, type DelegationStatusQueryConfig, type DelegationSubmittedEvent, type EIP712TypedData, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedBalanceHandle, type FeeQueryConfig, type FinalizeUnwrapParams, type FinalizeUnwrapSubmittedEvent, type GenericSigner, type GenericStorage, type IsAllowedQueryConfig, type IsConfidentialQueryConfig, type IsConfidentialTokenValidQueryConfig, type ListPairsQueryConfig, type MutationFactoryOptions, type OnChainEvent, type PublicDecryptResult, type PublicKeyQueryConfig, type PublicParamsQueryConfig, type QueryClientLike, type QueryFactoryOptions, type QueryFilterLike, type QueryLike, type RawLog, type ReadonlyToken, type ReadonlyTokenConfig, type RelayerSDK, type ResumeUnshieldParams, type RevokeDelegationParams, type RevokeDelegationSubmittedEvent, type SessionExpiredEvent, type ShieldCallbacks, type ShieldETHParams, type ShieldFeeQueryConfig, type ShieldOptions, type ShieldParams, type ShieldSubmittedEvent, type SignerAddressQueryConfig, type SignerLifecycleCallbacks, type StoredCredentials, type StrippedQueryOptionKeys, type Token, type TokenAddressQueryConfig, type TokenConfig, type TokenMetadata, type TokenMetadataQueryConfig, type TokenPairQueryConfig, type TokenPairsSliceQueryConfig, type TotalSupplyQueryConfig, type TransactionErrorEvent, type TransactionReceipt, type TransactionResult, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, type UnderlyingAllowanceQueryConfig, type UnshieldAllParams, type UnshieldCallbacks, type UnshieldFeeQueryConfig, type UnshieldOptions, type UnshieldParams, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapParams, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type UnwrappedFinalizedEvent, type UnwrappedStartedEvent, type UserDecryptCallbacks, type UserDecryptMutationParams, type UserDecryptParams, type WrappedEvent, type WrapperDiscoveryQueryConfig, type WrappersRegistryQueryConfig, ZERO_HANDLE, type ZamaSDK, type ZamaSDKConfig, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, ZamaSDKEvents, activityFeedQueryOptions, allowMutationOptions, approveUnderlyingMutationOptions, batchDecryptBalancesAsMutationOptions, batchTransferFeeQueryOptions, confidentialApproveMutationOptions, confidentialBalanceQueryOptions, confidentialBalancesQueryOptions, confidentialHandleQueryOptions, confidentialHandlesQueryOptions, confidentialIsApprovedQueryOptions, confidentialTokenAddressQueryOptions, confidentialTransferFromMutationOptions, confidentialTransferMutationOptions, createDelegatedUserDecryptEIP712MutationOptions, createEIP712MutationOptions, decryptBalanceAsMutationOptions, delegateDecryptionMutationOptions, delegatedUserDecryptMutationOptions, delegationStatusQueryOptions, deriveActivityFeedLogsKey, encryptMutationOptions, feeRecipientQueryOptions, 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, shieldETHMutationOptions, shieldFeeQueryOptions, shieldMutationOptions, signerAddressQueryOptions, tokenAddressQueryOptions, tokenMetadataQueryOptions, tokenPairQueryOptions, tokenPairsLengthQueryOptions, tokenPairsQueryOptions, tokenPairsSliceQueryOptions, totalSupplyQueryOptions, underlyingAllowanceQueryOptions, unshieldAllMutationOptions, unshieldFeeQueryOptions, unshieldMutationOptions, unwrapAllMutationOptions, unwrapMutationOptions, userDecryptMutationOptions, wrapperDiscoveryQueryOptions, zamaQueryKeys };
760
752
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- import{F as e,I as t,L as n,O as r,P as i,R as a,U as o,V as s,W as c,i as l,j as u,k as d,n as f,r as p,t as m,w as h}from"../activity-CNU7ZLpc.js";import{t as g}from"../encryption-UaXE1L_W.js";import{i as _}from"../assertions-Dty7Quc0.js";import{r as v}from"../memory-storage-B4_heQa5.js";import{C as y,D as b,_ as x,a as S,d as C,i as w,m as T,n as E,o as ee,r as te,s as ne,t as re,u as ie}from"../wrappers-registry-DqPr_JG2.js";import{getAddress as D,zeroAddress as O}from"viem";function k(e){if(!A(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!A(n)||!n.hasOwnProperty(`isPrototypeOf`))}function A(e){return Object.prototype.toString.call(e)===`[object Object]`}const j=`0x0000000000000000000000000000000000000000000000000000000000000000`;function M(e){let{gcTime:t,staleTime:n,enabled:r,select:i,refetchInterval:a,refetchOnMount:o,refetchOnWindowFocus:s,refetchOnReconnect:c,retry:l,retryDelay:u,retryOnMount:d,queryFn:f,queryKey:p,queryKeyHashFn:m,initialData:h,initialDataUpdatedAt:g,placeholderData:_,structuralSharing:v,throwOnError:y,meta:b,query:x,pollingInterval:S,...C}=e;return C}function N(e){return JSON.stringify(e,(e,t)=>k(t)?Object.keys(t).toSorted().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const P=e=>e.map(e=>D(e)),F=e=>e===void 0?void 0:D(e),I={signerAddress:{all:[`zama.signerAddress`],scope:e=>[`zama.signerAddress`,{scope:e}],token:e=>[`zama.signerAddress`,{tokenAddress:D(e)}]},confidentialHandle:{all:[`zama.confidentialHandle`],token:e=>[`zama.confidentialHandle`,{tokenAddress:D(e)}],owner:(e,t)=>[`zama.confidentialHandle`,{tokenAddress:D(e),...t?{owner:D(t)}:{}}]},confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:D(e)}],owner:(e,t,n)=>[`zama.confidentialBalance`,{tokenAddress:D(e),...t?{owner:D(t)}:{},...n===void 0?{}:{handle:n}}]},confidentialHandles:{all:[`zama.confidentialHandles`],tokens:(e,t)=>[`zama.confidentialHandles`,{tokenAddresses:P(e),...t?{owner:D(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t,n)=>[`zama.confidentialBalances`,{tokenAddresses:P(e),...t?{owner:D(t)}:{},...n===void 0?{}:{handles:n}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:D(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:D(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:D(e)}]},wrapperDiscovery:{all:[`zama.wrapperDiscovery`],token:(e,t,n)=>{let r=F(e),i=F(t),a=F(n);return[`zama.wrapperDiscovery`,{...r?{tokenAddress:r}:{},...i?{erc20Address:i}:{},...a?{registryAddress:a}:{}}]}},underlyingAllowance:{all:[`zama.underlyingAllowance`],token:e=>[`zama.underlyingAllowance`,{tokenAddress:D(e)}],scope:(e,t,n)=>[`zama.underlyingAllowance`,{tokenAddress:D(e),...t?{owner:D(t)}:{},...n?{wrapperAddress:D(n)}:{}}]},confidentialIsApproved:{all:[`zama.confidentialIsApproved`],token:e=>{let t=F(e);return[`zama.confidentialIsApproved`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=F(e),i=F(t),a=F(n);return[`zama.confidentialIsApproved`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:D(e)}]},activityFeed:{all:[`zama.activityFeed`],token:e=>[`zama.activityFeed`,{tokenAddress:D(e)}],scope:(e,t,n,r)=>[`zama.activityFeed`,{tokenAddress:D(e),...t?{userAddress:D(t)}:{},...n?{logsKey:n}:{},...r===void 0?{}:{decrypt:r}}]},fees:{all:[`zama.fees`],shieldFee:(e,t,n,r)=>[`zama.fees`,{type:`shield`,...e?{feeManagerAddress:D(e)}:{},...t===void 0?{}:{amount:t},...n?{from:D(n)}:{},...r?{to:D(r)}:{}}],unshieldFee:(e,t,n,r)=>[`zama.fees`,{type:`unshield`,...e?{feeManagerAddress:D(e)}:{},...t===void 0?{}:{amount:t},...n?{from:D(n)}:{},...r?{to:D(r)}:{}}],batchTransferFee:e=>[`zama.fees`,{type:`batchTransfer`,...e?{feeManagerAddress:D(e)}:{}}],feeRecipient:e=>[`zama.fees`,{type:`feeRecipient`,...e?{feeManagerAddress:D(e)}:{}}]},isAllowed:{all:[`zama.isAllowed`],scope:e=>[`zama.isAllowed`,{account:D(e)}]},publicKey:{all:[`zama.publicKey`]},publicParams:{all:[`zama.publicParams`],bits:e=>[`zama.publicParams`,{bits:e}]},delegationStatus:{all:[`zama.delegationStatus`],token:e=>{let t=F(e);return[`zama.delegationStatus`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=F(e),i=F(t),a=F(n);return[`zama.delegationStatus`,{...r?{tokenAddress:r}:{},...i?{delegatorAddress:i}:{},...a?{delegateAddress:a}:{}}]}},decryption:{all:[`zama.decryption`],handle:(e,t)=>[`zama.decryption`,{handle:e,...t===void 0?{}:{contractAddress:D(t)}}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:D(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:D(e),tokenAddress:D(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:D(e),confidentialTokenAddress:D(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:D(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:D(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:D(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:D(e),confidentialTokenAddress:D(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:D(e),page:t,pageSize:n,metadata:r}]}};function L(e,t){e.invalidateQueries({queryKey:I.underlyingAllowance.token(t)})}function R(e,t){z(e,t),L(e,t),q(e),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function z(e,t){e.invalidateQueries({queryKey:I.confidentialHandle.token(t)}),e.invalidateQueries({queryKey:I.confidentialHandles.all}),e.invalidateQueries({queryKey:I.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:I.confidentialBalances.all})}function B(e,t){z(e,t),L(e,t),q(e),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function V(e,t){z(e,t),L(e,t),q(e),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function H(e,t){z(e,t),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function U(e,t){L(e,t)}function W(e,t){e.invalidateQueries({queryKey:I.confidentialIsApproved.token(t)}),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function G(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}function K(e){return Array.isArray(e.queryKey)&&e.queryKey.some(e=>typeof e!=`object`||!e||!(`functionName`in e)?!1:e.functionName===`balanceOf`)}function q(e){e.invalidateQueries({predicate:K})}function J(e){e.removeQueries({queryKey:I.signerAddress.all}),e.removeQueries({queryKey:I.decryption.all}),e.invalidateQueries({predicate:G}),q(e)}const Y=new WeakMap;let ae=1;function oe(e){let t=Y.get(e);if(t!==void 0)return t;let n=ae++;return Y.set(e,n),n}function se(e,t){return{...M(t?.query??{}),queryKey:I.signerAddress.scope(oe(e)),queryFn:async()=>e.getAddress(),staleTime:3e4,enabled:t?.query?.enabled!==!1}}function ce(e,t,n){let r=I.tokenMetadata.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey,[r,i,a]=await Promise.all([e.readContract(o(n)),e.readContract(c(n)),e.readContract(s(n))]);return{name:r,symbol:i,decimals:a}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function le(e,t,n){let r=I.isConfidential.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(ie(n))}catch(e){if(v(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function ue(e,t,n){let r=I.isWrapper.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(C(n))}catch(e){if(v(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function de(e,t,n){let r=I.totalSupply.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.readContract(b(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function fe(e,t){let n=I.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...M(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 pe(e,t,n){let r=n.owner,i=n.wrapperAddress,o=n.query?.enabled!==!1,s=I.underlyingAllowance.scope(t,r,i);return{...M(n.query??{}),queryKey:s,queryFn:async t=>{let[,{owner:n,wrapperAddress:r}]=t.queryKey;if(!n)throw Error(`owner is required`);if(!r)throw Error(`wrapperAddress is required`);let i=await e.readContract(T(r));return e.readContract(a(i,n,r))},staleTime:3e4,enabled:!!(r&&i)&&o}}function me(e,t,n){let r=n.holder,i=n.spender,a=n.query?.enabled!==!1,o=I.confidentialIsApproved.scope(t,r,i);return{...M(n.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddress:n,holder:r,spender:i}]=t.queryKey;if(!n)throw Error(`tokenAddress is required`);if(!r)throw Error(`holder is required`);if(!i)throw Error(`spender is required`);return e.readContract(y(n,r,i))},staleTime:3e4,enabled:!!(t&&r&&i)&&a}}function X(e){return e===void 0?void 0:BigInt(e)}function he(e,t){let r=t.amount?.toString(),i=t.feeManagerAddress,a=t.from,o=t.to,s=t.query?.enabled!==!1,c=I.fees.shieldFee(i,r,a,o);return{...M(t.query??{}),queryKey:c,queryFn:async t=>{let[,r]=t.queryKey,i=X(r.amount);if(!r.feeManagerAddress)throw Error(`feeManagerAddress is required`);if(i===void 0)throw Error(`amount is required`);if(!r.from)throw Error(`from is required`);if(!r.to)throw Error(`to is required`);return e.readContract(n(r.feeManagerAddress,i,r.from,r.to))},staleTime:3e4,enabled:!!(i&&r!==void 0&&a&&o)&&s}}function ge(e,n){let r=n.amount?.toString(),i=n.feeManagerAddress,a=n.from,o=n.to,s=n.query?.enabled!==!1,c=I.fees.unshieldFee(i,r,a,o);return{...M(n.query??{}),queryKey:c,queryFn:async n=>{let[,r]=n.queryKey,i=X(r.amount);if(!r.feeManagerAddress)throw Error(`feeManagerAddress is required`);if(i===void 0)throw Error(`amount is required`);if(!r.from)throw Error(`from is required`);if(!r.to)throw Error(`to is required`);return e.readContract(t(r.feeManagerAddress,i,r.from,r.to))},staleTime:3e4,enabled:!!(i&&r!==void 0&&a&&o)&&s}}function _e(e,t,n){let r=n?.query?.enabled!==!1,a=I.fees.batchTransferFee(t);return{...M(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{feeManagerAddress:n}]=t.queryKey;if(!n)throw Error(`feeManagerAddress is required`);return e.readContract(i(n))},staleTime:3e4,enabled:!!t&&r}}function ve(t,n,r){let i=r?.query?.enabled!==!1,a=I.fees.feeRecipient(n);return{...M(r?.query??{}),queryKey:a,queryFn:async n=>{let[,{feeManagerAddress:r}]=n.queryKey;if(!r)throw Error(`feeManagerAddress is required`);return t.readContract(e(r))},staleTime:3e4,enabled:!!n&&i}}function ye(e,t){let n=I.publicKey.all;return{...M(t?.query??{}),queryKey:n,queryFn:async()=>e.relayer.getPublicKey(),staleTime:1/0,enabled:t?.query?.enabled!==!1}}function be(e,t,n){let r=I.publicParams.bits(t);return{...M(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 xe(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,a=I.confidentialHandle.owner(t,r);return{...M(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddress:n,owner:r}]=t.queryKey;if(!r)throw Error(`owner is required`);return await e.readContract(x(n,r))},enabled:!!r&&i,refetchInterval:n?.pollingInterval??1e4}}function Se(e,t){let n=t?.owner,r=t?.handle,i=t?.query?.enabled!==!1,a=I.confidentialBalance.owner(e.address,n,r);return{...M(t?.query??{}),queryKey:a,queryFn:async t=>{let[,{owner:n,handle:r}]=t.queryKey;if(!n)throw Error(`owner is required`);if(!r)throw Error(`handle is required`);return e.decryptBalance(r,n)},enabled:!!(n&&r)&&i,staleTime:1/0}}function Ce(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,a=I.confidentialHandles.tokens(t,r);return{...M(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddresses:n,owner:r}]=t.queryKey;if(!r)throw Error(`owner is required`);return Promise.all(n.map(async t=>await e.readContract(x(t,r))))},enabled:!!(r&&t.length>0)&&i,refetchInterval:n?.pollingInterval??1e4}}function we(e,t){let n=e.map(e=>e.address),r=t?.resultAddresses??n,i=t?.owner,a=t?.handles,o=t?.query?.enabled!==!1,s=Array.isArray(a)&&a.length===e.length&&a.every(e=>!!e),c=I.confidentialBalances.tokens(n,i,a);return{...M(t?.query??{}),queryKey:c,queryFn:async n=>{let[,{owner:i,handles:a}]=n.queryKey;if(!i)throw Error(`owner is required`);if(!a)throw Error(`handles are required`);let o=new Map,s=await h.batchDecryptBalances(e,{owner:i,handles:a,maxConcurrency:t?.maxConcurrency,onError:(e,t)=>(o.set(t,e),0n)}),c=new Map,l=new Map;for(let t=0;t<e.length;t++){let n=e[t].address,i=r[t],a=o.get(n);if(a)l.set(i,a);else{let e=s.get(n);e!==void 0&&c.set(i,e)}}if(l.size===e.length&&e.length>0)throw l.values().next().value??new g(`All token balance decryptions failed`);return{balances:c,errors:l,isPartialError:l.size>0}},enabled:r.length===e.length&&!!i&&e.length>0&&s&&o,staleTime:1/0}}function Z(e){if(e)return N([`zama.activityFeed.logs`,e.map(e=>({topics:[...e.topics],data:e.data,transactionHash:e.transactionHash,blockNumber:e.blockNumber,logIndex:e.logIndex}))])}function Te(e,t,n){let r=t.userAddress,i=t.decrypt??!0,a=t.logs,o=t.logsKey??Z(a),s=n?.query?.enabled!==!1,c=I.activityFeed.scope(e.address,r,o,i);return{...M(n?.query??{}),queryKey:c,queryFn:async t=>{let[,{userAddress:n,decrypt:r}]=t.queryKey;if(!n)throw Error(`userAddress is required`);if(!a)throw Error(`logs are required`);let i=p(a,n);if(!r)return l(i);let o=f(i);return o.length===0?l(i):l(m(i,await e.decryptHandles(o,n)))},staleTime:1/0,enabled:!!(r&&a)&&s}}const Q=86400*1e3;function Ee(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPairs(t.registryAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(w(n))},staleTime:Q,enabled:n}}function De(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.confidentialTokenAddress(t.registryAddress??O,t.tokenAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.readContract(re(n,r))},staleTime:Q,enabled:n}}function Oe(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenAddress(t.registryAddress??O,t.confidentialTokenAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(E(n,r))},staleTime:Q,enabled:n}}function ke(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPairsLength(t.registryAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(S(n))},staleTime:Q,enabled:n}}function Ae(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPairsSlice(t.registryAddress??O,String(t.fromIndex??0n),String(t.toIndex??0n));return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.readContract(ee(n,BigInt(r),BigInt(i)))},staleTime:Q,enabled:n}}function je(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPair(t.registryAddress??O,String(t.index??0n));return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.readContract(te(n,BigInt(r)))},staleTime:Q,enabled:n}}function Me(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??O,t.confidentialTokenAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(ne(n,r))},staleTime:Q,enabled:n}}function Ne(e,t){let n=t.page??1,r=t.pageSize??100,i=t.metadata??!1,a=!!t.registryAddress&&t.query?.enabled!==!1,o=I.wrappersRegistry.listPairs(t.registryAddress??O,n,r,i);return{...M(t.query??{}),queryKey:o,queryFn:async()=>e.listPairs({page:n,pageSize:r,metadata:i}),staleTime:e.ttlMs,enabled:a}}function Pe(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,fees:n,approvalStrategy:r,to:i,callbacks:a})=>e.shield(t,{fees:n,approvalStrategy:r,to:i,callbacks:a})}}function Fe(e){return{mutationKey:[`zama.shieldETH`,e.address],mutationFn:async({amount:t,value:n})=>e.shieldETH(t,n)}}function Ie(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,callbacks:r})=>e.confidentialTransfer(t,n,r)}}function Le(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function Re(e){return{mutationKey:[`zama.confidentialApprove`,e.address],mutationFn:async({spender:t,until:n})=>e.approve(t,n)}}function ze(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,callbacks:n})=>e.unshield(t,n)}}function Ve(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t?.callbacks)}}function He(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,callbacks:n})=>e.resumeUnshield(t,n)}}function Ue(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function We(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Ge(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({burnAmountHandle:t})=>e.finalizeUnwrap(t)}}function Ke(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.relayer.encrypt(t)}}function qe(e){return{mutationKey:[`zama.generateKeypair`],mutationFn:async()=>e.relayer.generateKeypair()}}function Je(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 Ye(e){return{mutationKey:[`zama.delegatedUserDecrypt`],mutationFn:async t=>e.relayer.delegatedUserDecrypt(t)}}function Xe(e){return{mutationKey:[`zama.publicDecrypt`],mutationFn:async t=>e.relayer.publicDecrypt(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(I.decryption.handle(t),n)}}}function Ze(e){return{mutationKey:[`zama.requestZKProofVerification`],mutationFn:async t=>e.relayer.requestZKProofVerification(t)}}function Qe(e){return{mutationKey:[`zama.allow`],mutationFn:t=>e.allow(...t)}}function $e(e,t){return{...M(t.query??{}),queryKey:I.isAllowed.scope(t.account),queryFn:()=>e.isAllowed(),staleTime:3e4,enabled:t.query?.enabled!==!1}}function et(e){return{mutationKey:[`zama.revoke`],mutationFn:t=>e.revoke(...t)}}function tt(e){return{mutationKey:[`zama.revokeSession`],mutationFn:()=>e.revokeSession()}}function nt(e){return{mutationKey:[`zama.delegateDecryption`,e.address],mutationFn:async({delegateAddress:t,expirationDate:n})=>e.delegateDecryption({delegateAddress:t,expirationDate:n})}}function rt(e,t){return{mutationKey:[`zama.userDecrypt`],mutationFn:async({handles:n})=>{let r=[...new Set(n.map(e=>e.contractAddress))],i=await e.credentials.allow(...r);t?.onCredentialsReady?.();let a=await e.signer.getAddress(),o={},s=new Map;for(let e of n){let t=s.get(e.contractAddress)??[];t.push(e.handle),s.set(e.contractAddress,t)}for(let[t,n]of s){let r=await e.relayer.userDecrypt({handles:n,contractAddress:t,signedContractAddresses:i.contractAddresses,privateKey:i.privateKey,publicKey:i.publicKey,signature:i.signature,signerAddress:a,startTimestamp:i.startTimestamp,durationDays:i.durationDays});Object.assign(o,r)}return t?.onDecrypted?.(o),o},onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e))r.client.setQueryData(I.decryption.handle(t),n)}}}function it(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,owner:n})=>e.decryptBalanceAs({delegatorAddress:t,owner:n})}}function at(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>h.batchDecryptBalancesAs(e,t)}}function ot(e){return{mutationKey:[`zama.revokeDelegation`,e.address],mutationFn:async({delegateAddress:t})=>e.revokeDelegation({delegateAddress:t})}}function st(e,t){return{...M(t.query??{}),queryKey:I.delegationStatus.scope(t.tokenAddress,t.delegatorAddress,t.delegateAddress),queryFn:async t=>{let[,{tokenAddress:n,delegatorAddress:r,delegateAddress:i}]=t.queryKey;_(n,`delegationStatusQueryOptions: tokenAddress`),_(r,`delegationStatusQueryOptions: delegatorAddress`),_(i,`delegationStatusQueryOptions: delegateAddress`);let a=await e.relayer.getAclAddress(),o=await e.signer.readContract(u(a,r,i,n)),s;return s=o===0n?!1:o===d?!0:o>await e.signer.getBlockTimestamp(),{isDelegated:s,expiryTimestamp:o}},enabled:!!(t.tokenAddress&&t.delegatorAddress&&t.delegateAddress)&&t.query?.enabled!==!1}}export{j as ZERO_HANDLE,r as ZamaSDKEvents,Te as activityFeedQueryOptions,Qe as allowMutationOptions,ze as approveUnderlyingMutationOptions,at as batchDecryptBalancesAsMutationOptions,_e as batchTransferFeeQueryOptions,Re as confidentialApproveMutationOptions,Se as confidentialBalanceQueryOptions,we as confidentialBalancesQueryOptions,xe as confidentialHandleQueryOptions,Ce as confidentialHandlesQueryOptions,me as confidentialIsApprovedQueryOptions,De as confidentialTokenAddressQueryOptions,Le as confidentialTransferFromMutationOptions,Ie as confidentialTransferMutationOptions,$ as createDelegatedUserDecryptEIP712MutationOptions,Je as createEIP712MutationOptions,it as decryptBalanceAsMutationOptions,nt as delegateDecryptionMutationOptions,Ye as delegatedUserDecryptMutationOptions,st as delegationStatusQueryOptions,Z as deriveActivityFeedLogsKey,Ke as encryptMutationOptions,ve as feeRecipientQueryOptions,M as filterQueryOptions,Ge as finalizeUnwrapMutationOptions,qe as generateKeypairMutationOptions,N as hashFn,W as invalidateAfterApprove,U as invalidateAfterApproveUnderlying,B as invalidateAfterShield,H as invalidateAfterTransfer,V as invalidateAfterUnshield,R as invalidateAfterUnwrap,z as invalidateBalanceQueries,q as invalidateWagmiBalanceQueries,J as invalidateWalletLifecycleQueries,$e as isAllowedQueryOptions,le as isConfidentialQueryOptions,Me as isConfidentialTokenValidQueryOptions,ue as isWrapperQueryOptions,Ne as listPairsQueryOptions,Xe as publicDecryptMutationOptions,ye as publicKeyQueryOptions,be as publicParamsQueryOptions,Ze as requestZKProofVerificationMutationOptions,He as resumeUnshieldMutationOptions,ot as revokeDelegationMutationOptions,et as revokeMutationOptions,tt as revokeSessionMutationOptions,Fe as shieldETHMutationOptions,he as shieldFeeQueryOptions,Pe as shieldMutationOptions,se as signerAddressQueryOptions,Oe as tokenAddressQueryOptions,ce as tokenMetadataQueryOptions,je as tokenPairQueryOptions,ke as tokenPairsLengthQueryOptions,Ee as tokenPairsQueryOptions,Ae as tokenPairsSliceQueryOptions,de as totalSupplyQueryOptions,pe as underlyingAllowanceQueryOptions,Ve as unshieldAllMutationOptions,ge as unshieldFeeQueryOptions,Be as unshieldMutationOptions,We as unwrapAllMutationOptions,Ue as unwrapMutationOptions,rt as userDecryptMutationOptions,fe as wrapperDiscoveryQueryOptions,I as zamaQueryKeys};
1
+ import{A as e,F as t,G as n,H as r,I as i,L as a,M as o,R as s,W as c,i as l,k as u,n as d,r as f,t as p,w as m,z as h}from"../activity-b2RsqKHW.js";import{t as g}from"../encryption-CmIPBcfP.js";import{i as _}from"../assertions-Dty7Quc0.js";import{r as v}from"../memory-storage-B4_heQa5.js";import{C as y,D as b,_ as x,a as S,d as C,i as w,m as T,n as E,o as ee,r as te,s as ne,t as re,u as ie}from"../wrappers-registry-DqPr_JG2.js";import{getAddress as D,zeroAddress as O}from"viem";function k(e){if(!A(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!A(n)||!n.hasOwnProperty(`isPrototypeOf`))}function A(e){return Object.prototype.toString.call(e)===`[object Object]`}const j=`0x0000000000000000000000000000000000000000000000000000000000000000`;function M(e){let{gcTime:t,staleTime:n,enabled:r,select:i,refetchInterval:a,refetchOnMount:o,refetchOnWindowFocus:s,refetchOnReconnect:c,retry:l,retryDelay:u,retryOnMount:d,queryFn:f,queryKey:p,queryKeyHashFn:m,initialData:h,initialDataUpdatedAt:g,placeholderData:_,structuralSharing:v,throwOnError:y,meta:b,query:x,pollingInterval:S,...C}=e;return C}function N(e){return JSON.stringify(e,(e,t)=>k(t)?Object.keys(t).toSorted().reduce((e,n)=>(e[n]=t[n],e),{}):typeof t==`bigint`?t.toString():t)}const P=e=>e.map(e=>D(e)),F=e=>e===void 0?void 0:D(e),I={signerAddress:{all:[`zama.signerAddress`],scope:e=>[`zama.signerAddress`,{scope:e}],token:e=>[`zama.signerAddress`,{tokenAddress:D(e)}]},confidentialHandle:{all:[`zama.confidentialHandle`],token:e=>[`zama.confidentialHandle`,{tokenAddress:D(e)}],owner:(e,t)=>[`zama.confidentialHandle`,{tokenAddress:D(e),...t?{owner:D(t)}:{}}]},confidentialBalance:{all:[`zama.confidentialBalance`],token:e=>[`zama.confidentialBalance`,{tokenAddress:D(e)}],owner:(e,t,n)=>[`zama.confidentialBalance`,{tokenAddress:D(e),...t?{owner:D(t)}:{},...n===void 0?{}:{handle:n}}]},confidentialHandles:{all:[`zama.confidentialHandles`],tokens:(e,t)=>[`zama.confidentialHandles`,{tokenAddresses:P(e),...t?{owner:D(t)}:{}}]},confidentialBalances:{all:[`zama.confidentialBalances`],tokens:(e,t,n)=>[`zama.confidentialBalances`,{tokenAddresses:P(e),...t?{owner:D(t)}:{},...n===void 0?{}:{handles:n}}]},tokenMetadata:{all:[`zama.tokenMetadata`],token:e=>[`zama.tokenMetadata`,{tokenAddress:D(e)}]},isConfidential:{all:[`zama.isConfidential`],token:e=>[`zama.isConfidential`,{tokenAddress:D(e)}]},isWrapper:{all:[`zama.isWrapper`],token:e=>[`zama.isWrapper`,{tokenAddress:D(e)}]},wrapperDiscovery:{all:[`zama.wrapperDiscovery`],token:(e,t,n)=>{let r=F(e),i=F(t),a=F(n);return[`zama.wrapperDiscovery`,{...r?{tokenAddress:r}:{},...i?{erc20Address:i}:{},...a?{registryAddress:a}:{}}]}},underlyingAllowance:{all:[`zama.underlyingAllowance`],token:e=>[`zama.underlyingAllowance`,{tokenAddress:D(e)}],scope:(e,t,n)=>[`zama.underlyingAllowance`,{tokenAddress:D(e),...t?{owner:D(t)}:{},...n?{wrapperAddress:D(n)}:{}}]},confidentialIsApproved:{all:[`zama.confidentialIsApproved`],token:e=>{let t=F(e);return[`zama.confidentialIsApproved`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=F(e),i=F(t),a=F(n);return[`zama.confidentialIsApproved`,{...r?{tokenAddress:r}:{},...i?{holder:i}:{},...a?{spender:a}:{}}]}},totalSupply:{all:[`zama.totalSupply`],token:e=>[`zama.totalSupply`,{tokenAddress:D(e)}]},activityFeed:{all:[`zama.activityFeed`],token:e=>[`zama.activityFeed`,{tokenAddress:D(e)}],scope:(e,t,n,r)=>[`zama.activityFeed`,{tokenAddress:D(e),...t?{userAddress:D(t)}:{},...n?{logsKey:n}:{},...r===void 0?{}:{decrypt:r}}]},fees:{all:[`zama.fees`],shieldFee:(e,t,n,r)=>[`zama.fees`,{type:`shield`,...e?{feeManagerAddress:D(e)}:{},...t===void 0?{}:{amount:t},...n?{from:D(n)}:{},...r?{to:D(r)}:{}}],unshieldFee:(e,t,n,r)=>[`zama.fees`,{type:`unshield`,...e?{feeManagerAddress:D(e)}:{},...t===void 0?{}:{amount:t},...n?{from:D(n)}:{},...r?{to:D(r)}:{}}],batchTransferFee:e=>[`zama.fees`,{type:`batchTransfer`,...e?{feeManagerAddress:D(e)}:{}}],feeRecipient:e=>[`zama.fees`,{type:`feeRecipient`,...e?{feeManagerAddress:D(e)}:{}}]},isAllowed:{all:[`zama.isAllowed`],scope:e=>[`zama.isAllowed`,{account:D(e)}]},publicKey:{all:[`zama.publicKey`]},publicParams:{all:[`zama.publicParams`],bits:e=>[`zama.publicParams`,{bits:e}]},delegationStatus:{all:[`zama.delegationStatus`],token:e=>{let t=F(e);return[`zama.delegationStatus`,t?{tokenAddress:t}:{}]},scope:(e,t,n)=>{let r=F(e),i=F(t),a=F(n);return[`zama.delegationStatus`,{...r?{tokenAddress:r}:{},...i?{delegatorAddress:i}:{},...a?{delegateAddress:a}:{}}]}},decryption:{all:[`zama.decryption`],handle:(e,t)=>[`zama.decryption`,{handle:e,...t===void 0?{}:{contractAddress:D(t)}}]},wrappersRegistry:{all:[`zama.wrappersRegistry`],chainId:()=>[`zama.wrappersRegistry`,{type:`chainId`}],tokenPairs:e=>[`zama.wrappersRegistry`,{type:`tokenPairs`,registryAddress:D(e)}],confidentialTokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`confidentialTokenAddress`,registryAddress:D(e),tokenAddress:D(t)}],tokenAddress:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenAddress`,registryAddress:D(e),confidentialTokenAddress:D(t)}],tokenPairsLength:e=>[`zama.wrappersRegistry`,{type:`tokenPairsLength`,registryAddress:D(e)}],tokenPairsSlice:(e,t,n)=>[`zama.wrappersRegistry`,{type:`tokenPairsSlice`,registryAddress:D(e),fromIndex:t,toIndex:n}],tokenPair:(e,t)=>[`zama.wrappersRegistry`,{type:`tokenPair`,registryAddress:D(e),index:t}],isConfidentialTokenValid:(e,t)=>[`zama.wrappersRegistry`,{type:`isConfidentialTokenValid`,registryAddress:D(e),confidentialTokenAddress:D(t)}],listPairs:(e,t,n,r)=>[`zama.wrappersRegistry`,{type:`listPairs`,registryAddress:D(e),page:t,pageSize:n,metadata:r}]}};function L(e,t){e.invalidateQueries({queryKey:I.underlyingAllowance.token(t)})}function R(e,t){z(e,t),L(e,t),q(e),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function z(e,t){e.invalidateQueries({queryKey:I.confidentialHandle.token(t)}),e.invalidateQueries({queryKey:I.confidentialHandles.all}),e.invalidateQueries({queryKey:I.confidentialBalance.token(t)}),e.invalidateQueries({queryKey:I.confidentialBalances.all})}function B(e,t){z(e,t),L(e,t),q(e),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function V(e,t){z(e,t),L(e,t),q(e),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function H(e,t){z(e,t),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function U(e,t){L(e,t)}function W(e,t){e.invalidateQueries({queryKey:I.confidentialIsApproved.token(t)}),e.invalidateQueries({queryKey:I.activityFeed.token(t)})}function G(e){return Array.isArray(e.queryKey)&&typeof e.queryKey[0]==`string`?e.queryKey[0].startsWith(`zama.`):!1}function K(e){return Array.isArray(e.queryKey)&&e.queryKey.some(e=>typeof e!=`object`||!e||!(`functionName`in e)?!1:e.functionName===`balanceOf`)}function q(e){e.invalidateQueries({predicate:K})}function J(e){e.removeQueries({queryKey:I.signerAddress.all}),e.removeQueries({queryKey:I.decryption.all}),e.invalidateQueries({predicate:G}),q(e)}const Y=new WeakMap;let ae=1;function oe(e){let t=Y.get(e);if(t!==void 0)return t;let n=ae++;return Y.set(e,n),n}function se(e,t){return{...M(t?.query??{}),queryKey:I.signerAddress.scope(oe(e)),queryFn:async()=>e.getAddress(),staleTime:3e4,enabled:t?.query?.enabled!==!1}}function ce(e,t,i){let a=I.tokenMetadata.token(t);return{...M(i?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddress:i}]=t.queryKey,[a,o,s]=await Promise.all([e.readContract(c(i)),e.readContract(n(i)),e.readContract(r(i))]);return{name:a,symbol:o,decimals:s}},staleTime:1/0,enabled:i?.query?.enabled!==!1}}function le(e,t,n){let r=I.isConfidential.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(ie(n))}catch(e){if(v(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function ue(e,t,n){let r=I.isWrapper.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;try{return await e.readContract(C(n))}catch(e){if(v(e))return!1;throw e}},staleTime:1/0,enabled:n?.query?.enabled!==!1}}function de(e,t,n){let r=I.totalSupply.token(t);return{...M(n?.query??{}),queryKey:r,queryFn:async t=>{let[,{tokenAddress:n}]=t.queryKey;return e.readContract(b(n))},staleTime:3e4,enabled:n?.query?.enabled!==!1}}function fe(e,t){let n=I.wrapperDiscovery.token(t.tokenAddress,t.erc20Address,t.registryAddress);return{...M(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 pe(e,t,n){let r=n.owner,i=n.wrapperAddress,a=n.query?.enabled!==!1,o=I.underlyingAllowance.scope(t,r,i);return{...M(n.query??{}),queryKey:o,queryFn:async t=>{let[,{owner:n,wrapperAddress:r}]=t.queryKey;_(n,`underlyingAllowanceQueryOptions: owner`),_(r,`underlyingAllowanceQueryOptions: wrapperAddress`);let i=await e.readContract(T(r));return e.readContract(h(i,n,r))},staleTime:3e4,enabled:!!(r&&i)&&a}}function me(e,t,n){let r=n.holder,i=n.spender,a=n.query?.enabled!==!1,o=I.confidentialIsApproved.scope(t,r,i);return{...M(n.query??{}),queryKey:o,queryFn:async t=>{let[,{tokenAddress:n,holder:r,spender:i}]=t.queryKey;return _(n,`confidentialIsApprovedQueryOptions: tokenAddress`),_(r,`confidentialIsApprovedQueryOptions: holder`),_(i,`confidentialIsApprovedQueryOptions: spender`),e.readContract(y(n,r,i))},staleTime:3e4,enabled:!!(t&&r&&i)&&a}}function X(e){return e===void 0?void 0:BigInt(e)}function he(e,t){let n=t.amount?.toString(),r=t.feeManagerAddress,i=t.from,a=t.to,o=t.query?.enabled!==!1,c=I.fees.shieldFee(r,n,i,a);return{...M(t.query??{}),queryKey:c,queryFn:async t=>{let[,n]=t.queryKey,r=X(n.amount);return _(n.feeManagerAddress,`shieldFeeQueryOptions: feeManagerAddress`),_(r,`shieldFeeQueryOptions: amount`),_(n.from,`shieldFeeQueryOptions: from`),_(n.to,`shieldFeeQueryOptions: to`),e.readContract(s(n.feeManagerAddress,r,n.from,n.to))},staleTime:3e4,enabled:!!(r&&n!==void 0&&i&&a)&&o}}function ge(e,t){let n=t.amount?.toString(),r=t.feeManagerAddress,i=t.from,o=t.to,s=t.query?.enabled!==!1,c=I.fees.unshieldFee(r,n,i,o);return{...M(t.query??{}),queryKey:c,queryFn:async t=>{let[,n]=t.queryKey,r=X(n.amount);return _(n.feeManagerAddress,`unshieldFeeQueryOptions: feeManagerAddress`),_(r,`unshieldFeeQueryOptions: amount`),_(n.from,`unshieldFeeQueryOptions: from`),_(n.to,`unshieldFeeQueryOptions: to`),e.readContract(a(n.feeManagerAddress,r,n.from,n.to))},staleTime:3e4,enabled:!!(r&&n!==void 0&&i&&o)&&s}}function _e(e,n,r){let i=r?.query?.enabled!==!1,a=I.fees.batchTransferFee(n);return{...M(r?.query??{}),queryKey:a,queryFn:async n=>{let[,{feeManagerAddress:r}]=n.queryKey;return _(r,`batchTransferFeeQueryOptions: feeManagerAddress`),e.readContract(t(r))},staleTime:3e4,enabled:!!n&&i}}function ve(e,t,n){let r=n?.query?.enabled!==!1,a=I.fees.feeRecipient(t);return{...M(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{feeManagerAddress:n}]=t.queryKey;return _(n,`feeRecipientQueryOptions: feeManagerAddress`),e.readContract(i(n))},staleTime:3e4,enabled:!!t&&r}}function ye(e,t){let n=I.publicKey.all;return{...M(t?.query??{}),queryKey:n,queryFn:async()=>e.relayer.getPublicKey(),staleTime:1/0,enabled:t?.query?.enabled!==!1}}function be(e,t,n){let r=I.publicParams.bits(t);return{...M(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 xe(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,a=I.confidentialHandle.owner(t,r);return{...M(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddress:n,owner:r}]=t.queryKey;return _(r,`confidentialHandleQueryOptions: owner`),await e.readContract(x(n,r))},enabled:!!r&&i,refetchInterval:n?.pollingInterval??1e4}}function Se(e,t){let n=t?.owner,r=t?.handle,i=t?.query?.enabled!==!1,a=I.confidentialBalance.owner(e.address,n,r);return{...M(t?.query??{}),queryKey:a,queryFn:async t=>{let[,{owner:n,handle:r}]=t.queryKey;return _(n,`confidentialBalanceQueryOptions: owner`),_(r,`confidentialBalanceQueryOptions: handle`),e.decryptBalance(r,n)},enabled:!!(n&&r)&&i,staleTime:1/0}}function Ce(e,t,n){let r=n?.owner,i=n?.query?.enabled!==!1,a=I.confidentialHandles.tokens(t,r);return{...M(n?.query??{}),queryKey:a,queryFn:async t=>{let[,{tokenAddresses:n,owner:r}]=t.queryKey;return _(r,`confidentialHandlesQueryOptions: owner`),Promise.all(n.map(async t=>await e.readContract(x(t,r))))},enabled:!!(r&&t.length>0)&&i,refetchInterval:n?.pollingInterval??1e4}}function we(e,t){let n=e.map(e=>e.address),r=t?.resultAddresses??n,i=t?.owner,a=t?.handles,o=t?.query?.enabled!==!1,s=Array.isArray(a)&&a.length===e.length&&a.every(e=>!!e),c=I.confidentialBalances.tokens(n,i,a);return{...M(t?.query??{}),queryKey:c,queryFn:async n=>{let[,{owner:i,handles:a}]=n.queryKey;_(i,`confidentialBalancesQueryOptions: owner`),_(a,`confidentialBalancesQueryOptions: handles`);let o=new Map,s=await m.batchDecryptBalances(e,{owner:i,handles:a,maxConcurrency:t?.maxConcurrency,onError:(e,t)=>(o.set(t,e),0n)}),c=new Map,l=new Map;for(let t=0;t<e.length;t++){let n=e[t].address,i=r[t],a=o.get(n);if(a)l.set(i,a);else{let e=s.get(n);e!==void 0&&c.set(i,e)}}if(l.size===e.length&&e.length>0)throw l.values().next().value??new g(`All token balance decryptions failed`);return{balances:c,errors:l,isPartialError:l.size>0}},enabled:r.length===e.length&&!!i&&e.length>0&&s&&o,staleTime:1/0}}function Z(e){if(e)return N([`zama.activityFeed.logs`,e.map(e=>({topics:[...e.topics],data:e.data,transactionHash:e.transactionHash,blockNumber:e.blockNumber,logIndex:e.logIndex}))])}function Te(e,t,n){let r=t.userAddress,i=t.decrypt??!0,a=t.logs,o=t.logsKey??Z(a),s=n?.query?.enabled!==!1,c=I.activityFeed.scope(e.address,r,o,i);return{...M(n?.query??{}),queryKey:c,queryFn:async t=>{let[,{userAddress:n,decrypt:r}]=t.queryKey;_(n,`activityFeedQueryOptions: userAddress`),_(a,`activityFeedQueryOptions: logs`);let i=f(a,n);if(!r)return l(i);let o=d(i);return o.length===0?l(i):l(p(i,await e.decryptHandles(o,n)))},staleTime:1/0,enabled:!!(r&&a)&&s}}const Q=86400*1e3;function Ee(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPairs(t.registryAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(w(n))},staleTime:Q,enabled:n}}function De(e,t){let n=!!t.registryAddress&&!!t.tokenAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.confidentialTokenAddress(t.registryAddress??O,t.tokenAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,tokenAddress:r}]=t.queryKey;return e.readContract(re(n,r))},staleTime:Q,enabled:n}}function Oe(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenAddress(t.registryAddress??O,t.confidentialTokenAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(E(n,r))},staleTime:Q,enabled:n}}function ke(e,t){let n=!!t.registryAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPairsLength(t.registryAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n}]=t.queryKey;return e.readContract(S(n))},staleTime:Q,enabled:n}}function Ae(e,t){let n=!!t.registryAddress&&t.fromIndex!==void 0&&t.toIndex!==void 0&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPairsSlice(t.registryAddress??O,String(t.fromIndex??0n),String(t.toIndex??0n));return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,fromIndex:r,toIndex:i}]=t.queryKey;return e.readContract(ee(n,BigInt(r),BigInt(i)))},staleTime:Q,enabled:n}}function je(e,t){let n=!!t.registryAddress&&t.index!==void 0&&t.query?.enabled!==!1,r=I.wrappersRegistry.tokenPair(t.registryAddress??O,String(t.index??0n));return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,index:r}]=t.queryKey;return e.readContract(te(n,BigInt(r)))},staleTime:Q,enabled:n}}function Me(e,t){let n=!!t.registryAddress&&!!t.confidentialTokenAddress&&t.query?.enabled!==!1,r=I.wrappersRegistry.isConfidentialTokenValid(t.registryAddress??O,t.confidentialTokenAddress??O);return{...M(t.query??{}),queryKey:r,queryFn:async t=>{let[,{registryAddress:n,confidentialTokenAddress:r}]=t.queryKey;return e.readContract(ne(n,r))},staleTime:Q,enabled:n}}function Ne(e,t){let n=t.page??1,r=t.pageSize??100,i=t.metadata??!1,a=!!t.registryAddress&&t.query?.enabled!==!1,o=I.wrappersRegistry.listPairs(t.registryAddress??O,n,r,i);return{...M(t.query??{}),queryKey:o,queryFn:async()=>e.listPairs({page:n,pageSize:r,metadata:i}),staleTime:e.ttlMs,enabled:a}}function Pe(e){return{mutationKey:[`zama.shield`,e.address],mutationFn:async({amount:t,...n})=>e.shield(t,n)}}function Fe(e){return{mutationKey:[`zama.shieldETH`,e.address],mutationFn:async({amount:t,value:n})=>e.shieldETH(t,n)}}function Ie(e){return{mutationKey:[`zama.confidentialTransfer`,e.address],mutationFn:async({to:t,amount:n,...r})=>e.confidentialTransfer(t,n,r)}}function Le(e){return{mutationKey:[`zama.confidentialTransferFrom`,e.address],mutationFn:async({from:t,to:n,amount:r,callbacks:i})=>e.confidentialTransferFrom(t,n,r,i)}}function Re(e){return{mutationKey:[`zama.confidentialApprove`,e.address],mutationFn:async({spender:t,until:n})=>e.approve(t,n)}}function ze(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 Ve(e){return{mutationKey:[`zama.unshieldAll`,e.address],mutationFn:async t=>e.unshieldAll(t||void 0)}}function He(e){return{mutationKey:[`zama.resumeUnshield`,e.address],mutationFn:async({unwrapTxHash:t,...n})=>e.resumeUnshield(t,n)}}function Ue(e){return{mutationKey:[`zama.unwrap`,e.address],mutationFn:async({amount:t})=>e.unwrap(t)}}function We(e){return{mutationKey:[`zama.unwrapAll`,e.address],mutationFn:async()=>e.unwrapAll()}}function Ge(e){return{mutationKey:[`zama.finalizeUnwrap`,e.address],mutationFn:async({burnAmountHandle:t})=>e.finalizeUnwrap(t)}}function Ke(e){return{mutationKey:[`zama.encrypt`],mutationFn:async t=>e.relayer.encrypt(t)}}function qe(e){return{mutationKey:[`zama.generateKeypair`],mutationFn:async()=>e.relayer.generateKeypair()}}function Je(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 Ye(e){return{mutationKey:[`zama.delegatedUserDecrypt`],mutationFn:async t=>e.relayer.delegatedUserDecrypt(t)}}function Xe(e){return{mutationKey:[`zama.publicDecrypt`],mutationFn:async t=>e.relayer.publicDecrypt(t),onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e.clearValues))r.client.setQueryData(I.decryption.handle(t),n)}}}function Ze(e){return{mutationKey:[`zama.requestZKProofVerification`],mutationFn:async t=>e.relayer.requestZKProofVerification(t)}}function Qe(e){return{mutationKey:[`zama.allow`],mutationFn:t=>e.allow(...t)}}function $e(e,t){return{...M(t.query??{}),queryKey:I.isAllowed.scope(t.account),queryFn:()=>e.isAllowed(),staleTime:3e4,enabled:t.query?.enabled!==!1}}function et(e){return{mutationKey:[`zama.revoke`],mutationFn:t=>e.revoke(...t)}}function tt(e){return{mutationKey:[`zama.revokeSession`],mutationFn:()=>e.revokeSession()}}function nt(e){return{mutationKey:[`zama.delegateDecryption`,e.address],mutationFn:async({delegateAddress:t,expirationDate:n})=>e.delegateDecryption({delegateAddress:t,expirationDate:n})}}function rt(e,t){return{mutationKey:[`zama.userDecrypt`],mutationFn:async({handles:n})=>{let r=[...new Set(n.map(e=>e.contractAddress))],i=await e.credentials.allow(...r);t?.onCredentialsReady?.();let a=await e.signer.getAddress(),o={},s=new Map;for(let e of n){let t=s.get(e.contractAddress)??[];t.push(e.handle),s.set(e.contractAddress,t)}for(let[t,n]of s){let r=await e.relayer.userDecrypt({handles:n,contractAddress:t,signedContractAddresses:i.contractAddresses,privateKey:i.privateKey,publicKey:i.publicKey,signature:i.signature,signerAddress:a,startTimestamp:i.startTimestamp,durationDays:i.durationDays});Object.assign(o,r)}return t?.onDecrypted?.(o),o},onSuccess:(e,t,n,r)=>{for(let[t,n]of Object.entries(e))r.client.setQueryData(I.decryption.handle(t),n)}}}function it(e){return{mutationKey:[`zama.decryptBalanceAs`,e.address],mutationFn:async({delegatorAddress:t,owner:n})=>e.decryptBalanceAs({delegatorAddress:t,owner:n})}}function at(e){return{mutationKey:[`zama.batchDecryptBalancesAs`,...e.map(e=>e.address)],mutationFn:async t=>m.batchDecryptBalancesAs(e,t)}}function ot(e){return{mutationKey:[`zama.revokeDelegation`,e.address],mutationFn:async({delegateAddress:t})=>e.revokeDelegation({delegateAddress:t})}}function st(t,n){return{...M(n.query??{}),queryKey:I.delegationStatus.scope(n.tokenAddress,n.delegatorAddress,n.delegateAddress),queryFn:async n=>{let[,{tokenAddress:r,delegatorAddress:i,delegateAddress:a}]=n.queryKey;_(r,`delegationStatusQueryOptions: tokenAddress`),_(i,`delegationStatusQueryOptions: delegatorAddress`),_(a,`delegationStatusQueryOptions: delegateAddress`);let s=await t.relayer.getAclAddress(),c=await t.signer.readContract(o(s,i,a,r)),l;return l=c===0n?!1:c===e?!0:c>await t.signer.getBlockTimestamp(),{isDelegated:l,expiryTimestamp:c}},enabled:!!(n.tokenAddress&&n.delegatorAddress&&n.delegateAddress)&&n.query?.enabled!==!1}}export{j as ZERO_HANDLE,u as ZamaSDKEvents,Te as activityFeedQueryOptions,Qe as allowMutationOptions,ze as approveUnderlyingMutationOptions,at as batchDecryptBalancesAsMutationOptions,_e as batchTransferFeeQueryOptions,Re as confidentialApproveMutationOptions,Se as confidentialBalanceQueryOptions,we as confidentialBalancesQueryOptions,xe as confidentialHandleQueryOptions,Ce as confidentialHandlesQueryOptions,me as confidentialIsApprovedQueryOptions,De as confidentialTokenAddressQueryOptions,Le as confidentialTransferFromMutationOptions,Ie as confidentialTransferMutationOptions,$ as createDelegatedUserDecryptEIP712MutationOptions,Je as createEIP712MutationOptions,it as decryptBalanceAsMutationOptions,nt as delegateDecryptionMutationOptions,Ye as delegatedUserDecryptMutationOptions,st as delegationStatusQueryOptions,Z as deriveActivityFeedLogsKey,Ke as encryptMutationOptions,ve as feeRecipientQueryOptions,M as filterQueryOptions,Ge as finalizeUnwrapMutationOptions,qe as generateKeypairMutationOptions,N as hashFn,W as invalidateAfterApprove,U as invalidateAfterApproveUnderlying,B as invalidateAfterShield,H as invalidateAfterTransfer,V as invalidateAfterUnshield,R as invalidateAfterUnwrap,z as invalidateBalanceQueries,q as invalidateWagmiBalanceQueries,J as invalidateWalletLifecycleQueries,$e as isAllowedQueryOptions,le as isConfidentialQueryOptions,Me as isConfidentialTokenValidQueryOptions,ue as isWrapperQueryOptions,Ne as listPairsQueryOptions,Xe as publicDecryptMutationOptions,ye as publicKeyQueryOptions,be as publicParamsQueryOptions,Ze as requestZKProofVerificationMutationOptions,He as resumeUnshieldMutationOptions,ot as revokeDelegationMutationOptions,et as revokeMutationOptions,tt as revokeSessionMutationOptions,Fe as shieldETHMutationOptions,he as shieldFeeQueryOptions,Pe as shieldMutationOptions,se as signerAddressQueryOptions,Oe as tokenAddressQueryOptions,ce as tokenMetadataQueryOptions,je as tokenPairQueryOptions,ke as tokenPairsLengthQueryOptions,Ee as tokenPairsQueryOptions,Ae as tokenPairsSliceQueryOptions,de as totalSupplyQueryOptions,pe as underlyingAllowanceQueryOptions,Ve as unshieldAllMutationOptions,ge as unshieldFeeQueryOptions,Be as unshieldMutationOptions,We as unwrapAllMutationOptions,Ue as unwrapMutationOptions,rt as userDecryptMutationOptions,fe as wrapperDiscoveryQueryOptions,I as zamaQueryKeys};
2
2
  //# sourceMappingURL=index.js.map