@zama-fhe/sdk 3.8.0-beta.2 → 3.8.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/cjs/alignment.cjs +2 -0
  2. package/dist/cjs/alignment.cjs.map +1 -0
  3. package/dist/cjs/base-signer.cjs +1 -1
  4. package/dist/cjs/base-signer.cjs.map +1 -1
  5. package/dist/cjs/chains.cjs +1 -1
  6. package/dist/cjs/chains.cjs.map +1 -1
  7. package/dist/cjs/cleartext.cjs +1 -1
  8. package/dist/cjs/cleartext.cjs.map +1 -1
  9. package/dist/cjs/eip1193-subscribe.cjs +1 -1
  10. package/dist/cjs/eip1193-subscribe.cjs.map +1 -1
  11. package/dist/cjs/encryption.cjs.map +1 -1
  12. package/dist/cjs/ethers/index.cjs +1 -1
  13. package/dist/cjs/ethers/index.cjs.map +1 -1
  14. package/dist/cjs/fatal-batch.cjs.map +1 -1
  15. package/dist/cjs/fhevm-relayer.cjs +2 -2
  16. package/dist/cjs/fhevm-relayer.cjs.map +1 -1
  17. package/dist/cjs/index.cjs +1 -1
  18. package/dist/cjs/index.cjs.map +1 -1
  19. package/dist/cjs/internal/index.cjs +1 -1
  20. package/dist/cjs/internal/index.cjs.map +1 -1
  21. package/dist/cjs/log-decoding.cjs +2 -0
  22. package/dist/cjs/log-decoding.cjs.map +1 -0
  23. package/dist/cjs/node/index.cjs +1 -1
  24. package/dist/cjs/node/index.cjs.map +1 -1
  25. package/dist/cjs/query/index.cjs +1 -1
  26. package/dist/cjs/query/index.cjs.map +1 -1
  27. package/dist/cjs/query-keys.cjs +2 -0
  28. package/dist/cjs/query-keys.cjs.map +1 -0
  29. package/dist/cjs/relayer.cjs +1 -1
  30. package/dist/cjs/relayer.cjs.map +1 -1
  31. package/dist/cjs/signing.cjs +1 -1
  32. package/dist/cjs/signing.cjs.map +1 -1
  33. package/dist/cjs/telemetry.cjs +1 -1
  34. package/dist/cjs/telemetry.cjs.map +1 -1
  35. package/dist/cjs/token.cjs +1 -1
  36. package/dist/cjs/token.cjs.map +1 -1
  37. package/dist/cjs/typed-data.cjs +2 -0
  38. package/dist/cjs/typed-data.cjs.map +1 -0
  39. package/dist/cjs/validation.cjs.map +1 -1
  40. package/dist/cjs/vaults/index.cjs +1 -1
  41. package/dist/cjs/vaults/index.cjs.map +1 -1
  42. package/dist/cjs/viem/index.cjs +1 -1
  43. package/dist/cjs/viem/index.cjs.map +1 -1
  44. package/dist/cjs/web/index.cjs +1 -1
  45. package/dist/cjs/web/index.cjs.map +1 -1
  46. package/dist/cjs/wrappers-registry.cjs.map +1 -1
  47. package/dist/esm/alignment-o-YIndFR.js +2 -0
  48. package/dist/esm/alignment-o-YIndFR.js.map +1 -0
  49. package/dist/esm/{base-signer-BxIDBDTF.d.ts → base-signer-nenGJU9U.d.ts} +2 -7
  50. package/dist/esm/base-signer-p5iz9eeb.js +2 -0
  51. package/dist/esm/base-signer-p5iz9eeb.js.map +1 -0
  52. package/dist/esm/chains/index.d.ts +11 -1
  53. package/dist/esm/chains/index.js +1 -1
  54. package/dist/esm/chains-BQXSxIwU.js +2 -0
  55. package/dist/esm/chains-BQXSxIwU.js.map +1 -0
  56. package/dist/esm/cleartext/index.d.ts +9 -2
  57. package/dist/esm/cleartext/index.js +1 -1
  58. package/dist/esm/{cleartext-BnTAN4-g.d.ts → cleartext-BLMLdKFh.d.ts} +2 -5
  59. package/dist/esm/{cleartext-CvCakQal.js → cleartext-C1Y5zc1Y.js} +2 -2
  60. package/dist/esm/cleartext-C1Y5zc1Y.js.map +1 -0
  61. package/dist/esm/{decryption-B0mY2M8N.d.ts → decryption-Cp8calaa.d.ts} +3777 -126
  62. package/dist/esm/{eip1193-subscribe-CNxVHW6y.js → eip1193-subscribe-DxAQh8dY.js} +2 -2
  63. package/dist/esm/eip1193-subscribe-DxAQh8dY.js.map +1 -0
  64. package/dist/esm/{encrypt-worker-client-BW88njEe.d.ts → encrypt-worker-client-CkEIA0Tp.d.ts} +3 -6
  65. package/dist/esm/encrypt.worker.js +27 -33
  66. package/dist/esm/{encryption-6AVd-82z.js → encryption-BT886Jlj.js} +2 -2
  67. package/dist/esm/{encryption-6AVd-82z.js.map → encryption-BT886Jlj.js.map} +1 -1
  68. package/dist/esm/ethers/index.d.ts +39 -34
  69. package/dist/esm/ethers/index.js +1 -1
  70. package/dist/esm/ethers/index.js.map +1 -1
  71. package/dist/esm/{fatal-batch-BiiS7KdS.js → fatal-batch-BYeHrf0V.js} +2 -2
  72. package/dist/esm/fatal-batch-BYeHrf0V.js.map +1 -0
  73. package/dist/esm/fhevm-relayer-BEzN0aev.js +8 -0
  74. package/dist/esm/fhevm-relayer-BEzN0aev.js.map +1 -0
  75. package/dist/esm/{index-DXCcwJ77.d.ts → index-CI6f4jxt.d.ts} +7 -10
  76. package/dist/esm/{index-fsWBYM8S.d.ts → index-ClNBSbRy.d.ts} +7 -11
  77. package/dist/esm/{index-D1Wtji3m.d.ts → index-ZTcD9b_z.d.ts} +31 -29
  78. package/dist/esm/index.d.ts +26 -31
  79. package/dist/esm/index.js +1 -1
  80. package/dist/esm/index.js.map +1 -1
  81. package/dist/esm/internal/index.d.ts +14 -15
  82. package/dist/esm/internal/index.js +1 -1
  83. package/dist/esm/internal/index.js.map +1 -1
  84. package/dist/esm/{invalidation-CJ-pzOUG.d.ts → invalidation-IBiMIXGB.d.ts} +1 -4
  85. package/dist/esm/log-decoding-ZthqwHOv.js +2 -0
  86. package/dist/esm/log-decoding-ZthqwHOv.js.map +1 -0
  87. package/dist/esm/node/index.d.ts +12 -4
  88. package/dist/esm/node/index.js +1 -1
  89. package/dist/esm/node/index.js.map +1 -1
  90. package/dist/esm/query/index.d.ts +68 -141
  91. package/dist/esm/query/index.js +1 -1
  92. package/dist/esm/query/index.js.map +1 -1
  93. package/dist/esm/query-keys-CSPxPLBB.js +2 -0
  94. package/dist/esm/query-keys-CSPxPLBB.js.map +1 -0
  95. package/dist/esm/relayer-nWfQAlo7.js +2 -0
  96. package/dist/esm/relayer-nWfQAlo7.js.map +1 -0
  97. package/dist/esm/{signing-C6nbPCyd.js → signing-CVEOw21I.js} +2 -2
  98. package/dist/esm/signing-CVEOw21I.js.map +1 -0
  99. package/dist/esm/telemetry-YFH36F_7.js +2 -0
  100. package/dist/esm/telemetry-YFH36F_7.js.map +1 -0
  101. package/dist/esm/token-AXsOIUDB.js +2 -0
  102. package/dist/esm/token-AXsOIUDB.js.map +1 -0
  103. package/dist/esm/typed-data-eAgGr9V-.js +2 -0
  104. package/dist/esm/typed-data-eAgGr9V-.js.map +1 -0
  105. package/dist/esm/{types-Dc1fpXWt.d.ts → types-D253qkvB.d.ts} +3 -6
  106. package/dist/esm/{types-C2ccCjoA.d.ts → types-DH06Ap0n.d.ts} +3 -6
  107. package/dist/esm/{types-CHepK8MK.d.ts → types-Ubeo72FV.d.ts} +57 -41
  108. package/dist/esm/{validation-ClSvPh6P.js → validation-CZfDLOUh.js} +2 -2
  109. package/dist/esm/{validation-ClSvPh6P.js.map → validation-CZfDLOUh.js.map} +1 -1
  110. package/dist/esm/vaults/index.d.ts +247 -13771
  111. package/dist/esm/vaults/index.js +1 -1
  112. package/dist/esm/vaults/index.js.map +1 -1
  113. package/dist/esm/viem/index.d.ts +39 -34
  114. package/dist/esm/viem/index.js +1 -1
  115. package/dist/esm/viem/index.js.map +1 -1
  116. package/dist/esm/web/index.d.ts +13 -7
  117. package/dist/esm/web/index.js +1 -1
  118. package/dist/esm/web/index.js.map +1 -1
  119. package/dist/esm/wrappers-registry-Cm3JJeqx.js.map +1 -1
  120. package/package.json +2 -2
  121. package/dist/cjs/applied-runtime.cjs +0 -2
  122. package/dist/cjs/applied-runtime.cjs.map +0 -1
  123. package/dist/cjs/erc165.cjs +0 -2
  124. package/dist/cjs/erc165.cjs.map +0 -1
  125. package/dist/cjs/invalidation.cjs +0 -2
  126. package/dist/cjs/invalidation.cjs.map +0 -1
  127. package/dist/cjs/primitives.cjs +0 -2
  128. package/dist/cjs/primitives.cjs.map +0 -1
  129. package/dist/cjs/wrapped-token.cjs +0 -2
  130. package/dist/cjs/wrapped-token.cjs.map +0 -1
  131. package/dist/esm/applied-runtime-3fzqBC2V.js +0 -2
  132. package/dist/esm/applied-runtime-3fzqBC2V.js.map +0 -1
  133. package/dist/esm/base-signer-BoBsvn5Q.js +0 -2
  134. package/dist/esm/base-signer-BoBsvn5Q.js.map +0 -1
  135. package/dist/esm/chains-BwlDI944.js +0 -2
  136. package/dist/esm/chains-BwlDI944.js.map +0 -1
  137. package/dist/esm/cleartext-CvCakQal.js.map +0 -1
  138. package/dist/esm/eip1193-subscribe-CNxVHW6y.js.map +0 -1
  139. package/dist/esm/erc165-B8gx2luK.js +0 -2
  140. package/dist/esm/erc165-B8gx2luK.js.map +0 -1
  141. package/dist/esm/fatal-batch-BiiS7KdS.js.map +0 -1
  142. package/dist/esm/fhevm-relayer-CGvejcdJ.js +0 -8
  143. package/dist/esm/fhevm-relayer-CGvejcdJ.js.map +0 -1
  144. package/dist/esm/index-DkN4q5Cm.d.ts +0 -1
  145. package/dist/esm/invalidation-BgFjmXeQ.js +0 -2
  146. package/dist/esm/invalidation-BgFjmXeQ.js.map +0 -1
  147. package/dist/esm/primitives-Cym-3HKa.js +0 -2
  148. package/dist/esm/primitives-Cym-3HKa.js.map +0 -1
  149. package/dist/esm/relayer-C3jVhqSK.js +0 -2
  150. package/dist/esm/relayer-C3jVhqSK.js.map +0 -1
  151. package/dist/esm/signing-C6nbPCyd.js.map +0 -1
  152. package/dist/esm/telemetry-BDnhC-vh.js +0 -2
  153. package/dist/esm/telemetry-BDnhC-vh.js.map +0 -1
  154. package/dist/esm/token-g6sinwTx.js +0 -2
  155. package/dist/esm/token-g6sinwTx.js.map +0 -1
  156. package/dist/esm/wrapped-token-3usJd0oi.js +0 -2
  157. package/dist/esm/wrapped-token-3usJd0oi.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["#publicClient","TransactionRevertedError","BaseSigner","#walletClient","#ethereum","#unsubscribeProvider","#subscribeToProvider","WalletNotConnectedError","#requireAccount","eip1193Subscribe","buildZamaConfig","confidentialBalanceOfContract","underlyingContract","supportsInterfaceContract","confidentialTransferContract","unwrapContract","unwrapFromBalanceContract","finalizeUnwrapContract","setOperatorContract","wrapContract","getTokenPairsContract","getTokenPairsLengthContract","getTokenPairsSliceContract","getTokenPairContract","getConfidentialTokenAddressContract","getTokenAddressContract","isConfidentialTokenValidContract"],"sources":["../../../src/viem/viem-provider.ts","../../../src/viem/viem-signer.ts","../../../src/viem/config.ts","../../../src/viem/contracts.ts"],"sourcesContent":["import {\n encodeFunctionData,\n serializeTransaction,\n type Abi,\n type Address,\n type ContractFunctionArgs,\n type ContractFunctionName,\n type ContractFunctionReturnType,\n type Hex,\n type PublicClient,\n} from \"viem\";\nimport { TransactionRevertedError } from \"../errors\";\nimport type {\n ContractAbi,\n GenericProvider,\n ReadContractConfig,\n TransactionReceipt,\n WriteContractArgs,\n WriteContractConfig,\n WriteFunctionName,\n} from \"../types\";\n\n/** Configuration for {@link ViemProvider}. */\nexport interface ViemProviderConfig {\n /** A viem `PublicClient` backing all read operations. */\n publicClient: PublicClient;\n}\n\n/**\n * Read-only {@link GenericProvider} backed by a viem `PublicClient`.\n *\n * Use this for integrations that only need public chain reads before the user has Pair with a\n * {@link ViemSigner} when wallet authority is required; the two can share a transport or point at\n * independent RPCs.\n *\n * @example\n * ```ts\n * const publicClient = createPublicClient({ chain: sepolia, transport: http(ALCHEMY_URL) });\n * const provider = new ViemProvider({ publicClient });\n * ```\n */\nexport class ViemProvider implements GenericProvider {\n readonly #publicClient: PublicClient;\n\n constructor(config: ViemProviderConfig) {\n this.#publicClient = config.publicClient;\n }\n\n /** Return the chain ID of the connected network. */\n async getChainId(): Promise<number> {\n return this.#publicClient.getChainId();\n }\n\n /** Execute a read-only call and return the decoded result. */\n async readContract<\n const TAbi extends Abi | readonly unknown[],\n TFunctionName extends ContractFunctionName<TAbi, \"pure\" | \"view\">,\n const TArgs extends ContractFunctionArgs<TAbi, \"pure\" | \"view\", TFunctionName>,\n >(\n config: ReadContractConfig<TAbi, TFunctionName, TArgs>,\n ): Promise<ContractFunctionReturnType<TAbi, \"pure\" | \"view\", TFunctionName, TArgs>> {\n return this.#publicClient.readContract(config);\n }\n\n /** Wait for a transaction to be mined and return its receipt. */\n async waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt> {\n return this.#publicClient.waitForTransactionReceipt({ hash });\n }\n\n /** Return the latest block timestamp in seconds. */\n async getBlockTimestamp(): Promise<bigint> {\n const block = await this.#publicClient.getBlock();\n return block.timestamp;\n }\n\n /** Build a fully-populated, RLP-encoded unsigned transaction ready to be signed offline. */\n async prepareTransaction<\n const TAbi extends ContractAbi,\n TFunctionName extends WriteFunctionName<TAbi>,\n const TArgs extends WriteContractArgs<TAbi, TFunctionName>,\n >(args: {\n from: Address;\n calldata: WriteContractConfig<TAbi, TFunctionName, TArgs>;\n nonce?: number;\n gasLimit?: bigint;\n fees?: { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint };\n }): Promise<Hex> {\n const { from, calldata } = args;\n const data = encodeFunctionData({\n abi: calldata.abi as Abi,\n functionName: calldata.functionName as string,\n args: calldata.args as readonly unknown[],\n });\n // Wrap the estimateGas leg so a pre-flight revert (the most common\n // prepareTransaction failure) surfaces as a typed error with the\n // function name + cause. Other legs propagate as-is — failures there\n // (chainId, nonce, fee data) are rare and usually self-explanatory.\n // Skip the network round-trips entirely when the caller supplied\n // overrides — useful for custodians with their own nonce/fee managers.\n const chainIdPromise = this.#publicClient.getChainId();\n const noncePromise =\n args.nonce !== undefined\n ? Promise.resolve(args.nonce)\n : this.#publicClient.getTransactionCount({ address: from, blockTag: \"pending\" });\n const gasPromise =\n args.gasLimit !== undefined\n ? Promise.resolve(args.gasLimit)\n : (calldata.gas ??\n this.#publicClient\n .estimateGas({ account: from, to: calldata.address, data, value: calldata.value ?? 0n })\n .catch((error: unknown) => {\n throw new TransactionRevertedError(\n `ViemProvider.prepareTransaction: gas estimation reverted for ${calldata.functionName} on ${calldata.address}`,\n { cause: error },\n );\n }));\n const feesPromise = args.fees ?? this.#publicClient.estimateFeesPerGas();\n const [chainId, nonce, gas, fees] = await Promise.all([\n chainIdPromise,\n noncePromise,\n gasPromise,\n feesPromise,\n ]);\n return serializeTransaction({\n type: \"eip1559\",\n chainId,\n nonce,\n to: calldata.address,\n data,\n value: calldata.value ?? 0n,\n gas,\n maxFeePerGas: fees.maxFeePerGas,\n maxPriorityFeePerGas: fees.maxPriorityFeePerGas,\n });\n }\n}\n","import type {\n Account,\n Abi,\n ContractFunctionArgs,\n ContractFunctionName,\n EIP1193Provider,\n WalletClient,\n Hex,\n} from \"viem\";\nimport { getAddress } from \"viem\";\nimport type { writeContract } from \"viem/actions\";\nimport { WalletNotConnectedError } from \"../errors\";\nimport type { EIP712TypedData } from \"../relayer/types\";\nimport { BaseSigner } from \"../signer/base-signer\";\nimport { eip1193Subscribe } from \"../signer/eip1193-subscribe\";\nimport type { WalletAccount, WriteContractConfig } from \"../types\";\n\n/**\n * Configuration for {@link ViemSigner}.\n *\n * The optional `ethereum` field is needed for `subscribe()` (EIP-1193\n * `accountsChanged` / `disconnect` events). It cannot be auto-extracted from\n * `walletClient` because viem's `custom(ethereum)` transport captures the\n * provider in a closure and does **not** expose `on` / `removeListener` on\n * `walletClient.transport`.\n *\n * If you omit `ethereum`, `subscribe()` returns a no-op. For automatic\n * wallet lifecycle handling, consider using `WagmiSigner` instead.\n */\nexport interface ViemSignerConfig {\n /** Wallet client for signing and write operations. */\n walletClient: WalletClient;\n /** Raw EIP-1193 provider enabling wallet lifecycle events; omit for a no-op `subscribe()`. */\n ethereum?: EIP1193Provider;\n}\n\n// viem requires uint values as bigints, but the KMS permit message carries them\n// as decimal strings. Convert by declared field type rather than by name so every\n// permit version is covered (V1 `durationDays`, V2 `durationSeconds`, ...).\nfunction messageWithBigIntUints(typedData: EIP712TypedData): Record<string, unknown> {\n const fields = (typedData.primaryType ? typedData.types[typedData.primaryType] : undefined) ?? [];\n const message: Record<string, unknown> = { ...typedData.message };\n for (const { name, type } of fields) {\n if (/^uint\\d*$/.test(type)) {\n message[name] = BigInt(message[name] as string | number | bigint);\n }\n }\n return message;\n}\n\nfunction walletAccountFromWalletClient(walletClient: WalletClient): WalletAccount | undefined {\n if (!walletClient.account || !walletClient.chain) {\n return undefined;\n }\n const address = getAddress(walletClient.account.address);\n return { address, chainId: walletClient.chain.id };\n}\n\n/**\n * {@link GenericSigner} backed by a viem `WalletClient` for EIP-712 signing and\n * write transactions. Pass `ethereum` in {@link ViemSignerConfig} to track\n * wallet lifecycle events.\n */\nexport class ViemSigner extends BaseSigner {\n readonly #walletClient: WalletClient;\n readonly #ethereum?: EIP1193Provider;\n readonly #unsubscribeProvider: () => void;\n\n constructor(config: ViemSignerConfig) {\n super(walletAccountFromWalletClient(config.walletClient));\n this.#walletClient = config.walletClient;\n this.#ethereum = config.ethereum;\n this.#unsubscribeProvider = this.#subscribeToProvider();\n }\n\n #requireAccount(operation: string): { walletClient: WalletClient; account: Account } {\n if (!this.#walletClient.account) {\n throw new WalletNotConnectedError(operation);\n }\n return { walletClient: this.#walletClient, account: this.#walletClient.account };\n }\n\n /** Sign EIP-712 typed data (used for decrypt authorization). */\n async signTypedData(typedData: EIP712TypedData): Promise<Hex> {\n const { walletClient, account } = this.#requireAccount(\"signTypedData\");\n const { EIP712Domain: _, ...sigTypes } = typedData.types;\n return walletClient.signTypedData({\n account,\n primaryType: typedData.primaryType,\n types: sigTypes,\n domain: typedData.domain,\n message: messageWithBigIntUints(typedData),\n // Cast: EIP712TypedData is structural (`Eip712Like`), so viem cannot correlate primaryType/types/message and the inferred `message` collapses to `never`.\n } as Parameters<typeof walletClient.signTypedData>[0]);\n }\n\n /** Send a write transaction and return the tx hash. */\n async writeContract<\n const TAbi extends Abi | readonly unknown[],\n TFunctionName extends ContractFunctionName<TAbi, \"nonpayable\" | \"payable\">,\n const TArgs extends ContractFunctionArgs<TAbi, \"nonpayable\" | \"payable\", TFunctionName>,\n >(config: WriteContractConfig<TAbi, TFunctionName, TArgs>): Promise<Hex> {\n const { walletClient, account } = this.#requireAccount(\"writeContract\");\n return walletClient.writeContract({\n chain: walletClient.chain,\n account,\n ...config,\n } as Parameters<typeof writeContract>[1]);\n }\n\n #subscribeToProvider(): () => void {\n if (!this.#ethereum) {\n return () => {};\n }\n return eip1193Subscribe({\n provider: this.#ethereum,\n getInitialWalletAccount: () => walletAccountFromWalletClient(this.#walletClient),\n onWalletAccountChange: ({ next }) => {\n this.walletAccount.setSnapshot(next);\n },\n });\n }\n\n /** Unsubscribe from the EIP-1193 provider's wallet lifecycle events. */\n protected override onDispose(): void {\n this.#unsubscribeProvider();\n }\n}\n","import type { FheChain } from \"../chains\";\nimport type { ZamaConfig } from \"../config/types\";\nimport { buildZamaConfig } from \"../config/build\";\nimport { ViemProvider } from \"./viem-provider\";\nimport { ViemSigner } from \"./viem-signer\";\nimport type { ZamaConfigViem } from \"./types\";\n\n/** Create a {@link ZamaConfig} from viem clients. */\nexport function createConfig<const TChains extends readonly [FheChain, ...FheChain[]]>(\n params: ZamaConfigViem<TChains>,\n): ZamaConfig {\n const signer = new ViemSigner({ walletClient: params.walletClient, ethereum: params.ethereum });\n const provider = new ViemProvider({ publicClient: params.publicClient });\n return buildZamaConfig(signer, provider, params);\n}\n","import type { PublicClient, WalletClient, Address, Hex } from \"viem\";\nimport type { EncryptedValue } from \"../relayer/types\";\nimport {\n confidentialBalanceOfContract,\n confidentialTransferContract,\n finalizeUnwrapContract,\n setOperatorContract,\n supportsInterfaceContract,\n underlyingContract,\n unwrapContract,\n unwrapFromBalanceContract,\n wrapContract,\n getTokenPairsContract,\n getTokenPairsLengthContract,\n getTokenPairsSliceContract,\n getTokenPairContract,\n getConfidentialTokenAddressContract,\n getTokenAddressContract,\n isConfidentialTokenValidContract,\n} from \"../contracts\";\n\n// ── Helpers ────────────────────────────────────────────────\n\nfunction requireAccount(client: WalletClient) {\n if (!client.account) {\n throw new TypeError(\"WalletClient has no account\");\n }\n return client.account;\n}\n\n// ── Read helpers ────────────────────────────────────────────\n\n/** Reads a token's confidential (encrypted) balance handle for `userAddress` via a viem client. */\nexport function readConfidentialBalanceOfContract(\n client: PublicClient,\n tokenAddress: Address,\n userAddress: Address,\n) {\n return client.readContract(confidentialBalanceOfContract(tokenAddress, userAddress));\n}\n\n/** Reads the underlying ERC-20 address wrapped by a confidential wrapper via a viem client. */\nexport function readUnderlyingTokenContract(client: PublicClient, wrapperAddress: Address) {\n return client.readContract(underlyingContract(wrapperAddress));\n}\n\n/** Reads whether a token implements the given ERC-165 interface id via a viem client. */\nexport function readSupportsInterfaceContract(\n client: PublicClient,\n tokenAddress: Address,\n interfaceId: Address,\n) {\n return client.readContract(supportsInterfaceContract(tokenAddress, interfaceId));\n}\n\n// ── Write helpers ───────────────────────────────────────────\n\n/** Submits a confidential transfer of an encrypted amount to `to` via a viem wallet client. */\nexport function writeConfidentialTransferContract(\n client: WalletClient,\n tokenAddress: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...confidentialTransferContract(tokenAddress, to, encryptedAmount, inputProof),\n });\n}\n\n/** Submits an unwrap of an encrypted amount from `from` to `to` on a confidential ERC-20 via a viem wallet client. */\nexport function writeUnwrapContract(\n client: WalletClient,\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...unwrapContract(encryptedErc20, from, to, encryptedAmount, inputProof),\n });\n}\n\n/** Submits an unwrap of the full encrypted balance from `from` to `to` via a viem wallet client. */\nexport function writeUnwrapFromBalanceContract(\n client: WalletClient,\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedBalance: EncryptedValue,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...unwrapFromBalanceContract(encryptedErc20, from, to, encryptedBalance),\n });\n}\n\n/** Finalizes a pending unwrap request with the decrypted amount and decryption proof via a viem wallet client. */\nexport function writeFinalizeUnwrapContract(\n client: WalletClient,\n wrapper: Address,\n unwrapRequestId: EncryptedValue,\n unwrapAmountCleartext: bigint,\n decryptionProof: Hex,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...finalizeUnwrapContract(wrapper, unwrapRequestId, unwrapAmountCleartext, decryptionProof),\n });\n}\n\n/** Authorizes `operator` on a token, until an optional expiry timestamp, via a viem wallet client. */\nexport function writeSetOperatorContract(\n client: WalletClient,\n tokenAddress: Address,\n operator: Address,\n until?: number,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...setOperatorContract(tokenAddress, operator, until),\n });\n}\n\n/** Wraps `amount` of the underlying ERC-20 into confidential tokens credited to `to` via a viem wallet client. */\nexport function writeWrapContract(\n client: WalletClient,\n wrapperAddress: Address,\n to: Address,\n amount: bigint,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...wrapContract(wrapperAddress, to, amount),\n });\n}\n\n// ── Registry read helpers ──────────────────────────────────\n\n/** Reads all underlying/confidential token pairs from a wrappers registry via a viem client. */\nexport function readTokenPairsContract(client: PublicClient, registry: Address) {\n return client.readContract(getTokenPairsContract(registry));\n}\n\n/** Reads the number of token pairs in a wrappers registry via a viem client. */\nexport function readTokenPairsLengthContract(client: PublicClient, registry: Address) {\n return client.readContract(getTokenPairsLengthContract(registry));\n}\n\n/** Reads a slice of token pairs (`fromIndex` to `toIndex`) from a wrappers registry via a viem client. */\nexport function readTokenPairsSliceContract(\n client: PublicClient,\n registry: Address,\n fromIndex: bigint,\n toIndex: bigint,\n) {\n return client.readContract(getTokenPairsSliceContract(registry, fromIndex, toIndex));\n}\n\n/** Reads the token pair at `index` from a wrappers registry via a viem client. */\nexport function readTokenPairContract(client: PublicClient, registry: Address, index: bigint) {\n return client.readContract(getTokenPairContract(registry, index));\n}\n\n/** Reads the confidential token registered for a given underlying token in a wrappers registry via a viem client. */\nexport function readConfidentialTokenAddressContract(\n client: PublicClient,\n registry: Address,\n tokenAddress: Address,\n) {\n return client.readContract(getConfidentialTokenAddressContract(registry, tokenAddress));\n}\n\n/** Reads the underlying token registered for a given confidential token in a wrappers registry via a viem client. */\nexport function readTokenAddressContract(\n client: PublicClient,\n registry: Address,\n confidentialTokenAddress: Address,\n) {\n return client.readContract(getTokenAddressContract(registry, confidentialTokenAddress));\n}\n\n/** Reads whether a confidential token is registered and valid in a wrappers registry via a viem client. */\nexport function readIsConfidentialTokenValidContract(\n client: PublicClient,\n registry: Address,\n confidentialTokenAddress: Address,\n) {\n return client.readContract(isConfidentialTokenValidContract(registry, confidentialTokenAddress));\n}\n"],"mappings":"sOAyCA,IAAa,EAAb,KAAqD,CACnD,GAEA,YAAY,EAA4B,CACtC,KAAKA,GAAgB,EAAO,YAC9B,CAGA,MAAM,YAA8B,CAClC,OAAO,KAAKA,GAAc,WAAW,CACvC,CAGA,MAAM,aAKJ,EACkF,CAClF,OAAO,KAAKA,GAAc,aAAa,CAAM,CAC/C,CAGA,MAAM,0BAA0B,EAAwC,CACtE,OAAO,KAAKA,GAAc,0BAA0B,CAAE,MAAK,CAAC,CAC9D,CAGA,MAAM,mBAAqC,CAEzC,OAAO,MADa,KAAKA,GAAc,SAAS,EAAA,CACnC,SACf,CAGA,MAAM,mBAIJ,EAMe,CACf,GAAM,CAAE,OAAM,YAAa,EACrB,GAAA,EAAA,EAAA,mBAAA,CAA0B,CAC9B,IAAK,EAAS,IACd,aAAc,EAAS,aACvB,KAAM,EAAS,IACjB,CAAC,EAOK,EAAiB,KAAKA,GAAc,WAAW,EAC/C,EACJ,EAAK,QAAU,IAAA,GAEX,KAAKA,GAAc,oBAAoB,CAAE,QAAS,EAAM,SAAU,SAAU,CAAC,EAD7E,QAAQ,QAAQ,EAAK,KAAK,EAE1B,EACJ,EAAK,WAAa,IAAA,GAEb,EAAS,KACV,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sB,CAAQ,CAAC,CAC5D,CAGA,SAAgB,EAA6B,EAAsB,EAAmB,CACpF,OAAO,EAAO,aAAaC,EAAAA,EAA4B,CAAQ,CAAC,CAClE,CAGA,SAAgB,EACd,EACA,EACA,EACA,EACA,CACA,OAAO,EAAO,aAAaC,EAAAA,EAA2B,EAAU,EAAW,CAAO,CAAC,CACrF,CAGA,SAAgB,EAAsB,EAAsB,EAAmB,EAAe,CAC5F,OAAO,EAAO,aAAaC,EAAAA,EAAqB,EAAU,CAAK,CAAC,CAClE,CAGA,SAAgB,EACd,EACA,EACA,EACA,CACA,OAAO,EAAO,aAAaC,EAAAA,EAAoC,EAAU,CAAY,CAAC,CACxF,CAGA,SAAgB,EACd,EACA,EACA,EACA,CACA,OAAO,EAAO,aAAaC,EAAAA,EAAwB,EAAU,CAAwB,CAAC,CACxF,CAGA,SAAgB,EACd,EACA,EACA,EACA,CACA,OAAO,EAAO,aAAaC,EAAAA,EAAiC,EAAU,CAAwB,CAAC,CACjG"}
