@zama-fhe/sdk 3.2.0 → 3.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/ethers/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/token.cjs +1 -1
- package/dist/cjs/token.cjs.map +1 -1
- package/dist/cjs/viem/index.cjs +1 -1
- package/dist/cjs/wrappers-registry.cjs +1 -1
- package/dist/cjs/wrappers-registry.cjs.map +1 -1
- package/dist/esm/base-signer-DaRQNB29.js +2 -0
- package/dist/esm/{base-signer-BVqcM5jt.js.map → base-signer-DaRQNB29.js.map} +1 -1
- package/dist/esm/{cleartext-DMW5nK1M.d.ts → cleartext-4WhQWHZF.d.ts} +2 -2
- package/dist/esm/ethers/index.d.ts +2 -2
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/ethers/index.js.map +1 -1
- package/dist/esm/{index-DoVo9J1n.d.ts → index-BRIQ3Msg.d.ts} +56 -2
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +2 -2
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +26 -3
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/token-BTgHqRIL.js +2 -0
- package/dist/esm/token-BTgHqRIL.js.map +1 -0
- package/dist/esm/{types-BjDu-RZg.d.ts → types-C4JRzs5M.d.ts} +13 -1
- package/dist/esm/{types-DiZhtG8i.d.ts → types-Cb7AvEOP.d.ts} +2 -2
- package/dist/esm/{types-Xg_On_yY.d.ts → types-DJp9eoXC.d.ts} +2 -2
- package/dist/esm/viem/index.d.ts +2 -2
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/web/index.d.ts +1 -1
- package/dist/esm/{wrappers-registry-BWWG0aze.js → wrappers-registry-ChxQp8ty.js} +2 -2
- package/dist/esm/wrappers-registry-ChxQp8ty.js.map +1 -0
- package/package.json +1 -1
- package/dist/esm/base-signer-BVqcM5jt.js +0 -2
- package/dist/esm/token-TQ-VFHS4.js +0 -2
- package/dist/esm/token-TQ-VFHS4.js.map +0 -1
- package/dist/esm/wrappers-registry-BWWG0aze.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrappers-registry.cjs","names":["ZamaError","ZamaErrorCode","ZamaError","ZamaErrorCode","erc20Abi"],"sources":["../../src/errors/signing.ts","../../src/errors/signer.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/contracts/wrappers-registry.ts"],"sourcesContent":["import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/** User rejected the wallet signature prompt. */\nexport class SigningRejectedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.SigningRejected, message, options);\n this.name = \"SigningRejectedError\";\n }\n}\n\n/** Wallet signature failed for a reason other than rejection. */\nexport class SigningFailedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.SigningFailed, message, options);\n this.name = \"SigningFailedError\";\n }\n}\n\n/**\n * Wrap a signing error as {@link SigningRejectedError} or {@link SigningFailedError}.\n * Detects user rejection via EIP-1193 code 4001 or message heuristics.\n */\nexport function wrapSigningError(error: unknown, context: string): never {\n const hasCode4001 =\n typeof error === \"object\" && error !== null && \"code\" in error && error.code === 4001;\n const originalMsg = error instanceof Error ? error.message : String(error);\n const lowerMsg = originalMsg.toLowerCase();\n const hasRejectionMessage =\n lowerMsg.includes(\"user rejected\") || lowerMsg.includes(\"user denied\");\n const fullMessage = `${context}: ${originalMsg}`;\n if (hasCode4001 || hasRejectionMessage) {\n throw new SigningRejectedError(fullMessage, { cause: error });\n }\n throw new SigningFailedError(fullMessage, { cause: error });\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * Base class for signer/account readiness failures.\n */\nexport class SignerRequiredError extends ZamaError {\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 { GenericLogger } from \"../worker/worker.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: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\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: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialBalanceOf\",\n inputs: [\n {\n name: \"account\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialProtocolId\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTotalSupply\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"contractURI\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"decimals\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"discloseEncryptedAmount\",\n inputs: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"cleartextAmount\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"decryptionProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"finalizeUnwrap\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"unwrapAmountCleartext\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"decryptionProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getUnderlyingDenyListSelector\",\n inputs: [],\n outputs: [\n {\n name: \"isSet\",\n type: \"bool\",\n internalType: \"bool\",\n },\n {\n name: \"selector\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"inferredTotalSupply\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"initialize\",\n inputs: [\n {\n name: \"name_\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"symbol_\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"contractURI_\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"underlying_\",\n type: \"address\",\n internalType: \"contract IERC20\",\n },\n {\n name: \"owner_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"isBlocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"isOperator\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"spender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"maxTotalSupply\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"name\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onTransferReceived\",\n inputs: [\n {\n name: \"operator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"proxiableUUID\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"rate\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\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 {\n name: \"blockedUsers\",\n type: \"address[]\",\n internalType: \"address[]\",\n },\n {\n name: \"underlyingDenyListSelector\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n {\n name: \"hasUnderlyingDenyListSelector_\",\n type: \"bool\",\n internalType: \"bool\",\n },\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: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setOperator\",\n inputs: [\n {\n name: \"operator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"until\",\n type: \"uint48\",\n internalType: \"uint48\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [\n {\n name: \"interfaceId\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"symbol\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [\n {\n name: \"newOwner\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unblockUser\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"underlying\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrapAmount\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrapRequester\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"upgradeToAndCall\",\n inputs: [\n {\n name: \"newImplementation\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"wrap\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"AmountDiscloseRequested\",\n inputs: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"euint64\",\n },\n {\n name: \"requester\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"AmountDisclosed\",\n inputs: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"euint64\",\n },\n {\n name: \"amount\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"ConfidentialTransfer\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"euint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Initialized\",\n inputs: [\n {\n name: \"version\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OperatorSet\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"operator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"until\",\n type: \"uint48\",\n indexed: false,\n internalType: \"uint48\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PublicDecryptionVerified\",\n inputs: [\n {\n name: \"handlesList\",\n type: \"bytes32[]\",\n indexed: false,\n internalType: \"bytes32[]\",\n },\n {\n name: \"abiEncodedCleartexts\",\n type: \"bytes\",\n indexed: false,\n internalType: \"bytes\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapFinalized\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"bytes32\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n indexed: false,\n internalType: \"euint64\",\n },\n {\n name: \"cleartextAmount\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapRequested\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"bytes32\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n indexed: false,\n internalType: \"euint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Upgraded\",\n inputs: [\n {\n name: \"implementation\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserBlocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserUnblocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Wrap\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"roundedAmount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"encryptedWrappedAmount\",\n type: \"bytes32\",\n indexed: false,\n internalType: \"euint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AddressEmptyCode\",\n inputs: [\n {\n name: \"target\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"BlockedUser\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC1967InvalidImplementation\",\n inputs: [\n {\n name: \"implementation\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC1967NonPayable\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidSender\",\n inputs: [\n {\n name: \"sender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984TotalSupplyOverflow\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedCaller\",\n inputs: [\n {\n name: \"caller\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedSpender\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"spender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedUseOfEncryptedAmount\",\n inputs: [\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984ZeroBalance\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"FailedCall\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidInitialization\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidKMSSignatures\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidUnderlyingDenyListResponse\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidUnwrapRequest\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"NotInitializing\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"OwnableInvalidOwner\",\n inputs: [\n {\n name: \"owner\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"OwnableUnauthorizedAccount\",\n inputs: [\n {\n name: \"account\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"SafeCastOverflowedUintDowncast\",\n inputs: [\n {\n name: \"bits\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"value\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"SafeERC20FailedOperation\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"SenderNotAllowedToUseHandle\",\n inputs: [\n {\n name: \"handle\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"sender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UUPSUnauthorizedCallContext\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"UUPSUnsupportedProxiableUUID\",\n inputs: [\n {\n name: \"slot\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UnderlyingDenyListCallFailed\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"UnderlyingDenyListedAddress\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UserAlreadyBlocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UserAlreadyUnblocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ZamaProtocolUnsupported\",\n inputs: [],\n },\n] as const;\n","import type { Address, Hex } from \"viem\";\nimport { confidentialWrapperAbi } from \"../abi/confidential-wrapper.abi\";\nimport type { EncryptedValue } from \"../relayer/relayer-sdk.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 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 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"name\",\n args: [],\n } 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"symbol\",\n args: [],\n } 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"decimals\",\n args: [],\n } 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"totalSupply\",\n args: [],\n } 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: [\n {\n name: \"interfaceId\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\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 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 {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\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 {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\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 {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\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: [\n {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\n ],\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: [\n {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\n ],\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: [\n {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\n ],\n name: \"revokeConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\nexport interface TokenWrapperPair {\n readonly tokenAddress: Address;\n readonly confidentialTokenAddress: Address;\n readonly isValid: boolean;\n}\n\n/** Extended pair with on-chain metadata for both tokens. */\nexport interface TokenWrapperPairWithMetadata extends TokenWrapperPair {\n readonly underlying: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n readonly totalSupply: bigint;\n };\n readonly confidential: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n };\n}\n\n/** Paginated result set modelled after standard API pagination. */\nexport interface PaginatedResult<T> {\n readonly items: readonly T[];\n readonly total: number;\n readonly page: number;\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":"uDAGA,IAAa,EAAb,cAA0CA,EAAAA,CAAU,CAClD,YAAY,EAAiB,EAAwB,CACnD,MAAMC,EAAAA,EAAc,gBAAiB,EAAS,CAAO,EACrD,KAAK,KAAO,sBACd,CACF,EAGa,EAAb,cAAwCD,EAAAA,CAAU,CAChD,YAAY,EAAiB,EAAwB,CACnD,MAAMC,EAAAA,EAAc,cAAe,EAAS,CAA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,OAAM,CAAC,CAC3C,CACF,CClBA,MAAa,EAAyB,CACpC,CACE,KAAM,WACN,KAAM,4BACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,kBACN,OAAQ,CAAC,EACT,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,YACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,wBACN,OAAQ,CACN,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,yBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,0BACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,kCACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,kCACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,cACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,WACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,0BACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,kBACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,wBACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,kBACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,gCACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,QACN,KAAM,OACN,aAAc,MAChB,EACA,CACE,KAAM,WACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,sBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,aACN,OAAQ,CACN,CACE,KAAM,QACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,UACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,eACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,cACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,YACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,aACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,OACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,qBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,QACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,eACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,gBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,OACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CAAC,EACT,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CACN,CACE,KAAM,eACN,KAAM,YACN,aAAc,WAChB,EACA,CACE,KAAM,6BACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,iCACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,oBACN,OAAQ,CAAC,EACT,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,iCACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,QACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,oBACN,OAAQ,CACN,CACE,KAAM,cACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,SACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,oBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,aACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,SACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,SACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,eACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,mBACN,OAAQ,CACN,CACE,KAAM,oBACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,SACnB,EACA,CACE,KAAM,WACN,KAAM,OACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,QACN,KAAM,0BACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,YACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,UACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,QACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,gBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,gBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,cACN,KAAM,YACN,QAAS,GACT,aAAc,WAChB,EACA,CACE,KAAM,uBACN,KAAM,QACN,QAAS,GACT,aAAc,OAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,WACN,OAAQ,CACN,CACE,KAAM,iBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,gBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,OACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,gBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,yBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,mBACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,+BACN,OAAQ,CACN,CACE,KAAM,iBACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,oBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,yBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,yBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,6BACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,4BACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,6BACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,0CACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,qBACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,aACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,wBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,oCACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,sBACN,OAAQ,CACN,CACE,KAAM,QACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,6BACN,OAAQ,CACN,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,iCACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,EACA,CACE,KAAM,QACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,QACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,8BACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,+BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,+BACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,qBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,0BACN,OAAQ,CAAC,CACX,CACF,ECr7CA,SAAgB,EAA8B,EAAuB,EAAsB,CACzF,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,wBACd,KAAM,CAAC,CAAW,CACpB,CACF,CAYA,SAAgB,EACd,EACA,EACA,EACA,EACA,CACA,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,uBACd,KAAM,CAAC,EAAI,EAAiB,CAAU,CACxC,CACF,CAYA,SAAgB,EACd,EACA,EACA,EACA,EACA,EACA,CACA,MA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vD,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,iCACd,KAAM,CAAC,CACT,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":["ZamaError","ZamaErrorCode","ZamaError","ZamaErrorCode","erc20Abi"],"sources":["../../src/errors/signing.ts","../../src/errors/signer.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/contracts/wrappers-registry.ts"],"sourcesContent":["import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/** User rejected the wallet signature prompt. */\nexport class SigningRejectedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.SigningRejected, message, options);\n this.name = \"SigningRejectedError\";\n }\n}\n\n/** Wallet signature failed for a reason other than rejection. */\nexport class SigningFailedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.SigningFailed, message, options);\n this.name = \"SigningFailedError\";\n }\n}\n\n/**\n * Wrap a signing error as {@link SigningRejectedError} or {@link SigningFailedError}.\n * Detects user rejection via EIP-1193 code 4001 or message heuristics.\n */\nexport function wrapSigningError(error: unknown, context: string): never {\n const hasCode4001 =\n typeof error === \"object\" && error !== null && \"code\" in error && error.code === 4001;\n const originalMsg = error instanceof Error ? error.message : String(error);\n const lowerMsg = originalMsg.toLowerCase();\n const hasRejectionMessage =\n lowerMsg.includes(\"user rejected\") || lowerMsg.includes(\"user denied\");\n const fullMessage = `${context}: ${originalMsg}`;\n if (hasCode4001 || hasRejectionMessage) {\n throw new SigningRejectedError(fullMessage, { cause: error });\n }\n throw new SigningFailedError(fullMessage, { cause: error });\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * Base class for signer/account readiness failures.\n */\nexport class SignerRequiredError extends ZamaError {\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 { GenericLogger } from \"../worker/worker.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: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\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: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialBalanceOf\",\n inputs: [\n {\n name: \"account\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialProtocolId\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTotalSupply\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"transferred\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"contractURI\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"decimals\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"discloseEncryptedAmount\",\n inputs: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"cleartextAmount\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"decryptionProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"finalizeUnwrap\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"unwrapAmountCleartext\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"decryptionProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getUnderlyingDenyListSelector\",\n inputs: [],\n outputs: [\n {\n name: \"isSet\",\n type: \"bool\",\n internalType: \"bool\",\n },\n {\n name: \"selector\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"inferredTotalSupply\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"initialize\",\n inputs: [\n {\n name: \"name_\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"symbol_\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"contractURI_\",\n type: \"string\",\n internalType: \"string\",\n },\n {\n name: \"underlying_\",\n type: \"address\",\n internalType: \"contract IERC20\",\n },\n {\n name: \"owner_\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"isBlocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"isOperator\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"spender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"maxTotalSupply\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"name\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onTransferReceived\",\n inputs: [\n {\n name: \"operator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"proxiableUUID\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"rate\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\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 {\n name: \"blockedUsers\",\n type: \"address[]\",\n internalType: \"address[]\",\n },\n {\n name: \"underlyingDenyListSelector\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n {\n name: \"hasUnderlyingDenyListSelector_\",\n type: \"bool\",\n internalType: \"bool\",\n },\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: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setOperator\",\n inputs: [\n {\n name: \"operator\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"until\",\n type: \"uint48\",\n internalType: \"uint48\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [\n {\n name: \"interfaceId\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"symbol\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\",\n internalType: \"string\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [\n {\n name: \"newOwner\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unblockUser\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"underlying\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n internalType: \"externalEuint64\",\n },\n {\n name: \"inputProof\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrapAmount\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrapRequester\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"upgradeToAndCall\",\n inputs: [\n {\n name: \"newImplementation\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"wrap\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"AmountDiscloseRequested\",\n inputs: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"euint64\",\n },\n {\n name: \"requester\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"AmountDisclosed\",\n inputs: [\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"euint64\",\n },\n {\n name: \"amount\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"ConfidentialTransfer\",\n inputs: [\n {\n name: \"from\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"to\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"euint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Initialized\",\n inputs: [\n {\n name: \"version\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OperatorSet\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"operator\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"until\",\n type: \"uint48\",\n indexed: false,\n internalType: \"uint48\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PublicDecryptionVerified\",\n inputs: [\n {\n name: \"handlesList\",\n type: \"bytes32[]\",\n indexed: false,\n internalType: \"bytes32[]\",\n },\n {\n name: \"abiEncodedCleartexts\",\n type: \"bytes\",\n indexed: false,\n internalType: \"bytes\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapFinalized\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"bytes32\",\n },\n {\n name: \"encryptedAmount\",\n type: \"bytes32\",\n indexed: false,\n internalType: \"euint64\",\n },\n {\n name: \"cleartextAmount\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapRequested\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"bytes32\",\n },\n {\n name: \"amount\",\n type: \"bytes32\",\n indexed: false,\n internalType: \"euint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Upgraded\",\n inputs: [\n {\n name: \"implementation\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserBlocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserUnblocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Wrap\",\n inputs: [\n {\n name: \"to\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"roundedAmount\",\n type: \"uint256\",\n indexed: false,\n internalType: \"uint256\",\n },\n {\n name: \"encryptedWrappedAmount\",\n type: \"bytes32\",\n indexed: false,\n internalType: \"euint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AddressEmptyCode\",\n inputs: [\n {\n name: \"target\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"BlockedUser\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC1967InvalidImplementation\",\n inputs: [\n {\n name: \"implementation\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC1967NonPayable\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [\n {\n name: \"receiver\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidSender\",\n inputs: [\n {\n name: \"sender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984TotalSupplyOverflow\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedCaller\",\n inputs: [\n {\n name: \"caller\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedSpender\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"spender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedUseOfEncryptedAmount\",\n inputs: [\n {\n name: \"amount\",\n type: \"bytes32\",\n internalType: \"euint64\",\n },\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984ZeroBalance\",\n inputs: [\n {\n name: \"holder\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"FailedCall\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidInitialization\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidKMSSignatures\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidUnderlyingDenyListResponse\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"InvalidUnwrapRequest\",\n inputs: [\n {\n name: \"unwrapRequestId\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"NotInitializing\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"OwnableInvalidOwner\",\n inputs: [\n {\n name: \"owner\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"OwnableUnauthorizedAccount\",\n inputs: [\n {\n name: \"account\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"SafeCastOverflowedUintDowncast\",\n inputs: [\n {\n name: \"bits\",\n type: \"uint8\",\n internalType: \"uint8\",\n },\n {\n name: \"value\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"SafeERC20FailedOperation\",\n inputs: [\n {\n name: \"token\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"SenderNotAllowedToUseHandle\",\n inputs: [\n {\n name: \"handle\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"sender\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UUPSUnauthorizedCallContext\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"UUPSUnsupportedProxiableUUID\",\n inputs: [\n {\n name: \"slot\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UnderlyingDenyListCallFailed\",\n inputs: [],\n },\n {\n type: \"error\",\n name: \"UnderlyingDenyListedAddress\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UserAlreadyBlocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"UserAlreadyUnblocked\",\n inputs: [\n {\n name: \"user\",\n type: \"address\",\n internalType: \"address\",\n },\n ],\n },\n {\n type: \"error\",\n name: \"ZamaProtocolUnsupported\",\n inputs: [],\n },\n] as const;\n","import type { Address, Hex } from \"viem\";\nimport { confidentialWrapperAbi } from \"../abi/confidential-wrapper.abi\";\nimport type { EncryptedValue } from \"../relayer/relayer-sdk.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 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"name\",\n args: [],\n } 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"symbol\",\n args: [],\n } 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"decimals\",\n args: [],\n } 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 {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"totalSupply\",\n args: [],\n } 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: [\n {\n name: \"interfaceId\",\n type: \"bytes4\",\n internalType: \"bytes4\",\n },\n ],\n outputs: [\n {\n name: \"\",\n type: \"bool\",\n internalType: \"bool\",\n },\n ],\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 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 {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\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 {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\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 {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\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: [\n {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\n ],\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: [\n {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\n ],\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: [\n {\n internalType: \"address\",\n name: \"confidentialTokenAddress\",\n type: \"address\",\n },\n ],\n name: \"revokeConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\nexport interface TokenWrapperPair {\n readonly tokenAddress: Address;\n readonly confidentialTokenAddress: Address;\n readonly isValid: boolean;\n}\n\n/** Extended pair with on-chain metadata for both tokens. */\nexport interface TokenWrapperPairWithMetadata extends TokenWrapperPair {\n readonly underlying: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n readonly totalSupply: bigint;\n };\n readonly confidential: {\n readonly name: string;\n readonly symbol: string;\n readonly decimals: number;\n };\n}\n\n/** Paginated result set modelled after standard API pagination. */\nexport interface PaginatedResult<T> {\n readonly items: readonly T[];\n readonly total: number;\n readonly page: number;\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":"uDAGA,IAAa,EAAb,cAA0CA,EAAAA,CAAU,CAClD,YAAY,EAAiB,EAAwB,CACnD,MAAMC,EAAAA,EAAc,gBAAiB,E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AS,EAE9C,OAAO,CACT,CCnEA,eAAsB,EACpB,EACA,EACA,EACe,CACf,GAAI,CACF,MAAM,EAAG,CACX,OAAS,EAAO,CACd,GAAQ,KAAK,GAAG,EAAM,SAAU,CAAE,OAAM,CAAC,CAC3C,CACF,CClBA,MAAa,EAAyB,CACpC,CACE,KAAM,WACN,KAAM,4BACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,kBACN,OAAQ,CAAC,EACT,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,YACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,wBACN,OAAQ,CACN,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,yBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,0BACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,kCACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,kCACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,cACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,cACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,WACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,0BACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,kBACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,wBACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,kBACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,gCACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,QACN,KAAM,OACN,aAAc,MAChB,EACA,CACE,KAAM,WACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,sBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,aACN,OAAQ,CACN,CACE,KAAM,QACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,UACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,eACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,cACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,YACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,aACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,OACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,qBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,QACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,eACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,gBACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,OACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CAAC,EACT,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,iBACN,OAAQ,CACN,CACE,KAAM,eACN,KAAM,YACN,aAAc,WAChB,EACA,CACE,KAAM,6BACN,KAAM,SACN,aAAc,QAChB,EACA,CACE,KAAM,iCACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,oBACN,OAAQ,CAAC,EACT,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,iCACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,QACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,oBACN,OAAQ,CACN,CACE,KAAM,cACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,OACN,aAAc,MAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,SACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,SACN,aAAc,QAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,oBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,aACN,OAAQ,CAAC,EACT,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,SACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,aAAc,iBAChB,EACA,CACE,KAAM,aACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,SACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,WACN,KAAM,eACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,MACnB,EACA,CACE,KAAM,WACN,KAAM,mBACN,OAAQ,CACN,CACE,KAAM,oBACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,CACF,EACA,QAAS,CAAC,EACV,gBAAiB,SACnB,EACA,CACE,KAAM,WACN,KAAM,OACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,QAAS,CACP,CACE,KAAM,GACN,KAAM,UACN,aAAc,SAChB,CACF,EACA,gBAAiB,YACnB,EACA,CACE,KAAM,QACN,KAAM,0BACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,YACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,KACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,UACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,QACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,gBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,gBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,cACN,KAAM,YACN,QAAS,GACT,aAAc,WAChB,EACA,CACE,KAAM,uBACN,KAAM,QACN,QAAS,GACT,aAAc,OAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,SACN,QAAS,GACT,aAAc,QAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,kBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,WACN,OAAQ,CACN,CACE,KAAM,iBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,gBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,OACN,OAAQ,CACN,CACE,KAAM,KACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,gBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,EACA,CACE,KAAM,yBACN,KAAM,UACN,QAAS,GACT,aAAc,SAChB,CACF,EACA,UAAW,EACb,EACA,CACE,KAAM,QACN,KAAM,mBACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,cACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,+BACN,OAAQ,CACN,CACE,KAAM,iBACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,oBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,yBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,yBACN,OAAQ,CACN,CACE,KAAM,WACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,6BACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,4BACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,6BACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,0CACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,qBACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,aACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,wBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,oCACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,kBACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,kBACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,sBACN,OAAQ,CACN,CACE,KAAM,QACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,6BACN,OAAQ,CACN,CACE,KAAM,UACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,iCACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,QACN,aAAc,OAChB,EACA,CACE,KAAM,QACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,2BACN,OAAQ,CACN,CACE,KAAM,QACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,EACA,CACE,KAAM,SACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,8BACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,+BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,+BACN,OAAQ,CAAC,CACX,EACA,CACE,KAAM,QACN,KAAM,8BACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,qBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,uBACN,OAAQ,CACN,CACE,KAAM,OACN,KAAM,UACN,aAAc,SAChB,CACF,CACF,EACA,CACE,KAAM,QACN,KAAM,0BACN,OAAQ,CAAC,CACX,CACF,ECr7CA,SAAgB,EAA8B,EAAuB,EAAsB,CACzF,MAAO,CACL,QAAS,EACT,IAAK,EACL,aAAc,wBACd,KAAM,CAAC,CAAW,CACpB,CACF,CAYA,SAAgB,EACd,EACA,EACA,EACA,EACA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e,t}from"./relayer-D-nicEYJ.js";import{G as n,L as r,V as i,a,b as o,i as s,n as c,o as l,r as u,s as d,t as f,v as p,x as m,y as h}from"./wrappers-registry-ChxQp8ty.js";import{r as g}from"./error-W1N-FGwV.js";import{t as ee}from"./indexeddb-storage-Mi-fCWN3.js";import{t as te}from"./memory-storage-fp9RY5BQ.js";import{i as _}from"./assertions-CnPIS0VN.js";import{a as v,c as y,n as b,o as x,s as S}from"./chains-CXcO1DBP.js";import{t as C}from"./validation-DHZ3JPOn.js";import{getAddress as w,isAddress as ne,isHex as re,zeroAddress as T}from"viem";import{z as E}from"zod/mini";function D(e){return`keypair:${e}`}function O(e){return`permits:${e.signerAddress}:${e.chainId}:${e.delegatorAddress}`}function k(e){return`permits-index:${e}`}function A(e){return w(e)}const j=E.custom(e=>typeof e==`string`&&re(e,{strict:!0}),`expected 0x-prefixed hex string`),ie=E.custom(e=>typeof e==`string`&&ne(e,{strict:!1}),`expected EVM address`),M=E.pipe(ie,E.transform(A)),N=E.int().check(E.nonnegative()),P=E.int().check(E.positive()),ae=E.int().check(E.nonnegative()),oe=E.int().check(E.positive()),se=E.int().check(E.positive());function F(){return Math.floor(Date.now()/1e3)}function I(e){return[...new Set(e.map(A))].toSorted()}const L=`transportKeyPairTTL must be a positive integer number of seconds`,R=`permitTTL must be a positive integer number of days`,z=365*86400,B=E.int({error:L}).check(E.positive({error:L}),E.maximum(z,`transportKeyPairTTL must not exceed the fhevm ACL maximum of ${z}s (365 days)`)),V=E.int({error:R}).check(E.positive({error:R})),H=E.object({publicKey:j,privateKey:j,createdAt:N,expiresAt:P}),U=E.object({keypairPublicKey:j,signerAddress:M,delegatorAddress:M,chainId:se,signedContractAddresses:E.array(M).check(E.maxLength(10)),signature:j,startTimestamp:N,durationDays:oe}),W=E.array(U),G=E.array(E.string());var ce=class{#e;#t;#n;#r;#i=new Map;constructor(e){this.#e=e.generator,this.#t=e.storage,this.#n=e.ttl,this.#r=e.logger}async readStored(e){let t=D(e),n=await this.#t.get(t);if(n==null)return null;let i=H.safeParse(n);if(!i.success)return await r(`delete transport key pair entry`,()=>this.#t.delete(t),this.#r),null;let a=i.data;return F()>=a.expiresAt?(await r(`delete transport key pair entry`,()=>this.#t.delete(t),this.#r),null):a}async getOrCreate(e){let t=this.#i.get(e);if(t)return t;let n=(async()=>{let t=await this.readStored(e);if(t!==null)return t;let n=await this.#e(),i=F(),a={publicKey:n.publicKey,privateKey:n.privateKey,createdAt:i,expiresAt:i+this.#n},o=D(e);return await r(`persist transport key pair`,()=>this.#t.set(o,a),this.#r),a})().finally(()=>{this.#i.delete(e)});return this.#i.set(e,n),n}async clear(e){let t=D(e);await r(`delete transport key pair entry`,()=>this.#t.delete(t),this.#r)}};function K(e,t){let n=new Set(e.flatMap(e=>e.signedContractAddresses));return t.filter(e=>!n.has(e))}function le(e){let t=[];for(let n=0;n<e.length;n+=10)t.push(e.slice(n,n+10));return t}function ue(e,t,n){return e.filter(e=>e.keypairPublicKey===t&&n<e.startTimestamp+e.durationDays*86400)}function de(e,t){let n=new Set(t);return e.filter(e=>!e.signedContractAddresses.some(e=>n.has(e)))}function fe(e,t){return[...new Set([...e,...t])].toSorted()}function pe(e,t,n){let r=new Set(n),i=e.filter(e=>new Set([...e.signedContractAddresses,...t]).size<=10);if(i.length===0)return null;function a(e){return e.signedContractAddresses.reduce((e,t)=>e+ +!!r.has(t),0)}let o=Math.max(...i.map(a));return i.filter(e=>a(e)===o).reduce((e,t)=>t.startTimestamp>e.startTimestamp?t:e)}var me=class{#e;#t;constructor(e){this.#e=e.storage,this.#t=e.logger}async list(e){let t=O(e),n=await this.#e.get(t);if(n==null)return[];let r=W.safeParse(n);return r.success?r.data:(await this.#a(t),await this.#i(e),[])}async listUsableAndPrune(e,t){let n=await this.list(e),i=ue(n,t,Math.floor(Date.now()/1e3));if(i.length!==n.length){let t=O(e);i.length===0?(await this.#a(t),await this.#i(e)):await r(`update permit entry`,()=>this.#e.set(t,i),this.#t)}return i}async append(e,t){if(t.length===0)return;let n=t.map(e=>U.parse(e)),r=await this.list(e);await this.#e.set(O(e),[...r,...n]),await this.#r(e)}async replace(e,t,n){let r=U.parse(n),i=(await this.list(e)).filter(e=>e.signature!==t);await this.#e.set(O(e),[...i,r]),await this.#r(e)}async deletePermitsTouching(e,t){let n=await this.list(e);if(n.length===0)return;let r=O(e),i=de(n,t);i.length===0?(await this.#a(r),await this.#i(e)):await this.#e.set(r,i)}async clearAllForSigner(e){let t=k(e),n=await this.#n(t);await Promise.all(n.map(e=>this.#a(e))),await r(`delete permit index`,()=>this.#e.delete(t),this.#t)}async#n(e){let t=await this.#e.get(e);if(t==null)return[];let n=G.safeParse(t);return n.success?n.data:(await r(`delete permit index`,()=>this.#e.delete(e),this.#t),[])}async#r(e){let t=k(e.signerAddress),n=O(e),r=await this.#n(t);r.includes(n)||await this.#e.set(t,[...r,n])}async#i(e){let t=k(e.signerAddress),n=O(e),i=await this.#n(t),a=i.filter(e=>e!==n);a.length!==i.length&&(a.length===0?await r(`delete permit index`,()=>this.#e.delete(t),this.#t):await r(`update permit index`,()=>this.#e.set(t,a),this.#t))}async#a(e){await r(`delete permit entry`,()=>this.#e.delete(e),this.#t)}},he=class{#e;#t;#n;#r;#i;#a;constructor(e){this.#e=new ce({generator:()=>e.relayer.generateTransportKeyPair(),storage:e.storage,ttl:e.transportKeyPairTTL,logger:e.logger}),this.#t=new me({storage:e.permitStorage??e.storage,logger:e.logger}),this.#n=e.relayer,this.#r=e.signer,this.#i=e.permitTTL,this.#a=e.logger}async grantPermit(e,t){let n=this.#r.requireWalletAccount(`grantPermit`),i=A(n.address),a=I(e),o=await this.#e.getOrCreate(i);if(a.length===0)return{keypair:o,permits:[]};let s={signerAddress:i,chainId:n.chainId,delegatorAddress:t?A(t):i},c=await this.#t.listUsableAndPrune(s,o.publicKey),l=K(c,a);if(l.length>0){let e=pe(c,l,a);if(e!==null){let t=fe(e.signedContractAddresses,l),n=await this.#o({chunk:t,keypair:o,scope:s});await r(`replace permit`,()=>this.#t.replace(s,e.signature,n),this.#a),c[c.indexOf(e)]=n}else for(let e of le(l)){let t=await this.#o({chunk:e,keypair:o,scope:s});c.push(t),await r(`persist permit`,()=>this.#t.append(s,[t]),this.#a)}}let u=new Set(a);return{keypair:o,permits:c.filter(e=>e.signedContractAddresses.some(e=>u.has(e)))}}async hasPermit(e,t){if(e.length===0)return!0;let n=this.#r.walletAccount.getSnapshot();if(!n)return!1;let r=A(n.address),i=await this.#e.readStored(r);if(i===null)return!1;let a={signerAddress:r,chainId:n.chainId,delegatorAddress:t?A(t):r};return K(await this.#t.listUsableAndPrune(a,i.publicKey),I(e)).length===0}async revokePermits(e){let t=this.#r.requireWalletAccount(`revokePermits`),n=A(t.address);if(e===void 0){await this.#t.clearAllForSigner(n);return}let r=I(e);if(r.length===0)return;let i=t.chainId;await this.#t.deletePermitsTouching({signerAddress:n,chainId:i,delegatorAddress:n},r)}async clearCredentials(){let e=A(this.#r.requireWalletAccount(`clearCredentials`).address);await this.#e.clear(e),await this.#t.clearAllForSigner(e)}async warmTransportKeyPair(e){await this.#e.getOrCreate(A(e))}async handleWalletAccountChange(e,t){let n=e?A(e.address):void 0;n!==(t?A(t.address):void 0)&&n&&(await this.#e.clear(n),await this.#t.clearAllForSigner(n))}async#o(t){let{chunk:r,keypair:i,scope:a}=t,o=F(),s=a.delegatorAddress!==a.signerAddress;try{let e=s?await this.#n.createDelegatedUserDecryptEIP712(i.publicKey,r,a.delegatorAddress,o,this.#i):await this.#n.createEIP712(i.publicKey,r,o,this.#i),t=await this.#r.signTypedData(e);return{keypairPublicKey:i.publicKey,signerAddress:a.signerAddress,delegatorAddress:a.delegatorAddress,chainId:a.chainId,signedContractAddresses:r,signature:t,startTimestamp:o,durationDays:this.#i}}catch(t){throw t instanceof e?t:n(t,`Credential signing failed`)}}},ge=class{#e;#t=`[zama-sdk]`;constructor(e){this.#e=e}error(e,t){this.#e?.error(`${this.#t} ${e}`,t)}warn(e,t){this.#e?.warn(`${this.#t} ${e}`,t)}info(e,t){this.#e?.info(`${this.#t} ${e}`,t)}debug(e,t){this.#e?.debug(`${this.#t} ${e}`,t)}};function _e(){return typeof window<`u`?new ee(`CredentialStore`):new te}function q(e=_e(),t=e){return{storage:e,permitStorage:t}}function J(e,n){let r=new Map(e.map(e=>[e.id,e]));if(r.size!==e.length){let n=e.map(e=>e.id);throw new t(`Duplicate chain id(s) [${[...new Set(n.filter((e,t)=>n.indexOf(e)!==t))].join(`, `)}] in the chains array. Each chain id must appear only once. Note: hardhat and anvil are aliases (both use 31337).`)}let i=new Map(Object.entries(n)),a=new Map;for(let e of r.keys()){let n=r.get(e),o=i.get(String(e));if(!o)throw new t(`Chain ${e} has no relayer configured. Add a relayer entry: relayers: { [${e}]: web() }`);if(!n)throw new t(`Chain ${e} has a relayer configured but no entry in the chains array. Add the chain config to the chains array.`);a.set(e,{chain:n,relayer:o})}let o=new Set(Object.keys(n).map(Number)),s=new Set([...o].filter(e=>!r.has(e)));if(s.size>0)throw new t(`Relayer entries for chain(s) [${[...s].join(`, `)}] have no matching entry in the chains array. Remove them or add the corresponding chain config.`);return a}var Y=class{#e;#t;#n;#r;constructor(e,n,r){if(e.length===0)throw new t(`At least one chain is required.`);this.#e=new Map(e.map(e=>[e.id,e])),this.#r=e[0].id;let i=J(e,n),a=new Map;for(let[e,t]of i){let n=t.relayer,r=a.get(n);r||(r=[],a.set(n,r)),r.push([e,t.chain])}let o=new Map,s=[];try{for(let[e,t]of a){let n=t.map(([,e])=>e),i=e.createWorker?.(n,r);i&&s.push(i);for(let[n,a]of t)o.set(n,e.createRelayer(a,i,r))}}catch(e){for(let e of s)try{e.terminate()}catch{}throw e}this.#t=o,this.#n=s}get chains(){return[...this.#e.values()]}get chain(){let e=this.#e.get(this.#r);return _(e,`RelayerDispatcher: chain`),e}switchChain(e){if(!this.#e.has(e))throw new t(`No relayer configured for chain ${e}. Add it to the chains array.`);this.#r=e}get#i(){let e=this.#t.get(this.#r);return _(e,`RelayerDispatcher: relayer`),e}generateTransportKeyPair(){return this.#i.generateTransportKeyPair()}createEIP712(e,t,n,r){return this.#i.createEIP712(e,t,n,r)}encrypt(e){return this.#i.encrypt(e)}userDecrypt(e){return this.#i.userDecrypt(e)}publicDecrypt(e){return this.#i.publicDecrypt(e)}createDelegatedUserDecryptEIP712(e,t,n,r,i){return this.#i.createDelegatedUserDecryptEIP712(e,t,n,r,i)}delegatedUserDecrypt(e){return this.#i.delegatedUserDecrypt(e)}requestZKProofVerification(e){return this.#i.requestZKProofVerification(e)}fetchFheEncryptionKeyBytes(){return this.#i.fetchFheEncryptionKeyBytes()}getPublicParams(e){return this.#i.getPublicParams(e)}getAclAddress(){return this.#i.getAclAddress()}terminate(){let e=[];for(let t of new Set(this.#t.values()))try{t.terminate()}catch(t){e.push(g(t))}for(let t of new Set(this.#n))try{t.terminate()}catch(t){e.push(g(t))}if(e.length>0)throw AggregateError(e,`Failed to terminate relayer resources`)}[Symbol.dispose](){this.terminate()}};const X={[S.id]:S.registryAddress,[y.id]:y.registryAddress,[v.id]:v.registryAddress,[x.id]:x.registryAddress,[b.id]:b.registryAddress},ve=E.record(E.string().check(E.regex(/^\d+$/,`expected numeric chain id key`)),M),Z=ae,Q=300*1e3;var ye=class{provider;#e;#t;#n=new Map;constructor(e){this.provider=e.provider,this.#e=Object.assign({},X,C(E.optional(ve),e.registryAddresses)),this.#t=C(Z,e.registryTTL??86400)*1e3}getAddress(e){return this.#e[e]}#r(e){let t=this.#n.get(e);if(t){if(Date.now()>=t.expiresAt){this.#n.delete(e);return}return t.data}}#i(e,t,n=this.#t){return this.#n.set(e,{data:t,expiresAt:Date.now()+n}),t}refresh(){this.#n.clear()}get ttlMs(){return this.#t}async getRegistryAddress(){let e=await this.provider.getChainId(),n=this.#e[e];if(!n)throw new t(`No wrappers registry address configured for chain ${e}.\nPass a registryAddresses entry for this chain.`);return w(n)}async listPairs(e={}){let n=e.page??1,r=e.pageSize??100,i=e.metadata??!1;if(n<1)throw new t(`page must be >= 1, got ${n}`);if(r<1)throw new t(`pageSize must be >= 1, got ${r}`);let o=await this.getRegistryAddress(),s=`total:${o}`,c=this.#r(s);if(c===void 0){let e=await this.provider.readContract(a(o));c=this.#i(s,Number(e))}let u=BigInt((n-1)*r),d=u+BigInt(r)>BigInt(c)?BigInt(c):u+BigInt(r);if(u>=BigInt(c))return{items:[],total:c,page:n,pageSize:r};let f=`slice:${o}:${u}:${d}`,p=this.#r(f);if(p===void 0){let e=await this.provider.readContract(l(o,u,d));p=this.#i(f,[...e])}if(!i)return{items:p,total:c,page:n,pageSize:r};let m=`metadata:${o}:${u}:${d}`,h=this.#r(m);if(h===void 0){let e=await Promise.allSettled(p.map(e=>this.#a(e))),t=e.some(e=>e.status===`rejected`),n=e.map((e,t)=>e.status===`fulfilled`?e.value:Object.assign({},p[t],{metadataFailed:!0,underlying:{name:`Unknown`,symbol:`???`,decimals:0,totalSupply:0n},confidential:{name:`Unknown`,symbol:`???`,decimals:0}}));h=this.#i(m,n,t?Q:void 0)}return{items:h,total:c,page:n,pageSize:r}}async#a(e){let[t,n,r,i,a,s,c]=await Promise.all([this.provider.readContract(o(e.tokenAddress)),this.provider.readContract(m(e.tokenAddress)),this.provider.readContract(p(e.tokenAddress)),this.provider.readContract(h(e.tokenAddress)),this.provider.readContract(o(e.confidentialTokenAddress)),this.provider.readContract(m(e.confidentialTokenAddress)),this.provider.readContract(p(e.confidentialTokenAddress))]);return{...e,underlying:{name:t,symbol:n,decimals:r,totalSupply:i},confidential:{name:a,symbol:s,decimals:c}}}async getConfidentialToken(e){let t=await this.getRegistryAddress(),n=w(e),r=`ct:${t}:${n}`,i=this.#r(r);if(i!==void 0)return i;let[a,o]=await this.provider.readContract(f(t,n));return o===T?this.#i(r,null,Q):this.#i(r,{confidentialTokenAddress:o,isValid:a})}async getUnderlyingToken(e){let t=await this.getRegistryAddress(),n=w(e),r=`ut:${t}:${n}`,i=this.#r(r);if(i!==void 0)return i;let[a,o]=await this.provider.readContract(c(t,n));return o===T?this.#i(r,null,Q):this.#i(r,{tokenAddress:o,isValid:a})}async getTokenPairs(){let e=await this.getRegistryAddress();return this.provider.readContract(s(e))}async getTokenPairsLength(){let e=await this.getRegistryAddress();return this.provider.readContract(a(e))}async getTokenPairsSlice(e,t){let n=await this.getRegistryAddress();return this.provider.readContract(l(n,e,t))}async getTokenPair(e){let t=await this.getRegistryAddress();return this.provider.readContract(u(t,e))}async getConfidentialTokenAddress(e){let t=await this.getRegistryAddress();return this.provider.readContract(f(t,w(e)))}async getTokenAddress(e){let t=await this.getRegistryAddress();return this.provider.readContract(c(t,w(e)))}async isConfidentialTokenValid(e){let t=await this.getRegistryAddress();return this.provider.readContract(d(t,w(e)))}};function be(e,t,n){let{storage:r,permitStorage:i}=q(n.storage,n.permitStorage),a=new ge(n.logger),o=new Y(n.chains,n.relayers,a);return{chains:n.chains,relayer:o,provider:t,signer:e,storage:r,permitStorage:i,transportKeyPairTTL:C(B,n.transportKeyPairTTL??2592e3),permitTTL:C(V,n.permitTTL??30),registryTTL:C(Z,n.registryTTL??86400),logger:a,onEvent:n.onEvent}}function xe(e,t){return e?.address===t?.address&&e?.chainId===t?.chainId}var $=class{#e=new Set;#t;#n;constructor(e){this.#t=e,this.#n=e!==void 0}getSnapshot(){return this.#t}isReady(){return this.#n}setSnapshot(e){this.#n=!0;let t=this.#t;xe(t,e)||(this.#t=e,this.#r({previous:t,next:e}))}subscribe(e){this.#e.add(e);let t=this.#t;return t&&e({previous:void 0,next:t}),()=>{this.#e.delete(e)}}#r(e){for(let t of this.#e)t(e)}};function Se(e){return new $(e)}var Ce=class{walletAccount;#e=!1;constructor(e){this.walletAccount=new $(e)}requireWalletAccount(e){let t=this.walletAccount.getSnapshot();if(!t)throw new i(e);return t}dispose(){this.#e||(this.#e=!0,this.onDispose())}[Symbol.dispose](){this.dispose()}onDispose(){}};export{X as a,q as c,M as d,j as f,be as i,he as l,$ as n,ye as o,Se as r,J as s,Ce as t,A as u};
|
|
2
|
+
//# sourceMappingURL=base-signer-DaRQNB29.js.map
|