@zama-fhe/sdk 3.4.0-alpha.2 → 3.4.0-alpha.3

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.
@@ -1,6 +1,6 @@
1
1
  import { u as FheChain } from "./index-doNE2KoX.js";
2
- import { Ut as FhevmRelayerSDK, Vt as FhevmClient, Wt as RelayerOptions, c as GenericStorage, n as RelayerConfig } from "./types-nwhfaUCK.js";
3
- import "./cleartext-Bvx-0y6k.js";
2
+ import { Gt as RelayerOptions, Ht as FhevmClient, Wt as FhevmRelayerSDK, c as GenericStorage, n as RelayerConfig } from "./types-C5XL-FYs.js";
3
+ import "./cleartext-D2thmTZC.js";
4
4
  //#region src/relayer/fhevm-relayer.d.ts
5
5
  /** Construction config for {@link FhevmRelayer}. */
6
6
  interface FhevmRelayerConfig {
@@ -326,4 +326,4 @@ declare class AsyncLocalMapStorage implements GenericStorage {
326
326
  declare const asyncLocalStorage: AsyncLocalMapStorage;
327
327
  //#endregion
328
328
  export { node as i, asyncLocalStorage as n, NodeRelayerConfig as r, AsyncLocalMapStorage as t };
329
- //# sourceMappingURL=index-CDJk5ZAg.d.ts.map
329
+ //# sourceMappingURL=index-DNToBw2D.d.ts.map
@@ -1,79 +1,8 @@
1
1
  import { a as hoodi, c as sepolia, d as FheChainAuth, i as hardhat, l as AtLeastOneChain, n as bscTestnet, o as ingenTestnet, r as chains, s as mainnet, t as anvil, u as FheChain } from "./index-doNE2KoX.js";
2
- import { $ as TransferOptions, A as EncryptEndEvent, At as RawLog, B as TransferSubmittedEvent, Bt as EncryptedValue, C as ChainRouter, Ct as decodeUnwrapFinalized, D as DecryptErrorEvent, Dt as findRevokedDelegationForUserDecryption, E as DecryptEndEvent, Et as findDelegatedForUserDecryption, F as SetOperatorSubmittedEvent, Ft as DecryptValuesParameters, G as ZamaSDKEvent, Gt as TypedValue, H as UnshieldPhase2StartedEvent, I as ShieldSubmittedEvent, It as EIP712TypedData, J as ZamaSDKEventType, K as ZamaSDKEventInput, L as TransactionErrorEvent, Lt as EncryptInput, M as EncryptStartEvent, Mt as TransactionResult, N as FinalizeUnwrapSubmittedEvent, Nt as ClearValue, O as DecryptStartEvent, Ot as findUnwrapRequested, P as RevokeDelegationSubmittedEvent, Pt as DecryptPublicValuesResult, Q as ShieldPath, R as TransactionOperation, Rt as EncryptParams, S as WriteFunctionName, St as decodeRevokedDelegationForUserDecryption, T as BaseEvent, Tt as decodeWrap, U as UnshieldPhase2SubmittedEvent, Ut as FhevmRelayerSDK, V as UnshieldPhase1SubmittedEvent, W as UnwrapSubmittedEvent, X as ApprovalStrategy, Y as ZamaSDKEvents, Z as ShieldOptions, _ as ReadContractConfig, _t as decodeAclEvents, a as ZamaConfigBase, at as AclEvent, b as WriteContractArgs, bt as decodeOnChainEvent, c as GenericStorage, ct as DelegatedForUserDecryptionEvent, d as WalletAccount, dt as TOKEN_TOPICS, et as UnshieldOptions, f as WalletAccountChange, ft as Topics, g as ReadContractArgs, gt as decodeAclEvent, h as ContractAbi, ht as WrapEvent, i as ZamaConfig, it as ACL_TOPICS, j as EncryptErrorEvent, jt as TransactionReceipt, k as DelegationSubmittedEvent, kt as findWrap, l as GenericProvider, lt as OnChainEvent, m as WalletAccountStore, mt as UnwrapRequestedEvent, n as RelayerConfig, nt as TransferCallbacks, o as ZamaConfigGeneric, ot as AclTopics, p as WalletAccountListener, pt as UnwrapFinalizedEvent, q as ZamaSDKEventListener, rt as UnshieldCallbacks, s as GenericLogger, st as ConfidentialTransferEvent, t as CleartextRelayerConfig, tt as ShieldCallbacks, u as GenericSigner, ut as RevokedDelegationForUserDecryptionEvent, v as ReadContractReturnType, vt as decodeConfidentialTransfer, w as ApproveUnderlyingSubmittedEvent, wt as decodeUnwrapRequested, x as WriteContractConfig, xt as decodeOnChainEvents, y as ReadFunctionName, yt as decodeDelegatedForUserDecryption, z as TransferFromSubmittedEvent, zt as EncryptResult } from "./types-nwhfaUCK.js";
3
- import { t as cleartext } from "./cleartext-Bvx-0y6k.js";
4
- import { t as ZamaConfigEthers } from "./types-D8g0H49N.js";
5
- import { n as MutableWalletAccountStore, r as createWalletAccountStore, t as BaseSigner } from "./base-signer-D5HdiBp1.js";
6
- import { $n as TokenWrapperPairWithMetadata, $t as DelegationSelfNotAllowedError, Ar as isOperatorContract, At as SignerRequiredError, Br as createConfig, Bt as InsufficientConfidentialBalanceError, Cr as symbolContract, Ct as BatchDecryptAsOptions, D as DecryptResult, Dr as confidentialTransferFromContract, Dt as SigningFailedError, Er as confidentialTransferContract, Et as TransactionRevertedError, Fr as unwrapFromBalanceContract, Ft as ConfigurationError, Gt as DelegationContractIsSelfError, Ht as DecryptionFailedError, Ir as wrapContract, It as RelayerRequestFailedError, Jt as DelegationExpirationTooSoonError, Kt as DelegationCooldownError, Lr as ResolvedChainRelayer, Lt as BalanceCheckUnavailableError, Mr as setOperatorContract, Mt as WalletNotConnectedError, Nr as underlyingContract, Nt as RpcRateLimitError, O as EncryptedInput, Or as finalizeUnwrapContract, Ot as SigningRejectedError, Pr as unwrapContract, Pt as NotEntitledError, Qn as TokenWrapperPair, Qt as DelegationNotPropagatedError, Rr as resolveChainRelayers, Rt as BalanceErrorDetails, Sn as StoredTransportKeyPair, Sr as nameContract, St as BatchBalancesResult, Tr as confidentialTotalSupplyContract, Tt as matchZamaError, Ut as EncryptionFailedError, Vt as InsufficientERC20BalanceError, Wt as AclPausedError, Xt as DelegationExpiryUnchangedError, Yt as DelegationExpiredError, Zn as PaginatedResult, Zt as DelegationNotFoundError, _n as ListPairsOptions, _r as supportsInterfaceContract, a as BatchDecryptItem, an as ZamaErrorCode, ar as getTokenPairsSliceContract, bn as Permission, br as balanceOfContract, cr as getDelegationExpiryContract, dr as transferAndCallContract, en as InvalidTransportKeyPairError, er as getConfidentialTokenAddressContract, fr as ERC1363_INTERFACE_ID, gn as DefaultRegistryAddresses, gr as isConfidentialWrapperContract, hr as isConfidentialTokenContract, i as Decryption, in as ZamaError, ir as getTokenPairsLengthContract, jr as rateContract, jt as WalletAccountNotReadyError, kr as inferredTotalSupplyContract, kt as SignerNotConfiguredError, lr as isHandleDelegatedContract, mr as ERC7984_WRAPPER_INTERFACE_ID, n as Permits, nn as TransportKeyPairExpiredError, nr as getTokenPairContract, o as BatchDecryptResult, on as isRetryable, or as isConfidentialTokenValidContract, pr as ERC7984_INTERFACE_ID, qt as DelegationDelegateEqualsContractError, r as Delegations, rn as ChainMismatchError, rr as getTokenPairsContract, s as DelegatedDecryptOptions, sn as retryAfterSeconds, sr as delegateForUserDecryptionContract, t as ZamaSDK, tn as NoCiphertextError, tr as getTokenAddressContract, ur as revokeDelegationContract, vn as WrappersRegistry, vr as allowanceContract, wr as confidentialBalanceOfContract, wt as Token, xn as SerializedTransportKeyPair, xr as decimalsContract, xt as WrappedToken, yn as WrappersRegistryConfig, yr as approveContract, zr as resolveStorage, zt as ERC20ReadFailedError } from "./zama-sdk-aaLl2ZlA.js";
7
- import { t as ZamaConfigViem } from "./types-CObfaH4A.js";
8
- import { Address, Hex } from "viem";
9
- //#region src/utils/handles.d.ts
10
- declare const ZERO_ENCRYPTED_VALUE: "0x0000000000000000000000000000000000000000000000000000000000000000";
11
- /**
12
- * Check whether an encrypted value represents the zero value.
13
- */
14
- declare function isEncryptedValueZero(encryptedValue: string): boolean;
15
- //#endregion
16
- //#region src/storage/memory-storage.d.ts
17
- /** In-memory credential store. Credentials are lost on page reload. */
18
- declare class MemoryStorage implements GenericStorage {
19
- #private;
20
- get<T = unknown>(key: string): Promise<T | null>;
21
- set<T = unknown>(key: string, value: T): Promise<void>;
22
- delete(key: string): Promise<void>;
23
- }
24
- /** Default singleton for application-wide use. */
25
- declare const memoryStorage: MemoryStorage;
26
- //#endregion
27
- //#region src/storage/indexeddb-storage.d.ts
28
- /**
29
- * IndexedDB-backed {@link GenericStorage}.
30
- *
31
- * Stores keypair and permit objects keyed by a hashed wallet address. The
32
- * SDK delegates security to the storage backend — values are persisted
33
- * verbatim with no SDK-layer encryption.
34
- */
35
- declare class IndexedDBStorage implements GenericStorage {
36
- #private;
37
- constructor(dbName?: string, dbVersion?: number, storeName?: string);
38
- get<T = unknown>(key: string): Promise<T | null>;
39
- set<T = unknown>(key: string, value: T): Promise<void>;
40
- delete(key: string): Promise<void>;
41
- clear(): Promise<void>;
42
- }
43
- /** Default singleton for application-wide use. */
44
- declare const indexedDBStorage: IndexedDBStorage;
45
- //#endregion
46
- //#region src/storage/chrome-session-storage.d.ts
47
- /**
48
- * {@link GenericStorage} backed by `chrome.storage.session`.
49
- *
50
- * Use this in MV3 web extensions so the wallet signature survives
51
- * service worker restarts and is shared across popup, background,
52
- * and content script contexts.
53
- *
54
- * @example
55
- * ```ts
56
- * import { ZamaSDK, indexedDBStorage, chromeSessionStorage } from "@zama-fhe/sdk";
57
- * import { createConfig } from "@zama-fhe/sdk/viem";
58
- *
59
- * const config = createConfig({
60
- * chains: [mySepolia],
61
- * publicClient,
62
- * walletClient,
63
- * relayers: { [mySepolia.id]: web() },
64
- * storage: indexedDBStorage, // encrypted transport key pair — persistent
65
- * permitStorage: chromeSessionStorage, // signed permits — ephemeral
66
- * });
67
- * const sdk = new ZamaSDK(config);
68
- * ```
69
- */
70
- declare class ChromeSessionStorage implements GenericStorage {
71
- get<T = unknown>(key: string): Promise<T | null>;
72
- set(key: string, value: unknown): Promise<void>;
73
- delete(key: string): Promise<void>;
74
- }
75
- /** Default singleton for application-wide use. */
76
- declare const chromeSessionStorage: ChromeSessionStorage;
77
- //#endregion
78
- export { ACL_TOPICS, type AclEvent, AclPausedError, AclTopics, type Address, type ApprovalStrategy, type ApproveUnderlyingSubmittedEvent, type AtLeastOneChain, BalanceCheckUnavailableError, type BalanceErrorDetails, type BaseEvent, BaseSigner, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptItem, type BatchDecryptResult, ChainMismatchError, type ChainRouter, ChromeSessionStorage, type ClearValue, type CleartextRelayerConfig, type ConfidentialTransferEvent, ConfigurationError, type ContractAbi, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type DecryptValuesParameters, Decryption, DecryptionFailedError, DefaultRegistryAddresses, type DelegatedDecryptOptions, type DelegatedForUserDecryptionEvent, DelegationContractIsSelfError, DelegationCooldownError, DelegationDelegateEqualsContractError, DelegationExpirationTooSoonError, DelegationExpiredError, DelegationExpiryUnchangedError, DelegationNotFoundError, DelegationNotPropagatedError, DelegationSelfNotAllowedError, type DelegationSubmittedEvent, Delegations, type EIP712TypedData, ERC1363_INTERFACE_ID, ERC20ReadFailedError, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, EncryptionFailedError, type FheChain, type FheChainAuth, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type Hex, IndexedDBStorage, InsufficientConfidentialBalanceError, InsufficientERC20BalanceError, InvalidTransportKeyPairError, type ListPairsOptions, MemoryStorage, MutableWalletAccountStore, NoCiphertextError, NotEntitledError, type OnChainEvent, type PaginatedResult, type Permission, Permits, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RelayerConfig, RelayerRequestFailedError, type FhevmRelayerSDK as RelayerSDK, type ResolvedChainRelayer, type RevokeDelegationSubmittedEvent, type RevokedDelegationForUserDecryptionEvent, RpcRateLimitError, type SerializedTransportKeyPair, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldPath, type ShieldSubmittedEvent, SignerNotConfiguredError, SignerRequiredError, SigningFailedError, SigningRejectedError, type StoredTransportKeyPair, TOKEN_TOPICS, Token, type TokenWrapperPair, type TokenWrapperPairWithMetadata, Topics, type TransactionErrorEvent, type TransactionOperation, type TransactionReceipt, type TransactionResult, TransactionRevertedError, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, TransportKeyPairExpiredError, type TypedValue, type UnshieldCallbacks, type UnshieldOptions, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapFinalizedEvent, type UnwrapRequestedEvent, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, WalletAccountNotReadyError, type WalletAccountStore, WalletNotConnectedError, type WrapEvent, WrappedToken, WrappersRegistry, type WrappersRegistryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, ZERO_ENCRYPTED_VALUE, type ZamaConfig, type ZamaConfigBase, type ZamaConfigEthers, type ZamaConfigGeneric, type ZamaConfigViem, ZamaError, ZamaErrorCode, ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, allowanceContract, anvil, approveContract, balanceOfContract, bscTestnet, chains, chromeSessionStorage, cleartext, confidentialBalanceOfContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, createConfig, createWalletAccountStore, decimalsContract, decodeAclEvent, decodeAclEvents, decodeConfidentialTransfer, decodeDelegatedForUserDecryption, decodeOnChainEvent, decodeOnChainEvents, decodeRevokedDelegationForUserDecryption, decodeUnwrapFinalized, decodeUnwrapRequested, decodeWrap, delegateForUserDecryptionContract, finalizeUnwrapContract, findDelegatedForUserDecryption, findRevokedDelegationForUserDecryption, findUnwrapRequested, findWrap, getConfidentialTokenAddressContract, getDelegationExpiryContract, getTokenAddressContract, getTokenPairContract, getTokenPairsContract, getTokenPairsLengthContract, getTokenPairsSliceContract, hardhat, hoodi, indexedDBStorage, inferredTotalSupplyContract, ingenTestnet, isConfidentialTokenContract, isConfidentialTokenValidContract, isConfidentialWrapperContract, isEncryptedValueZero, isHandleDelegatedContract, isOperatorContract, isRetryable, mainnet, matchZamaError, memoryStorage, nameContract, rateContract, resolveChainRelayers, resolveStorage, retryAfterSeconds, revokeDelegationContract, sepolia, setOperatorContract, supportsInterfaceContract, symbolContract, transferAndCallContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract };
79
- //# sourceMappingURL=index.d.ts.map
2
+ import { $ as TransferOptions, A as EncryptEndEvent, At as findWrap, B as TransferSubmittedEvent, Bt as EncryptResult, C as ChainRouter, Ct as decodeRevokedDelegationForUserDecryption, D as DecryptErrorEvent, Dt as findDelegatedForUserDecryption, E as DecryptEndEvent, Et as decodeWrap, F as SetOperatorSubmittedEvent, Ft as DecryptPublicValuesResult, G as ZamaSDKEvent, H as UnshieldPhase2StartedEvent, I as ShieldSubmittedEvent, It as DecryptValuesParameters, J as ZamaSDKEventType, K as ZamaSDKEventInput, Kt as TypedValue, L as TransactionErrorEvent, Lt as EIP712TypedData, M as EncryptStartEvent, Mt as TransactionReceipt, N as FinalizeUnwrapSubmittedEvent, Nt as TransactionResult, O as DecryptStartEvent, Ot as findRevokedDelegationForUserDecryption, P as RevokeDelegationSubmittedEvent, Pt as ClearValue, Q as ShieldPath, R as TransactionOperation, Rt as EncryptInput, S as WriteFunctionName, St as decodeOnChainEvents, T as BaseEvent, Tt as decodeUnwrapRequested, U as UnshieldPhase2SubmittedEvent, V as UnshieldPhase1SubmittedEvent, Vt as EncryptedValue, W as UnwrapSubmittedEvent, Wt as FhevmRelayerSDK, X as ApprovalStrategy, Y as ZamaSDKEvents, Z as ShieldOptions, _ as ReadContractConfig, _t as decodeAclEvent, a as ZamaConfigBase, at as ACL_TOPICS, b as WriteContractArgs, bt as decodeDelegatedForUserDecryption, c as GenericStorage, ct as ConfidentialTransferEvent, d as WalletAccount, dt as RevokedDelegationForUserDecryptionEvent, et as UnshieldOptions, f as WalletAccountChange, ft as TOKEN_TOPICS, g as ReadContractArgs, gt as WrapEvent, h as ContractAbi, ht as UnwrapRequestedEvent, i as ZamaConfig, it as UnshieldCallbacks, j as EncryptErrorEvent, jt as RawLog, k as DelegationSubmittedEvent, kt as findUnwrapRequested, l as GenericProvider, lt as DelegatedForUserDecryptionEvent, m as WalletAccountStore, mt as UnwrapFinalizedEvent, n as RelayerConfig, nt as ShieldCallbacks, o as ZamaConfigGeneric, ot as AclEvent, p as WalletAccountListener, pt as Topics, q as ZamaSDKEventListener, rt as TransferCallbacks, s as GenericLogger, st as AclTopics, t as CleartextRelayerConfig, tt as UnwrapResult, u as GenericSigner, ut as OnChainEvent, v as ReadContractReturnType, vt as decodeAclEvents, w as ApproveUnderlyingSubmittedEvent, wt as decodeUnwrapFinalized, x as WriteContractConfig, xt as decodeOnChainEvent, y as ReadFunctionName, yt as decodeConfidentialTransfer, z as TransferFromSubmittedEvent, zt as EncryptParams } from "./types-C5XL-FYs.js";
3
+ import { t as cleartext } from "./cleartext-D2thmTZC.js";
4
+ import { t as ZamaConfigEthers } from "./types-BHavXeSS.js";
5
+ import { n as MutableWalletAccountStore, r as createWalletAccountStore, t as BaseSigner } from "./base-signer-DEZW976z.js";
6
+ import { $ as DelegationNotPropagatedError, $t as rateContract, A as SignerNotConfiguredError, At as getDelegationExpiryContract, B as ERC20ReadFailedError, Bt as allowanceContract, C as BatchDecryptItem, Ct as getTokenAddressContract, D as TransactionRevertedError, Dt as getTokenPairsSliceContract, E as matchZamaError, Et as getTokenPairsLengthContract, F as NotEntitledError, Ft as ERC7984_INTERFACE_ID, G as AclPausedError, Gt as symbolContract, H as InsufficientERC20BalanceError, Ht as balanceOfContract, I as ConfigurationError, It as ERC7984_WRAPPER_INTERFACE_ID, J as DelegationDelegateEqualsContractError, Jt as confidentialTransferContract, K as DelegationContractIsSelfError, Kt as confidentialBalanceOfContract, L as RelayerRequestFailedError, Lt as isConfidentialTokenContract, M as WalletAccountNotReadyError, Mt as revokeDelegationContract, N as WalletNotConnectedError, Nt as transferAndCallContract, O as SigningFailedError, Ot as isConfidentialTokenValidContract, P as RpcRateLimitError, Pt as ERC1363_INTERFACE_ID, Q as DelegationNotFoundError, Qt as isOperatorContract, R as BalanceCheckUnavailableError, Rt as isConfidentialWrapperContract, S as Decryption, St as getConfidentialTokenAddressContract, T as DelegatedDecryptOptions, Tt as getTokenPairsContract, U as DecryptionFailedError, Ut as decimalsContract, V as InsufficientConfidentialBalanceError, Vt as approveContract, W as EncryptionFailedError, Wt as nameContract, X as DelegationExpiredError, Xt as finalizeUnwrapContract, Y as DelegationExpirationTooSoonError, Yt as confidentialTransferFromContract, Z as DelegationExpiryUnchangedError, Zt as inferredTotalSupplyContract, _ as BatchBalancesResult, a as IndexedDBStorage, an as ResolvedChainRelayer, at as ZamaError, b as Permits, bt as TokenWrapperPair, c as memoryStorage, cn as createConfig, ct as retryAfterSeconds, d as ZamaSDK, dt as StoredTransportKeyPair, en as setOperatorContract, et as DelegationSelfNotAllowedError, f as DefaultRegistryAddresses, ft as DecryptResult, g as WrappedToken, h as WrappersRegistryConfig, i as chromeSessionStorage, in as wrapContract, it as ChainMismatchError, j as SignerRequiredError, jt as isHandleDelegatedContract, k as SigningRejectedError, kt as delegateForUserDecryptionContract, l as ZERO_ENCRYPTED_VALUE, lt as Permission, m as WrappersRegistry, n as Hex, nn as unwrapContract, nt as NoCiphertextError, o as indexedDBStorage, on as resolveChainRelayers, ot as ZamaErrorCode, p as ListPairsOptions, pt as EncryptedInput, q as DelegationCooldownError, qt as confidentialTotalSupplyContract, r as ChromeSessionStorage, rn as unwrapFromBalanceContract, rt as TransportKeyPairExpiredError, s as MemoryStorage, sn as resolveStorage, st as isRetryable, t as Address, tn as underlyingContract, tt as InvalidTransportKeyPairError, u as isEncryptedValueZero, ut as SerializedTransportKeyPair, v as BatchDecryptAsOptions, w as BatchDecryptResult, wt as getTokenPairContract, x as Delegations, xt as TokenWrapperPairWithMetadata, y as Token, yt as PaginatedResult, z as BalanceErrorDetails, zt as supportsInterfaceContract } from "./index-09tK1t8M.js";
7
+ import { t as ZamaConfigViem } from "./types-CLSVkR1j.js";
8
+ export { ACL_TOPICS, type AclEvent, AclPausedError, AclTopics, type Address, type ApprovalStrategy, type ApproveUnderlyingSubmittedEvent, type AtLeastOneChain, BalanceCheckUnavailableError, type BalanceErrorDetails, type BaseEvent, BaseSigner, type BatchBalancesResult, type BatchDecryptAsOptions, type BatchDecryptItem, type BatchDecryptResult, ChainMismatchError, type ChainRouter, ChromeSessionStorage, type ClearValue, type CleartextRelayerConfig, type ConfidentialTransferEvent, ConfigurationError, type ContractAbi, type DecryptEndEvent, type DecryptErrorEvent, type EncryptedInput as DecryptInput, type DecryptPublicValuesResult, type DecryptResult, type DecryptStartEvent, type DecryptValuesParameters, Decryption, DecryptionFailedError, DefaultRegistryAddresses, type DelegatedDecryptOptions, type DelegatedForUserDecryptionEvent, DelegationContractIsSelfError, DelegationCooldownError, DelegationDelegateEqualsContractError, DelegationExpirationTooSoonError, DelegationExpiredError, DelegationExpiryUnchangedError, DelegationNotFoundError, DelegationNotPropagatedError, DelegationSelfNotAllowedError, type DelegationSubmittedEvent, Delegations, type EIP712TypedData, ERC1363_INTERFACE_ID, ERC20ReadFailedError, ERC7984_INTERFACE_ID, ERC7984_WRAPPER_INTERFACE_ID, type EncryptEndEvent, type EncryptErrorEvent, type EncryptInput, type EncryptParams, type EncryptResult, type EncryptStartEvent, type EncryptedValue, EncryptionFailedError, type FheChain, type FheChainAuth, type FinalizeUnwrapSubmittedEvent, type GenericLogger, type GenericProvider, type GenericSigner, type GenericStorage, type Hex, IndexedDBStorage, InsufficientConfidentialBalanceError, InsufficientERC20BalanceError, InvalidTransportKeyPairError, type ListPairsOptions, MemoryStorage, MutableWalletAccountStore, NoCiphertextError, NotEntitledError, type OnChainEvent, type PaginatedResult, type Permission, Permits, type RawLog, type ReadContractArgs, type ReadContractConfig, type ReadContractReturnType, type ReadFunctionName, type RelayerConfig, RelayerRequestFailedError, type FhevmRelayerSDK as RelayerSDK, type ResolvedChainRelayer, type RevokeDelegationSubmittedEvent, type RevokedDelegationForUserDecryptionEvent, RpcRateLimitError, type SerializedTransportKeyPair, type SetOperatorSubmittedEvent, type ShieldCallbacks, type ShieldOptions, type ShieldPath, type ShieldSubmittedEvent, SignerNotConfiguredError, SignerRequiredError, SigningFailedError, SigningRejectedError, type StoredTransportKeyPair, TOKEN_TOPICS, Token, type TokenWrapperPair, type TokenWrapperPairWithMetadata, Topics, type TransactionErrorEvent, type TransactionOperation, type TransactionReceipt, type TransactionResult, TransactionRevertedError, type TransferCallbacks, type TransferFromSubmittedEvent, type TransferOptions, type TransferSubmittedEvent, TransportKeyPairExpiredError, type TypedValue, type UnshieldCallbacks, type UnshieldOptions, type UnshieldPhase1SubmittedEvent, type UnshieldPhase2StartedEvent, type UnshieldPhase2SubmittedEvent, type UnwrapFinalizedEvent, type UnwrapRequestedEvent, type UnwrapResult, type UnwrapSubmittedEvent, type WalletAccount, type WalletAccountChange, type WalletAccountListener, WalletAccountNotReadyError, type WalletAccountStore, WalletNotConnectedError, type WrapEvent, WrappedToken, WrappersRegistry, type WrappersRegistryConfig, type WriteContractArgs, type WriteContractConfig, type WriteFunctionName, ZERO_ENCRYPTED_VALUE, type ZamaConfig, type ZamaConfigBase, type ZamaConfigEthers, type ZamaConfigGeneric, type ZamaConfigViem, ZamaError, ZamaErrorCode, ZamaSDK, type ZamaSDKEvent, type ZamaSDKEventInput, type ZamaSDKEventListener, type ZamaSDKEventType, ZamaSDKEvents, allowanceContract, anvil, approveContract, balanceOfContract, bscTestnet, chains, chromeSessionStorage, cleartext, confidentialBalanceOfContract, confidentialTotalSupplyContract, confidentialTransferContract, confidentialTransferFromContract, createConfig, createWalletAccountStore, decimalsContract, decodeAclEvent, decodeAclEvents, decodeConfidentialTransfer, decodeDelegatedForUserDecryption, decodeOnChainEvent, decodeOnChainEvents, decodeRevokedDelegationForUserDecryption, decodeUnwrapFinalized, decodeUnwrapRequested, decodeWrap, delegateForUserDecryptionContract, finalizeUnwrapContract, findDelegatedForUserDecryption, findRevokedDelegationForUserDecryption, findUnwrapRequested, findWrap, getConfidentialTokenAddressContract, getDelegationExpiryContract, getTokenAddressContract, getTokenPairContract, getTokenPairsContract, getTokenPairsLengthContract, getTokenPairsSliceContract, hardhat, hoodi, indexedDBStorage, inferredTotalSupplyContract, ingenTestnet, isConfidentialTokenContract, isConfidentialTokenValidContract, isConfidentialWrapperContract, isEncryptedValueZero, isHandleDelegatedContract, isOperatorContract, isRetryable, mainnet, matchZamaError, memoryStorage, nameContract, rateContract, resolveChainRelayers, resolveStorage, retryAfterSeconds, revokeDelegationContract, sepolia, setOperatorContract, supportsInterfaceContract, symbolContract, transferAndCallContract, underlyingContract, unwrapContract, unwrapFromBalanceContract, wrapContract };
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m}from"./relayer-BUxKmetl.js";import{A as h,B as g,C as ee,D as te,F as ne,H as _,I as re,L as v,M as ie,N as ae,O as oe,P as se,R as ce,S as le,T as ue,U as de,V as fe,W as pe,_ as me,a as he,b as ge,c as _e,d as ve,f as ye,g as y,h as b,i as be,j as xe,k as Se,l as Ce,m as we,n as Te,o as Ee,p as De,r as Oe,s as ke,t as Ae,u as je,v as Me,x as Ne,z as Pe}from"./wrappers-registry-vjouAqDk.js";import{C as x,E as S,S as Fe,T as C,_ as Ie,a as w,b as Le,c as Re,d as T,f as E,g as ze,h as Be,i as Ve,l as He,m as Ue,n as We,o as Ge,p as Ke,r as qe,s as D,t as O,u as k,v as Je,w as A,x as Ye,y as Xe}from"./token-CK6XGnWp.js";import{t as Ze}from"./cleartext-DHEMC21x.js";import{a as Qe,c as $e,d as et,f as tt,g as nt,h as rt,i as it,l as at,m as ot,n as st,o as j,p as ct,r as lt,s as ut,t as dt,u as M}from"./base-signer-Co79VFwf.js";import{a as ft,c as pt,i as mt,n as ht,o as gt,r as _t,s as vt,t as yt}from"./chains-CLv9HEJ_.js";import{getAddress as N,keccak256 as bt,toBytes as xt}from"viem";import{z as P}from"zod/mini";function St(e,t){if(e instanceof f){let n=t[e.code];if(n)return n(e)}return t._?.(e)}var Ct=class extends f{constructor(e,t){super(o.TransportKeyPairExpired,e,t),this.name=`TransportKeyPairExpiredError`}},wt=class extends f{constructor(e,t){super(o.InvalidTransportKeyPair,e,t),this.name=`InvalidTransportKeyPairError`}},Tt=class extends f{constructor(e,t){super(o.NoCiphertext,e,t),this.name=`NoCiphertextError`}},F=class extends f{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}},I=class extends f{constructor(e,t){super(o.DelegationSelfNotAllowed,e,t),this.name=`DelegationSelfNotAllowedError`}},Et=class extends f{constructor(e,t){super(o.DelegationCooldown,e,t),this.name=`DelegationCooldownError`}},L=class extends f{constructor(e,t){super(o.DelegationNotFound,e,t),this.name=`DelegationNotFoundError`}},R=class extends f{constructor(e,t){super(o.DelegationExpired,e,t),this.name=`DelegationExpiredError`}},z=class extends f{constructor(e,t){super(o.DelegationExpiryUnchanged,e,t),this.name=`DelegationExpiryUnchangedError`}},B=class extends f{constructor(e,t){super(o.DelegationDelegateEqualsContract,e,t),this.name=`DelegationDelegateEqualsContractError`}},Dt=class extends f{constructor(e,t){super(o.DelegationContractIsSelf,e,t),this.name=`DelegationContractIsSelfError`}},Ot=class extends f{constructor(e,t){super(o.AclPaused,e,t),this.name=`AclPausedError`}},V=class extends f{constructor(e,t){super(o.DelegationExpirationTooSoon,e,t),this.name=`DelegationExpirationTooSoonError`}},H=class extends f{constructor(e,t){super(o.DelegationNotPropagated,e,t),this.name=`DelegationNotPropagatedError`}};const kt=[C,Tt,l,H,pe,de,F,x];function U(e,i,o={}){if(kt.some(t=>e instanceof t))return e;let u=e instanceof Error?e.message:i;if(e instanceof Error&&n(e.message))return o.isDelegated?new H(`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:e}):new F({encryptedValue:a(e.message)??``,contractAddress:o.contractAddress??``,account:o.account??``},{cause:e});if(s(e))return new x(u,{cause:e,retryAfter:t(e)});let f=p(e);return f===void 0&&c(e)?new x(u,{cause:e,retryAfter:t(e)}):f===400?new Tt(e instanceof Error?e.message:`No ciphertext for this account`,{cause:e}):o.isDelegated&&f===500?new H(`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:e}):r(e)||f!==void 0?new l(u,f,{cause:e,retryAfter:t(e),retryable:d(e)||void 0}):new C(i,{cause:e})}function At(e,n){if(e instanceof f)return e;let i=p(e),a=d(e);return i!==void 0||r(e)?new l(e instanceof Error?e.message:n,i,{cause:e,retryAfter:t(e),retryable:a||void 0}):new S(n,{cause:e})}const jt=[{type:`function`,name:`allowance`,inputs:[{name:`owner`,type:`address`,internalType:`address`},{name:`spender`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`approve`,inputs:[{name:`spender`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`approveAndCall`,inputs:[{name:`spender`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`approveAndCall`,inputs:[{name:`spender`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`balanceOf`,inputs:[{name:`account`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`supportsInterface`,inputs:[{name:`interfaceId`,type:`bytes4`,internalType:`bytes4`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`totalSupply`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`transfer`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferFrom`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`event`,name:`Approval`,inputs:[{name:`owner`,type:`address`,indexed:!0,internalType:`address`},{name:`spender`,type:`address`,indexed:!0,internalType:`address`},{name:`value`,type:`uint256`,indexed:!1,internalType:`uint256`}],anonymous:!1},{type:`event`,name:`Transfer`,inputs:[{name:`from`,type:`address`,indexed:!0,internalType:`address`},{name:`to`,type:`address`,indexed:!0,internalType:`address`},{name:`value`,type:`uint256`,indexed:!1,internalType:`uint256`}],anonymous:!1}];function Mt(e,t,n,r=`0x`){return{address:e,abi:jt,functionName:`transferAndCall`,args:[t,n,r]}}function Nt(e){return it(e.signer,e.provider,e)}function W(e){return e.startsWith(`0x`)?e:`0x${e}`}var Pt=class{#e;#t;#n;#r;constructor(e){this.#e=e.signer,this.#t=e.provider,this.#n=e.router,this.#r=e.decryptionService}#i(e){return _(this.#r,e)}async decryptValues(e,t){let n=this.#i(`decryptValues`),r=await k(`decryptValues`,this.#e,this.#t);return n.decryptValues(e,r.address,t)}async delegatedDecryptValues(e,t,n=t,r){let i=this.#i(`delegatedDecryptValues`),a=await k(`delegatedDecryptValues`,this.#e,this.#t);return i.delegatedDecryptValues(e,t,a.address,n,r)}async decryptPublicValues(e,t){if(e.length===0)return{clearValues:{},decryptionProof:`0x`,abiEncodedClearValues:`0x`};try{let n=await this.#n.relayer.decryptPublicValuesWithSignatures({encryptedValues:e,options:t}),r={};return n.checkSignaturesArgs.handlesList.forEach((e,t)=>{He(n.clearValues[t],`result.clearValues[${t}]`),r[e]=n.clearValues[t].value}),{clearValues:r,abiEncodedClearValues:n.checkSignaturesArgs.abiEncodedCleartexts,decryptionProof:n.checkSignaturesArgs.decryptionProof}}catch(e){throw U(e,`Public decryption failed`)}}async delegatedBatchDecryptValues({encryptedInputs:e,delegatorAddress:t,accountAddress:n=t,maxConcurrency:r,waitForPropagation:i}){let a=this.#i(`delegatedBatchDecryptValues`),o=await k(`delegatedBatchDecryptValues`,this.#e,this.#t);return a.delegatedBatchDecryptHandlesAs({encryptedInputs:e,delegatorAddress:t,delegateAddress:o.address,accountAddress:n,maxConcurrency:r,waitForPropagation:i})}},Ft=class{#e;#t;#n;constructor(e){this.#e=e.signer,this.#t=e.provider,this.#n=e.delegationService}#r(e){return _(this.#e,e)}async delegateDecryption({contractAddress:e,delegateAddress:t,expirationDate:n}){let r=this.#r(`delegateDecryption`),i=await k(`delegateDecryption`,this.#e,this.#t);return this.#n.delegateDecryption(r,{contractAddress:e,delegateAddress:t,delegatorAddress:i.address,expirationDate:n})}async revokeDelegation({contractAddress:e,delegateAddress:t}){let n=this.#r(`revokeDelegation`),r=await k(`revokeDelegation`,this.#e,this.#t);return this.#n.revokeDelegation(n,{contractAddress:e,delegateAddress:t,delegatorAddress:r.address})}async isActive(e){return this.#n.isDelegated(e)}async getExpiry(e){return this.#n.getDelegationExpiry(e)}},It=class{#e;#t;#n;#r;#i;constructor(e){this.#e=e.signer,this.#t=e.provider,this.#n=e.cachingService,this.#r=e.credentialService,this.#i=e.logger}#a(e){return _(this.#r,e)}async grantPermit(e){if(e.length===0)return;let t=this.#a(`grantPermit`);await T(`grantPermit`,this.#e,this.#t),await t.grantPermit(e)}async grantDelegationPermit(e,t){if(t.length===0)return;let n=this.#a(`grantDelegationPermit`);await T(`grantDelegationPermit`,this.#e,this.#t),await n.grantPermit(t,e)}async hasPermit(e){return this.#r?this.#r.hasPermit(e):!1}async hasDelegationPermit(e,t){return this.#r?this.#r.hasPermit(t,e):!1}async warmTransportKeyPair(){let e=this.#r;if(!e)return;let t=this.#e?.walletAccount.getSnapshot();t&&await e.warmTransportKeyPair(t.address)}async revokePermits(e){let t=this.#a(`revokePermits`),n=N((await k(`revokePermits`,this.#e,this.#t)).address);try{await t.revokePermits(e)}finally{await v(`clear decrypt cache`,()=>this.#n.clearForRequester(n),this.#i)}}async clear(){let e=this.#a(`clear`),t=N((await k(`clear`,this.#e,this.#t)).address);try{await e.clearCredentials()}finally{await v(`clear decrypt cache`,()=>this.#n.clearForRequester(t),this.#i)}}};const Lt=P.union([P.bigint(),P.boolean(),at]),Rt=P.array(P.string());var zt=class{#e;#t;#n=`zama:decrypt`;#r=`${this.#n}:keys`;#i=Promise.resolve();constructor(e,t){this.#e=e,this.#t=t}async get(e,t,n){try{let r=this.#c(e,t,n),i=await this.#e.get(r);if(i===null)return null;let a=Lt.safeParse(i);return a.success?a.data:(await this.delete(e,t,n),null)}catch(e){return this.#t.warn(`CachingService.get failed`,{error:e}),null}}async set(e,t,n,r){try{let i=this.#c(e,t,n);await this.#e.set(i,r),this.#i=this.#i.then(()=>this.#u(i).catch(e=>{this.#t.warn(`CachingService index write failed`,{error:e})})),await this.#i}catch(e){this.#t.warn(`CachingService.set failed`,{error:e})}}async delete(e,t,n){let r=this.#c(e,t,n);this.#i=this.#i.then(()=>this.#a(r).catch(e=>{this.#t.warn(`CachingService.delete failed`,{error:e})})),await this.#i}async clearForRequester(e){this.#i=this.#i.then(()=>this.#o(e).catch(e=>{this.#t.warn(`CachingService.clearForRequester failed`,{error:e})})),await this.#i}async clearAll(){this.#i=this.#i.then(()=>this.#s().catch(e=>{this.#t.warn(`CachingService.clearAll failed`,{error:e})})),await this.#i}async#a(e){await this.#e.delete(e).catch(()=>{});let t=await this.#l(),n=t.filter(t=>t!==e);n.length!==t.length&&await this.#e.set(this.#r,n)}async#o(e){let t=N(e),n=`${this.#n}:${t}:`,r=await this.#l(),i=[],a=[];for(let e of r)e.startsWith(n)?i.push(e):a.push(e);await Promise.all(i.map(e=>this.#e.delete(e).catch(()=>{}))),await this.#e.set(this.#r,a)}async#s(){let e=await this.#l();await Promise.all(e.map(e=>this.#e.delete(e).catch(()=>{}))),await this.#e.delete(this.#r)}#c(e,t,n){return`${this.#n}:${N(e)}:${N(t)}:${n.toLowerCase()}`}async#l(){let e=await this.#e.get(this.#r);if(e===null)return[];let t=Rt.safeParse(e);return t.success?t.data:(await this.#e.delete(this.#r).catch(()=>{}),[])}async#u(e){let t=await this.#l();t.includes(e)||(t.push(e),await this.#e.set(this.#r,t))}};function Bt(e,t){let n=Vt(e,t);if(!n)throw new C(`No permit covers contract ${t} after allow()`);return{privateKey:e.keypair.privateKey,publicKey:e.keypair.publicKey,serializedPermit:n.serializedPermit}}function Vt(e,t){let n=$e(t);return e.permissions.find(e=>e.contractAddresses.includes(n))}const Ht=e=>new Promise(t=>setTimeout(t,e));var Ut=class{#e;#t;#n;#r;#i;constructor({cache:e,credentialService:t,delegationService:n,router:r,emitEvent:i}){this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#i=i}async decryptValues(e,t,n){let r=N(t);return this.#s(e,{requesterAddress:r,aclActorAddress:r,resolveCredentials:e=>this.#t.grantPermit(e),decryptContract:({credentials:e,contractAddress:t,encryptedValues:n,options:r})=>this.#o(e,t,n,r),errorMessage:`Failed to decrypt encrypted values`},n)}async delegatedDecryptValues(e,t,n,r,i){let a=N(t),o=N(n);return this.#a(i?.waitForPropagation??!0,()=>this.#s(e,{requesterAddress:N(r),aclActorAddress:a,resolveCredentials:e=>this.#t.grantPermit(e,a),validate:e=>this.#f(e,{delegatorAddress:a,delegateAddress:o}),decryptContract:({credentials:e,contractAddress:t,encryptedValues:n,options:r})=>this.#o(e,t,n,r),errorMessage:`Failed to decrypt delegated encrypted values`,delegated:!0}))}async#a(e,t){let n;for(let r=0;r<16;r++)try{return await t()}catch(t){if(n=t,!(r<15&&e&&t instanceof H))throw t;await Ht(2e3)}throw n}async delegatedBatchDecryptHandlesAs({encryptedInputs:e,delegatorAddress:t,delegateAddress:n,accountAddress:r,maxConcurrency:i=5,waitForPropagation:a=!0}){let o=e.map(e=>({encryptedValue:e.encryptedValue,contractAddress:N(e.contractAddress)}));if(o.length===0)return{items:o};let s=N(r);try{let e=await this.delegatedDecryptValues(o.map(({encryptedValue:e,contractAddress:t})=>({encryptedValue:e,contractAddress:t})),t,n,s,{waitForPropagation:a});for(let t of o)this.#l(t,e);return{items:o}}catch(e){if(Ie(e))throw e;if(o.length===1){let[n=this.#d()]=o;return n.error=this.#u(e,`Failed to decrypt delegated encrypted values`,{isDelegated:!0,contractAddress:n.contractAddress,account:N(t)}),{items:o}}}let c=!1;return await Ge(o.map(e=>async()=>{if(!c)try{let r=await this.delegatedDecryptValues([{encryptedValue:e.encryptedValue,contractAddress:e.contractAddress}],t,n,s,{waitForPropagation:!1});this.#l(e,r)}catch(n){if(Ie(n))throw c=!0,n;e.error=this.#u(n,`Failed to decrypt delegated encrypted values`,{isDelegated:!0,contractAddress:e.contractAddress,account:N(t)})}}),i),{items:o}}async#o(e,t,n,r){let i=Bt(e,t),a=await this.#r.relayer.parseTransportKeyPair({publicKey:i.publicKey,privateKey:i.privateKey}),o=await this.#r.relayer.parseSignedDecryptionPermit({transportKeyPair:a,serializedPermit:i.serializedPermit});return this.#r.relayer.decryptValues({transportKeyPair:a,signedPermit:o,encryptedValues:n,contractAddress:t,options:r})}async#s(e,t,n){if(e.length===0)return{};let r=e.map(e=>({encryptedValue:e.encryptedValue,contractAddress:N(e.contractAddress)})),a={},o=[];for(let e of r)w(e.encryptedValue)?a[e.encryptedValue]=0n:o.push(e);if(o.length===0)return a;let s=Array.from(new Set(r.map(e=>e.contractAddress))),l=Array.from(new Set(o.map(e=>e.contractAddress)));if(t.validate)try{await t.validate(l)}catch(e){throw c(e)?this.#c(e,`the delegation pre-check`):e}let u=[];for(let e of o){let n=await this.#e.get(t.requesterAddress,e.contractAddress,e.encryptedValue);n===null?u.push(e):a[e.encryptedValue]=n}if(u.length===0)return a;let d=await t.resolveCredentials(s),p=new Map;for(let e of u){let t=p.get(e.contractAddress);t?t.push(e.encryptedValue):p.set(e.contractAddress,[e.encryptedValue])}let m=[];for(let[e,t]of p)for(let n of Ve(t))m.push({contractAddress:e,encryptedValues:n});let h=Date.now(),g=u.map(e=>e.encryptedValue);try{this.#i({type:D.DecryptStart,encryptedValues:g}),await Ge(m.map(({contractAddress:e,encryptedValues:r})=>async()=>{let i;try{i=await t.decryptContract({credentials:d,contractAddress:e,encryptedValues:r,options:n})}catch(n){throw U(n,t.errorMessage,{isDelegated:t.delegated,contractAddress:e,account:t.aclActorAddress})}for(let n=0;n<r.length;n++){let o=r[n],s=i[n]?.value;o===void 0||s===void 0||(a[o]=s,await this.#e.set(t.requesterAddress,e,o,s))}let o=r.filter(e=>a[e]===void 0);if(o.length>0)throw new C(`${t.errorMessage}: relayer returned no clear value for ${o.length} of ${r.length} handle(s) on ${e}`,{cause:AggregateError(o.map(t=>new C(`No clear value for handle ${t} on ${e}`)),`${o.length} handle(s) missing a clear value on ${e}`)})}),5);let e={};for(let t of g){let n=a[t];n!==void 0&&(e[t]=n)}return this.#i({type:D.DecryptEnd,durationMs:Date.now()-h,encryptedValues:g,result:e}),a}catch(e){let n=e instanceof f&&e.cause instanceof Error?e.cause:e;throw this.#i({type:D.DecryptError,error:i(n),durationMs:Date.now()-h,encryptedValues:g}),U(e,t.errorMessage,{isDelegated:t.delegated})}}#c(e,n){return new x(`RPC provider rate-limited ${n}; retry with backoff.`,{cause:e,retryAfter:t(e)})}#l(e,t){let n=t[e.encryptedValue];if(n===void 0){e.error=new C(`Batch delegated decryption returned no value for encrypted value ${e.encryptedValue} on contract ${e.contractAddress}`);return}e.value=n}#u(e,t,n){return e instanceof f?e:U(e,t,n)}#d(){throw new C(`Batch delegated decryption invariant failed: missing item`)}async#f(e,{delegatorAddress:t,delegateAddress:n}){let r=await this.#n.findInactiveDelegations(e,t,n);if(r.size!==0)for(let e of r.values())throw e}};function Wt(e){if(!(e instanceof Error))return null;let t=e.cause;if(typeof t!=`object`||!t||!(`data`in t))return null;let{data:n}=t;return typeof n!=`object`||!n||!(`errorName`in n)?null:typeof n.errorName==`string`?n.errorName:null}const G={AlreadyDelegatedOrRevokedInSameBlock:e=>new Et(`Only one delegate/revoke per (delegator, delegate, contract) per block. Wait for the next block before retrying.`,{cause:e}),SenderCannotBeContractAddress:e=>new Dt(`The contract address cannot be the caller address.`,{cause:e}),EnforcedPause:e=>new Ot(`The ACL contract is paused. Delegation operations are temporarily disabled.`,{cause:e}),SenderCannotBeDelegate:e=>new I(`Cannot delegate to yourself (delegate === msg.sender).`,{cause:e}),DelegateCannotBeContractAddress:e=>new B(`Delegate address cannot be the same as the contract address.`,{cause:e}),ExpirationDateBeforeOneHour:e=>new V(`Expiration date must be at least 1 hour in the future.`,{cause:e}),ExpirationDateAlreadySetToSameValue:e=>new z(`The new expiration date is the same as the current one.`,{cause:e}),NotDelegatedYet:e=>new L(`Cannot revoke: no active delegation exists.`,{cause:e})};function Gt(e){return e in G}function Kt(e,t){let n=Wt(e);if(n&&Gt(n))return G[n](t);let r=e instanceof Error?e.message:String(e);for(let[e,n]of Object.entries(G))if(r.includes(e))return n(t);return null}var qt=class{#e;#t;#n;#r;constructor({provider:e,router:t,emitEvent:n=()=>{},logger:r}){this.#t=e,this.#e=t,this.#r=r,this.#n=n}async delegateDecryption(e,{contractAddress:t,delegateAddress:n,delegatorAddress:r,expirationDate:i}){if(i&&i.getTime()<Date.now()+36e5)throw new V(`Expiration date must be at least 1 hour in the future`);let a=N(t),o=N(n),s=N(r);if(o===s)throw new I(`Cannot delegate to yourself (delegate === msg.sender).`);if(o===a)throw new B(`Delegate address cannot be the same as the contract address (${a}).`);let c=this.#e.relayer.chain.aclContractAddress,l=i?BigInt(Math.floor(i.getTime()/1e3)):E,u;try{u=await this.getDelegationExpiry({contractAddress:a,delegatorAddress:s,delegateAddress:o})}catch(e){this.#r.warn(`delegateDecryption: pre-flight expiry check failed`,{error:e}),u=-1n}if(u===l)throw new z(`The new expiration date (${l}) is the same as the current one. No on-chain change needed.`);return this.#i({operation:`delegateDecryption`,signer:e,contractAddress:t,config:Ke(c,o,a,l)})}async revokeDelegation(e,{contractAddress:t,delegateAddress:n,delegatorAddress:r}){let i=N(t),a=N(n),o=N(r),s=this.#e.relayer.chain.aclContractAddress,c;try{c=await this.getDelegationExpiry({contractAddress:i,delegatorAddress:o,delegateAddress:a})}catch(e){this.#r.warn(`revokeDelegation: pre-flight expiry check failed`,{error:e}),c=1n}if(c===0n)throw new L(`No active delegation found for delegate ${a} on contract ${i}.`);return this.#i({operation:`revokeDelegation`,signer:e,contractAddress:t,config:ze(s,a,i)})}async isDelegated(e){let t=await this.getDelegationExpiry(e);return t===0n?!1:t===E?!0:t>await this.#t.getBlockTimestamp()}async getDelegationExpiry({contractAddress:e,delegatorAddress:t,delegateAddress:n}){let r=this.#e.relayer.chain.aclContractAddress;return this.#t.readContract(Ue(r,N(t),N(n),N(e)))}async#i({operation:e,signer:t,contractAddress:n,config:r}){try{return await We({operation:e,signer:t,provider:this.#t,config:r,emit:e=>this.#n(e,n),logger:this.#r})}catch(e){throw this.#a(e),e}}#a(e){if(!(e instanceof A))return;let t=Kt(e.cause??e,e);if(t)throw t}async findInactiveDelegations(e,t,n){let r=new Map;return await Promise.all(e.map(async e=>{try{await this.assertDelegationActive(e,t,n)}catch(t){if(t instanceof L||t instanceof R){let n=N(e);r.set(n,t);return}throw t}})),r}async assertDelegationActive(e,t,n){let r=N(e),i=N(t),a=N(n),o=await this.getDelegationExpiry({contractAddress:r,delegatorAddress:i,delegateAddress:a});if(o===0n)throw new L(`No active delegation from ${i} to ${a} for ${r}`);if(o!==E&&o<=await this.#t.getBlockTimestamp())throw new R(`Delegation from ${i} to ${a} for ${r} has expired`)}},Jt=class{#e;#t;constructor({router:e,emitEvent:t}){this.#e=e,this.#t=t}async encryptValues(e,t){let n=Date.now(),r=N(e.contractAddress);try{this.#t({type:D.EncryptStart},r);let i=await this.#e.relayer.encryptValues({...e,options:t});return this.#t({type:D.EncryptEnd,durationMs:Date.now()-n},r),i}catch(e){throw this.#t({type:D.EncryptError,error:i(e),durationMs:Date.now()-n},r),At(e,`Encryption failed`)}}},Yt=class{#e;#t;#n;#r;#i;#a=new Set;#o;constructor(e){this.#e=e.signer,this.#t=e.router,this.#n=e.cachingService,this.#r=e.credentialService,this.#i=e.logger,this.#e&&(this.#o=this.#e.walletAccount.subscribe(e=>{this.#s(e).catch(e=>{this.#i.warn(`wallet account handler failed`,{error:e})})}))}onWalletAccountChange(e){return this.#a.add(e),()=>{this.#a.delete(e)}}dispose(){this.#o?.(),this.#o=void 0,this.#a.clear()}async#s(e){let t=e.previous,n=e.next,r=n?.chainId;r!==void 0&&await v(`switch relayer chain`,()=>this.#t.switchChain(r),this.#i);let i=this.#r;i&&await v(`credential wallet account change`,()=>i.handleWalletAccountChange(t,n),this.#i),t&&await v(`clear decrypt cache`,()=>this.#n.clearForRequester(t.address),this.#i),await Promise.all(Array.from(this.#a,t=>v(`wallet account listener`,()=>t(e),this.#i)))}};function K(e){return bt(xt(e))}const q={ConfidentialTransfer:K(`ConfidentialTransfer(address,address,bytes32)`),Wrap:K(`Wrap(address,uint256,bytes32)`),UnwrapRequested:K(`UnwrapRequested(address,bytes32,bytes32)`),UnwrapFinalized:K(`UnwrapFinalized(address,bytes32,bytes32,uint64)`)};function J(e){return N(W(e.slice(-40)))}function Xt(e){return e}function Zt(e,t){let n=2+t*64,r=e.slice(n,n+64);return r.length===64?r:r.padEnd(64,`0`)}function Qt(e,t){return N(W(Zt(e,t).slice(-40)))}function Y(e,t){return BigInt(`0x`+Zt(e,t))}function $t(e,t){return W(Zt(e,t))}function en(e){return e.topics[0]!==q.ConfidentialTransfer||e.topics.length<4?null:{eventName:`ConfidentialTransfer`,from:J(e.topics[1]),to:J(e.topics[2]),encryptedAmount:Xt(e.topics[3])}}function tn(e){return e.topics[0]!==q.Wrap||e.topics.length<2?null:{eventName:`Wrap`,to:J(e.topics[1]),roundedAmount:Y(e.data,0),encryptedWrappedAmount:$t(e.data,1)}}function nn(e){return e.topics[0]!==q.UnwrapRequested||e.topics.length<3?null:{eventName:`UnwrapRequested`,receiver:J(e.topics[1]),unwrapRequestId:Xt(e.topics[2]),encryptedAmount:$t(e.data,0)}}function rn(e){return e.topics[0]!==q.UnwrapFinalized||e.topics.length<3?null:{eventName:`UnwrapFinalized`,receiver:J(e.topics[1]),unwrapRequestId:Xt(e.topics[2]),encryptedAmount:$t(e.data,0),cleartextAmount:Y(e.data,1)}}function an(e){return en(e)??tn(e)??nn(e)??rn(e)}function on(e){let t=[];for(let n of e){let e=an(n);e&&t.push(e)}return t}function sn(e){for(let t of e){let e=nn(t);if(e)return e}return null}function cn(e){for(let t of e){let e=tn(t);if(e)return e}return null}const ln=[q.ConfidentialTransfer,q.Wrap,q.UnwrapRequested,q.UnwrapFinalized],X={DelegatedForUserDecryption:K(`DelegatedForUserDecryption(address,address,address,uint64,uint64,uint64)`),RevokedDelegationForUserDecryption:K(`RevokedDelegationForUserDecryption(address,address,address,uint64,uint64)`)};function Z(e){return e.topics[0]!==X.DelegatedForUserDecryption||e.topics.length<3?null:{eventName:`DelegatedForUserDecryption`,delegator:J(e.topics[1]),delegate:J(e.topics[2]),contractAddress:Qt(e.data,0),delegationCounter:Y(e.data,1),oldExpirationDate:Y(e.data,2),newExpirationDate:Y(e.data,3)}}function Q(e){return e.topics[0]!==X.RevokedDelegationForUserDecryption||e.topics.length<3?null:{eventName:`RevokedDelegationForUserDecryption`,delegator:J(e.topics[1]),delegate:J(e.topics[2]),contractAddress:Qt(e.data,0),delegationCounter:Y(e.data,1),oldExpirationDate:Y(e.data,2)}}function un(e){return Z(e)??Q(e)}function dn(e){let t=[];for(let n of e){let e=un(n);e&&t.push(e)}return t}function fn(e){for(let t of e){let e=Z(t);if(e)return e}return null}function pn(e){for(let t of e){let e=Q(t);if(e)return e}return null}const mn=[X.DelegatedForUserDecryption,X.RevokedDelegationForUserDecryption];function $(e){return`zama:pending-unshield:${$e(e)}`}const hn=P.union([P.pipe(M,P.transform(e=>({unwrapTxHash:e}))),P.pipe(P.object({version:P.literal(1),unwrapTxHash:M,unwrapRequestId:P.optional(M)}),P.transform(({unwrapTxHash:e,unwrapRequestId:t})=>({unwrapTxHash:e,unwrapRequestId:t})))]);async function gn(e,t,n,r){if(r===void 0){await e.set($(t),n);return}await e.set($(t),{version:1,unwrapTxHash:n,unwrapRequestId:r})}async function _n(e,t){return(await vn(e,t))?.unwrapTxHash??null}async function vn(e,t){let n=$(t),r=await e.get(n);if(r==null)return null;let i=hn.safeParse(r);return i.success?i.data:(await e.delete(n),null)}async function yn(e,t){await e.delete($(t))}var bn=class extends O{#e;#t=null;#n=null;#r(e){try{return He(this.sdk.signer,`WrappedToken.sdk.signer`),this.sdk.signer}catch(t){throw new ce(e,{cause:t})}}async underlying(){return this.#o()}async isPayable(){if(this.#n!==null)return this.#n;try{let e=await this.#o();this.#n=await this.sdk.provider.readContract(De(e))}catch{this.#n=!1}return this.#n}async allowance(e){let t=await this.#o();return this.sdk.provider.readContract(b(t,N(e),this.address))}async shield(e,t){let n=await k(`shield`,this.sdk.signer,this.sdk.provider),r=await this.isPayable(),a=await this.#o(),o=N(n.address),s;try{s=await this.sdk.provider.readContract(me(a,o))}catch(e){throw e instanceof f?e:new Xe(`Could not read ERC-20 balance for shield validation (token: ${a})`,{cause:i(e)})}if(s<e)throw new Ye(`Insufficient ERC-20 balance: requested ${e}, available ${s} (token: ${a})`,{requested:e,available:s,token:a});return r?this.#i(e,a,o,t):this.#a(e,o,t)}async#i(e,t,n,r){this.#r(`shield`);let i=r?.to?N(r.to):n,a=i===n?`0x`:i;return this.submitTransaction({operation:`shield:transferAndCall`,config:Mt(t,this.address,e,a),onSubmitted:r?.onShieldSubmitted})}async#a(e,t,n){this.#r(`shield`);let r=n?.approvalStrategy??`exact`;r!==`skip`&&await this.#c(e,r===`max`,n);let i=n?.to?N(n.to):t;return this.submitTransaction({operation:`shield:approveAndWrap`,config:re(this.address,i,e),onSubmitted:n?.onShieldSubmitted})}async approveUnderlying(e){this.#r(`approveUnderlying`);let t=await k(`approveUnderlying`,this.sdk.signer,this.sdk.provider),n=await this.#o(),r=N(t.address),i=e??2n**256n-1n;return i>0n&&await this.sdk.provider.readContract(b(n,r,this.address))>0n&&await this.submitTransaction({operation:`approveUnderlying:reset`,config:y(n,this.address,0n)}),this.submitTransaction({operation:`approveUnderlying`,config:y(n,this.address,i)})}async unshield(e,t){let{skipBalanceCheck:n=!1,onUnwrapSubmitted:r,onFinalizing:i,onFinalizeSubmitted:a}=t??{};n||await this.assertConfidentialBalance(e);let o={onFinalizing:i,onFinalizeSubmitted:a},s=crypto.randomUUID(),c=await this.unwrap(e);return v(`unshield: onUnwrapSubmitted`,()=>r?.(c.txHash),this.sdk.logger),this.#s(c.txHash,s,o)}async unshieldAll(e){let t=crypto.randomUUID(),n=await this.unwrapAll();return v(`unshieldAll: onUnwrapSubmitted`,()=>e?.onUnwrapSubmitted?.(n.txHash),this.sdk.logger),this.#s(n.txHash,t,e)}async resumeUnshield(e,t){return this.#s(e,crypto.randomUUID(),t)}async getPendingUnshield(){return _n(this.sdk.storage,this.address)}async unwrap(e){this.#r(`unwrap`);let t=N((await k(`unwrap`,this.sdk.signer,this.sdk.provider)).address),{encryptedValues:n,inputProof:r}=await this.sdk.encrypt({values:[{value:e,type:`euint64`}],contractAddress:this.address,userAddress:t}),[i]=n;if(!i)throw new S(`Encryption returned no encrypted values`);return this.submitTransaction({operation:`unwrap`,config:se(this.address,t,t,i,r)})}async unwrapAll(){this.#r(`unwrapAll`);let e=N((await k(`unwrapAll`,this.sdk.signer,this.sdk.provider)).address),t=await this.readConfidentialBalanceOf(e);if(w(t))throw new C(`Cannot unshield: balance is zero`);return this.submitTransaction({operation:`unwrapAll`,config:ne(this.address,e,e,t)})}async finalizeUnwrap(e){this.#r(`finalizeUnwrap`),await T(`finalizeUnwrap`,this.sdk.signer,this.sdk.provider);let t=await this.sdk.decryption.decryptPublicValues([e]),n=t.clearValues[e];return Re(n,`finalizeUnwrap: clearValue`),this.submitTransaction({operation:`finalizeUnwrap`,config:oe(this.address,e,n,t.decryptionProof)})}async#o(){return this.#e===void 0?(this.#t||=this.sdk.provider.readContract(ae(this.address)).then(e=>(this.#e=e,this.#t=null,e)).catch(e=>{throw this.#t=null,e}),this.#t):this.#e}async#s(e,t,n){this.emit({type:D.UnshieldPhase1Submitted,txHash:e,operationId:t}),await v(`unshield: savePendingUnshield`,()=>gn(this.sdk.storage,this.address,e),this.sdk.logger);let r;try{r=await this.sdk.provider.waitForTransactionReceipt(e)}catch(e){throw e instanceof f?e:new A(`Failed to get unshield receipt`,{cause:e})}let i=sn(r.logs);if(!i)throw new A(`No UnwrapRequested event found in unshield receipt`);this.emit({type:D.UnshieldPhase2Started,operationId:t}),v(`unshield: onFinalizing`,()=>n?.onFinalizing?.(),this.sdk.logger);let a=await this.finalizeUnwrap(i.unwrapRequestId??i.encryptedAmount);return this.emit({type:D.UnshieldPhase2Submitted,txHash:a.txHash,operationId:t}),v(`unshield: onFinalizeSubmitted`,()=>n?.onFinalizeSubmitted?.(a.txHash),this.sdk.logger),await v(`unshield: clearPendingUnshield`,()=>yn(this.sdk.storage,this.address),this.sdk.logger),a}async#c(e,t,n){this.#r(`approveUnderlying`);let r=await this.#o(),i=N((await k(`approveUnderlying`,this.sdk.signer,this.sdk.provider)).address),a=await this.sdk.provider.readContract(b(r,i,this.address));if(a>=e)return;a>0n&&await this.submitTransaction({operation:`approveUnderlying:reset`,config:y(r,this.address,0n)});let o=t?2n**256n-1n:e;await this.submitTransaction({operation:`approveUnderlying`,config:y(r,this.address,o),onSubmitted:n?.onApprovalSubmitted})}},xn=class{#e;provider;signer;storage;registry;permits;delegations;decryption;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e){this.#e=e.router,this.provider=e.provider,this.signer=e.signer,this.storage=e.storage,this.#r=e.onEvent??function(){},this.#i=e.logger,this.#a=new zt(e.storage,this.#i),this.#u=new qt({provider:this.provider,router:e.router,emitEvent:this.emitEvent.bind(this),logger:this.#i});let t={};for(let n of e.chains)n.registryAddress&&(t[n.id]=n.registryAddress);this.registry=new j({provider:this.provider,registryAddresses:t,registryTTL:e.registryTTL}),this.#n=t,this.#t=e.registryTTL,e.signer&&(this.#l=new ut({router:e.router,signer:e.signer,transportKeyPairTTL:e.transportKeyPairTTL,permitTTL:e.permitTTL,storage:this.storage,permitStorage:e.permitStorage,logger:this.#i}),this.#c=new Ut({cache:this.#a,credentialService:this.#l,delegationService:this.#u,router:e.router,emitEvent:this.emitEvent.bind(this)})),this.#s=new Jt({router:e.router,emitEvent:this.emitEvent.bind(this)}),this.#o=new Yt({signer:e.signer,router:e.router,cachingService:this.#a,credentialService:this.#l,logger:this.#i}),this.permits=new It({signer:this.signer,provider:this.provider,cachingService:this.#a,credentialService:this.#l,logger:this.#i}),this.delegations=new Ft({signer:this.signer,provider:this.provider,delegationService:this.#u}),this.decryption=new Pt({signer:this.signer,provider:this.provider,router:e.router,decryptionService:this.#c})}onWalletAccountChange(e){return this.#o.onWalletAccountChange(e)}get logger(){return this.#i}get relayer(){return this.#e.relayer}emitEvent(e,t){try{this.#r({...e,tokenAddress:t,timestamp:Date.now()})}catch(t){this.#i.warn(`${e.type} event listener silently failed`,{error:t})}}createWrappersRegistry(e){return new j({provider:this.provider,registryAddresses:{...this.#n,...e},registryTTL:this.#t})}async encrypt(e,t){return this.#s.encryptValues(e,t)}createToken(e){return new O(this,e)}createWrappedToken(e){return new bn(this,e)}dispose(){this.#o.dispose()}terminate(){this.dispose(),this.signer?.dispose?.()}[Symbol.dispose](){this.terminate()}},Sn=class{async get(e){return(await chrome.storage.session.get(e))[e]??null}async set(e,t){await chrome.storage.session.set({[e]:t})}async delete(e){await chrome.storage.session.remove(e)}};const Cn=new Sn;export{mn as ACL_TOPICS,Ot as AclPausedError,X as AclTopics,Je as BalanceCheckUnavailableError,dt as BaseSigner,Fe as ChainMismatchError,Sn as ChromeSessionStorage,m as ConfigurationError,Pt as Decryption,C as DecryptionFailedError,Qe as DefaultRegistryAddresses,Dt as DelegationContractIsSelfError,Et as DelegationCooldownError,B as DelegationDelegateEqualsContractError,V as DelegationExpirationTooSoonError,R as DelegationExpiredError,z as DelegationExpiryUnchangedError,L as DelegationNotFoundError,H as DelegationNotPropagatedError,I as DelegationSelfNotAllowedError,Ft as Delegations,_e as ERC1363_INTERFACE_ID,Xe as ERC20ReadFailedError,Ce as ERC7984_INTERFACE_ID,je as ERC7984_WRAPPER_INTERFACE_ID,S as EncryptionFailedError,rt as IndexedDBStorage,Le as InsufficientConfidentialBalanceError,Ye as InsufficientERC20BalanceError,wt as InvalidTransportKeyPairError,ct as MemoryStorage,st as MutableWalletAccountStore,Tt as NoCiphertextError,F as NotEntitledError,It as Permits,l as RelayerRequestFailedError,x as RpcRateLimitError,ce as SignerNotConfiguredError,Pe as SignerRequiredError,de as SigningFailedError,pe as SigningRejectedError,ln as TOKEN_TOPICS,O as Token,q as Topics,A as TransactionRevertedError,Ct as TransportKeyPairExpiredError,g as WalletAccountNotReadyError,fe as WalletNotConnectedError,bn as WrappedToken,j as WrappersRegistry,qe as ZERO_ENCRYPTED_VALUE,f as ZamaError,o as ZamaErrorCode,xn as ZamaSDK,D as ZamaSDKEvents,b as allowanceContract,yt as anvil,y as approveContract,me as balanceOfContract,ht as bscTestnet,_t as chains,Cn as chromeSessionStorage,Ze as cleartext,le as confidentialBalanceOfContract,ee as confidentialTotalSupplyContract,ue as confidentialTransferContract,te as confidentialTransferFromContract,Nt as createConfig,lt as createWalletAccountStore,Me as decimalsContract,un as decodeAclEvent,dn as decodeAclEvents,en as decodeConfidentialTransfer,Z as decodeDelegatedForUserDecryption,an as decodeOnChainEvent,on as decodeOnChainEvents,Q as decodeRevokedDelegationForUserDecryption,rn as decodeUnwrapFinalized,nn as decodeUnwrapRequested,tn as decodeWrap,Ke as delegateForUserDecryptionContract,oe as finalizeUnwrapContract,fn as findDelegatedForUserDecryption,pn as findRevokedDelegationForUserDecryption,sn as findUnwrapRequested,cn as findWrap,Ae as getConfidentialTokenAddressContract,Ue as getDelegationExpiryContract,Te as getTokenAddressContract,Oe as getTokenPairContract,be as getTokenPairsContract,he as getTokenPairsLengthContract,Ee as getTokenPairsSliceContract,mt as hardhat,ft as hoodi,nt as indexedDBStorage,Se as inferredTotalSupplyContract,gt as ingenTestnet,ve as isConfidentialTokenContract,ke as isConfidentialTokenValidContract,ye as isConfidentialWrapperContract,w as isEncryptedValueZero,Be as isHandleDelegatedContract,h as isOperatorContract,e as isRetryable,vt as mainnet,St as matchZamaError,ot as memoryStorage,ge as nameContract,xe as rateContract,et as resolveChainRelayers,tt as resolveStorage,u as retryAfterSeconds,ze as revokeDelegationContract,pt as sepolia,ie as setOperatorContract,we as supportsInterfaceContract,Ne as symbolContract,Mt as transferAndCallContract,ae as underlyingContract,se as unwrapContract,ne as unwrapFromBalanceContract,re as wrapContract};
1
+ import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m}from"./relayer-BUxKmetl.js";import{A as h,B as g,C as ee,D as te,F as ne,H as _,I as re,L as v,M as ie,N as ae,O as oe,P as se,R as ce,S as le,T as ue,U as de,V as fe,W as pe,_ as me,a as he,b as ge,c as _e,d as ve,f as ye,g as y,h as b,i as be,j as xe,k as Se,l as Ce,m as we,n as Te,o as Ee,p as De,r as Oe,s as ke,t as Ae,u as je,v as Me,x as Ne,z as Pe}from"./wrappers-registry-vjouAqDk.js";import{C as x,E as S,S as Fe,T as C,_ as Ie,a as w,b as Le,c as Re,d as T,f as E,g as ze,h as Be,i as Ve,l as He,m as Ue,n as We,o as Ge,p as Ke,r as qe,s as D,t as O,u as k,v as Je,w as A,x as Ye,y as Xe}from"./token-CK6XGnWp.js";import{t as Ze}from"./cleartext-DHEMC21x.js";import{a as Qe,c as $e,d as et,f as tt,g as nt,h as rt,i as it,l as at,m as ot,n as st,o as j,p as ct,r as lt,s as ut,t as dt,u as M}from"./base-signer-Co79VFwf.js";import{a as ft,c as pt,i as mt,n as ht,o as gt,r as _t,s as vt,t as yt}from"./chains-CLv9HEJ_.js";import{getAddress as N,keccak256 as bt,toBytes as xt}from"viem";import{z as P}from"zod/mini";function St(e,t){if(e instanceof f){let n=t[e.code];if(n)return n(e)}return t._?.(e)}var Ct=class extends f{constructor(e,t){super(o.TransportKeyPairExpired,e,t),this.name=`TransportKeyPairExpiredError`}},wt=class extends f{constructor(e,t){super(o.InvalidTransportKeyPair,e,t),this.name=`InvalidTransportKeyPairError`}},Tt=class extends f{constructor(e,t){super(o.NoCiphertext,e,t),this.name=`NoCiphertextError`}},F=class extends f{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}},I=class extends f{constructor(e,t){super(o.DelegationSelfNotAllowed,e,t),this.name=`DelegationSelfNotAllowedError`}},Et=class extends f{constructor(e,t){super(o.DelegationCooldown,e,t),this.name=`DelegationCooldownError`}},L=class extends f{constructor(e,t){super(o.DelegationNotFound,e,t),this.name=`DelegationNotFoundError`}},R=class extends f{constructor(e,t){super(o.DelegationExpired,e,t),this.name=`DelegationExpiredError`}},z=class extends f{constructor(e,t){super(o.DelegationExpiryUnchanged,e,t),this.name=`DelegationExpiryUnchangedError`}},B=class extends f{constructor(e,t){super(o.DelegationDelegateEqualsContract,e,t),this.name=`DelegationDelegateEqualsContractError`}},Dt=class extends f{constructor(e,t){super(o.DelegationContractIsSelf,e,t),this.name=`DelegationContractIsSelfError`}},Ot=class extends f{constructor(e,t){super(o.AclPaused,e,t),this.name=`AclPausedError`}},V=class extends f{constructor(e,t){super(o.DelegationExpirationTooSoon,e,t),this.name=`DelegationExpirationTooSoonError`}},H=class extends f{constructor(e,t){super(o.DelegationNotPropagated,e,t),this.name=`DelegationNotPropagatedError`}};const kt=[C,Tt,l,H,pe,de,F,x];function U(e,i,o={}){if(kt.some(t=>e instanceof t))return e;let u=e instanceof Error?e.message:i;if(e instanceof Error&&n(e.message))return o.isDelegated?new H(`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:e}):new F({encryptedValue:a(e.message)??``,contractAddress:o.contractAddress??``,account:o.account??``},{cause:e});if(s(e))return new x(u,{cause:e,retryAfter:t(e)});let f=p(e);return f===void 0&&c(e)?new x(u,{cause:e,retryAfter:t(e)}):f===400?new Tt(e instanceof Error?e.message:`No ciphertext for this account`,{cause:e}):o.isDelegated&&f===500?new H(`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:e}):r(e)||f!==void 0?new l(u,f,{cause:e,retryAfter:t(e),retryable:d(e)||void 0}):new C(i,{cause:e})}function At(e,n){if(e instanceof f)return e;let i=p(e),a=d(e);return i!==void 0||r(e)?new l(e instanceof Error?e.message:n,i,{cause:e,retryAfter:t(e),retryable:a||void 0}):new S(n,{cause:e})}const jt=[{type:`function`,name:`allowance`,inputs:[{name:`owner`,type:`address`,internalType:`address`},{name:`spender`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`approve`,inputs:[{name:`spender`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`approveAndCall`,inputs:[{name:`spender`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`approveAndCall`,inputs:[{name:`spender`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`balanceOf`,inputs:[{name:`account`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`supportsInterface`,inputs:[{name:`interfaceId`,type:`bytes4`,internalType:`bytes4`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`totalSupply`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`transfer`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferFrom`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`function`,name:`transferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`value`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`nonpayable`},{type:`event`,name:`Approval`,inputs:[{name:`owner`,type:`address`,indexed:!0,internalType:`address`},{name:`spender`,type:`address`,indexed:!0,internalType:`address`},{name:`value`,type:`uint256`,indexed:!1,internalType:`uint256`}],anonymous:!1},{type:`event`,name:`Transfer`,inputs:[{name:`from`,type:`address`,indexed:!0,internalType:`address`},{name:`to`,type:`address`,indexed:!0,internalType:`address`},{name:`value`,type:`uint256`,indexed:!1,internalType:`uint256`}],anonymous:!1}];function Mt(e,t,n,r=`0x`){return{address:e,abi:jt,functionName:`transferAndCall`,args:[t,n,r]}}function Nt(e){return it(e.signer,e.provider,e)}function W(e){return e.startsWith(`0x`)?e:`0x${e}`}var Pt=class{#e;#t;#n;#r;constructor(e){this.#e=e.signer,this.#t=e.provider,this.#n=e.router,this.#r=e.decryptionService}#i(e){return _(this.#r,e)}async decryptValues(e,t){let n=this.#i(`decryptValues`),r=await k(`decryptValues`,this.#e,this.#t);return n.decryptValues(e,r.address,t)}async delegatedDecryptValues(e,t,n=t,r){let i=this.#i(`delegatedDecryptValues`),a=await k(`delegatedDecryptValues`,this.#e,this.#t);return i.delegatedDecryptValues(e,t,a.address,n,r)}async decryptPublicValues(e,t){if(e.length===0)return{clearValues:{},decryptionProof:`0x`,abiEncodedClearValues:`0x`};try{let n=await this.#n.relayer.decryptPublicValuesWithSignatures({encryptedValues:e,options:t}),r={};return n.checkSignaturesArgs.handlesList.forEach((e,t)=>{He(n.clearValues[t],`result.clearValues[${t}]`),r[e]=n.clearValues[t].value}),{clearValues:r,abiEncodedClearValues:n.checkSignaturesArgs.abiEncodedCleartexts,decryptionProof:n.checkSignaturesArgs.decryptionProof}}catch(e){throw U(e,`Public decryption failed`)}}async delegatedBatchDecryptValues({encryptedInputs:e,delegatorAddress:t,accountAddress:n=t,maxConcurrency:r,waitForPropagation:i}){let a=this.#i(`delegatedBatchDecryptValues`),o=await k(`delegatedBatchDecryptValues`,this.#e,this.#t);return a.delegatedBatchDecryptHandlesAs({encryptedInputs:e,delegatorAddress:t,delegateAddress:o.address,accountAddress:n,maxConcurrency:r,waitForPropagation:i})}},Ft=class{#e;#t;#n;constructor(e){this.#e=e.signer,this.#t=e.provider,this.#n=e.delegationService}#r(e){return _(this.#e,e)}async delegateDecryption({contractAddress:e,delegateAddress:t,expirationDate:n}){let r=this.#r(`delegateDecryption`),i=await k(`delegateDecryption`,this.#e,this.#t);return this.#n.delegateDecryption(r,{contractAddress:e,delegateAddress:t,delegatorAddress:i.address,expirationDate:n})}async revokeDelegation({contractAddress:e,delegateAddress:t}){let n=this.#r(`revokeDelegation`),r=await k(`revokeDelegation`,this.#e,this.#t);return this.#n.revokeDelegation(n,{contractAddress:e,delegateAddress:t,delegatorAddress:r.address})}async isActive(e){return this.#n.isDelegated(e)}async getExpiry(e){return this.#n.getDelegationExpiry(e)}},It=class{#e;#t;#n;#r;#i;constructor(e){this.#e=e.signer,this.#t=e.provider,this.#n=e.cachingService,this.#r=e.credentialService,this.#i=e.logger}#a(e){return _(this.#r,e)}async grantPermit(e){if(e.length===0)return;let t=this.#a(`grantPermit`);await T(`grantPermit`,this.#e,this.#t),await t.grantPermit(e)}async grantDelegationPermit(e,t){if(t.length===0)return;let n=this.#a(`grantDelegationPermit`);await T(`grantDelegationPermit`,this.#e,this.#t),await n.grantPermit(t,e)}async hasPermit(e){return this.#r?this.#r.hasPermit(e):!1}async hasDelegationPermit(e,t){return this.#r?this.#r.hasPermit(t,e):!1}async warmTransportKeyPair(){let e=this.#r;if(!e)return;let t=this.#e?.walletAccount.getSnapshot();t&&await e.warmTransportKeyPair(t.address)}async revokePermits(e){let t=this.#a(`revokePermits`),n=N((await k(`revokePermits`,this.#e,this.#t)).address);try{await t.revokePermits(e)}finally{await v(`clear decrypt cache`,()=>this.#n.clearForRequester(n),this.#i)}}async clear(){let e=this.#a(`clear`),t=N((await k(`clear`,this.#e,this.#t)).address);try{await e.clearCredentials()}finally{await v(`clear decrypt cache`,()=>this.#n.clearForRequester(t),this.#i)}}};const Lt=P.union([P.bigint(),P.boolean(),at]),Rt=P.array(P.string());var zt=class{#e;#t;#n=`zama:decrypt`;#r=`${this.#n}:keys`;#i=Promise.resolve();constructor(e,t){this.#e=e,this.#t=t}async get(e,t,n){try{let r=this.#c(e,t,n),i=await this.#e.get(r);if(i===null)return null;let a=Lt.safeParse(i);return a.success?a.data:(await this.delete(e,t,n),null)}catch(e){return this.#t.warn(`CachingService.get failed`,{error:e}),null}}async set(e,t,n,r){try{let i=this.#c(e,t,n);await this.#e.set(i,r),this.#i=this.#i.then(()=>this.#u(i).catch(e=>{this.#t.warn(`CachingService index write failed`,{error:e})})),await this.#i}catch(e){this.#t.warn(`CachingService.set failed`,{error:e})}}async delete(e,t,n){let r=this.#c(e,t,n);this.#i=this.#i.then(()=>this.#a(r).catch(e=>{this.#t.warn(`CachingService.delete failed`,{error:e})})),await this.#i}async clearForRequester(e){this.#i=this.#i.then(()=>this.#o(e).catch(e=>{this.#t.warn(`CachingService.clearForRequester failed`,{error:e})})),await this.#i}async clearAll(){this.#i=this.#i.then(()=>this.#s().catch(e=>{this.#t.warn(`CachingService.clearAll failed`,{error:e})})),await this.#i}async#a(e){await this.#e.delete(e).catch(()=>{});let t=await this.#l(),n=t.filter(t=>t!==e);n.length!==t.length&&await this.#e.set(this.#r,n)}async#o(e){let t=N(e),n=`${this.#n}:${t}:`,r=await this.#l(),i=[],a=[];for(let e of r)e.startsWith(n)?i.push(e):a.push(e);await Promise.all(i.map(e=>this.#e.delete(e).catch(()=>{}))),await this.#e.set(this.#r,a)}async#s(){let e=await this.#l();await Promise.all(e.map(e=>this.#e.delete(e).catch(()=>{}))),await this.#e.delete(this.#r)}#c(e,t,n){return`${this.#n}:${N(e)}:${N(t)}:${n.toLowerCase()}`}async#l(){let e=await this.#e.get(this.#r);if(e===null)return[];let t=Rt.safeParse(e);return t.success?t.data:(await this.#e.delete(this.#r).catch(()=>{}),[])}async#u(e){let t=await this.#l();t.includes(e)||(t.push(e),await this.#e.set(this.#r,t))}};function Bt(e,t){let n=Vt(e,t);if(!n)throw new C(`No permit covers contract ${t} after allow()`);return{privateKey:e.keypair.privateKey,publicKey:e.keypair.publicKey,serializedPermit:n.serializedPermit}}function Vt(e,t){let n=$e(t);return e.permissions.find(e=>e.contractAddresses.includes(n))}const Ht=e=>new Promise(t=>setTimeout(t,e));var Ut=class{#e;#t;#n;#r;#i;constructor({cache:e,credentialService:t,delegationService:n,router:r,emitEvent:i}){this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#i=i}async decryptValues(e,t,n){let r=N(t);return this.#s(e,{requesterAddress:r,aclActorAddress:r,resolveCredentials:e=>this.#t.grantPermit(e),decryptContract:({credentials:e,contractAddress:t,encryptedValues:n,options:r})=>this.#o(e,t,n,r),errorMessage:`Failed to decrypt encrypted values`},n)}async delegatedDecryptValues(e,t,n,r,i){let a=N(t),o=N(n);return this.#a(i?.waitForPropagation??!0,()=>this.#s(e,{requesterAddress:N(r),aclActorAddress:a,resolveCredentials:e=>this.#t.grantPermit(e,a),validate:e=>this.#f(e,{delegatorAddress:a,delegateAddress:o}),decryptContract:({credentials:e,contractAddress:t,encryptedValues:n,options:r})=>this.#o(e,t,n,r),errorMessage:`Failed to decrypt delegated encrypted values`,delegated:!0}))}async#a(e,t){let n;for(let r=0;r<16;r++)try{return await t()}catch(t){if(n=t,!(r<15&&e&&t instanceof H))throw t;await Ht(2e3)}throw n}async delegatedBatchDecryptHandlesAs({encryptedInputs:e,delegatorAddress:t,delegateAddress:n,accountAddress:r,maxConcurrency:i=5,waitForPropagation:a=!0}){let o=e.map(e=>({encryptedValue:e.encryptedValue,contractAddress:N(e.contractAddress)}));if(o.length===0)return{items:o};let s=N(r);try{let e=await this.delegatedDecryptValues(o.map(({encryptedValue:e,contractAddress:t})=>({encryptedValue:e,contractAddress:t})),t,n,s,{waitForPropagation:a});for(let t of o)this.#l(t,e);return{items:o}}catch(e){if(Ie(e))throw e;if(o.length===1){let[n=this.#d()]=o;return n.error=this.#u(e,`Failed to decrypt delegated encrypted values`,{isDelegated:!0,contractAddress:n.contractAddress,account:N(t)}),{items:o}}}let c=!1;return await Ge(o.map(e=>async()=>{if(!c)try{let r=await this.delegatedDecryptValues([{encryptedValue:e.encryptedValue,contractAddress:e.contractAddress}],t,n,s,{waitForPropagation:!1});this.#l(e,r)}catch(n){if(Ie(n))throw c=!0,n;e.error=this.#u(n,`Failed to decrypt delegated encrypted values`,{isDelegated:!0,contractAddress:e.contractAddress,account:N(t)})}}),i),{items:o}}async#o(e,t,n,r){let i=Bt(e,t),a=await this.#r.relayer.parseTransportKeyPair({publicKey:i.publicKey,privateKey:i.privateKey}),o=await this.#r.relayer.parseSignedDecryptionPermit({transportKeyPair:a,serializedPermit:i.serializedPermit});return this.#r.relayer.decryptValues({transportKeyPair:a,signedPermit:o,encryptedValues:n,contractAddress:t,options:r})}async#s(e,t,n){if(e.length===0)return{};let r=e.map(e=>({encryptedValue:e.encryptedValue,contractAddress:N(e.contractAddress)})),a={},o=[];for(let e of r)w(e.encryptedValue)?a[e.encryptedValue]=0n:o.push(e);if(o.length===0)return a;let s=Array.from(new Set(r.map(e=>e.contractAddress))),l=Array.from(new Set(o.map(e=>e.contractAddress)));if(t.validate)try{await t.validate(l)}catch(e){throw c(e)?this.#c(e,`the delegation pre-check`):e}let u=[];for(let e of o){let n=await this.#e.get(t.requesterAddress,e.contractAddress,e.encryptedValue);n===null?u.push(e):a[e.encryptedValue]=n}if(u.length===0)return a;let d=await t.resolveCredentials(s),p=new Map;for(let e of u){let t=p.get(e.contractAddress);t?t.push(e.encryptedValue):p.set(e.contractAddress,[e.encryptedValue])}let m=[];for(let[e,t]of p)for(let n of Ve(t))m.push({contractAddress:e,encryptedValues:n});let h=Date.now(),g=u.map(e=>e.encryptedValue);try{this.#i({type:D.DecryptStart,encryptedValues:g}),await Ge(m.map(({contractAddress:e,encryptedValues:r})=>async()=>{let i;try{i=await t.decryptContract({credentials:d,contractAddress:e,encryptedValues:r,options:n})}catch(n){throw U(n,t.errorMessage,{isDelegated:t.delegated,contractAddress:e,account:t.aclActorAddress})}for(let n=0;n<r.length;n++){let o=r[n],s=i[n]?.value;o===void 0||s===void 0||(a[o]=s,await this.#e.set(t.requesterAddress,e,o,s))}let o=r.filter(e=>a[e]===void 0);if(o.length>0)throw new C(`${t.errorMessage}: relayer returned no clear value for ${o.length} of ${r.length} handle(s) on ${e}`,{cause:AggregateError(o.map(t=>new C(`No clear value for handle ${t} on ${e}`)),`${o.length} handle(s) missing a clear value on ${e}`)})}),5);let e={};for(let t of g){let n=a[t];n!==void 0&&(e[t]=n)}return this.#i({type:D.DecryptEnd,durationMs:Date.now()-h,encryptedValues:g,result:e}),a}catch(e){let n=e instanceof f&&e.cause instanceof Error?e.cause:e;throw this.#i({type:D.DecryptError,error:i(n),durationMs:Date.now()-h,encryptedValues:g}),U(e,t.errorMessage,{isDelegated:t.delegated})}}#c(e,n){return new x(`RPC provider rate-limited ${n}; retry with backoff.`,{cause:e,retryAfter:t(e)})}#l(e,t){let n=t[e.encryptedValue];if(n===void 0){e.error=new C(`Batch delegated decryption returned no value for encrypted value ${e.encryptedValue} on contract ${e.contractAddress}`);return}e.value=n}#u(e,t,n){return e instanceof f?e:U(e,t,n)}#d(){throw new C(`Batch delegated decryption invariant failed: missing item`)}async#f(e,{delegatorAddress:t,delegateAddress:n}){let r=await this.#n.findInactiveDelegations(e,t,n);if(r.size!==0)for(let e of r.values())throw e}};function Wt(e){if(!(e instanceof Error))return null;let t=e.cause;if(typeof t!=`object`||!t||!(`data`in t))return null;let{data:n}=t;return typeof n!=`object`||!n||!(`errorName`in n)?null:typeof n.errorName==`string`?n.errorName:null}const G={AlreadyDelegatedOrRevokedInSameBlock:e=>new Et(`Only one delegate/revoke per (delegator, delegate, contract) per block. Wait for the next block before retrying.`,{cause:e}),SenderCannotBeContractAddress:e=>new Dt(`The contract address cannot be the caller address.`,{cause:e}),EnforcedPause:e=>new Ot(`The ACL contract is paused. Delegation operations are temporarily disabled.`,{cause:e}),SenderCannotBeDelegate:e=>new I(`Cannot delegate to yourself (delegate === msg.sender).`,{cause:e}),DelegateCannotBeContractAddress:e=>new B(`Delegate address cannot be the same as the contract address.`,{cause:e}),ExpirationDateBeforeOneHour:e=>new V(`Expiration date must be at least 1 hour in the future.`,{cause:e}),ExpirationDateAlreadySetToSameValue:e=>new z(`The new expiration date is the same as the current one.`,{cause:e}),NotDelegatedYet:e=>new L(`Cannot revoke: no active delegation exists.`,{cause:e})};function Gt(e){return e in G}function Kt(e,t){let n=Wt(e);if(n&&Gt(n))return G[n](t);let r=e instanceof Error?e.message:String(e);for(let[e,n]of Object.entries(G))if(r.includes(e))return n(t);return null}var qt=class{#e;#t;#n;#r;constructor({provider:e,router:t,emitEvent:n=()=>{},logger:r}){this.#t=e,this.#e=t,this.#r=r,this.#n=n}async delegateDecryption(e,{contractAddress:t,delegateAddress:n,delegatorAddress:r,expirationDate:i}){if(i&&i.getTime()<Date.now()+36e5)throw new V(`Expiration date must be at least 1 hour in the future`);let a=N(t),o=N(n),s=N(r);if(o===s)throw new I(`Cannot delegate to yourself (delegate === msg.sender).`);if(o===a)throw new B(`Delegate address cannot be the same as the contract address (${a}).`);let c=this.#e.relayer.chain.aclContractAddress,l=i?BigInt(Math.floor(i.getTime()/1e3)):E,u;try{u=await this.getDelegationExpiry({contractAddress:a,delegatorAddress:s,delegateAddress:o})}catch(e){this.#r.warn(`delegateDecryption: pre-flight expiry check failed`,{error:e}),u=-1n}if(u===l)throw new z(`The new expiration date (${l}) is the same as the current one. No on-chain change needed.`);return this.#i({operation:`delegateDecryption`,signer:e,contractAddress:t,config:Ke(c,o,a,l)})}async revokeDelegation(e,{contractAddress:t,delegateAddress:n,delegatorAddress:r}){let i=N(t),a=N(n),o=N(r),s=this.#e.relayer.chain.aclContractAddress,c;try{c=await this.getDelegationExpiry({contractAddress:i,delegatorAddress:o,delegateAddress:a})}catch(e){this.#r.warn(`revokeDelegation: pre-flight expiry check failed`,{error:e}),c=1n}if(c===0n)throw new L(`No active delegation found for delegate ${a} on contract ${i}.`);return this.#i({operation:`revokeDelegation`,signer:e,contractAddress:t,config:ze(s,a,i)})}async isDelegated(e){let t=await this.getDelegationExpiry(e);return t===0n?!1:t===E?!0:t>await this.#t.getBlockTimestamp()}async getDelegationExpiry({contractAddress:e,delegatorAddress:t,delegateAddress:n}){let r=this.#e.relayer.chain.aclContractAddress;return this.#t.readContract(Ue(r,N(t),N(n),N(e)))}async#i({operation:e,signer:t,contractAddress:n,config:r}){try{return await We({operation:e,signer:t,provider:this.#t,config:r,emit:e=>this.#n(e,n),logger:this.#r})}catch(e){throw this.#a(e),e}}#a(e){if(!(e instanceof A))return;let t=Kt(e.cause??e,e);if(t)throw t}async findInactiveDelegations(e,t,n){let r=new Map;return await Promise.all(e.map(async e=>{try{await this.assertDelegationActive(e,t,n)}catch(t){if(t instanceof L||t instanceof R){let n=N(e);r.set(n,t);return}throw t}})),r}async assertDelegationActive(e,t,n){let r=N(e),i=N(t),a=N(n),o=await this.getDelegationExpiry({contractAddress:r,delegatorAddress:i,delegateAddress:a});if(o===0n)throw new L(`No active delegation from ${i} to ${a} for ${r}`);if(o!==E&&o<=await this.#t.getBlockTimestamp())throw new R(`Delegation from ${i} to ${a} for ${r} has expired`)}},Jt=class{#e;#t;constructor({router:e,emitEvent:t}){this.#e=e,this.#t=t}async encryptValues(e,t){let n=Date.now(),r=N(e.contractAddress);try{this.#t({type:D.EncryptStart},r);let i=await this.#e.relayer.encryptValues({...e,options:t});return this.#t({type:D.EncryptEnd,durationMs:Date.now()-n},r),i}catch(e){throw this.#t({type:D.EncryptError,error:i(e),durationMs:Date.now()-n},r),At(e,`Encryption failed`)}}},Yt=class{#e;#t;#n;#r;#i;#a=new Set;#o;constructor(e){this.#e=e.signer,this.#t=e.router,this.#n=e.cachingService,this.#r=e.credentialService,this.#i=e.logger,this.#e&&(this.#o=this.#e.walletAccount.subscribe(e=>{this.#s(e).catch(e=>{this.#i.warn(`wallet account handler failed`,{error:e})})}))}onWalletAccountChange(e){return this.#a.add(e),()=>{this.#a.delete(e)}}dispose(){this.#o?.(),this.#o=void 0,this.#a.clear()}async#s(e){let t=e.previous,n=e.next,r=n?.chainId;r!==void 0&&await v(`switch relayer chain`,()=>this.#t.switchChain(r),this.#i);let i=this.#r;i&&await v(`credential wallet account change`,()=>i.handleWalletAccountChange(t,n),this.#i),t&&await v(`clear decrypt cache`,()=>this.#n.clearForRequester(t.address),this.#i),await Promise.all(Array.from(this.#a,t=>v(`wallet account listener`,()=>t(e),this.#i)))}};function K(e){return bt(xt(e))}const q={ConfidentialTransfer:K(`ConfidentialTransfer(address,address,bytes32)`),Wrap:K(`Wrap(address,uint256,bytes32)`),UnwrapRequested:K(`UnwrapRequested(address,bytes32,bytes32)`),UnwrapFinalized:K(`UnwrapFinalized(address,bytes32,bytes32,uint64)`)};function J(e){return N(W(e.slice(-40)))}function Xt(e){return e}function Zt(e,t){let n=2+t*64,r=e.slice(n,n+64);return r.length===64?r:r.padEnd(64,`0`)}function Qt(e,t){return N(W(Zt(e,t).slice(-40)))}function Y(e,t){return BigInt(`0x`+Zt(e,t))}function $t(e,t){return W(Zt(e,t))}function en(e){return e.topics[0]!==q.ConfidentialTransfer||e.topics.length<4?null:{eventName:`ConfidentialTransfer`,from:J(e.topics[1]),to:J(e.topics[2]),encryptedAmount:Xt(e.topics[3])}}function tn(e){return e.topics[0]!==q.Wrap||e.topics.length<2?null:{eventName:`Wrap`,to:J(e.topics[1]),roundedAmount:Y(e.data,0),encryptedWrappedAmount:$t(e.data,1)}}function nn(e){return e.topics[0]!==q.UnwrapRequested||e.topics.length<3?null:{eventName:`UnwrapRequested`,receiver:J(e.topics[1]),unwrapRequestId:Xt(e.topics[2]),encryptedAmount:$t(e.data,0)}}function rn(e){return e.topics[0]!==q.UnwrapFinalized||e.topics.length<3?null:{eventName:`UnwrapFinalized`,receiver:J(e.topics[1]),unwrapRequestId:Xt(e.topics[2]),encryptedAmount:$t(e.data,0),cleartextAmount:Y(e.data,1)}}function an(e){return en(e)??tn(e)??nn(e)??rn(e)}function on(e){let t=[];for(let n of e){let e=an(n);e&&t.push(e)}return t}function sn(e){for(let t of e){let e=nn(t);if(e)return e}return null}function cn(e){for(let t of e){let e=tn(t);if(e)return e}return null}const ln=[q.ConfidentialTransfer,q.Wrap,q.UnwrapRequested,q.UnwrapFinalized],X={DelegatedForUserDecryption:K(`DelegatedForUserDecryption(address,address,address,uint64,uint64,uint64)`),RevokedDelegationForUserDecryption:K(`RevokedDelegationForUserDecryption(address,address,address,uint64,uint64)`)};function Z(e){return e.topics[0]!==X.DelegatedForUserDecryption||e.topics.length<3?null:{eventName:`DelegatedForUserDecryption`,delegator:J(e.topics[1]),delegate:J(e.topics[2]),contractAddress:Qt(e.data,0),delegationCounter:Y(e.data,1),oldExpirationDate:Y(e.data,2),newExpirationDate:Y(e.data,3)}}function Q(e){return e.topics[0]!==X.RevokedDelegationForUserDecryption||e.topics.length<3?null:{eventName:`RevokedDelegationForUserDecryption`,delegator:J(e.topics[1]),delegate:J(e.topics[2]),contractAddress:Qt(e.data,0),delegationCounter:Y(e.data,1),oldExpirationDate:Y(e.data,2)}}function un(e){return Z(e)??Q(e)}function dn(e){let t=[];for(let n of e){let e=un(n);e&&t.push(e)}return t}function fn(e){for(let t of e){let e=Z(t);if(e)return e}return null}function pn(e){for(let t of e){let e=Q(t);if(e)return e}return null}const mn=[X.DelegatedForUserDecryption,X.RevokedDelegationForUserDecryption];function $(e){return`zama:pending-unshield:${$e(e)}`}const hn=P.union([P.pipe(M,P.transform(e=>({unwrapTxHash:e}))),P.pipe(P.object({version:P.literal(1),unwrapTxHash:M,unwrapRequestId:P.optional(M)}),P.transform(({unwrapTxHash:e,unwrapRequestId:t})=>({unwrapTxHash:e,unwrapRequestId:t})))]);async function gn(e,t,n,r){if(r===void 0){await e.set($(t),n);return}await e.set($(t),{version:1,unwrapTxHash:n,unwrapRequestId:r})}async function _n(e,t){return(await vn(e,t))?.unwrapTxHash??null}async function vn(e,t){let n=$(t),r=await e.get(n);if(r==null)return null;let i=hn.safeParse(r);return i.success?i.data:(await e.delete(n),null)}async function yn(e,t){await e.delete($(t))}var bn=class extends O{#e;#t=null;#n=null;#r(e){try{return He(this.sdk.signer,`WrappedToken.sdk.signer`),this.sdk.signer}catch(t){throw new ce(e,{cause:t})}}async underlying(){return this.#s()}async isPayable(){if(this.#n!==null)return this.#n;try{let e=await this.#s();this.#n=await this.sdk.provider.readContract(De(e))}catch{this.#n=!1}return this.#n}async allowance(e){let t=await this.#s();return this.sdk.provider.readContract(b(t,N(e),this.address))}async shield(e,t){let n=await k(`shield`,this.sdk.signer,this.sdk.provider),r=await this.isPayable(),a=await this.#s(),o=N(n.address),s;try{s=await this.sdk.provider.readContract(me(a,o))}catch(e){throw e instanceof f?e:new Xe(`Could not read ERC-20 balance for shield validation (token: ${a})`,{cause:i(e)})}if(s<e)throw new Ye(`Insufficient ERC-20 balance: requested ${e}, available ${s} (token: ${a})`,{requested:e,available:s,token:a});return r?this.#i(e,a,o,t):this.#a(e,o,t)}async#i(e,t,n,r){this.#r(`shield`);let i=r?.to?N(r.to):n,a=i===n?`0x`:i;return this.submitTransaction({operation:`shield:transferAndCall`,config:Mt(t,this.address,e,a),onSubmitted:r?.onShieldSubmitted})}async#a(e,t,n){this.#r(`shield`);let r=n?.approvalStrategy??`exact`;r!==`skip`&&await this.#l(e,r===`max`,n);let i=n?.to?N(n.to):t;return this.submitTransaction({operation:`shield:approveAndWrap`,config:re(this.address,i,e),onSubmitted:n?.onShieldSubmitted})}async approveUnderlying(e){this.#r(`approveUnderlying`);let t=await k(`approveUnderlying`,this.sdk.signer,this.sdk.provider),n=await this.#s(),r=N(t.address),i=e??2n**256n-1n;return i>0n&&await this.sdk.provider.readContract(b(n,r,this.address))>0n&&await this.submitTransaction({operation:`approveUnderlying:reset`,config:y(n,this.address,0n)}),this.submitTransaction({operation:`approveUnderlying`,config:y(n,this.address,i)})}async unshield(e,t){let{skipBalanceCheck:n=!1,onUnwrapSubmitted:r,onFinalizing:i,onFinalizeSubmitted:a}=t??{};n||await this.assertConfidentialBalance(e);let o={onFinalizing:i,onFinalizeSubmitted:a},s=crypto.randomUUID(),c=await this.unwrap(e);return v(`unshield: onUnwrapSubmitted`,()=>r?.(c.txHash),this.sdk.logger),this.#c(c.unwrapRequestId,c.txHash,s,o)}async unshieldAll(e){let t=crypto.randomUUID(),n=await this.unwrapAll();return v(`unshieldAll: onUnwrapSubmitted`,()=>e?.onUnwrapSubmitted?.(n.txHash),this.sdk.logger),this.#c(n.unwrapRequestId,n.txHash,t,e)}async resumeUnshield(e,t){let n;try{n=await this.sdk.provider.waitForTransactionReceipt(e)}catch(e){throw e instanceof f?e:new A(`Failed to get unwrap receipt`,{cause:e})}let r=this.#o(n.logs);return this.#c(r,e,crypto.randomUUID(),t)}async getPendingUnshield(){return _n(this.sdk.storage,this.address)}async unwrap(e){this.#r(`unwrap`);let t=N((await k(`unwrap`,this.sdk.signer,this.sdk.provider)).address),{encryptedValues:n,inputProof:r}=await this.sdk.encrypt({values:[{value:e,type:`euint64`}],contractAddress:this.address,userAddress:t}),[i]=n;if(!i)throw new S(`Encryption returned no encrypted values`);let a=await this.submitTransaction({operation:`unwrap`,config:se(this.address,t,t,i,r)});return{...a,unwrapRequestId:this.#o(a.receipt.logs)}}async unwrapAll(){this.#r(`unwrapAll`);let e=N((await k(`unwrapAll`,this.sdk.signer,this.sdk.provider)).address),t=await this.readConfidentialBalanceOf(e);if(w(t))throw new C(`Cannot unshield: balance is zero`);let n=await this.submitTransaction({operation:`unwrapAll`,config:ne(this.address,e,e,t)});return{...n,unwrapRequestId:this.#o(n.receipt.logs)}}async finalizeUnwrap(e){this.#r(`finalizeUnwrap`),await T(`finalizeUnwrap`,this.sdk.signer,this.sdk.provider);let t=await this.sdk.decryption.decryptPublicValues([e]),n=t.clearValues[e];return Re(n,`finalizeUnwrap: clearValue`),this.submitTransaction({operation:`finalizeUnwrap`,config:oe(this.address,e,n,t.decryptionProof)})}#o(e){let t=sn(e);if(!t)throw new A(`No UnwrapRequested event found in unwrap receipt`);return t.unwrapRequestId}async#s(){return this.#e===void 0?(this.#t||=this.sdk.provider.readContract(ae(this.address)).then(e=>(this.#e=e,this.#t=null,e)).catch(e=>{throw this.#t=null,e}),this.#t):this.#e}async#c(e,t,n,r){this.emit({type:D.UnshieldPhase1Submitted,txHash:t,operationId:n}),await v(`unshield: savePendingUnshield`,()=>gn(this.sdk.storage,this.address,t),this.sdk.logger),this.emit({type:D.UnshieldPhase2Started,operationId:n}),v(`unshield: onFinalizing`,()=>r?.onFinalizing?.(),this.sdk.logger);let i=await this.finalizeUnwrap(e);return this.emit({type:D.UnshieldPhase2Submitted,txHash:i.txHash,operationId:n}),v(`unshield: onFinalizeSubmitted`,()=>r?.onFinalizeSubmitted?.(i.txHash),this.sdk.logger),await v(`unshield: clearPendingUnshield`,()=>yn(this.sdk.storage,this.address),this.sdk.logger),i}async#l(e,t,n){this.#r(`approveUnderlying`);let r=await this.#s(),i=N((await k(`approveUnderlying`,this.sdk.signer,this.sdk.provider)).address),a=await this.sdk.provider.readContract(b(r,i,this.address));if(a>=e)return;a>0n&&await this.submitTransaction({operation:`approveUnderlying:reset`,config:y(r,this.address,0n)});let o=t?2n**256n-1n:e;await this.submitTransaction({operation:`approveUnderlying`,config:y(r,this.address,o),onSubmitted:n?.onApprovalSubmitted})}},xn=class{#e;provider;signer;storage;registry;permits;delegations;decryption;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e){this.#e=e.router,this.provider=e.provider,this.signer=e.signer,this.storage=e.storage,this.#r=e.onEvent??function(){},this.#i=e.logger,this.#a=new zt(e.storage,this.#i),this.#u=new qt({provider:this.provider,router:e.router,emitEvent:this.emitEvent.bind(this),logger:this.#i});let t={};for(let n of e.chains)n.registryAddress&&(t[n.id]=n.registryAddress);this.registry=new j({provider:this.provider,registryAddresses:t,registryTTL:e.registryTTL}),this.#n=t,this.#t=e.registryTTL,e.signer&&(this.#l=new ut({router:e.router,signer:e.signer,transportKeyPairTTL:e.transportKeyPairTTL,permitTTL:e.permitTTL,storage:this.storage,permitStorage:e.permitStorage,logger:this.#i}),this.#c=new Ut({cache:this.#a,credentialService:this.#l,delegationService:this.#u,router:e.router,emitEvent:this.emitEvent.bind(this)})),this.#s=new Jt({router:e.router,emitEvent:this.emitEvent.bind(this)}),this.#o=new Yt({signer:e.signer,router:e.router,cachingService:this.#a,credentialService:this.#l,logger:this.#i}),this.permits=new It({signer:this.signer,provider:this.provider,cachingService:this.#a,credentialService:this.#l,logger:this.#i}),this.delegations=new Ft({signer:this.signer,provider:this.provider,delegationService:this.#u}),this.decryption=new Pt({signer:this.signer,provider:this.provider,router:e.router,decryptionService:this.#c})}onWalletAccountChange(e){return this.#o.onWalletAccountChange(e)}get logger(){return this.#i}get relayer(){return this.#e.relayer}emitEvent(e,t){try{this.#r({...e,tokenAddress:t,timestamp:Date.now()})}catch(t){this.#i.warn(`${e.type} event listener silently failed`,{error:t})}}createWrappersRegistry(e){return new j({provider:this.provider,registryAddresses:{...this.#n,...e},registryTTL:this.#t})}async encrypt(e,t){return this.#s.encryptValues(e,t)}createToken(e){return new O(this,e)}createWrappedToken(e){return new bn(this,e)}dispose(){this.#o.dispose()}terminate(){this.dispose(),this.signer?.dispose?.()}[Symbol.dispose](){this.terminate()}},Sn=class{async get(e){return(await chrome.storage.session.get(e))[e]??null}async set(e,t){await chrome.storage.session.set({[e]:t})}async delete(e){await chrome.storage.session.remove(e)}};const Cn=new Sn;export{mn as ACL_TOPICS,Ot as AclPausedError,X as AclTopics,Je as BalanceCheckUnavailableError,dt as BaseSigner,Fe as ChainMismatchError,Sn as ChromeSessionStorage,m as ConfigurationError,Pt as Decryption,C as DecryptionFailedError,Qe as DefaultRegistryAddresses,Dt as DelegationContractIsSelfError,Et as DelegationCooldownError,B as DelegationDelegateEqualsContractError,V as DelegationExpirationTooSoonError,R as DelegationExpiredError,z as DelegationExpiryUnchangedError,L as DelegationNotFoundError,H as DelegationNotPropagatedError,I as DelegationSelfNotAllowedError,Ft as Delegations,_e as ERC1363_INTERFACE_ID,Xe as ERC20ReadFailedError,Ce as ERC7984_INTERFACE_ID,je as ERC7984_WRAPPER_INTERFACE_ID,S as EncryptionFailedError,rt as IndexedDBStorage,Le as InsufficientConfidentialBalanceError,Ye as InsufficientERC20BalanceError,wt as InvalidTransportKeyPairError,ct as MemoryStorage,st as MutableWalletAccountStore,Tt as NoCiphertextError,F as NotEntitledError,It as Permits,l as RelayerRequestFailedError,x as RpcRateLimitError,ce as SignerNotConfiguredError,Pe as SignerRequiredError,de as SigningFailedError,pe as SigningRejectedError,ln as TOKEN_TOPICS,O as Token,q as Topics,A as TransactionRevertedError,Ct as TransportKeyPairExpiredError,g as WalletAccountNotReadyError,fe as WalletNotConnectedError,bn as WrappedToken,j as WrappersRegistry,qe as ZERO_ENCRYPTED_VALUE,f as ZamaError,o as ZamaErrorCode,xn as ZamaSDK,D as ZamaSDKEvents,b as allowanceContract,yt as anvil,y as approveContract,me as balanceOfContract,ht as bscTestnet,_t as chains,Cn as chromeSessionStorage,Ze as cleartext,le as confidentialBalanceOfContract,ee as confidentialTotalSupplyContract,ue as confidentialTransferContract,te as confidentialTransferFromContract,Nt as createConfig,lt as createWalletAccountStore,Me as decimalsContract,un as decodeAclEvent,dn as decodeAclEvents,en as decodeConfidentialTransfer,Z as decodeDelegatedForUserDecryption,an as decodeOnChainEvent,on as decodeOnChainEvents,Q as decodeRevokedDelegationForUserDecryption,rn as decodeUnwrapFinalized,nn as decodeUnwrapRequested,tn as decodeWrap,Ke as delegateForUserDecryptionContract,oe as finalizeUnwrapContract,fn as findDelegatedForUserDecryption,pn as findRevokedDelegationForUserDecryption,sn as findUnwrapRequested,cn as findWrap,Ae as getConfidentialTokenAddressContract,Ue as getDelegationExpiryContract,Te as getTokenAddressContract,Oe as getTokenPairContract,be as getTokenPairsContract,he as getTokenPairsLengthContract,Ee as getTokenPairsSliceContract,mt as hardhat,ft as hoodi,nt as indexedDBStorage,Se as inferredTotalSupplyContract,gt as ingenTestnet,ve as isConfidentialTokenContract,ke as isConfidentialTokenValidContract,ye as isConfidentialWrapperContract,w as isEncryptedValueZero,Be as isHandleDelegatedContract,h as isOperatorContract,e as isRetryable,vt as mainnet,St as matchZamaError,ot as memoryStorage,ge as nameContract,xe as rateContract,et as resolveChainRelayers,tt as resolveStorage,u as retryAfterSeconds,ze as revokeDelegationContract,pt as sepolia,ie as setOperatorContract,we as supportsInterfaceContract,Ne as symbolContract,Mt as transferAndCallContract,ae as underlyingContract,se as unwrapContract,ne as unwrapFromBalanceContract,re as wrapContract};
2
2
  //# sourceMappingURL=index.js.map