1
+ {"version":3,"file":"index.cjs","names":["requireReadChain","encodeFunctionData","TransactionRevertedError","serializeTransaction","getAddress","BaseSigner","WalletNotConnectedError","toViemTypedData","eip1193Subscribe","buildZamaConfig","confidentialBalanceOfContract","underlyingContract","supportsInterfaceContract","confidentialTransferContract","unwrapContract","unwrapFromBalanceContract","finalizeUnwrapContract","setOperatorContract","wrapContract","getTokenPairsContract","getTokenPairsLengthContract","getTokenPairsSliceContract","getTokenPairContract","getConfidentialTokenAddressContract","getTokenAddressContract","isConfidentialTokenValidContract","require_alignment","require_base_signer","require_eip1193_subscribe","require_typed_data","require_wrappers_registry","viem","ViemProvider","#publicClient","config","call","chainId","params","_","args","data","calldata","chainIdPromise","noncePromise","from","gasPromise","error","feesPromise","nonce","gas","fees","walletAccountFromWalletClient","walletClient","ViemSigner","#walletClient","#ethereum","#unsubscribeProvider","#subscribeToProvider","operation","#requireAccount","typedData","next","createConfig","signer","provider","requireAccount","client","readConfidentialBalanceOfContract","tokenAddress","userAddress","readUnderlyingTokenContract","wrapperAddress","readSupportsInterfaceContract","interfaceId","writeConfidentialTransferContract","to","encryptedAmount","inputProof","writeUnwrapContract","encryptedErc20","writeUnwrapFromBalanceContract","encryptedBalance","writeFinalizeUnwrapContract","wrapper","unwrapRequestId","unwrapAmountCleartext","decryptionProof","writeSetOperatorContract","operator","until","writeWrapContract","amount","readTokenPairsContract","registry","readTokenPairsLengthContract","readTokenPairsSliceContract","fromIndex","toIndex","readTokenPairContract","index","readConfidentialTokenAddressContract","readTokenAddressContract","confidentialTokenAddress","readIsConfidentialTokenValidContract"],"sources":["../../../src/viem/viem-provider.ts","../../../src/viem/viem-signer.ts","../../../src/viem/config.ts","../../../src/viem/contracts.ts"],"sourcesContent":["import {\n encodeFunctionData,\n serializeTransaction,\n type Abi,\n type Address,\n type ContractFunctionArgs,\n type ContractFunctionName,\n type ContractFunctionReturnType,\n type Hex,\n type PublicClient,\n} from \"viem\";\nimport { TransactionRevertedError } from \"../errors\";\nimport type {\n ContractAbi,\n GenericProvider,\n MulticallReturnType,\n ReadContractConfig,\n TransactionReceipt,\n WriteContractArgs,\n WriteContractConfig,\n WriteFunctionName,\n} from \"../types\";\nimport { requireReadChain } from \"../utils/alignment\";\n\n/** Configuration for {@link ViemProvider}. */\nexport interface ViemProviderConfig {\n /** A viem `PublicClient` backing all read operations. */\n publicClient: PublicClient;\n}\n\n/**\n * Read-only {@link GenericProvider} backed by a viem `PublicClient`.\n *\n * Use this for integrations that only need public chain reads before the user has Pair with a\n * {@link ViemSigner} when wallet authority is required; the two can share a transport or point at\n * independent RPCs.\n *\n * @example\n * ```ts\n * const publicClient = createPublicClient({ chain: sepolia, transport: http(ALCHEMY_URL) });\n * const provider = new ViemProvider({ publicClient });\n * ```\n */\nexport class ViemProvider implements GenericProvider {\n readonly #publicClient: PublicClient;\n\n constructor(config: ViemProviderConfig) {\n this.#publicClient = config.publicClient;\n }\n\n /** Return the chain ID of the connected network. */\n async getChainId(): Promise<number> {\n return this.#publicClient.getChainId();\n }\n\n /** Execute a read-only call and return the decoded result. */\n async readContract<\n const TAbi extends Abi | readonly unknown[],\n TFunctionName extends ContractFunctionName<TAbi, \"pure\" | \"view\">,\n const TArgs extends ContractFunctionArgs<TAbi, \"pure\" | \"view\", TFunctionName>,\n >(\n config: ReadContractConfig<TAbi, TFunctionName, TArgs>,\n ): Promise<ContractFunctionReturnType<TAbi, \"pure\" | \"view\", TFunctionName, TArgs>> {\n const { chainId, ...call } = config;\n await requireReadChain(\"ViemProvider\", chainId, () => this.getChainId());\n return this.#publicClient.readContract(call as typeof config);\n }\n\n /**\n * Run many reads in one Multicall3 call. On a chain whose viem definition\n * names no Multicall3, such as a local Hardhat node, the call carries its code.\n */\n async multicall<const TCalls extends readonly ReadContractConfig[]>(params: {\n readonly calls: TCalls;\n readonly chainId?: number;\n }): Promise<MulticallReturnType<TCalls>> {\n await requireReadChain(\"ViemProvider\", params.chainId, () => this.getChainId());\n const results = await this.#publicClient.multicall({\n contracts: params.calls.map(({ chainId: _, ...call }) => call) as never,\n allowFailure: false,\n deployless: this.#publicClient.chain?.contracts?.multicall3 === undefined,\n });\n return results as MulticallReturnType<TCalls>;\n }\n\n /** Wait for a transaction to be mined and return its receipt. */\n async waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt> {\n return this.#publicClient.waitForTransactionReceipt({ hash });\n }\n\n /** Return the latest block timestamp in seconds. */\n async getBlockTimestamp(chainId?: number): Promise<bigint> {\n await requireReadChain(\"ViemProvider\", chainId, () => this.getChainId());\n const block = await this.#publicClient.getBlock();\n return block.timestamp;\n }\n\n /** Build a fully-populated, RLP-encoded unsigned transaction ready to be signed offline. */\n async prepareTransaction<\n const TAbi extends ContractAbi,\n TFunctionName extends WriteFunctionName<TAbi>,\n const TArgs extends WriteContractArgs<TAbi, TFunctionName>,\n >(args: {\n from: Address;\n calldata: WriteContractConfig<TAbi, TFunctionName, TArgs>;\n nonce?: number;\n gasLimit?: bigint;\n fees?: { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint };\n }): Promise<Hex> {\n const { from, calldata } = args;\n const data = encodeFunctionData({\n abi: calldata.abi as Abi,\n functionName: calldata.functionName as string,\n args: calldata.args as readonly unknown[],\n });\n // Wrap the estimateGas leg so a pre-flight revert (the most common\n // prepareTransaction failure) surfaces as a typed error with the\n // function name + cause. Other legs propagate as-is — failures there\n // (chainId, nonce, fee data) are rare and usually self-explanatory.\n // Skip the network round-trips entirely when the caller supplied\n // overrides — useful for custodians with their own nonce/fee managers.\n const chainIdPromise = this.#publicClient.getChainId();\n const noncePromise =\n args.nonce !== undefined\n ? Promise.resolve(args.nonce)\n : this.#publicClient.getTransactionCount({ address: from, blockTag: \"pending\" });\n const gasPromise =\n args.gasLimit !== undefined\n ? Promise.resolve(args.gasLimit)\n : (calldata.gas ??\n this.#publicClient\n .estimateGas({ account: from, to: calldata.address, data, value: calldata.value ?? 0n })\n .catch((error: unknown) => {\n throw new TransactionRevertedError(\n `ViemProvider.prepareTransaction: gas estimation reverted for ${calldata.functionName} on ${calldata.address}`,\n { cause: error },\n );\n }));\n const feesPromise = args.fees ?? this.#publicClient.estimateFeesPerGas();\n const [chainId, nonce, gas, fees] = await Promise.all([\n chainIdPromise,\n noncePromise,\n gasPromise,\n feesPromise,\n ]);\n return serializeTransaction({\n type: \"eip1559\",\n chainId,\n nonce,\n to: calldata.address,\n data,\n value: calldata.value ?? 0n,\n gas,\n maxFeePerGas: fees.maxFeePerGas,\n maxPriorityFeePerGas: fees.maxPriorityFeePerGas,\n });\n }\n}\n","import type {\n Account,\n Abi,\n ContractFunctionArgs,\n ContractFunctionName,\n EIP1193Provider,\n WalletClient,\n Hex,\n} from \"viem\";\nimport { getAddress } from \"viem\";\nimport type { writeContract } from \"viem/actions\";\nimport { WalletNotConnectedError } from \"../errors\";\nimport type { EIP712TypedData } from \"../relayer/types\";\nimport { BaseSigner } from \"../signer/base-signer\";\nimport { eip1193Subscribe } from \"../signer/eip1193-subscribe\";\nimport type { WalletAccount, WriteContractConfig } from \"../types\";\nimport { toViemTypedData } from \"./typed-data\";\n\n/**\n * Configuration for {@link ViemSigner}.\n *\n * The optional `ethereum` field is needed for `subscribe()` (EIP-1193\n * `accountsChanged` / `disconnect` events). It cannot be auto-extracted from\n * `walletClient` because viem's `custom(ethereum)` transport captures the\n * provider in a closure and does **not** expose `on` / `removeListener` on\n * `walletClient.transport`.\n *\n * If you omit `ethereum`, `subscribe()` returns a no-op. For automatic\n * wallet lifecycle handling, consider using `WagmiSigner` instead.\n */\nexport interface ViemSignerConfig {\n /** Wallet client for signing and write operations. */\n walletClient: WalletClient;\n /** Raw EIP-1193 provider enabling wallet lifecycle events; omit for a no-op `subscribe()`. */\n ethereum?: EIP1193Provider;\n}\n\nfunction walletAccountFromWalletClient(walletClient: WalletClient): WalletAccount | undefined {\n if (!walletClient.account || !walletClient.chain) {\n return undefined;\n }\n const address = getAddress(walletClient.account.address);\n return { address, chainId: walletClient.chain.id };\n}\n\n/**\n * {@link GenericSigner} backed by a viem `WalletClient` for EIP-712 signing and\n * write transactions. Pass `ethereum` in {@link ViemSignerConfig} to track\n * wallet lifecycle events.\n */\nexport class ViemSigner extends BaseSigner {\n readonly #walletClient: WalletClient;\n readonly #ethereum?: EIP1193Provider;\n readonly #unsubscribeProvider: () => void;\n\n constructor(config: ViemSignerConfig) {\n super(walletAccountFromWalletClient(config.walletClient));\n this.#walletClient = config.walletClient;\n this.#ethereum = config.ethereum;\n this.#unsubscribeProvider = this.#subscribeToProvider();\n }\n\n #requireAccount(operation: string): { walletClient: WalletClient; account: Account } {\n if (!this.#walletClient.account) {\n throw new WalletNotConnectedError(operation);\n }\n return { walletClient: this.#walletClient, account: this.#walletClient.account };\n }\n\n /** Sign EIP-712 typed data (used for decrypt authorization). */\n async signTypedData(typedData: EIP712TypedData): Promise<Hex> {\n const { walletClient, account } = this.#requireAccount(\"signTypedData\");\n return walletClient.signTypedData({ account, ...toViemTypedData(typedData) });\n }\n\n /** Send a write transaction and return the tx hash. */\n async writeContract<\n const TAbi extends Abi | readonly unknown[],\n TFunctionName extends ContractFunctionName<TAbi, \"nonpayable\" | \"payable\">,\n const TArgs extends ContractFunctionArgs<TAbi, \"nonpayable\" | \"payable\", TFunctionName>,\n >(config: WriteContractConfig<TAbi, TFunctionName, TArgs>): Promise<Hex> {\n const { walletClient, account } = this.#requireAccount(\"writeContract\");\n return walletClient.writeContract({\n chain: walletClient.chain,\n account,\n ...config,\n } as Parameters<typeof writeContract>[1]);\n }\n\n #subscribeToProvider(): () => void {\n if (!this.#ethereum) {\n return () => {};\n }\n return eip1193Subscribe({\n provider: this.#ethereum,\n getInitialWalletAccount: () => walletAccountFromWalletClient(this.#walletClient),\n onWalletAccountChange: ({ next }) => {\n this.walletAccount.setSnapshot(next);\n },\n });\n }\n\n /** Unsubscribe from the EIP-1193 provider's wallet lifecycle events. */\n protected override onDispose(): void {\n this.#unsubscribeProvider();\n }\n}\n","import type { FheChain } from \"../chains\";\nimport type { ZamaConfig } from \"../config/types\";\nimport { buildZamaConfig } from \"../config/build\";\nimport { ViemProvider } from \"./viem-provider\";\nimport { ViemSigner } from \"./viem-signer\";\nimport type { ZamaConfigViem } from \"./types\";\n\n/** Create a {@link ZamaConfig} from viem clients. */\nexport function createConfig<const TChains extends readonly [FheChain, ...FheChain[]]>(\n params: ZamaConfigViem<TChains>,\n): ZamaConfig {\n const signer = new ViemSigner({ walletClient: params.walletClient, ethereum: params.ethereum });\n const provider = new ViemProvider({ publicClient: params.publicClient });\n return buildZamaConfig(signer, provider, params);\n}\n","import type { PublicClient, WalletClient, Address, Hex } from \"viem\";\nimport type { EncryptedValue } from \"../relayer/types\";\nimport {\n confidentialBalanceOfContract,\n confidentialTransferContract,\n finalizeUnwrapContract,\n setOperatorContract,\n supportsInterfaceContract,\n underlyingContract,\n unwrapContract,\n unwrapFromBalanceContract,\n wrapContract,\n getTokenPairsContract,\n getTokenPairsLengthContract,\n getTokenPairsSliceContract,\n getTokenPairContract,\n getConfidentialTokenAddressContract,\n getTokenAddressContract,\n isConfidentialTokenValidContract,\n} from \"../contracts\";\n\n// ── Helpers ────────────────────────────────────────────────\n\nfunction requireAccount(client: WalletClient) {\n if (!client.account) {\n throw new TypeError(\"WalletClient has no account\");\n }\n return client.account;\n}\n\n// ── Read helpers ────────────────────────────────────────────\n\n/** Reads a token's confidential (encrypted) balance handle for `userAddress` via a viem client. */\nexport function readConfidentialBalanceOfContract(\n client: PublicClient,\n tokenAddress: Address,\n userAddress: Address,\n) {\n return client.readContract(confidentialBalanceOfContract(tokenAddress, userAddress));\n}\n\n/** Reads the underlying ERC-20 address wrapped by a confidential wrapper via a viem client. */\nexport function readUnderlyingTokenContract(client: PublicClient, wrapperAddress: Address) {\n return client.readContract(underlyingContract(wrapperAddress));\n}\n\n/** Reads whether a token implements the given ERC-165 interface id via a viem client. */\nexport function readSupportsInterfaceContract(\n client: PublicClient,\n tokenAddress: Address,\n interfaceId: Address,\n) {\n return client.readContract(supportsInterfaceContract(tokenAddress, interfaceId));\n}\n\n// ── Write helpers ───────────────────────────────────────────\n\n/** Submits a confidential transfer of an encrypted amount to `to` via a viem wallet client. */\nexport function writeConfidentialTransferContract(\n client: WalletClient,\n tokenAddress: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...confidentialTransferContract(tokenAddress, to, encryptedAmount, inputProof),\n });\n}\n\n/** Submits an unwrap of an encrypted amount from `from` to `to` on a confidential ERC-20 via a viem wallet client. */\nexport function writeUnwrapContract(\n client: WalletClient,\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...unwrapContract(encryptedErc20, from, to, encryptedAmount, inputProof),\n });\n}\n\n/** Submits an unwrap of the full encrypted balance from `from` to `to` via a viem wallet client. */\nexport function writeUnwrapFromBalanceContract(\n client: WalletClient,\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedBalance: EncryptedValue,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...unwrapFromBalanceContract(encryptedErc20, from, to, encryptedBalance),\n });\n}\n\n/** Finalizes a pending unwrap request with the decrypted amount and decryption proof via a viem wallet client. */\nexport function writeFinalizeUnwrapContract(\n client: WalletClient,\n wrapper: Address,\n unwrapRequestId: EncryptedValue,\n unwrapAmountCleartext: bigint,\n decryptionProof: Hex,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...finalizeUnwrapContract(wrapper, unwrapRequestId, unwrapAmountCleartext, decryptionProof),\n });\n}\n\n/** Authorizes `operator` on a token, until an optional expiry timestamp, via a viem wallet client. */\nexport function writeSetOperatorContract(\n client: WalletClient,\n tokenAddress: Address,\n operator: Address,\n until?: number,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...setOperatorContract(tokenAddress, operator, until),\n });\n}\n\n/** Wraps `amount` of the underlying ERC-20 into confidential tokens credited to `to` via a viem wallet client. */\nexport function writeWrapContract(\n client: WalletClient,\n wrapperAddress: Address,\n to: Address,\n amount: bigint,\n) {\n return client.writeContract({\n chain: client.chain,\n account: requireAccount(client),\n ...wrapContract(wrapperAddress, to, amount),\n });\n}\n\n// ── Registry read helpers ──────────────────────────────────\n\n/** Reads all underlying/confidential token pairs from a wrappers registry via a viem client. */\nexport function readTokenPairsContract(client: PublicClient, registry: Address) {\n return client.readContract(getTokenPairsContract(registry));\n}\n\n/** Reads the number of token pairs in a wrappers registry via a viem client. */\nexport function readTokenPairsLengthContract(client: PublicClient, registry: Address) {\n return client.readContract(getTokenPairsLengthContract(registry));\n}\n\n/** Reads a slice of token pairs (`fromIndex` to `toIndex`) from a wrappers registry via a viem client. */\nexport function readTokenPairsSliceContract(\n client: PublicClient,\n registry: Address,\n fromIndex: bigint,\n toIndex: bigint,\n) {\n return client.readContract(getTokenPairsSliceContract(registry, fromIndex, toIndex));\n}\n\n/** Reads the token pair at `index` from a wrappers registry via a viem client. */\nexport function readTokenPairContract(client: PublicClient, registry: Address, index: bigint) {\n return client.readContract(getTokenPairContract(registry, index));\n}\n\n/** Reads the confidential token registered for a given underlying token in a wrappers registry via a viem client. */\nexport function readConfidentialTokenAddressContract(\n client: PublicClient,\n registry: Address,\n tokenAddress: Address,\n) {\n return client.readContract(getConfidentialTokenAddressContract(registry, tokenAddress));\n}\n\n/** Reads the underlying token registered for a given confidential token in a wrappers registry via a viem client. */\nexport function readTokenAddressContract(\n client: PublicClient,\n registry: Address,\n confidentialTokenAddress: Address,\n) {\n return client.readContract(getTokenAddressContract(registry, confidentialTokenAddress));\n}\n\n/** Reads whether a confidential token is registered and valid in a wrappers registry via a viem client. */\nexport function readIsConfidentialTokenValidContract(\n client: PublicClient,\n registry: Address,\n confidentialTokenAddress: Address,\n) {\n return client.readContract(isConfidentialTokenValidContract(registry, confidentialTokenAddress));\n}\n"],"mappings":"A,wQA2CA,IAAagC,EAAb,KAAqD,CACnD,GAEA,YAAY,EAA4B,CACtC,KAAKC,GAAgBC,EAAO,YAC9B,CAGA,MAAM,YAA8B,CAClC,OAAO,KAAKD,GAAc,WAAW,CACvC,CAGA,MAAM,aAKJ,EACkF,CAClF,GAAM,CAAE,UAAS,GAAGE,GAASD,EAE7B,OADA,MAAMlC,EAAAA,EAAiB,eAAgBoC,MAAe,KAAK,WAAW,CAAC,EAChE,KAAKH,GAAc,aAAaE,CAAqB,CAC9D,CAMA,MAAM,UAA8D,EAG3B,CAOvC,OANA,MAAMnC,EAAAA,EAAiB,eAAgBqC,EAAO,YAAe,KAAK,WAAW,CAAC,EAMvE,MALe,KAAKJ,GAAc,UAAU,CACjD,UAAWI,EAAO,MAAM,KAAK,CAAE,QAASC,EAAG,GAAGH,KAAWA,CAAI,EAC7D,aAAc,GACd,WAAY,KAAKF,GAAc,OAAO,WAAW,aAAe,IAAA,EAClE,CAAC,CAEH,CAGA,MAAM,0BAA0B,EAAwC,CACtE,OAA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AuBC,CAAe,CAC5F,CAAC,CACH,CAGA,SAAgBC,EACd,EACA,EACA,EACA,EACA,CACA,OAAOrB,EAAO,cAAc,CAC1B,MAAOA,EAAO,MACd,QAASD,EAAeC,CAAM,EAC9B,GAAGjD,EAAAA,EAAoBmD,EAAcoB,EAAUC,CAAK,CACtD,CAAC,CACH,CAGA,SAAgBC,EACd,EACA,EACA,EACA,EACA,CACA,OAAOxB,EAAO,cAAc,CAC1B,MAAOA,EAAO,MACd,QAASD,EAAeC,CAAM,EAC9B,GAAGhD,EAAAA,EAAaqD,EAAgBI,EAAIgB,CAAM,CAC5C,CAAC,CACH,CAKA,SAAgBC,EAAuB,EAAsB,EAAmB,CAC9E,OAAO1B,EAAO,aAAa/C,EAAAA,EAAsB0E,CAAQ,CAAC,CAC5D,CAGA,SAAgBC,EAA6B,EAAsB,EAAmB,CACpF,OAAO5B,EAAO,aAAa9C,EAAAA,EAA4ByE,CAAQ,CAAC,CAClE,CAGA,SAAgBE,EACd,EACA,EACA,EACA,EACA,CACA,OAAO7B,EAAO,aAAa7C,EAAAA,EAA2BwE,EAAUG,EAAWC,CAAO,CAAC,CACrF,CAGA,SAAgBC,EAAsB,EAAsB,EAAmB,EAAe,CAC5F,OAAOhC,EAAO,aAAa5C,EAAAA,EAAqBuE,EAAUM,CAAK,CAAC,CAClE,CAGA,SAAgBC,EACd,EACA,EACA,EACA,CACA,OAAOlC,EAAO,aAAa3C,EAAAA,EAAoCsE,EAAUzB,CAAY,CAAC,CACxF,CAGA,SAAgBiC,EACd,EACA,EACA,EACA,CACA,OAAOnC,EAAO,aAAa1C,EAAAA,EAAwBqE,EAAUS,CAAwB,CAAC,CACxF,CAGA,SAAgBC,EACd,EACA,EACA,EACA,CACA,OAAOrC,EAAO,aAAazC,EAAAA,EAAiCoE,EAAUS,CAAwB,CAAC,CACjG,C"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../fhevm-relayer.cjs"),t=require("../validation.cjs");let n=require("zod/mini");const r=e=>n.z._default(n.z.number().check(n.z.positive()),e),i=n.z.custom(e=>typeof e==`function`),a=n.z.object({offloadEncrypt:n.z._default(n.z.union([n.z.literal(`auto`),n.z.boolean()]),`auto`),offloadTimeouts:n.z.optional(n.z.object({spawn:r(e.r.spawn),init:r(e.r.init)})),offloadWorker:n.z.optional(n.z.union([n.z.string().check(n.z.minLength(1)),n.z.instanceof(URL),i]))});function o(n){let{offloadEncrypt:r,offloadTimeouts:i,offloadWorker:o,...s}=n??{},c=t.t(a,{offloadEncrypt:r,offloadTimeouts:i,offloadWorker:o});return{type:`web`,createRelayer:(t,n,r)=>new e.t({chain:t,options:s,telemetry:r&&{state:r,runtime:`web`},offloadEncrypt:c.offloadEncrypt,offloadTimeouts:c.offloadTimeouts,offloadWorker:c.offloadWorker,logger:n})}}exports.web=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../fhevm-relayer.cjs"),t=require("../validation.cjs");let n=require("zod/mini");const r=e=>n.z._default(n.z.number().check(n.z.positive()),e),i=n.z.custom(e=>typeof e==`function`),a=n.z.object({offloadEncrypt:n.z._default(n.z.union([n.z.literal(`auto`),n.z.boolean()]),`auto`),offloadTimeouts:n.z.optional(n.z.object({spawn:r(e.r.spawn),init:r(e.r.init)})),offloadWorker:n.z.optional(n.z.union([n.z.string().check(n.z.minLength(1)),n.z.instanceof(URL),i]))});function o(n){let{offloadEncrypt:r,offloadTimeouts:i,offloadWorker:o,...s}=n??{},c=t.t(a,{offloadEncrypt:r,offloadTimeouts:i,offloadWorker:o});return{type:`web`,createRelayer:(t,n,r)=>new e.t({chain:t,options:s,telemetry:r&&{state:r,runtime:`web`,mode:r.mode},offloadEncrypt:c.offloadEncrypt,offloadTimeouts:c.offloadTimeouts,offloadWorker:c.offloadWorker,logger:n})}}exports.web=o;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["z","DEFAULT_ENCRYPT_WORKER_TIMEOUTS","parseSchema","FhevmRelayer"],"sources":["../../../src/config/web.ts"],"sourcesContent":["import { z } from \"zod/mini\";\nimport { FhevmRelayer } from \"../relayer/fhevm-relayer\";\nimport type { RelayerOptions } from \"../relayer/types\";\nimport { parseSchema } from \"../validation\";\nimport {\n DEFAULT_ENCRYPT_WORKER_TIMEOUTS,\n type EncryptWorkerTimeouts,\n} from \"../worker/encrypt-worker-client\";\nimport type { WebRelayerConfig } from \"./types\";\n\n/** {@link RelayerOptions} plus the web-only encryption offload switches. */\nexport interface WebRelayerOptions extends RelayerOptions {\n /**\n * Run encryption in a dedicated Web Worker so ZK proof generation never\n * blocks the page's main thread.\n *\n * - `\"auto\"` (the default) offloads when the environment can spawn module\n * workers, and falls back to the main thread when it can't (the worker\n * script fails to load, times out, or crashes), warning on the console.\n * - `true` requires the offload: the same failures reject the encryption\n * with `EncryptOffloadUnavailableError` instead of falling back.\n * The rejection happens on the first encryption, not at config time, so\n * server-side rendering is unaffected.\n * - `false` always encrypts on the calling thread.\n *\n * @defaultValue `\"auto\"`\n */\n readonly offloadEncrypt?: \"auto\" | boolean;\n /**\n * Watchdog deadlines for the encrypt worker's lifecycle steps, in\n * milliseconds. A missed deadline means the worker is presumed stuck: it\n * is discarded, and the operation falls back or rejects per the\n * `offloadEncrypt` setting. Individual encrypt operations are not watched; a\n * worker computing a ZK proof can run for as long as it needs.\n *\n * @defaultValue `{ spawn: 10_000, init: 300_000 }`\n */\n readonly offloadTimeouts?: Partial<EncryptWorkerTimeouts>;\n /**\n * Custom source for the encrypt worker, for bundlers or CSPs that the\n * built-in `new Worker(new URL(\"./encrypt.worker.js\", import.meta.url))`\n * spawn doesn't reach: Vite dev-mode pre-bundling and older webpack don't\n * always detect that pattern inside `node_modules`, and a strict\n * `worker-src` CSP may only allow a path the app itself serves.\n *\n * - A string or `URL`: spawned as `new Worker(source, options)` with the\n * SDK's own worker options. Same-origin rules apply, as for any worker\n * URL. Serve `dist/esm/encrypt.worker.js` from this package, copied into\n * your public/static directory.\n * - A factory `() => Worker`: called to obtain the worker; you own every\n * construction option. Write the `new Worker(new URL(...))` expression\n * in your own source so your bundler can detect and rewrite it natively.\n *\n * When absent, the SDK spawns its own bundled worker.\n *\n * @example\n * ```ts\n * web({ offloadWorker: \"/encrypt.worker.js\" })\n * web({ offloadWorker: () => new Worker(new URL(\"./workers/encrypt.js\", import.meta.url), { type: \"module\" }) })\n * ```\n */\n readonly offloadWorker?: string | URL | (() => Worker);\n}\n\nconst timeoutSchema = (fallback: number) => z._default(z.number().check(z.positive()), fallback);\nconst offloadWorkerFunction = z.custom<() => Worker>((v) => typeof v === \"function\");\nconst WebRelayerOptionsSchema = z.object({\n offloadEncrypt: z._default(z.union([z.literal(\"auto\"), z.boolean()]), \"auto\"),\n // Per-field defaults, so an explicit `{ spawn: undefined }` cannot overwrite\n // a default downstream.\n offloadTimeouts: z.optional(\n z.object({\n spawn: timeoutSchema(DEFAULT_ENCRYPT_WORKER_TIMEOUTS.spawn),\n init: timeoutSchema(DEFAULT_ENCRYPT_WORKER_TIMEOUTS.init),\n }),\n ),\n // Non-empty: `new Worker(\"\")` resolves to the document URL and fails as a\n // spawn error rather than as the configuration mistake it is.\n offloadWorker: z.optional(\n z.union([z.string().check(z.minLength(1)), z.instanceof(URL), offloadWorkerFunction]),\n ),\n});\n\n/**\n * Browser relayer, driving `@fhevm/sdk` via {@link FhevmRelayer} with\n * encryption offloaded to a Web Worker by default.\n *\n * @example\n * ```ts\n * relayers: {\n * [sepolia.id]: web({ timeout: 5 * 60_000 }),\n * [mainnet.id]: web({ batchRpcCalls: true, offloadEncrypt: false }),\n * }\n * ```\n */\nexport function web(options?: WebRelayerOptions): WebRelayerConfig {\n const { offloadEncrypt, offloadTimeouts, offloadWorker, ...relayerOptions } = options ?? {};\n const parsed = parseSchema(WebRelayerOptionsSchema, {\n offloadEncrypt,\n offloadTimeouts,\n offloadWorker,\n });\n return {\n type: \"web\",\n createRelayer: (chain, logger, telemetry) =>\n new FhevmRelayer({\n chain,\n options: relayerOptions,\n telemetry: telemetry && { state: telemetry, runtime: \"web\" },\n offloadEncrypt: parsed.offloadEncrypt,\n offloadTimeouts: parsed.offloadTimeouts,\n offloadWorker: parsed.offloadWorker,\n logger,\n }),\n };\n}\n"],"mappings":"oKAgEA,MAAM,EAAiB,GAAqBA,EAAAA,EAAE,SAASA,EAAAA,EAAE,OAAO,CAAC,CAAC,MAAMA,EAAAA,EAAE,SAAS,CAAC,EAAG,CAAQ,EACzF,EAAwBA,EAAAA,EAAE,OAAsB,GAAM,OAAO,GAAM,UAAU,EAC7E,EAA0BA,EAAAA,EAAE,OAAO,CACvC,eAAgBA,EAAAA,EAAE,SAASA,EAAAA,EAAE,MAAM,CAACA,EAAAA,EAAE,QAAQ,MAAM,EAAGA,EAAAA,EAAE,QAAQ,CAAC,CAAC,EAAG,MAAM,EAG5E,gBAAiBA,EAAAA,EAAE,SACjBA,EAAAA,EAAE,OAAO,CACP,MAAO,EAAcC,EAAAA,EAAgC,KAAK,EAC1D,KAAM,EAAcA,EAAAA,EAAgC,IAAI,CAC1D,CAAC,CACH,EAGA,cAAeD,EAAAA,EAAE,SACfA,EAAAA,EAAE,MAAM,CAACA,EAAAA,EAAE,OAAO,CAAC,CAAC,MAAMA,EAAAA,EAAE,UAAU,CAAC,CAAC,EAAGA,EAAAA,EAAE,WAAW,GAAG,EAAG,CAAqB,CAAC,CACtF,CACF,CAAC,EAcD,SAAgB,EAAI,EAA+C,CACjE,GAAM,CAAE,iBAAgB,kBAAiB,gBAAe,GAAG,GAAmB,GAAW,CAAC,EACpF,EAASE,EAAAA,EAAY,EAAyB,CAClD,iBACA,kBACA,eACF,CAAC,EACD,MAAO,CACL,KAAM,MACN,eAAgB,EAAO,EAAQ,IAC7B,IAAIC,EAAAA,EAAa,CACf,QACA,QAAS,EACT,UAAW,GAAa,CAAE,MAAO,EAAW,QAAS,KAAM,EAC3D,eAAgB,EAAO,eACvB,gBAAiB,EAAO,gBACxB,cAAe,EAAO,cACtB,QACF,CAAC,CACL,CACF"}
1
+ {"version":3,"file":"index.cjs","names":["z","DEFAULT_ENCRYPT_WORKER_TIMEOUTS","parseSchema","FhevmRelayer","require_fhevm_relayer","require_validation","zod_mini","timeoutSchema","fallback","offloadWorkerFunction","v","WebRelayerOptionsSchema","web","relayerOptions","options","parsed","telemetry"],"sources":["../../../src/config/web.ts"],"sourcesContent":["import { z } from \"zod/mini\";\nimport { FhevmRelayer } from \"../relayer/fhevm-relayer\";\nimport type { RelayerOptions } from \"../relayer/types\";\nimport { parseSchema } from \"../validation\";\nimport {\n DEFAULT_ENCRYPT_WORKER_TIMEOUTS,\n type EncryptWorkerTimeouts,\n} from \"../worker/encrypt-worker-client\";\nimport type { WebRelayerConfig } from \"./types\";\n\n/** {@link RelayerOptions} plus the web-only encryption offload switches. */\nexport interface WebRelayerOptions extends RelayerOptions {\n /**\n * Run encryption in a dedicated Web Worker so ZK proof generation never\n * blocks the page's main thread.\n *\n * - `\"auto\"` (the default) offloads when the environment can spawn module\n * workers, and falls back to the main thread when it can't (the worker\n * script fails to load, times out, or crashes), warning on the console.\n * - `true` requires the offload: the same failures reject the encryption\n * with `EncryptOffloadUnavailableError` instead of falling back.\n * The rejection happens on the first encryption, not at config time, so\n * server-side rendering is unaffected.\n * - `false` always encrypts on the calling thread.\n *\n * @defaultValue `\"auto\"`\n */\n readonly offloadEncrypt?: \"auto\" | boolean;\n /**\n * Watchdog deadlines for the encrypt worker's lifecycle steps, in\n * milliseconds. A missed deadline means the worker is presumed stuck: it\n * is discarded, and the operation falls back or rejects per the\n * `offloadEncrypt` setting. Individual encrypt operations are not watched; a\n * worker computing a ZK proof can run for as long as it needs.\n *\n * @defaultValue `{ spawn: 10_000, init: 300_000 }`\n */\n readonly offloadTimeouts?: Partial<EncryptWorkerTimeouts>;\n /**\n * Custom source for the encrypt worker, for bundlers or CSPs that the\n * built-in `new Worker(new URL(\"./encrypt.worker.js\", import.meta.url))`\n * spawn doesn't reach: Vite dev-mode pre-bundling and older webpack don't\n * always detect that pattern inside `node_modules`, and a strict\n * `worker-src` CSP may only allow a path the app itself serves.\n *\n * - A string or `URL`: spawned as `new Worker(source, options)` with the\n * SDK's own worker options. Same-origin rules apply, as for any worker\n * URL. Serve `dist/esm/encrypt.worker.js` from this package, copied into\n * your public/static directory.\n * - A factory `() => Worker`: called to obtain the worker; you own every\n * construction option. Write the `new Worker(new URL(...))` expression\n * in your own source so your bundler can detect and rewrite it natively.\n *\n * When absent, the SDK spawns its own bundled worker.\n *\n * @example\n * ```ts\n * web({ offloadWorker: \"/encrypt.worker.js\" })\n * web({ offloadWorker: () => new Worker(new URL(\"./workers/encrypt.js\", import.meta.url), { type: \"module\" }) })\n * ```\n */\n readonly offloadWorker?: string | URL | (() => Worker);\n}\n\nconst timeoutSchema = (fallback: number) => z._default(z.number().check(z.positive()), fallback);\nconst offloadWorkerFunction = z.custom<() => Worker>((v) => typeof v === \"function\");\nconst WebRelayerOptionsSchema = z.object({\n offloadEncrypt: z._default(z.union([z.literal(\"auto\"), z.boolean()]), \"auto\"),\n // Per-field defaults, so an explicit `{ spawn: undefined }` cannot overwrite\n // a default downstream.\n offloadTimeouts: z.optional(\n z.object({\n spawn: timeoutSchema(DEFAULT_ENCRYPT_WORKER_TIMEOUTS.spawn),\n init: timeoutSchema(DEFAULT_ENCRYPT_WORKER_TIMEOUTS.init),\n }),\n ),\n // Non-empty: `new Worker(\"\")` resolves to the document URL and fails as a\n // spawn error rather than as the configuration mistake it is.\n offloadWorker: z.optional(\n z.union([z.string().check(z.minLength(1)), z.instanceof(URL), offloadWorkerFunction]),\n ),\n});\n\n/**\n * Browser relayer, driving `@fhevm/sdk` via {@link FhevmRelayer} with\n * encryption offloaded to a Web Worker by default.\n *\n * @example\n * ```ts\n * relayers: {\n * [sepolia.id]: web({ timeout: 5 * 60_000 }),\n * [mainnet.id]: web({ batchRpcCalls: true, offloadEncrypt: false }),\n * }\n * ```\n */\nexport function web(options?: WebRelayerOptions): WebRelayerConfig {\n const { offloadEncrypt, offloadTimeouts, offloadWorker, ...relayerOptions } = options ?? {};\n const parsed = parseSchema(WebRelayerOptionsSchema, {\n offloadEncrypt,\n offloadTimeouts,\n offloadWorker,\n });\n return {\n type: \"web\",\n createRelayer: (chain, logger, telemetry) =>\n new FhevmRelayer({\n chain,\n options: relayerOptions,\n telemetry: telemetry && { state: telemetry, runtime: \"web\", mode: telemetry.mode },\n offloadEncrypt: parsed.offloadEncrypt,\n offloadTimeouts: parsed.offloadTimeouts,\n offloadWorker: parsed.offloadWorker,\n logger,\n }),\n };\n}\n"],"mappings":"A,oKAgEA,MAAMO,EAAiB,GAAqBP,EAAAA,EAAE,SAASA,EAAAA,EAAE,OAAO,CAAC,CAAC,MAAMA,EAAAA,EAAE,SAAS,CAAC,EAAGQ,CAAQ,EACzFC,EAAwBT,EAAAA,EAAE,OAAsB,GAAM,OAAOU,GAAM,UAAU,EAC7EC,EAA0BX,EAAAA,EAAE,OAAO,CACvC,eAAgBA,EAAAA,EAAE,SAASA,EAAAA,EAAE,MAAM,CAACA,EAAAA,EAAE,QAAQ,MAAM,EAAGA,EAAAA,EAAE,QAAQ,CAAC,CAAC,EAAG,MAAM,EAG5E,gBAAiBA,EAAAA,EAAE,SACjBA,EAAAA,EAAE,OAAO,CACP,MAAOO,EAAcN,EAAAA,EAAgC,KAAK,EAC1D,KAAMM,EAAcN,EAAAA,EAAgC,IAAI,CAC1D,CAAC,CACH,EAGA,cAAeD,EAAAA,EAAE,SACfA,EAAAA,EAAE,MAAM,CAACA,EAAAA,EAAE,OAAO,CAAC,CAAC,MAAMA,EAAAA,EAAE,UAAU,CAAC,CAAC,EAAGA,EAAAA,EAAE,WAAW,GAAG,EAAGS,CAAqB,CAAC,CACtF,CACF,CAAC,EAcD,SAAgBG,EAAI,EAA+C,CACjE,GAAM,CAAE,iBAAgB,kBAAiB,gBAAe,GAAGC,GAAmBC,GAAW,CAAC,EACpFC,EAASb,EAAAA,EAAYS,EAAyB,CAClD,iBACA,kBACA,eACF,CAAC,EACD,MAAO,CACL,KAAM,MACN,eAAgB,EAAO,EAAQ,IAC7B,IAAIR,EAAAA,EAAa,CACf,QACA,QAASU,EACT,UAAWG,GAAa,CAAE,MAAOA,EAAW,QAAS,MAAO,KAAMA,EAAU,IAAK,EACjF,eAAgBD,EAAO,eACvB,gBAAiBA,EAAO,gBACxB,cAAeA,EAAO,cACtB,QACF,CAAC,CACL,CACF,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrappers-registry.cjs","names":[],"sources":["../../src/contracts/wrappers-registry.ts"],"sourcesContent":["import type { Address } from \"viem\";\n\nexport const wrappersRegistryAbi = [\n {\n inputs: [],\n name: \"getTokenConfidentialTokenPairs\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair[]\",\n name: \"\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getTokenConfidentialTokenPairsLength\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"fromIndex\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"toIndex\", type: \"uint256\" },\n ],\n name: \"getTokenConfidentialTokenPairsSlice\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair[]\",\n name: \"\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"index\", type: \"uint256\" }],\n name: \"getTokenConfidentialTokenPair\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"tokenAddress\", type: \"address\" }],\n name: \"getConfidentialTokenAddress\",\n outputs: [\n { internalType: \"bool\", name: \"\", type: \"bool\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"getTokenAddress\",\n outputs: [\n { internalType: \"bool\", name: \"\", type: \"bool\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"isConfidentialTokenValid\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"initialOwner\", type: \"address\" }],\n name: \"initialize\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n ],\n name: \"registerConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"revokeConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\n/** A registered plain-token / confidential-token pairing from the wrappers registry. */\nexport interface TokenWrapperPair {\n /** Address of the underlying public ERC-20 token. */\n readonly tokenAddress: Address;\n /** Address of the paired confidential (ERC-7984) token. */\n readonly confidentialTokenAddress: Address;\n /** Whether the pairing is currently valid (registered and not revoked). */\n readonly isValid: boolean;\n}\n\n/** Extended pair with on-chain metadata for both tokens. */\nexport interface TokenWrapperPairWithMetadata extends TokenWrapperPair {\n /** On-chain metadata of the underlying public ERC-20 token. */\n readonly underlying: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n readonly totalSupply: bigint;\n };\n /** On-chain metadata of the confidential token. */\n readonly confidential: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n };\n}\n\n/** Paginated result set modeled after standard API pagination. */\nexport interface PaginatedResult<T> {\n /** Items on the current page. */\n readonly items: readonly T[];\n /** Total number of items across all pages. */\n readonly total: number;\n /** One-based index of the current page. */\n readonly page: number;\n /** Maximum number of items per page. */\n readonly pageSize: number;\n}\n\n/**\n * Returns the contract config to fetch all token wrapper pairs.\n *\n * @example\n * ```ts\n * const pairs = await client.readContract(\n * getTokenPairsContract(registryAddress),\n * );\n * ```\n */\nexport function getTokenPairsContract(registry: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPairs\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to get the number of token wrapper pairs.\n *\n * @example\n * ```ts\n * const length = await client.readContract(\n * getTokenPairsLengthContract(registryAddress),\n * );\n * ```\n */\nexport function getTokenPairsLengthContract(registry: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPairsLength\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to fetch a slice of token wrapper pairs.\n *\n * @example\n * ```ts\n * const pairs = await client.readContract(\n * getTokenPairsSliceContract(registryAddress, 0n, 10n),\n * );\n * ```\n */\nexport function getTokenPairsSliceContract(registry: Address, fromIndex: bigint, toIndex: bigint) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPairsSlice\",\n args: [fromIndex, toIndex],\n } as const;\n}\n\n/**\n * Returns the contract config to fetch a single token wrapper pair by index.\n *\n * @example\n * ```ts\n * const pair = await client.readContract(\n * getTokenPairContract(registryAddress, 0n),\n * );\n * ```\n */\nexport function getTokenPairContract(registry: Address, index: bigint) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPair\",\n args: [index],\n } as const;\n}\n\n/**\n * Returns the contract config to look up the confidential token for a given plain token.\n *\n * @example\n * ```ts\n * const [isValid, confidentialToken] = await client.readContract(\n * getConfidentialTokenAddressContract(registryAddress, tokenAddress),\n * );\n * // isValid=false + confidentialToken=zeroAddress → not registered\n * // isValid=false + confidentialToken=nonZeroAddress → registered but revoked\n * // isValid=true + confidentialToken=nonZeroAddress → registered and valid\n * ```\n */\nexport function getConfidentialTokenAddressContract(registry: Address, tokenAddress: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getConfidentialTokenAddress\",\n args: [tokenAddress],\n } as const;\n}\n\n/**\n * Returns the contract config to look up the plain token for a given confidential token.\n *\n * @example\n * ```ts\n * const [isValid, token] = await client.readContract(\n * getTokenAddressContract(registryAddress, confidentialTokenAddress),\n * );\n * // isValid=false + token=zeroAddress → not registered\n * // isValid=false + token=nonZeroAddress → registered but revoked\n * // isValid=true + token=nonZeroAddress → registered and valid\n * ```\n */\nexport function getTokenAddressContract(registry: Address, confidentialTokenAddress: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenAddress\",\n args: [confidentialTokenAddress],\n } as const;\n}\n\n/**\n * Returns the contract config to check if a confidential token is valid.\n *\n * @example\n * ```ts\n * const isValid = await client.readContract(\n * isConfidentialTokenValidContract(registryAddress, confidentialTokenAddress),\n * );\n * ```\n */\nexport function isConfidentialTokenValidContract(\n registry: Address,\n confidentialTokenAddress: Address,\n) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"isConfidentialTokenValid\",\n args: [confidentialTokenAddress],\n } as const;\n}\n"],"mappings":"AAEA,MAAa,EAAsB,CACjC,CACE,OAAQ,CAAC,EACT,KAAM,iCACN,QAAS,CACP,CACE,WAAY,CACV,CAAE,aAAc,UAAW,KAAM,eAAgB,KAAM,SAAU,EACjE,CAAE,aAAc,UAAW,KAAM,2BAA4B,KAAM,SAAU,EAC7E,CAAE,aAAc,OAAQ,KAAM,UAAW,KAAM,MAAO,CACxD,EACA,aAAc,8DACd,KAAM,GACN,KAAM,SACR,CACF,EACA,gBAAiB,OACjB,KAAM,UACR,EACA,CACE,OAAQ,CAAC,EACT,KAAM,uCACN,QAAS,CAAC,CAAE,aAAc,UAAW,KAAM,GAAI,KAAM,SAAU,CAAC,EAChE,gBAAiB,OACjB,KAAM,UACR,EACA,CACE,OAAQ,CACN,CAAE,aAAc,UAAW,KAAM,YAAa,KAAM,SAAU,EAC9D,CAAE,aAAc,UAAW,KAAM,UAAW,KAAM,SAAU,CAC9D,EACA,KAAM,sCACN,QAAS,CACP,CACE,WAAY,CACV,CAAE,aAAc,UAAW,KAAM,eAAgB,KAAM,SAAU,EACjE,CAAE,aAAc,UAAW,KAAM,2BAA4B,KAAM,SAAU,EAC7E,CAAE,aAAc,OAAQ,KAAM,UAAW,KAAM,MAAO,CACxD,EACA,aAAc,8DACd,KAAM,GACN,KAAM,SACR,CACF,EACA,gBAAiB,OACjB,KAAM,UACR,EACA,CACE,OAAQ,CAAC,CAAE,aAAc,UAAW,KAAM,QAAS,KAAM,SAAU,CAAC,EACpE,KAAM,gCACN,QAAS,CACP,CACE,WAAY,CACV,CAAE,aAAc,UAAW,KAAM,eAAgB,KAAM,SAAU,EACjE,CAAE,aAAc,UAAW,KAAM,2BAA4B,KAAM,SAAU,EAC7E,CAAE,aAAc,OAAQ,KAAM,UAAW,KAAM,MAAO,CACxD,EACA,aAAc,4DACd,KAAM,GACN,KAAM,O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T,CACF,CAYA,SAAgB,EAA4B,EAAmB,CAC7D,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,uCACd,KAAM,CAAC,CACT,CACF,CAYA,SAAgB,EAA2B,EAAmB,EAAmB,EAAiB,CAChG,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,sCACd,KAAM,CAAC,EAAW,CAAO,CAC3B,CACF,CAYA,SAAgB,EAAqB,EAAmB,EAAe,CACrE,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,gCACd,KAAM,CAAC,CAAK,CACd,CACF,CAeA,SAAgB,EAAoC,EAAmB,EAAuB,CAC5F,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,8BACd,KAAM,CAAC,CAAY,CACrB,CACF,CAeA,SAAgB,EAAwB,EAAmB,EAAmC,CAC5F,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,kBACd,KAAM,CAAC,CAAwB,CACjC,CACF,CAYA,SAAgB,EACd,EACA,EACA,CACA,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,2BACd,KAAM,CAAC,CAAwB,CACjC,CACF"}
1
+ {"version":3,"file":"wrappers-registry.cjs","names":["wrappersRegistryAbi","getTokenPairsContract","registry","getTokenPairsLengthContract","getTokenPairsSliceContract","fromIndex","toIndex","getTokenPairContract","index","getConfidentialTokenAddressContract","tokenAddress","getTokenAddressContract","confidentialTokenAddress","isConfidentialTokenValidContract"],"sources":["../../src/contracts/wrappers-registry.ts"],"sourcesContent":["import type { Address } from \"viem\";\n\nexport const wrappersRegistryAbi = [\n {\n inputs: [],\n name: \"getTokenConfidentialTokenPairs\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair[]\",\n name: \"\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getTokenConfidentialTokenPairsLength\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"fromIndex\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"toIndex\", type: \"uint256\" },\n ],\n name: \"getTokenConfidentialTokenPairsSlice\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair[]\",\n name: \"\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"index\", type: \"uint256\" }],\n name: \"getTokenConfidentialTokenPair\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"tokenAddress\", type: \"address\" }],\n name: \"getConfidentialTokenAddress\",\n outputs: [\n { internalType: \"bool\", name: \"\", type: \"bool\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"getTokenAddress\",\n outputs: [\n { internalType: \"bool\", name: \"\", type: \"bool\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"isConfidentialTokenValid\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"initialOwner\", type: \"address\" }],\n name: \"initialize\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n ],\n name: \"registerConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"revokeConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\n/** A registered plain-token / confidential-token pairing from the wrappers registry. */\nexport interface TokenWrapperPair {\n /** Address of the underlying public ERC-20 token. */\n readonly tokenAddress: Address;\n /** Address of the paired confidential (ERC-7984) token. */\n readonly confidentialTokenAddress: Address;\n /** Whether the pairing is currently valid (registered and not revoked). */\n readonly isValid: boolean;\n}\n\n/** Extended pair with on-chain metadata for both tokens. */\nexport interface TokenWrapperPairWithMetadata extends TokenWrapperPair {\n /** On-chain metadata of the underlying public ERC-20 token. */\n readonly underlying: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n readonly totalSupply: bigint;\n };\n /** On-chain metadata of the confidential token. */\n readonly confidential: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n };\n}\n\n/** Paginated result set modeled after standard API pagination. */\nexport interface PaginatedResult<T> {\n /** Items on the current page. */\n readonly items: readonly T[];\n /** Total number of items across all pages. */\n readonly total: number;\n /** One-based index of the current page. */\n readonly page: number;\n /** Maximum number of items per page. */\n readonly pageSize: number;\n}\n\n/**\n * Returns the contract config to fetch all token wrapper pairs.\n *\n * @example\n * ```ts\n * const pairs = await client.readContract(\n * getTokenPairsContract(registryAddress),\n * );\n * ```\n */\nexport function getTokenPairsContract(registry: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPairs\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to get the number of token wrapper pairs.\n *\n * @example\n * ```ts\n * const length = await client.readContract(\n * getTokenPairsLengthContract(registryAddress),\n * );\n * ```\n */\nexport function getTokenPairsLengthContract(registry: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPairsLength\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to fetch a slice of token wrapper pairs.\n *\n * @example\n * ```ts\n * const pairs = await client.readContract(\n * getTokenPairsSliceContract(registryAddress, 0n, 10n),\n * );\n * ```\n */\nexport function getTokenPairsSliceContract(registry: Address, fromIndex: bigint, toIndex: bigint) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPairsSlice\",\n args: [fromIndex, toIndex],\n } as const;\n}\n\n/**\n * Returns the contract config to fetch a single token wrapper pair by index.\n *\n * @example\n * ```ts\n * const pair = await client.readContract(\n * getTokenPairContract(registryAddress, 0n),\n * );\n * ```\n */\nexport function getTokenPairContract(registry: Address, index: bigint) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenConfidentialTokenPair\",\n args: [index],\n } as const;\n}\n\n/**\n * Returns the contract config to look up the confidential token for a given plain token.\n *\n * @example\n * ```ts\n * const [isValid, confidentialToken] = await client.readContract(\n * getConfidentialTokenAddressContract(registryAddress, tokenAddress),\n * );\n * // isValid=false + confidentialToken=zeroAddress → not registered\n * // isValid=false + confidentialToken=nonZeroAddress → registered but revoked\n * // isValid=true + confidentialToken=nonZeroAddress → registered and valid\n * ```\n */\nexport function getConfidentialTokenAddressContract(registry: Address, tokenAddress: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getConfidentialTokenAddress\",\n args: [tokenAddress],\n } as const;\n}\n\n/**\n * Returns the contract config to look up the plain token for a given confidential token.\n *\n * @example\n * ```ts\n * const [isValid, token] = await client.readContract(\n * getTokenAddressContract(registryAddress, confidentialTokenAddress),\n * );\n * // isValid=false + token=zeroAddress → not registered\n * // isValid=false + token=nonZeroAddress → registered but revoked\n * // isValid=true + token=nonZeroAddress → registered and valid\n * ```\n */\nexport function getTokenAddressContract(registry: Address, confidentialTokenAddress: Address) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"getTokenAddress\",\n args: [confidentialTokenAddress],\n } as const;\n}\n\n/**\n * Returns the contract config to check if a confidential token is valid.\n *\n * @example\n * ```ts\n * const isValid = await client.readContract(\n * isConfidentialTokenValidContract(registryAddress, confidentialTokenAddress),\n * );\n * ```\n */\nexport function isConfidentialTokenValidContract(\n registry: Address,\n confidentialTokenAddress: Address,\n) {\n return {\n address: registry,\n abi: wrappersRegistryAbi,\n functionName: \"isConfidentialTokenValid\",\n args: [confidentialTokenAddress],\n } as const;\n}\n"],"mappings":"AAEA,MAAaA,EAAsB,CACjC,CACE,OAAQ,CAAC,EACT,KAAM,iCACN,QAAS,CACP,CACE,WAAY,CACV,CAAE,aAAc,UAAW,KAAM,eAAgB,KAAM,SAAU,EACjE,CAAE,aAAc,UAAW,KAAM,2BAA4B,KAAM,SAAU,EAC7E,CAAE,aAAc,OAAQ,KAAM,UAAW,KAAM,MAAO,CACxD,EACA,aAAc,8DACd,KAAM,GACN,KAAM,SACR,CACF,EACA,gBAAiB,OACjB,KAAM,UACR,EACA,CACE,OAAQ,CAAC,EACT,KAAM,uCACN,QAAS,CAAC,CAAE,aAAc,UAAW,KAAM,GAAI,KAAM,SAAU,CAAC,EAChE,gBAAiB,OACjB,KAAM,UACR,EACA,CACE,OAAQ,CACN,CAAE,aAAc,UAAW,KAAM,YAAa,KAAM,SAAU,EAC9D,CAAE,aAAc,UAAW,KAAM,UAAW,KAAM,SAAU,CAC9D,EACA,KAAM,sC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KAAM,CAACY,CAAwB,CACjC,CACF,C"}
@@ -0,0 +1,2 @@
1
+ import{i as e,r as t,t as n}from"./relayer-nWfQAlo7.js";import{erc20Abi as r,isHex as i}from"viem";var a=class extends t{constructor(t,n){super(e.TransactionReverted,t,n),this.name=`TransactionRevertedError`}},o=class extends t{constructor(t,n){super(e.HcuBlockLimitExceeded,t,n),this.name=`HcuBlockLimitExceededError`}},s=class extends t{constructor(t,n){super(e.HcuTransactionLimitExceeded,t,n),this.name=`HcuTransactionLimitExceededError`}},c=class extends t{operation;signerChainId;providerChainId;targetChainId;constructor({operation:t,signerChainId:n,providerChainId:r,targetChainId:i},a){super(e.ChainMismatch,i===void 0?`Operation "${t}" requires signer and provider to be on the same chain, but signer is on chain ${n} and provider is on chain ${r}.`:`Operation "${t}" targets chain ${i}, but signer is on chain ${n}.`,a),this.name=`ChainMismatchError`,this.operation=t,this.signerChainId=n,this.providerChainId=r,this.targetChainId=i}},l=class extends t{operation;constructor(e,t,n,r){super(e,n,r),this.name=`SignerRequiredError`,this.operation=t}},u=class extends l{constructor(t,n){super(e.SignerNotConfigured,t,`Cannot ${t} without a signer. Configure one via createConfig({ signer: ... }) or <ZamaProvider config={createConfig({ signer: ... })}>.`,n),this.name=`SignerNotConfiguredError`}},d=class extends l{constructor(t,n){super(e.WalletNotConnected,t,`Cannot ${t} without a connected wallet account.`,n),this.name=`WalletNotConnectedError`}},f=class extends l{constructor(t,n){super(e.WalletAccountNotReady,t,`Cannot ${t} before the wallet account is ready.`,n),this.name=`WalletAccountNotReadyError`}};function p(e,t){if(e==null)throw new u(t);return e}const m={EncryptStart:`encrypt:start`,EncryptEnd:`encrypt:end`,EncryptError:`encrypt:error`,DecryptStart:`decrypt:start`,DecryptEnd:`decrypt:end`,DecryptError:`decrypt:error`,PermitError:`permit:error`,TransactionError:`transaction:error`,ShieldSubmitted:`shield:submitted`,TransferSubmitted:`transfer:submitted`,TransferFromSubmitted:`transferFrom:submitted`,SetOperatorSubmitted:`setOperator:submitted`,ApproveUnderlyingSubmitted:`approveUnderlying:submitted`,WrapSubmitted:`wrap:submitted`,UnwrapSubmitted:`unwrap:submitted`,FinalizeUnwrapSubmitted:`finalizeUnwrap:submitted`,VaultSubmitted:`vault:submitted`,DelegationSubmitted:`delegation:submitted`,RevokeDelegationSubmitted:`revokeDelegation:submitted`,UnshieldPhase1Submitted:`unshield:phase1_submitted`,UnshieldPhase2Started:`unshield:phase2_started`,UnshieldPhase2Submitted:`unshield:phase2_submitted`},h={approveUnderlying:{submittedEvent:e=>({type:m.ApproveUnderlyingSubmitted,txHash:e,step:`approve`})},"approveUnderlying:reset":{submittedEvent:e=>({type:m.ApproveUnderlyingSubmitted,txHash:e,step:`reset`})},delegateDecryption:{submittedEvent:e=>({type:m.DelegationSubmitted,txHash:e})},finalizeUnwrap:{submittedEvent:e=>({type:m.FinalizeUnwrapSubmitted,txHash:e})},revokeDelegation:{submittedEvent:e=>({type:m.RevokeDelegationSubmitted,txHash:e})},setOperator:{submittedEvent:e=>({type:m.SetOperatorSubmitted,txHash:e})},"shield:transferAndCall":{submittedEvent:e=>({type:m.ShieldSubmitted,txHash:e,shieldPath:`transferAndCall`})},"shield:approveAndWrap":{submittedEvent:e=>({type:m.ShieldSubmitted,txHash:e,shieldPath:`approveAndWrap`})},wrap:{submittedEvent:e=>({type:m.WrapSubmitted,txHash:e})},transfer:{submittedEvent:e=>({type:m.TransferSubmitted,txHash:e})},transferAndCall:{submittedEvent:e=>({type:m.TransferSubmitted,txHash:e})},transferFrom:{submittedEvent:e=>({type:m.TransferFromSubmitted,txHash:e})},transferFromAndCall:{submittedEvent:e=>({type:m.TransferFromSubmitted,txHash:e})},unwrap:{submittedEvent:e=>({type:m.UnwrapSubmitted,txHash:e})},unwrapAll:{submittedEvent:e=>({type:m.UnwrapSubmitted,txHash:e})},"vault:join":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`join`})},"vault:quit":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`quit`})},"vault:claim":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`claim`})},"vault:recover":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`recover`})},"vault:dispatchBatch":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`dispatchBatch`})},"vault:finalize":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`finalize`})},"vault:routerJoin":{submittedEvent:e=>({type:m.VaultSubmitted,txHash:e,vaultOperation:`routerJoin`})}};function g(e,t){if(e==null)throw TypeError(`${t} must not be null or undefined`)}function _(e,t){if(typeof e!=`bigint`)throw TypeError(`${t} must be a bigint, got ${typeof e}`)}function v(e,t){if(!i(e))throw TypeError(`${t} must be a 0x-prefixed hex string, got ${typeof e}`)}async function y(e,t,n){try{await t()}catch(t){n?.warn(`${e} failed`,{error:t})}}const b=[{type:`function`,name:`UPGRADE_INTERFACE_VERSION`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`acceptOwnership`,inputs:[],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`blockUser`,inputs:[{name:`user`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`confidentialBalanceOf`,inputs:[{name:`account`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`view`},{type:`function`,name:`confidentialProtocolId`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`confidentialTotalSupply`,inputs:[],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`view`},{type:`function`,name:`confidentialTransfer`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransfer`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFrom`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFrom`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`contractURI`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`decimals`,inputs:[],outputs:[{name:``,type:`uint8`,internalType:`uint8`}],stateMutability:`view`},{type:`function`,name:`discloseEncryptedAmount`,inputs:[{name:`encryptedAmount`,type:`bytes32`,internalType:`euint64`},{name:`cleartextAmount`,type:`uint64`,internalType:`uint64`},{name:`decryptionProof`,type:`bytes`,internalType:`bytes`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`finalizeUnwrap`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`},{name:`unwrapAmountCleartext`,type:`uint64`,internalType:`uint64`},{name:`decryptionProof`,type:`bytes`,internalType:`bytes`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`getUnderlyingDenyListSelector`,inputs:[],outputs:[{name:`isSet`,type:`bool`,internalType:`bool`},{name:`selector`,type:`bytes4`,internalType:`bytes4`}],stateMutability:`view`},{type:`function`,name:`inferredTotalSupply`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`initialize`,inputs:[{name:`name_`,type:`string`,internalType:`string`},{name:`symbol_`,type:`string`,internalType:`string`},{name:`contractURI_`,type:`string`,internalType:`string`},{name:`underlying_`,type:`address`,internalType:`contract IERC20`},{name:`owner_`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`isBlocked`,inputs:[{name:`user`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`isOperator`,inputs:[{name:`holder`,type:`address`,internalType:`address`},{name:`spender`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`maxTotalSupply`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`name`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`onTransferReceived`,inputs:[{name:`operator`,type:`address`,internalType:`address`},{name:`from`,type:`address`,internalType:`address`},{name:`amount`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bytes4`,internalType:`bytes4`}],stateMutability:`nonpayable`},{type:`function`,name:`owner`,inputs:[],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`pendingOwner`,inputs:[],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`proxiableUUID`,inputs:[],outputs:[{name:``,type:`bytes32`,internalType:`bytes32`}],stateMutability:`view`},{type:`function`,name:`rate`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`reinitializeV2`,inputs:[],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`reinitializeV3`,inputs:[{name:`blockedUsers`,type:`address[]`,internalType:`address[]`},{name:`underlyingDenyListSelector`,type:`bytes4`,internalType:`bytes4`},{name:`hasUnderlyingDenyListSelector_`,type:`bool`,internalType:`bool`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`renounceOwnership`,inputs:[],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`requestDiscloseEncryptedAmount`,inputs:[{name:`encryptedAmount`,type:`bytes32`,internalType:`euint64`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`setOperator`,inputs:[{name:`operator`,type:`address`,internalType:`address`},{name:`until`,type:`uint48`,internalType:`uint48`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`supportsInterface`,inputs:[{name:`interfaceId`,type:`bytes4`,internalType:`bytes4`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`symbol`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`transferOwnership`,inputs:[{name:`newOwner`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`unblockUser`,inputs:[{name:`user`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`underlying`,inputs:[],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`unwrap`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bytes32`,internalType:`bytes32`}],stateMutability:`nonpayable`},{type:`function`,name:`unwrap`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`}],outputs:[{name:``,type:`bytes32`,internalType:`bytes32`}],stateMutability:`nonpayable`},{type:`function`,name:`unwrapAmount`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`view`},{type:`function`,name:`unwrapRequester`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`}],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`upgradeToAndCall`,inputs:[{name:`newImplementation`,type:`address`,internalType:`address`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[],stateMutability:`payable`},{type:`function`,name:`wrap`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`event`,name:`AmountDiscloseRequested`,inputs:[{name:`encryptedAmount`,type:`bytes32`,indexed:!0,internalType:`euint64`},{name:`requester`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`AmountDisclosed`,inputs:[{name:`encryptedAmount`,type:`bytes32`,indexed:!0,internalType:`euint64`},{name:`amount`,type:`uint64`,indexed:!1,internalType:`uint64`}],anonymous:!1},{type:`event`,name:`ConfidentialTransfer`,inputs:[{name:`from`,type:`address`,indexed:!0,internalType:`address`},{name:`to`,type:`address`,indexed:!0,internalType:`address`},{name:`amount`,type:`bytes32`,indexed:!0,internalType:`euint64`}],anonymous:!1},{type:`event`,name:`Initialized`,inputs:[{name:`version`,type:`uint64`,indexed:!1,internalType:`uint64`}],anonymous:!1},{type:`event`,name:`OperatorSet`,inputs:[{name:`holder`,type:`address`,indexed:!0,internalType:`address`},{name:`operator`,type:`address`,indexed:!0,internalType:`address`},{name:`until`,type:`uint48`,indexed:!1,internalType:`uint48`}],anonymous:!1},{type:`event`,name:`OwnershipTransferStarted`,inputs:[{name:`previousOwner`,type:`address`,indexed:!0,internalType:`address`},{name:`newOwner`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`OwnershipTransferred`,inputs:[{name:`previousOwner`,type:`address`,indexed:!0,internalType:`address`},{name:`newOwner`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`PublicDecryptionVerified`,inputs:[{name:`handlesList`,type:`bytes32[]`,indexed:!1,internalType:`bytes32[]`},{name:`abiEncodedCleartexts`,type:`bytes`,indexed:!1,internalType:`bytes`}],anonymous:!1},{type:`event`,name:`UnwrapFinalized`,inputs:[{name:`receiver`,type:`address`,indexed:!0,internalType:`address`},{name:`unwrapRequestId`,type:`bytes32`,indexed:!0,internalType:`bytes32`},{name:`encryptedAmount`,type:`bytes32`,indexed:!1,internalType:`euint64`},{name:`cleartextAmount`,type:`uint64`,indexed:!1,internalType:`uint64`}],anonymous:!1},{type:`event`,name:`UnwrapRequested`,inputs:[{name:`receiver`,type:`address`,indexed:!0,internalType:`address`},{name:`unwrapRequestId`,type:`bytes32`,indexed:!0,internalType:`bytes32`},{name:`amount`,type:`bytes32`,indexed:!1,internalType:`euint64`}],anonymous:!1},{type:`event`,name:`Upgraded`,inputs:[{name:`implementation`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`UserBlocked`,inputs:[{name:`user`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`UserUnblocked`,inputs:[{name:`user`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`Wrap`,inputs:[{name:`to`,type:`address`,indexed:!0,internalType:`address`},{name:`roundedAmount`,type:`uint256`,indexed:!1,internalType:`uint256`},{name:`encryptedWrappedAmount`,type:`bytes32`,indexed:!1,internalType:`euint64`}],anonymous:!1},{type:`error`,name:`AddressEmptyCode`,inputs:[{name:`target`,type:`address`,internalType:`address`}]},{type:`error`,name:`BlockedUser`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC1967InvalidImplementation`,inputs:[{name:`implementation`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC1967NonPayable`,inputs:[]},{type:`error`,name:`ERC7984InvalidReceiver`,inputs:[{name:`receiver`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984InvalidReceiver`,inputs:[{name:`receiver`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984InvalidSender`,inputs:[{name:`sender`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984TotalSupplyOverflow`,inputs:[]},{type:`error`,name:`ERC7984UnauthorizedCaller`,inputs:[{name:`caller`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984UnauthorizedSpender`,inputs:[{name:`holder`,type:`address`,internalType:`address`},{name:`spender`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984UnauthorizedUseOfEncryptedAmount`,inputs:[{name:`amount`,type:`bytes32`,internalType:`euint64`},{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984ZeroBalance`,inputs:[{name:`holder`,type:`address`,internalType:`address`}]},{type:`error`,name:`FailedCall`,inputs:[]},{type:`error`,name:`InvalidInitialization`,inputs:[]},{type:`error`,name:`InvalidKMSSignatures`,inputs:[]},{type:`error`,name:`InvalidUnderlyingDenyListResponse`,inputs:[]},{type:`error`,name:`InvalidUnwrapRequest`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`}]},{type:`error`,name:`NotInitializing`,inputs:[]},{type:`error`,name:`OwnableInvalidOwner`,inputs:[{name:`owner`,type:`address`,internalType:`address`}]},{type:`error`,name:`OwnableUnauthorizedAccount`,inputs:[{name:`account`,type:`address`,internalType:`address`}]},{type:`error`,name:`SafeCastOverflowedUintDowncast`,inputs:[{name:`bits`,type:`uint8`,internalType:`uint8`},{name:`value`,type:`uint256`,internalType:`uint256`}]},{type:`error`,name:`SafeERC20FailedOperation`,inputs:[{name:`token`,type:`address`,internalType:`address`}]},{type:`error`,name:`SenderNotAllowedToUseHandle`,inputs:[{name:`handle`,type:`bytes32`,internalType:`bytes32`},{name:`sender`,type:`address`,internalType:`address`}]},{type:`error`,name:`UUPSUnauthorizedCallContext`,inputs:[]},{type:`error`,name:`UUPSUnsupportedProxiableUUID`,inputs:[{name:`slot`,type:`bytes32`,internalType:`bytes32`}]},{type:`error`,name:`UnderlyingDenyListCallFailed`,inputs:[]},{type:`error`,name:`UnderlyingDenyListedAddress`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`UserAlreadyBlocked`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`UserAlreadyUnblocked`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`ZamaProtocolUnsupported`,inputs:[]}];function x(e,t){return{address:e,abi:b,functionName:`confidentialBalanceOf`,args:[t]}}function S(e,t,n,r){return{address:e,abi:b,functionName:`confidentialTransfer`,args:[t,n,r]}}function C(e,t,n,r,i){return{address:e,abi:b,functionName:`confidentialTransferFrom`,args:[t,n,r,i]}}function w(e,t,n,r,i){return{address:e,abi:b,functionName:`confidentialTransferAndCall`,args:[t,n,r,i]}}function T(e,t,n,r,i,a){return{address:e,abi:b,functionName:`confidentialTransferFromAndCall`,args:[t,n,r,i,a]}}function E(e,t,n){return{address:e,abi:b,functionName:`isOperator`,args:[t,n]}}function D(e,t,n){let r=n??Math.floor(Date.now()/1e3)+3600;return{address:e,abi:b,functionName:`setOperator`,args:[t,r]}}function O(e,t,n,r,i){return{address:e,abi:b,functionName:`unwrap`,args:[t,n,r,i]}}function k(e,t,n,r){return{address:e,abi:b,functionName:`unwrap`,args:[t,n,r]}}function A(e){return{address:e,abi:b,functionName:`confidentialTotalSupply`,args:[]}}function j(e){return{address:e,abi:b,functionName:`rate`,args:[]}}function M(e,t,n,r){return{address:e,abi:b,functionName:`finalizeUnwrap`,args:[t,n,r]}}function N(e,t){return{address:e,abi:b,functionName:`unwrapRequester`,args:[t]}}function ee(e,t){return{address:e,abi:b,functionName:`unwrapAmount`,args:[t]}}function P(e){return{address:e,abi:b,functionName:`underlying`,args:[]}}function F(e){return{address:e,abi:b,functionName:`inferredTotalSupply`,args:[]}}function I(e,t,n){return{address:e,abi:b,functionName:`wrap`,args:[t,n]}}function L(e){return{address:e,abi:r,functionName:`name`,args:[]}}function R(e){return{address:e,abi:r,functionName:`symbol`,args:[]}}function z(e){return{address:e,abi:r,functionName:`decimals`,args:[]}}function B(e){return{address:e,abi:r,functionName:`totalSupply`,args:[]}}function V(e,t){return{address:e,abi:r,functionName:`balanceOf`,args:[t]}}function H(e,t,n){return{address:e,abi:r,functionName:`allowance`,args:[t,n]}}function U(e,t,n){return{address:e,abi:r,functionName:`approve`,args:[t,n]}}const W=[{type:`function`,name:`supportsInterface`,inputs:[{name:`interfaceId`,type:`bytes4`,internalType:`bytes4`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`}],G=`0x4958f2a4`,K=`0x1f1c62b2`,q=`0xb0202a11`;function J(e,t){return{address:e,abi:W,functionName:`supportsInterface`,args:[t]}}function Y(e){return J(e,G)}function X(e){return J(e,K)}function Z(e){return J(e,q)}async function Q(e,t,n){if(!t)throw new u(e);let r;try{r=t.requireWalletAccount(e)}catch(n){if(!(n instanceof f)||!t.refreshWalletAccount)throw n;await t.refreshWalletAccount(),r=t.requireWalletAccount(e)}let i=await n.getChainId();if(r.chainId!==i)throw new c({operation:e,signerChainId:r.chainId,providerChainId:i});return r}async function $(e,t,n,r){let i=await Q(e,t,n);if(r!==void 0&&i.chainId!==r)throw new c({operation:e,signerChainId:i.chainId,providerChainId:i.chainId,targetChainId:r});return i}async function te(e,t,n){return(await Q(e,t,n)).chainId}async function ne(e,t,r){if(t===void 0)return;let i=await r();if(i!==t)throw new n(`${e} is bound to chain ${i} and cannot read chain ${t}; use a provider for that chain`)}export{P as A,m as B,T as C,E as D,F as E,I as F,d as G,u as H,y as I,o as J,p as K,_ as L,O as M,k as N,j as O,N as P,v as R,S,M as T,l as U,h as V,f as W,a as X,s as Y,L as _,q as a,A as b,Y as c,J as d,H as f,B as g,z as h,$ as i,ee as j,D as k,X as l,V as m,te as n,G as o,U as p,c as q,ne as r,K as s,Q as t,Z as u,R as v,C as w,w as x,x as y,g as z};
2
+ //# sourceMappingURL=alignment-o-YIndFR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alignment-o-YIndFR.js","names":["ZamaErrorCode","ZamaError","ConfigurationError","TransactionRevertedError","message","options","HcuBlockLimitExceededError","HcuTransactionLimitExceededError","ChainMismatchError","targetChainId","operation","signerChainId","providerChainId","SignerRequiredError","code","SignerNotConfiguredError","WalletNotConnectedError","WalletAccountNotReadyError","requireConfigured","value","ZamaSDKEvents","transactionOperationMetadata","assertNonNullable","context","assertBigint","assertHex","isHex","swallow","fn","error","logger","label","confidentialWrapperAbi","confidentialBalanceOfContract","tokenAddress","userAddress","confidentialTransferContract","encryptedErc20","to","encryptedAmount","inputProof","confidentialTransferFromContract","from","confidentialTransferAndCallContract","data","confidentialTransferFromAndCallContract","isOperatorContract","holder","spender","setOperatorContract","effectiveUntil","until","operator","unwrapContract","unwrapFromBalanceContract","encryptedBalance","confidentialTotalSupplyContract","rateContract","finalizeUnwrapContract","wrapper","unwrapRequestId","unwrapAmountCleartext","decryptionProof","unwrapRequesterContract","wrapperAddress","unwrapAmountContract","underlyingContract","inferredTotalSupplyContract","wrapContract","amount","nameContract","erc20Abi","symbolContract","decimalsContract","erc20TotalSupplyContract","balanceOfContract","account","allowanceContract","owner","approveContract","erc165Abi","ERC7984_INTERFACE_ID","ERC7984_WRAPPER_INTERFACE_ID","ERC1363_INTERFACE_ID","supportsInterfaceContract","interfaceId","isConfidentialTokenContract","isConfidentialWrapperContract","isPayableTokenContract","requireAlignedWalletAccount","signer","provider","requireWriteChain","requireChainAlignment","requireReadChain","chainId","current","getChainId","adapter"],"sources":["../../src/errors/transaction.ts","../../src/errors/chain.ts","../../src/errors/signer.ts","../../src/events/sdk-events.ts","../../src/utils/assertions.ts","../../src/utils/swallow.ts","../../src/abi/confidential-wrapper.abi.ts","../../src/contracts/confidential-wrapper.ts","../../src/contracts/erc20.ts","../../src/abi/erc165.abi.ts","../../src/contracts/erc165.ts","../../src/utils/alignment.ts"],"sourcesContent":["import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/** On-chain transaction reverted. */\nexport class TransactionRevertedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.TransactionReverted, message, options);\n this.name = \"TransactionRevertedError\";\n }\n}\n\n/**\n * The transaction needs more FHE compute (HCU) than the current block has\n * left. The budget resets every block, so a retry in the next block can succeed.\n */\nexport class HcuBlockLimitExceededError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.HcuBlockLimitExceeded, message, options);\n this.name = \"HcuBlockLimitExceededError\";\n }\n}\n\n/**\n * The transaction needs more FHE compute (HCU) than one transaction may use,\n * in total or along one sequential chain of operations. Retrying does not\n * help: the transaction has to do less FHE work.\n */\nexport class HcuTransactionLimitExceededError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.HcuTransactionLimitExceeded, message, options);\n this.name = \"HcuTransactionLimitExceededError\";\n }\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * Thrown when the signer and provider are connected to different chains at the\n * start of a write operation.\n *\n * Every write method runs a chain-alignment pre-flight check. If\n * `signer.getChainId()` and `provider.getChainId()` return different values,\n * this error is thrown before any RPC mutation is attempted.\n *\n * @example\n * ```ts\n * try {\n * await token.shield(1000n);\n * } catch (e) {\n * if (e instanceof ChainMismatchError) {\n * console.error(\n * `Signer is on chain ${e.signerChainId} but provider is on chain ${e.providerChainId}`,\n * );\n * }\n * }\n * ```\n */\nexport class ChainMismatchError extends ZamaError {\n /** Name of the operation that triggered the check. */\n readonly operation: string;\n /** Chain ID the signer is connected to. */\n readonly signerChainId: number;\n /** Chain ID the provider is connected to. */\n readonly providerChainId: number;\n /** Chain ID the operation's contract is pinned to, when it differs from the provider's. */\n readonly targetChainId: number | undefined;\n\n constructor(\n {\n operation,\n signerChainId,\n providerChainId,\n targetChainId,\n }: {\n operation: string;\n signerChainId: number;\n providerChainId: number;\n targetChainId?: number;\n },\n options?: ErrorOptions,\n ) {\n super(\n ZamaErrorCode.ChainMismatch,\n targetChainId === undefined\n ? `Operation \"${operation}\" requires signer and provider to be on the same chain, ` +\n `but signer is on chain ${signerChainId} and provider is on chain ${providerChainId}.`\n : `Operation \"${operation}\" targets chain ${targetChainId}, but signer is on chain ${signerChainId}.`,\n options,\n );\n this.name = \"ChainMismatchError\";\n this.operation = operation;\n this.signerChainId = signerChainId;\n this.providerChainId = providerChainId;\n this.targetChainId = targetChainId;\n }\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * Base class for signer/account readiness failures.\n */\nexport class SignerRequiredError extends ZamaError {\n /** Name of the operation that required a signer. */\n readonly operation: string;\n\n constructor(code: ZamaErrorCode, operation: string, message: string, options?: ErrorOptions) {\n super(code, message, options);\n this.name = \"SignerRequiredError\";\n this.operation = operation;\n }\n}\n\n/**\n * Thrown when an operation requires a signer but none is configured.\n *\n * The SDK can be constructed without a signer. Operations that need wallet\n * authority throw this before probing wallet state.\n *\n * @example\n * ```ts\n * try {\n * await token.confidentialTransfer(\"0xTo\", 100n);\n * } catch (e) {\n * if (e instanceof SignerNotConfiguredError) {\n * // Fix SDK/provider configuration.\n * }\n * }\n * ```\n */\nexport class SignerNotConfiguredError extends SignerRequiredError {\n constructor(operation: string, options?: ErrorOptions) {\n super(\n ZamaErrorCode.SignerNotConfigured,\n operation,\n `Cannot ${operation} without a signer. Configure one via createConfig({ signer: ... }) or <ZamaProvider config={createConfig({ signer: ... })}>.`,\n options,\n );\n this.name = \"SignerNotConfiguredError\";\n }\n}\n\n/** Thrown when a signer exists but no wallet account is currently connected. */\nexport class WalletNotConnectedError extends SignerRequiredError {\n constructor(operation: string, options?: ErrorOptions) {\n super(\n ZamaErrorCode.WalletNotConnected,\n operation,\n `Cannot ${operation} without a connected wallet account.`,\n options,\n );\n this.name = \"WalletNotConnectedError\";\n }\n}\n\n/** Thrown when an async adapter has not resolved its initial wallet account yet. */\nexport class WalletAccountNotReadyError extends SignerRequiredError {\n constructor(operation: string, options?: ErrorOptions) {\n super(\n ZamaErrorCode.WalletAccountNotReady,\n operation,\n `Cannot ${operation} before the wallet account is ready.`,\n options,\n );\n this.name = \"WalletAccountNotReadyError\";\n }\n}\n\n/**\n * Narrow a nullable signer-dependent value or throw {@link SignerNotConfiguredError}.\n */\nexport function requireConfigured<T>(value: T, operation: string): NonNullable<T> {\n if (value === null || value === undefined) {\n throw new SignerNotConfiguredError(operation);\n }\n return value as NonNullable<T>;\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ClearValue, EncryptedValue } from \"../relayer/types\";\nimport type { ShieldPath } from \"../types/token\";\n\n/**\n * All SDK event keys, accessible as `ZamaSDKEvents.EncryptStart` etc.\n */\nexport const ZamaSDKEvents = {\n // FHE operations\n EncryptStart: \"encrypt:start\",\n EncryptEnd: \"encrypt:end\",\n EncryptError: \"encrypt:error\",\n DecryptStart: \"decrypt:start\",\n DecryptEnd: \"decrypt:end\",\n DecryptError: \"decrypt:error\",\n // Credential operations\n PermitError: \"permit:error\",\n // Write operations\n TransactionError: \"transaction:error\",\n ShieldSubmitted: \"shield:submitted\",\n TransferSubmitted: \"transfer:submitted\",\n TransferFromSubmitted: \"transferFrom:submitted\",\n SetOperatorSubmitted: \"setOperator:submitted\",\n ApproveUnderlyingSubmitted: \"approveUnderlying:submitted\",\n WrapSubmitted: \"wrap:submitted\",\n UnwrapSubmitted: \"unwrap:submitted\",\n FinalizeUnwrapSubmitted: \"finalizeUnwrap:submitted\",\n VaultSubmitted: \"vault:submitted\",\n // Delegation operations\n DelegationSubmitted: \"delegation:submitted\",\n RevokeDelegationSubmitted: \"revokeDelegation:submitted\",\n // Unshield orchestration\n UnshieldPhase1Submitted: \"unshield:phase1_submitted\",\n UnshieldPhase2Started: \"unshield:phase2_started\",\n UnshieldPhase2Submitted: \"unshield:phase2_submitted\",\n} as const;\n\n/** Union of all SDK event type strings. */\nexport type ZamaSDKEventType = (typeof ZamaSDKEvents)[keyof typeof ZamaSDKEvents];\n\n// -- Base fields present on every event --\n\n/** Fields present on every SDK event; each concrete event extends this. */\nexport interface BaseEvent {\n /**\n * Contract this event relates to, when the operation targets one: the\n * confidential token, or the vault batcher for {@link VaultSubmittedEvent}.\n */\n tokenAddress?: Address;\n /** Unix epoch time (milliseconds) at which the event was emitted. */\n timestamp: number;\n /** Shared identifier linking related events in multi-phase operations (e.g. unshield). */\n operationId?: string;\n}\n\n// -- Per-event typed payloads --\n\n/** Emitted when an FHE encryption starts. */\nexport interface EncryptStartEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.EncryptStart;\n}\n\n/** Emitted when an FHE encryption completes successfully. */\nexport interface EncryptEndEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.EncryptEnd;\n /** Time the encryption took, in milliseconds. */\n durationMs: number;\n}\n\n/** Emitted when an FHE encryption fails. */\nexport interface EncryptErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.EncryptError;\n /** The error that caused the encryption to fail. */\n error: Error;\n /** Time elapsed before the encryption failed, in milliseconds. */\n durationMs: number;\n}\n\n/** Emitted when an FHE decryption starts. */\nexport interface DecryptStartEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DecryptStart;\n /** Encrypted values being decrypted — correlate with matching DecryptEnd/DecryptError. */\n encryptedValues: EncryptedValue[];\n}\n\n/** Emitted when an FHE decryption completes successfully. */\nexport interface DecryptEndEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DecryptEnd;\n /** Time the decryption took, in milliseconds. */\n durationMs: number;\n /** Encrypted values that were decrypted. */\n encryptedValues: EncryptedValue[];\n /** Decrypted values keyed by encrypted value — use this to correlate events to specific entries. */\n result: Record<EncryptedValue, ClearValue>;\n}\n\n/** Emitted when an FHE decryption fails. */\nexport interface DecryptErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DecryptError;\n /** The error that caused the decryption to fail. */\n error: Error;\n /** Time elapsed before the decryption failed, in milliseconds. */\n durationMs: number;\n /** Encrypted values that were being decrypted when the error occurred. */\n encryptedValues: EncryptedValue[];\n}\n\n/**\n * SDK credential/permit operations that emit a {@link PermitErrorEvent} on failure.\n * `grantPermit` and `grantDelegationPermit` are distinguished so an integrator\n * can tell a direct-decrypt permit failure from a delegation-permit failure\n * without parsing the error message.\n */\nexport type PermitOperation = \"grantPermit\" | \"grantDelegationPermit\" | \"registerPermit\";\n\n/**\n * Emitted when signing or registering a decryption permit fails — including\n * wallet/provider signing failures (`SigningFailedError`/`SigningRejectedError`)\n * that would otherwise only be visible by catching the thrown error at the call\n * site. Mirrors {@link TransactionErrorEvent} for the credential/permit path.\n */\nexport interface PermitErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.PermitError;\n /** Which permit operation failed. */\n operation: PermitOperation;\n /** The error that caused the operation to fail. */\n error: Error;\n}\n\n/** Emitted when a write operation's transaction fails (before or after submission). */\nexport interface TransactionErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.TransactionError;\n /** Which SDK operation failed. */\n operation: TransactionOperation;\n /** The error that caused the transaction to fail. */\n error: Error;\n}\n\n/** Emitted when a shield transaction has been submitted to the network. */\nexport interface ShieldSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.ShieldSubmitted;\n /** Hash of the submitted shield transaction. */\n txHash: Hex;\n /** Which execution path was used: single-tx `transferAndCall` or two-tx `approveAndWrap`. */\n shieldPath: ShieldPath;\n}\n\n/** Emitted when a confidential transfer transaction has been submitted to the network. */\nexport interface TransferSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.TransferSubmitted;\n /** Hash of the submitted transfer transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a confidential `transferFrom` transaction has been submitted to the network. */\nexport interface TransferFromSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.TransferFromSubmitted;\n /** Hash of the submitted transferFrom transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a set-operator transaction has been submitted to the network. */\nexport interface SetOperatorSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.SetOperatorSubmitted;\n /** Hash of the submitted setOperator transaction. */\n txHash: Hex;\n}\n\n/**\n * Which vault write a {@link VaultSubmittedEvent} describes: a batcher write,\n * or `routerJoin` for a fan-out submitted through the vault router.\n */\nexport type VaultOperation =\n | \"join\"\n | \"quit\"\n | \"claim\"\n | \"recover\"\n | \"dispatchBatch\"\n | \"finalize\"\n | \"routerJoin\";\n\n/** Emitted when a vault batcher or router transaction has been submitted to the network. */\nexport interface VaultSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.VaultSubmitted;\n /** Hash of the submitted transaction. */\n txHash: Hex;\n /** The vault write this transaction performs. */\n vaultOperation: VaultOperation;\n}\n\n/** Emitted when an underlying-ERC-20 approval transaction has been submitted to the network. */\nexport interface ApproveUnderlyingSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.ApproveUnderlyingSubmitted;\n /** Hash of the submitted approval transaction. */\n txHash: Hex;\n /** Which approval transaction was submitted. */\n step: \"reset\" | \"approve\";\n}\n\n/**\n * Emitted by the standalone `wrap()` escape hatch (not by `shield()`, which\n * emits {@link ShieldSubmittedEvent}). Distinct so a caller-initiated `wrap`\n * isn't conflated with `shield()`'s internal `approveAndWrap` leg — mirroring\n * how `unwrap` emits its own event rather than reusing the unshield phases.\n */\nexport interface WrapSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.WrapSubmitted;\n /** Hash of the submitted wrap transaction. */\n txHash: Hex;\n}\n\n/** Emitted when an unwrap transaction has been submitted to the network. */\nexport interface UnwrapSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnwrapSubmitted;\n /** Hash of the submitted unwrap transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a finalize-unwrap transaction has been submitted to the network. */\nexport interface FinalizeUnwrapSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.FinalizeUnwrapSubmitted;\n /** Hash of the submitted finalizeUnwrap transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a decryption-delegation transaction has been submitted to the network. */\nexport interface DelegationSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DelegationSubmitted;\n /** Hash of the submitted delegation transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a revoke-delegation transaction has been submitted to the network. */\nexport interface RevokeDelegationSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.RevokeDelegationSubmitted;\n /** Hash of the submitted revokeDelegation transaction. */\n txHash: Hex;\n}\n\n/** Emitted when the first phase of an unshield (the unwrap request) has been submitted. */\nexport interface UnshieldPhase1SubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnshieldPhase1Submitted;\n /** Hash of the submitted phase-1 transaction. */\n txHash: Hex;\n}\n\n/** Emitted when the second phase of an unshield (finalization) starts. */\nexport interface UnshieldPhase2StartedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnshieldPhase2Started;\n}\n\n/** Emitted when the second phase of an unshield (finalization) has been submitted. */\nexport interface UnshieldPhase2SubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnshieldPhase2Submitted;\n /** Hash of the submitted phase-2 transaction. */\n txHash: Hex;\n}\n\n/**\n * Discriminated union of all SDK events.\n *\n * Decrypt events carry encrypted values and decrypted clear-text values so event\n * subscribers can correlate and bind them in UI layers. Events never carry\n * private keys, permit signatures, or ZK proofs.\n */\nexport type ZamaSDKEvent =\n | EncryptStartEvent\n | EncryptEndEvent\n | EncryptErrorEvent\n | DecryptStartEvent\n | DecryptEndEvent\n | DecryptErrorEvent\n | PermitErrorEvent\n | TransactionErrorEvent\n | ShieldSubmittedEvent\n | TransferSubmittedEvent\n | TransferFromSubmittedEvent\n | SetOperatorSubmittedEvent\n | VaultSubmittedEvent\n | ApproveUnderlyingSubmittedEvent\n | WrapSubmittedEvent\n | UnwrapSubmittedEvent\n | FinalizeUnwrapSubmittedEvent\n | DelegationSubmittedEvent\n | RevokeDelegationSubmittedEvent\n | UnshieldPhase1SubmittedEvent\n | UnshieldPhase2StartedEvent\n | UnshieldPhase2SubmittedEvent;\n\n/** Callback invoked with each emitted {@link ZamaSDKEvent}. */\nexport type ZamaSDKEventListener = (event: ZamaSDKEvent) => void;\n\n/**\n * Distributive Omit that preserves the discriminated union. Internal emit-side\n * shape — consumers only ever receive fully-populated {@link ZamaSDKEvent}.\n * @internal\n */\nexport type ZamaSDKEventInput = ZamaSDKEvent extends infer E\n ? E extends ZamaSDKEvent\n ? Omit<E, \"timestamp\" | \"tokenAddress\">\n : never\n : never;\n\n/**\n * SDK transaction operations that emit submitted/error lifecycle events.\n *\n * Operation strings encode the execution-path discriminator for flows that have\n * one (`shield:transferAndCall` vs. `shield:approveAndWrap`), routing both error\n * and success events on a single field — see {@link transactionOperationMetadata}.\n */\nexport type TransactionOperation =\n | \"approveUnderlying\"\n | \"approveUnderlying:reset\"\n | \"delegateDecryption\"\n | \"finalizeUnwrap\"\n | \"revokeDelegation\"\n | \"setOperator\"\n | \"shield:transferAndCall\"\n | \"shield:approveAndWrap\"\n | \"wrap\"\n | \"transfer\"\n | \"transferAndCall\"\n | \"transferFrom\"\n | \"transferFromAndCall\"\n | \"unwrap\"\n | \"unwrapAll\"\n | \"vault:join\"\n | \"vault:quit\"\n | \"vault:claim\"\n | \"vault:recover\"\n | \"vault:dispatchBatch\"\n | \"vault:finalize\"\n | \"vault:routerJoin\";\n\n/**\n * Single source of truth for each transaction operation's submitted-event payload.\n *\n * Adding a write op = adding one entry here plus its {@link TransactionOperation}\n * member; the `satisfies Record<TransactionOperation, …>` check enforces that the\n * table and the union stay in lockstep (missing or extra keys fail the build) and\n * that every entry produces a valid {@link ZamaSDKEventInput}.\n *\n * @internal\n */\nexport const transactionOperationMetadata = {\n approveUnderlying: {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ApproveUnderlyingSubmitted,\n txHash,\n step: \"approve\" as const,\n }),\n },\n \"approveUnderlying:reset\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ApproveUnderlyingSubmitted,\n txHash,\n step: \"reset\" as const,\n }),\n },\n delegateDecryption: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.DelegationSubmitted, txHash }),\n },\n finalizeUnwrap: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.FinalizeUnwrapSubmitted, txHash }),\n },\n revokeDelegation: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.RevokeDelegationSubmitted, txHash }),\n },\n setOperator: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.SetOperatorSubmitted, txHash }),\n },\n \"shield:transferAndCall\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ShieldSubmitted,\n txHash,\n shieldPath: \"transferAndCall\" as const,\n }),\n },\n \"shield:approveAndWrap\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ShieldSubmitted,\n txHash,\n shieldPath: \"approveAndWrap\" as const,\n }),\n },\n wrap: { submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.WrapSubmitted, txHash }) },\n transfer: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferSubmitted, txHash }),\n },\n transferAndCall: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferSubmitted, txHash }),\n },\n transferFrom: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferFromSubmitted, txHash }),\n },\n transferFromAndCall: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferFromSubmitted, txHash }),\n },\n unwrap: { submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.UnwrapSubmitted, txHash }) },\n unwrapAll: { submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.UnwrapSubmitted, txHash }) },\n \"vault:join\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"join\" as const,\n }),\n },\n \"vault:quit\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"quit\" as const,\n }),\n },\n \"vault:claim\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"claim\" as const,\n }),\n },\n \"vault:recover\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"recover\" as const,\n }),\n },\n \"vault:dispatchBatch\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"dispatchBatch\" as const,\n }),\n },\n \"vault:finalize\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"finalize\" as const,\n }),\n },\n \"vault:routerJoin\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"routerJoin\" as const,\n }),\n },\n} satisfies Record<TransactionOperation, { submittedEvent: (txHash: Hex) => ZamaSDKEventInput }>;\n","import { isHex, type Hex } from \"viem\";\n\nexport function assertNonNullable<T>(value: T, context: string): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new TypeError(`${context} must not be null or undefined`);\n }\n}\n\nexport function assertObject(\n value: unknown,\n context: string,\n): asserts value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new TypeError(`${context} must be an object, got ${typeof value}`);\n }\n}\n\nexport function assertString(value: unknown, context: string): asserts value is string {\n if (typeof value !== \"string\") {\n throw new TypeError(`${context} must be a string, got ${typeof value}`);\n }\n}\n\nexport function assertArray(value: unknown, context: string): asserts value is unknown[] {\n if (!Array.isArray(value)) {\n throw new TypeError(`${context} must be an array, got ${typeof value}`);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport function assertFunction(value: unknown, context: string): asserts value is Function {\n if (typeof value !== \"function\") {\n throw new TypeError(`${context} must be a function, got ${typeof value}`);\n }\n}\n\nexport function assertBigint(value: unknown, context: string): asserts value is bigint {\n if (typeof value !== \"bigint\") {\n throw new TypeError(`${context} must be a bigint, got ${typeof value}`);\n }\n}\n\nexport function assertHex(value: unknown, context: string): asserts value is Hex {\n if (!isHex(value)) {\n throw new TypeError(`${context} must be a 0x-prefixed hex string, got ${typeof value}`);\n }\n}\n\n/** Assert that `obj[key]` is a string. Narrows `obj` to include `{ [key]: string }`. */\nexport function assertStringProp<\n K extends string,\n O extends Record<string, unknown> = Record<string, unknown>,\n>(obj: O, key: K, context: string): asserts obj is O & Record<K, string> {\n assertString(obj[key], context);\n}\n\n/** Assert that `obj[key]` is a function. Narrows `obj` to include `{ [key]: F }`. */\nexport function assertFunctionProp<\n K extends string,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n F extends Function,\n O extends Record<string, unknown> = Record<string, unknown>,\n>(obj: O, key: K, context: string): asserts obj is O & Record<K, F> {\n assertFunction(obj[key], context);\n}\n\nexport function assertCondition(condition: boolean, message: string): asserts condition {\n if (!condition) {\n throw new TypeError(message);\n }\n}\n","import type { GenericLogger } from \"../types\";\n\n/**\n * Runs a function and swallows any errors.\n *\n * The swallowed error is a handled, best-effort failure — when a logger is\n * supplied it is routed to the {@link GenericLogger} at `warn`, never to the\n * console. Most SDK call sites pass the SDK-wide logger; a few (e.g. a signer\n * constructed before `createConfig` exists) genuinely have none, so the logger\n * is optional and the failure is then silent.\n */\nexport async function swallow(\n label: string,\n fn: () => Promise<void> | void,\n logger?: GenericLogger,\n): Promise<void> {\n try {\n await fn();\n } catch (error) {\n logger?.warn(`${label} failed`, { error });\n }\n}\n","// DO NOT EDIT: generated by `pnpm abi:build` from\n// contracts/out/ConfidentialWrapperV3.sol/ConfidentialWrapperV3.json.\n// Regenerate after `pnpm contracts:build`; `pnpm abi:check` enforces this in CI.\nexport const confidentialWrapperAbi = [\n {\n type: \"function\",\n name: \"UPGRADE_INTERFACE_VERSION\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"acceptOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"blockUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialBalanceOf\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialProtocolId\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"contractURI\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"decimals\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint8\", internalType: \"uint8\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"discloseEncryptedAmount\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"cleartextAmount\", type: \"uint64\", internalType: \"uint64\" },\n { name: \"decryptionProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"finalizeUnwrap\",\n inputs: [\n { name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"unwrapAmountCleartext\", type: \"uint64\", internalType: \"uint64\" },\n { name: \"decryptionProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getUnderlyingDenyListSelector\",\n inputs: [],\n outputs: [\n { name: \"isSet\", type: \"bool\", internalType: \"bool\" },\n { name: \"selector\", type: \"bytes4\", internalType: \"bytes4\" },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"inferredTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"initialize\",\n inputs: [\n { name: \"name_\", type: \"string\", internalType: \"string\" },\n { name: \"symbol_\", type: \"string\", internalType: \"string\" },\n { name: \"contractURI_\", type: \"string\", internalType: \"string\" },\n { name: \"underlying_\", type: \"address\", internalType: \"contract IERC20\" },\n { name: \"owner_\", type: \"address\", internalType: \"address\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"isBlocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"isOperator\",\n inputs: [\n { name: \"holder\", type: \"address\", internalType: \"address\" },\n { name: \"spender\", type: \"address\", internalType: \"address\" },\n ],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"maxTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"name\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onTransferReceived\",\n inputs: [\n { name: \"operator\", type: \"address\", internalType: \"address\" },\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"proxiableUUID\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"rate\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"reinitializeV2\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"reinitializeV3\",\n inputs: [\n { name: \"blockedUsers\", type: \"address[]\", internalType: \"address[]\" },\n { name: \"underlyingDenyListSelector\", type: \"bytes4\", internalType: \"bytes4\" },\n { name: \"hasUnderlyingDenyListSelector_\", type: \"bool\", internalType: \"bool\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"renounceOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"requestDiscloseEncryptedAmount\",\n inputs: [{ name: \"encryptedAmount\", type: \"bytes32\", internalType: \"euint64\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setOperator\",\n inputs: [\n { name: \"operator\", type: \"address\", internalType: \"address\" },\n { name: \"until\", type: \"uint48\", internalType: \"uint48\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"symbol\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [{ name: \"newOwner\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unblockUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"underlying\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrapAmount\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrapRequester\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"upgradeToAndCall\",\n inputs: [\n { name: \"newImplementation\", type: \"address\", internalType: \"address\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"wrap\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"AmountDiscloseRequested\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n { name: \"requester\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"AmountDisclosed\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n { name: \"amount\", type: \"uint64\", indexed: false, internalType: \"uint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"ConfidentialTransfer\",\n inputs: [\n { name: \"from\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"to\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Initialized\",\n inputs: [{ name: \"version\", type: \"uint64\", indexed: false, internalType: \"uint64\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OperatorSet\",\n inputs: [\n { name: \"holder\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"operator\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"until\", type: \"uint48\", indexed: false, internalType: \"uint48\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n { name: \"previousOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"newOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n { name: \"previousOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"newOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PublicDecryptionVerified\",\n inputs: [\n { name: \"handlesList\", type: \"bytes32[]\", indexed: false, internalType: \"bytes32[]\" },\n { name: \"abiEncodedCleartexts\", type: \"bytes\", indexed: false, internalType: \"bytes\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapFinalized\",\n inputs: [\n { name: \"receiver\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"unwrapRequestId\", type: \"bytes32\", indexed: true, internalType: \"bytes32\" },\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n { name: \"cleartextAmount\", type: \"uint64\", indexed: false, internalType: \"uint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapRequested\",\n inputs: [\n { name: \"receiver\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"unwrapRequestId\", type: \"bytes32\", indexed: true, internalType: \"bytes32\" },\n { name: \"amount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Upgraded\",\n inputs: [{ name: \"implementation\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserBlocked\",\n inputs: [{ name: \"user\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserUnblocked\",\n inputs: [{ name: \"user\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Wrap\",\n inputs: [\n { name: \"to\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"roundedAmount\", type: \"uint256\", indexed: false, internalType: \"uint256\" },\n { name: \"encryptedWrappedAmount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AddressEmptyCode\",\n inputs: [{ name: \"target\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"BlockedUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC1967InvalidImplementation\",\n inputs: [{ name: \"implementation\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ERC1967NonPayable\", inputs: [] },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [{ name: \"receiver\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [{ name: \"receiver\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidSender\",\n inputs: [{ name: \"sender\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ERC7984TotalSupplyOverflow\", inputs: [] },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedCaller\",\n inputs: [{ name: \"caller\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedSpender\",\n inputs: [\n { name: \"holder\", type: \"address\", internalType: \"address\" },\n { name: \"spender\", type: \"address\", internalType: \"address\" },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedUseOfEncryptedAmount\",\n inputs: [\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"user\", type: \"address\", internalType: \"address\" },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984ZeroBalance\",\n inputs: [{ name: \"holder\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"FailedCall\", inputs: [] },\n { type: \"error\", name: \"InvalidInitialization\", inputs: [] },\n { type: \"error\", name: \"InvalidKMSSignatures\", inputs: [] },\n { type: \"error\", name: \"InvalidUnderlyingDenyListResponse\", inputs: [] },\n {\n type: \"error\",\n name: \"InvalidUnwrapRequest\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"NotInitializing\", inputs: [] },\n {\n type: \"error\",\n name: \"OwnableInvalidOwner\",\n inputs: [{ name: \"owner\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"OwnableUnauthorizedAccount\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SafeCastOverflowedUintDowncast\",\n inputs: [\n { name: \"bits\", type: \"uint8\", internalType: \"uint8\" },\n { name: \"value\", type: \"uint256\", internalType: \"uint256\" },\n ],\n },\n {\n type: \"error\",\n name: \"SafeERC20FailedOperation\",\n inputs: [{ name: \"token\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SenderNotAllowedToUseHandle\",\n inputs: [\n { name: \"handle\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"sender\", type: \"address\", internalType: \"address\" },\n ],\n },\n { type: \"error\", name: \"UUPSUnauthorizedCallContext\", inputs: [] },\n {\n type: \"error\",\n name: \"UUPSUnsupportedProxiableUUID\",\n inputs: [{ name: \"slot\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"UnderlyingDenyListCallFailed\", inputs: [] },\n {\n type: \"error\",\n name: \"UnderlyingDenyListedAddress\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"UserAlreadyBlocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"UserAlreadyUnblocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ZamaProtocolUnsupported\", inputs: [] },\n] as const;\n","import type { Address, Hex } from \"viem\";\nimport { confidentialWrapperAbi } from \"../abi/confidential-wrapper.abi\";\nimport type { EncryptedValue } from \"../relayer/types\";\n\n/**\n * Returns the contract config to read an encrypted balance.\n *\n * @example\n * ```ts\n * const handle = await provider.readContract(\n * confidentialBalanceOfContract(tokenAddress, userAddress),\n * );\n * ```\n */\nexport function confidentialBalanceOfContract(tokenAddress: Address, userAddress: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialBalanceOf\",\n args: [userAddress],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transfer.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferContract(tokenAddress, to, encryptedValues[0], inputProof),\n * );\n * ```\n */\nexport function confidentialTransferContract(\n encryptedErc20: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransfer\",\n args: [to, encryptedAmount, inputProof],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transferFrom.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferFromContract(tokenAddress, from, to, encryptedValues[0], inputProof),\n * );\n * ```\n */\nexport function confidentialTransferFromContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransferFrom\",\n args: [from, to, encryptedAmount, inputProof],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transferAndCall. The caller\n * supplies an opaque `data` payload that is forwarded to the recipient's\n * ERC-7984 receiver hook (`onConfidentialTransferReceived`). The SDK does not\n * craft, validate, or inspect `data` — encoding the call site's domain message\n * is the caller's responsibility.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferAndCallContract(\n * tokenAddress,\n * to,\n * encryptedValues[0],\n * inputProof,\n * data,\n * ),\n * );\n * ```\n */\nexport function confidentialTransferAndCallContract(\n encryptedErc20: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n data: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransferAndCall\",\n args: [to, encryptedAmount, inputProof, data],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transferFromAndCall. The\n * caller supplies an opaque `data` payload forwarded to the recipient's\n * ERC-7984 receiver hook; the SDK does not craft or inspect it.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferFromAndCallContract(\n * tokenAddress,\n * from,\n * to,\n * encryptedValues[0],\n * inputProof,\n * data,\n * ),\n * );\n * ```\n */\nexport function confidentialTransferFromAndCallContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n data: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransferFromAndCall\",\n args: [from, to, encryptedAmount, inputProof, data],\n } as const;\n}\n\n/**\n * Returns the contract config for checking operator status.\n *\n * @example\n * ```ts\n * const isOperator = await provider.readContract(\n * isOperatorContract(tokenAddress, holder, spender),\n * );\n * ```\n */\nexport function isOperatorContract(tokenAddress: Address, holder: Address, spender: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"isOperator\",\n args: [holder, spender],\n } as const;\n}\n\n/**\n * Returns the contract config for setting an operator.\n * Defaults until to 1 hour from now.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * setOperatorContract(tokenAddress, operator),\n * );\n * ```\n */\nexport function setOperatorContract(tokenAddress: Address, operator: Address, until?: number) {\n const effectiveUntil = until ?? Math.floor(Date.now() / 1000) + 3600;\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"setOperator\",\n args: [operator, effectiveUntil],\n } as const;\n}\n\n/**\n * Returns the contract config for an unwrap with newly encrypted amount.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * unwrapContract(encryptedErc20, from, to, encryptedValues[0], inputProof),\n * );\n * ```\n */\nexport function unwrapContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"unwrap\",\n args: [from, to, encryptedAmount, inputProof],\n } as const;\n}\n\n/**\n * Returns the contract config for an unwrap with an existing balance handle.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * unwrapFromBalanceContract(encryptedErc20, from, to, encryptedBalance),\n * );\n * ```\n */\nexport function unwrapFromBalanceContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedBalance: EncryptedValue,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"unwrap\",\n args: [from, to, encryptedBalance],\n } as const;\n}\n\n/**\n * Returns the contract config to read the confidential (encrypted) total supply.\n *\n * @example\n * ```ts\n * const handle = await provider.readContract(\n * confidentialTotalSupplyContract(tokenAddress),\n * );\n * ```\n */\nexport function confidentialTotalSupplyContract(tokenAddress: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTotalSupply\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to read the wrap/unwrap conversion rate.\n *\n * @example\n * ```ts\n * const rate = await provider.readContract(rateContract(tokenAddress));\n * ```\n */\nexport function rateContract(tokenAddress: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"rate\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config for finalizing an unwrap.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * finalizeUnwrapContract(wrapper, unwrapRequestId, cleartext, proof),\n * );\n * ```\n */\nexport function finalizeUnwrapContract(\n wrapper: Address,\n unwrapRequestId: EncryptedValue,\n unwrapAmountCleartext: bigint,\n decryptionProof: Hex,\n) {\n return {\n address: wrapper,\n abi: confidentialWrapperAbi,\n functionName: \"finalizeUnwrap\",\n args: [unwrapRequestId, unwrapAmountCleartext, decryptionProof],\n } as const;\n}\n\n/**\n * Returns the contract config to read the requester of an open unwrap request.\n * The wrapper deletes the request on finalize, so the zero address means the\n * request no longer exists.\n *\n * @example\n * ```ts\n * const requester = await provider.readContract(\n * unwrapRequesterContract(wrapperAddress, unwrapRequestId),\n * );\n * ```\n */\nexport function unwrapRequesterContract(wrapperAddress: Address, unwrapRequestId: EncryptedValue) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"unwrapRequester\",\n args: [unwrapRequestId],\n } as const;\n}\n\n/**\n * Returns the contract config to read the encrypted amount an unwrap request will release.\n *\n * @example\n * ```ts\n * const encryptedAmount = await provider.readContract(\n * unwrapAmountContract(wrapperAddress, unwrapRequestId),\n * );\n * ```\n */\nexport function unwrapAmountContract(wrapperAddress: Address, unwrapRequestId: EncryptedValue) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"unwrapAmount\",\n args: [unwrapRequestId],\n } as const;\n}\n\n/**\n * Returns the contract config to read the underlying ERC-20 token of a wrapper.\n *\n * @example\n * ```ts\n * const token = await provider.readContract(underlyingContract(wrapperAddress));\n * ```\n */\nexport function underlyingContract(wrapperAddress: Address) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"underlying\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to read the inferred plaintext total supply.\n *\n * @example\n * ```ts\n * const supply = await provider.readContract(\n * inferredTotalSupplyContract(wrapperAddress),\n * );\n * ```\n */\nexport function inferredTotalSupplyContract(wrapperAddress: Address) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"inferredTotalSupply\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config for a wrap (shield) operation.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * wrapContract(wrapperAddress, to, amount),\n * );\n * ```\n */\nexport function wrapContract(wrapperAddress: Address, to: Address, amount: bigint) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"wrap\",\n args: [to, amount],\n } as const;\n}\n","import { erc20Abi, type Address } from \"viem\";\n\n/**\n * Returns the contract config to read a token's name.\n *\n * @example\n * ```ts\n * const name = await provider.readContract(nameContract(tokenAddress));\n * ```\n */\nexport function nameContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"name\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read a token's symbol.\n *\n * @example\n * ```ts\n * const symbol = await provider.readContract(symbolContract(tokenAddress));\n * ```\n */\nexport function symbolContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"symbol\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read a token's decimals.\n *\n * @example\n * ```ts\n * const decimals = await provider.readContract(decimalsContract(tokenAddress));\n * ```\n */\nexport function decimalsContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"decimals\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 token's total supply.\n *\n * @example\n * ```ts\n * const supply = await provider.readContract(erc20TotalSupplyContract(tokenAddress));\n * ```\n */\nexport function erc20TotalSupplyContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"totalSupply\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 balance.\n *\n * @example\n * ```ts\n * const balance = await provider.readContract(\n * balanceOfContract(tokenAddress, account),\n * );\n * ```\n */\nexport function balanceOfContract(tokenAddress: Address, account: Address) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [account],\n } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 allowance.\n *\n * @example\n * ```ts\n * const allowance = await provider.readContract(\n * allowanceContract(tokenAddress, owner, spender),\n * );\n * ```\n */\nexport function allowanceContract(tokenAddress: Address, owner: Address, spender: Address) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"allowance\",\n args: [owner, spender],\n } as const;\n}\n\n/**\n * Returns the contract config for an ERC-20 approve.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * approveContract(tokenAddress, spender, amount),\n * );\n * ```\n */\nexport function approveContract(tokenAddress: Address, spender: Address, value: bigint) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"approve\",\n args: [spender, value],\n } as const;\n}\n","// DO NOT EDIT: generated by `pnpm abi:build` from\n// contracts/out/IERC165.sol/IERC165.json.\n// Regenerate after `pnpm contracts:build`; `pnpm abi:check` enforces this in CI.\nexport const erc165Abi = [\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n] as const;\n","import type { Address } from \"viem\";\nimport { erc165Abi } from \"../abi/erc165.abi\";\n\n/** ERC-165 interface ID for IERC7984 (confidential fungible token). */\nexport const ERC7984_INTERFACE_ID = \"0x4958f2a4\" as const;\n\n/** ERC-165 interface ID for IERC7984ERC20Wrapper (confidential wrapper). */\nexport const ERC7984_WRAPPER_INTERFACE_ID = \"0x1f1c62b2\" as const;\n\n/** ERC-165 interface ID for ERC-1363 (payable token — `transferAndCall`). */\nexport const ERC1363_INTERFACE_ID = \"0xb0202a11\" as const;\n\n/**\n * Returns the contract config for an ERC-165 `supportsInterface` check.\n *\n * Use with {@link ERC7984_INTERFACE_ID} to detect confidential tokens,\n * or {@link ERC7984_WRAPPER_INTERFACE_ID} to detect wrappers.\n *\n * @example\n * ```ts\n * const isConfidential = await provider.readContract(\n * supportsInterfaceContract(tokenAddress, ERC7984_INTERFACE_ID),\n * );\n * ```\n */\nexport function supportsInterfaceContract(tokenAddress: Address, interfaceId: Address) {\n return {\n address: tokenAddress,\n abi: erc165Abi,\n functionName: \"supportsInterface\",\n args: [interfaceId],\n } as const;\n}\n\n/**\n * Returns contract config to check if a token implements IERC7984 (confidential fungible token).\n *\n * @example\n * ```ts\n * const isConfidential = await provider.readContract(\n * isConfidentialTokenContract(\"0xTokenAddress\"),\n * );\n * ```\n */\nexport function isConfidentialTokenContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC7984_INTERFACE_ID);\n}\n\n/**\n * Returns contract config to check if a token implements IERC7984ERC20Wrapper (confidential wrapper).\n *\n * @example\n * ```ts\n * const isWrapper = await provider.readContract(\n * isConfidentialWrapperContract(\"0xWrapperAddress\"),\n * );\n * ```\n */\nexport function isConfidentialWrapperContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC7984_WRAPPER_INTERFACE_ID);\n}\n\n/**\n * Returns contract config to check if a token implements ERC-1363 (payable token).\n *\n * @example\n * ```ts\n * const isPayable = await provider.readContract(\n * isPayableTokenContract(\"0xTokenAddress\"),\n * );\n * ```\n */\nexport function isPayableTokenContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC1363_INTERFACE_ID);\n}\n","import {\n ChainMismatchError,\n ConfigurationError,\n SignerNotConfiguredError,\n WalletAccountNotReadyError,\n} from \"../errors\";\nimport type { GenericProvider, GenericSigner, WalletAccount } from \"../types\";\n\n/**\n * Pre-flight guard for signer-required operations. Resolves the connected\n * wallet account (refreshing once if the signer reports it isn't ready) and\n * verifies the signer's chain matches the provider's.\n *\n * @internal\n */\nexport async function requireAlignedWalletAccount(\n operation: string,\n signer: GenericSigner | undefined,\n provider: GenericProvider,\n): Promise<WalletAccount> {\n if (!signer) {\n throw new SignerNotConfiguredError(operation);\n }\n let account: WalletAccount;\n try {\n account = signer.requireWalletAccount(operation);\n } catch (error) {\n if (!(error instanceof WalletAccountNotReadyError) || !signer.refreshWalletAccount) {\n throw error;\n }\n await signer.refreshWalletAccount();\n account = signer.requireWalletAccount(operation);\n }\n const providerChainId = await provider.getChainId();\n if (account.chainId !== providerChainId) {\n throw new ChainMismatchError({ operation, signerChainId: account.chainId, providerChainId });\n }\n return account;\n}\n\n/**\n * {@link requireAlignedWalletAccount}, plus a check that the wallet is on\n * `targetChainId` when one is given, so a write never lands on another chain.\n *\n * @internal\n */\nexport async function requireWriteChain(\n operation: string,\n signer: GenericSigner | undefined,\n provider: GenericProvider,\n targetChainId: number | undefined,\n): Promise<WalletAccount> {\n const account = await requireAlignedWalletAccount(operation, signer, provider);\n if (targetChainId !== undefined && account.chainId !== targetChainId) {\n throw new ChainMismatchError({\n operation,\n signerChainId: account.chainId,\n // The alignment check above guarantees the signer's chain is the provider's chain.\n providerChainId: account.chainId,\n targetChainId,\n });\n }\n return account;\n}\n\n/**\n * Variant of {@link requireAlignedWalletAccount} that returns only the aligned\n * chain ID. Useful when a write path only needs to ensure signer/provider\n * coherence and doesn't otherwise consume the account.\n *\n * @internal\n */\nexport async function requireChainAlignment(\n operation: string,\n signer: GenericSigner | undefined,\n provider: GenericProvider,\n): Promise<number> {\n return (await requireAlignedWalletAccount(operation, signer, provider)).chainId;\n}\n\n/**\n * For a provider bound to one chain: throws when a read asks for another, so\n * it never answers from the wrong chain.\n *\n * @internal\n */\nexport async function requireReadChain(\n adapter: string,\n chainId: number | undefined,\n getChainId: () => Promise<number>,\n): Promise<void> {\n if (chainId === undefined) {\n return;\n }\n const current = await getChainId();\n if (current !== chainId) {\n throw new ConfigurationError(\n `${adapter} is bound to chain ${current} and cannot read chain ${chainId}; use a provider for that chain`,\n );\n }\n}\n"],"mappings":"A,mGAGA,IAAaG,EAAb,cAA8CF,CAAU,CACtD,YAAY,EAAiB,EAAwB,CACnD,MAAMD,EAAc,oBAAqBI,EAASC,CAAO,EACzD,KAAK,KAAO,0BACd,CACF,EAMaC,EAAb,cAAgDL,CAAU,CACxD,YAAY,EAAiB,EAAwB,CACnD,MAAMD,EAAc,sBAAuBI,EAASC,CAAO,EAC3D,KAAK,KAAO,4BACd,CACF,EAOaE,EAAb,cAAsDN,CAAU,CAC9D,YAAY,EAAiB,EAAwB,CACnD,MAAMD,EAAc,4BAA6BI,EAASC,CAAO,EACjE,KAAK,KAAO,kCACd,CACF,ECRaG,EAAb,cAAwCP,CAAU,CAEhD,UAEA,cAEA,gBAEA,cAEA,YACE,CACE,YACA,gBACA,kBACA,iBAOF,EACA,CACA,MACED,EAAc,cACdS,IAAkB,IAAA,GACd,cAAcC,EAAU,iFACIC,EAAc,4BAA4BC,EAAgB,GACtF,cAAcF,EAAU,kBAAkBD,EAAc,2BAA2BE,EAAc,GACrGN,CACF,EACA,KAAK,KAAO,qBACZ,KAAK,UAAYK,EACjB,KAAK,cAAgBC,EACrB,KAAK,gBAAkBC,EACvB,KAAK,cAAgBH,CACvB,CACF,ECxDaI,EAAb,cAAyCZ,CAAU,CAEjD,UAEA,YAAY,EAAqB,EAAmB,EAAiB,EA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e,CACf,GAAIC,IAAY,IAAA,GACd,OAEF,IAAMC,EAAU,MAAMC,EAAW,EACjC,GAAID,IAAYD,EACd,MAAM,IAAI7F,EACR,GAAGgG,EAAQ,qBAAqBF,EAAQ,yBAAyBD,EAAQ,gCAC3E,CAEJ,C"}
@@ -1,6 +1,5 @@
1
- import { A as WalletAccountListener, D as GenericSigner, L as WriteContractArgs, M as ContractAbi, O as WalletAccount, R as WriteContractConfig, in as EIP712TypedData, j as WalletAccountStore, z as WriteFunctionName } from "./types-CHepK8MK.js";
1
+ import { A as WalletAccountListener, B as WriteFunctionName, D as GenericSigner, M as ContractAbi, O as WalletAccount, R as WriteContractArgs, an as EIP712TypedData, j as WalletAccountStore, z as WriteContractConfig } from "./types-Ubeo72FV.js";
2
2
  import { Hex } from "viem";
3
- //#region src/signer/wallet-account-store.d.ts
4
3
  /**
5
4
  * Writable {@link WalletAccountStore} for custom signer adapters. Adapters call
6
5
  * {@link MutableWalletAccountStore.setSnapshot} when their underlying wallet
@@ -41,8 +40,6 @@ declare class MutableWalletAccountStore implements WalletAccountStore {
41
40
  * @param initial - Optional initial wallet account snapshot.
42
41
  */
43
42
  declare function createWalletAccountStore(initial?: WalletAccount): MutableWalletAccountStore;
44
- //#endregion
45
- //#region src/signer/base-signer.d.ts
46
43
  /**
47
44
  * Abstract base class that supplies the wallet-account / dispose
48
45
  * boilerplate every signer adapter needs: an observable wallet-account
@@ -71,6 +68,4 @@ declare abstract class BaseSigner implements GenericSigner, Disposable {
71
68
  /** Subclass cleanup hook, invoked once on the first {@link BaseSigner.dispose} call. */
72
69
  protected onDispose(): void;
73
70
  }
74
- //#endregion
75
- export { MutableWalletAccountStore as n, createWalletAccountStore as r, BaseSigner as t };
76
- //# sourceMappingURL=base-signer-BxIDBDTF.d.ts.map
71
+ export { MutableWalletAccountStore as n, createWalletAccountStore as r, BaseSigner as t };