@zama-fhe/sdk 3.2.0 → 3.3.0-alpha.10
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/assertions.cjs +1 -1
- package/dist/cjs/assertions.cjs.map +1 -1
- package/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/ethers/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/relayer-cleartext.cjs +1 -1
- package/dist/cjs/relayer-cleartext.cjs.map +1 -1
- package/dist/cjs/relayer-sdk.worker.js +134 -34
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/timeout.cjs +2 -0
- package/dist/cjs/timeout.cjs.map +1 -0
- 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/viem/index.cjs.map +1 -1
- package/dist/cjs/web/index.cjs +136 -36
- package/dist/cjs/web/index.cjs.map +1 -1
- package/dist/cjs/wrappers-registry.cjs +1 -1
- package/dist/cjs/wrappers-registry.cjs.map +1 -1
- package/dist/esm/assertions-zYseN5Xz.js +2 -0
- package/dist/esm/assertions-zYseN5Xz.js.map +1 -0
- package/dist/esm/{base-signer-ByGw5ReU.d.ts → base-signer-C3Wc5oi9.d.ts} +2 -2
- package/dist/esm/base-signer-DjytqPkd.js +2 -0
- package/dist/esm/base-signer-DjytqPkd.js.map +1 -0
- package/dist/esm/cleartext/index.d.ts +1 -1
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-DMW5nK1M.d.ts → cleartext-DAkOTlrE.d.ts} +2 -2
- package/dist/esm/{cleartext-CTla3A3O.js → cleartext-rTWFctyd.js} +2 -2
- package/dist/esm/{cleartext-CTla3A3O.js.map → cleartext-rTWFctyd.js.map} +1 -1
- package/dist/esm/{encryption-BGmINekJ.js → encryption-x4Z_Icqk.js} +2 -2
- package/dist/esm/{encryption-BGmINekJ.js.map → encryption-x4Z_Icqk.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +4 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/ethers/index.js.map +1 -1
- package/dist/esm/{hex-CxtyupeQ.js → hex-A72GrTf9.js} +2 -2
- package/dist/esm/{hex-CxtyupeQ.js.map → hex-A72GrTf9.js.map} +1 -1
- package/dist/esm/{index-DoVo9J1n.d.ts → index-C1Mtc8Rw.d.ts} +450 -163
- package/dist/esm/index.d.ts +17 -13
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +25 -7
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/node/relayer-sdk.node-worker.js +1 -1
- package/dist/esm/node/relayer-sdk.node-worker.js.map +1 -1
- package/dist/esm/query/index.d.ts +42 -4
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/relayer-cleartext-Bp6jtxDd.js +2 -0
- package/dist/esm/relayer-cleartext-Bp6jtxDd.js.map +1 -0
- package/dist/esm/{relayer-cleartext-DkKKjfI6.d.ts → relayer-cleartext-CSeMlmGO.d.ts} +102 -13
- package/dist/esm/relayer-eavK5bfZ.js +2 -0
- package/dist/esm/relayer-eavK5bfZ.js.map +1 -0
- package/dist/esm/relayer-sdk.worker.js +134 -34
- package/dist/esm/timeout-CNVfiaJD.js +2 -0
- package/dist/esm/timeout-CNVfiaJD.js.map +1 -0
- package/dist/esm/token-Bt33g0zQ.js +2 -0
- package/dist/esm/token-Bt33g0zQ.js.map +1 -0
- package/dist/esm/{types-BjDu-RZg.d.ts → types-Gn5MeDsr.d.ts} +14 -2
- package/dist/esm/{types-Xg_On_yY.d.ts → types-OHIaPwCy.d.ts} +2 -2
- package/dist/esm/{types-DiZhtG8i.d.ts → types-piBsdTIP.d.ts} +2 -2
- package/dist/esm/{validation-DHZ3JPOn.js → validation-DLszOweh.js} +2 -2
- package/dist/esm/{validation-DHZ3JPOn.js.map → validation-DLszOweh.js.map} +1 -1
- package/dist/esm/viem/index.d.ts +4 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/viem/index.js.map +1 -1
- package/dist/esm/web/index.d.ts +2 -2
- package/dist/esm/web/index.js +135 -35
- package/dist/esm/web/index.js.map +1 -1
- package/dist/esm/worker.base-client-BVnT4yJa.js +2 -0
- package/dist/esm/worker.base-client-BVnT4yJa.js.map +1 -0
- package/dist/esm/{wrappers-registry-BWWG0aze.js → wrappers-registry-C1oK8Bi6.js} +2 -2
- package/dist/esm/wrappers-registry-C1oK8Bi6.js.map +1 -0
- package/package.json +51 -51
- package/dist/esm/assertions-CnPIS0VN.js +0 -2
- package/dist/esm/assertions-CnPIS0VN.js.map +0 -1
- package/dist/esm/base-signer-BVqcM5jt.js +0 -2
- package/dist/esm/base-signer-BVqcM5jt.js.map +0 -1
- package/dist/esm/error-W1N-FGwV.js +0 -2
- package/dist/esm/error-W1N-FGwV.js.map +0 -1
- package/dist/esm/relayer-D-nicEYJ.js +0 -2
- package/dist/esm/relayer-D-nicEYJ.js.map +0 -1
- package/dist/esm/relayer-cleartext-DGcb5qtE.js +0 -2
- package/dist/esm/relayer-cleartext-DGcb5qtE.js.map +0 -1
- package/dist/esm/token-TQ-VFHS4.js +0 -2
- package/dist/esm/token-TQ-VFHS4.js.map +0 -1
- package/dist/esm/worker.base-client-x522sMBy.js +0 -2
- package/dist/esm/worker.base-client-x522sMBy.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,CAAO,EACnD,KAAK,KAAO,oBACd,CACF,EAMA,SAAgB,EAAiB,EAAgB,EAAwB,CACvE,IAAM,EACJ,OAAO,GAAU,YAAY,GAAkB,SAAU,GAAS,EAAM,OAAS,KAC7E,EAAc,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACnE,EAAW,EAAY,YAAY,EACnC,EACJ,EAAS,SAAS,eAAe,GAAK,EAAS,SAAS,aAAa,EACjE,EAAc,GAAG,EAAQ,IAAI,IAInC,MAHI,GAAe,EACX,IAAI,EAAqB,EAAa,CAAE,MAAO,CAAM,CAAC,EAExD,IAAI,EAAmB,EAAa,CAAE,MAAO,CAAM,CAAC,CAC5D,CC7BA,IAAa,E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N,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,K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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: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"acceptOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"blockUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialBalanceOf\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialProtocolId\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"contractURI\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"decimals\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint8\", internalType: \"uint8\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"discloseEncryptedAmount\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"cleartextAmount\", type: \"uint64\", internalType: \"uint64\" },\n { name: \"decryptionProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"finalizeUnwrap\",\n inputs: [\n { name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"unwrapAmountCleartext\", type: \"uint64\", internalType: \"uint64\" },\n { name: \"decryptionProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getUnderlyingDenyListSelector\",\n inputs: [],\n outputs: [\n { name: \"isSet\", type: \"bool\", internalType: \"bool\" },\n { name: \"selector\", type: \"bytes4\", internalType: \"bytes4\" },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"inferredTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"initialize\",\n inputs: [\n { name: \"name_\", type: \"string\", internalType: \"string\" },\n { name: \"symbol_\", type: \"string\", internalType: \"string\" },\n { name: \"contractURI_\", type: \"string\", internalType: \"string\" },\n { name: \"underlying_\", type: \"address\", internalType: \"contract IERC20\" },\n { name: \"owner_\", type: \"address\", internalType: \"address\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"isBlocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"isOperator\",\n inputs: [\n { name: \"holder\", type: \"address\", internalType: \"address\" },\n { name: \"spender\", type: \"address\", internalType: \"address\" },\n ],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"maxTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"name\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onTransferReceived\",\n inputs: [\n { name: \"operator\", type: \"address\", internalType: \"address\" },\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"proxiableUUID\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"rate\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"reinitializeV2\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"reinitializeV3\",\n inputs: [\n { name: \"blockedUsers\", type: \"address[]\", internalType: \"address[]\" },\n { name: \"underlyingDenyListSelector\", type: \"bytes4\", internalType: \"bytes4\" },\n { name: \"hasUnderlyingDenyListSelector_\", type: \"bool\", internalType: \"bool\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"renounceOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"requestDiscloseEncryptedAmount\",\n inputs: [{ name: \"encryptedAmount\", type: \"bytes32\", internalType: \"euint64\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setOperator\",\n inputs: [\n { name: \"operator\", type: \"address\", internalType: \"address\" },\n { name: \"until\", type: \"uint48\", internalType: \"uint48\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"symbol\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [{ name: \"newOwner\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unblockUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"underlying\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrapAmount\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrapRequester\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"upgradeToAndCall\",\n inputs: [\n { name: \"newImplementation\", type: \"address\", internalType: \"address\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"wrap\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"AmountDiscloseRequested\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n { name: \"requester\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"AmountDisclosed\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n { name: \"amount\", type: \"uint64\", indexed: false, internalType: \"uint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"ConfidentialTransfer\",\n inputs: [\n { name: \"from\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"to\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Initialized\",\n inputs: [{ name: \"version\", type: \"uint64\", indexed: false, internalType: \"uint64\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OperatorSet\",\n inputs: [\n { name: \"holder\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"operator\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"until\", type: \"uint48\", indexed: false, internalType: \"uint48\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n { name: \"previousOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"newOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n { name: \"previousOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"newOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PublicDecryptionVerified\",\n inputs: [\n { name: \"handlesList\", type: \"bytes32[]\", indexed: false, internalType: \"bytes32[]\" },\n { name: \"abiEncodedCleartexts\", type: \"bytes\", indexed: false, internalType: \"bytes\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapFinalized\",\n inputs: [\n { name: \"receiver\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"unwrapRequestId\", type: \"bytes32\", indexed: true, internalType: \"bytes32\" },\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n { name: \"cleartextAmount\", type: \"uint64\", indexed: false, internalType: \"uint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapRequested\",\n inputs: [\n { name: \"receiver\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"unwrapRequestId\", type: \"bytes32\", indexed: true, internalType: \"bytes32\" },\n { name: \"amount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Upgraded\",\n inputs: [{ name: \"implementation\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserBlocked\",\n inputs: [{ name: \"user\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserUnblocked\",\n inputs: [{ name: \"user\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Wrap\",\n inputs: [\n { name: \"to\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"roundedAmount\", type: \"uint256\", indexed: false, internalType: \"uint256\" },\n { name: \"encryptedWrappedAmount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AddressEmptyCode\",\n inputs: [{ name: \"target\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"BlockedUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC1967InvalidImplementation\",\n inputs: [{ name: \"implementation\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ERC1967NonPayable\", inputs: [] },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [{ name: \"receiver\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [{ name: \"receiver\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidSender\",\n inputs: [{ name: \"sender\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ERC7984TotalSupplyOverflow\", inputs: [] },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedCaller\",\n inputs: [{ name: \"caller\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedSpender\",\n inputs: [\n { name: \"holder\", type: \"address\", internalType: \"address\" },\n { name: \"spender\", type: \"address\", internalType: \"address\" },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedUseOfEncryptedAmount\",\n inputs: [\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"user\", type: \"address\", internalType: \"address\" },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984ZeroBalance\",\n inputs: [{ name: \"holder\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"FailedCall\", inputs: [] },\n { type: \"error\", name: \"InvalidInitialization\", inputs: [] },\n { type: \"error\", name: \"InvalidKMSSignatures\", inputs: [] },\n { type: \"error\", name: \"InvalidUnderlyingDenyListResponse\", inputs: [] },\n {\n type: \"error\",\n name: \"InvalidUnwrapRequest\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"NotInitializing\", inputs: [] },\n {\n type: \"error\",\n name: \"OwnableInvalidOwner\",\n inputs: [{ name: \"owner\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"OwnableUnauthorizedAccount\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SafeCastOverflowedUintDowncast\",\n inputs: [\n { name: \"bits\", type: \"uint8\", internalType: \"uint8\" },\n { name: \"value\", type: \"uint256\", internalType: \"uint256\" },\n ],\n },\n {\n type: \"error\",\n name: \"SafeERC20FailedOperation\",\n inputs: [{ name: \"token\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SenderNotAllowedToUseHandle\",\n inputs: [\n { name: \"handle\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"sender\", type: \"address\", internalType: \"address\" },\n ],\n },\n { type: \"error\", name: \"UUPSUnauthorizedCallContext\", inputs: [] },\n {\n type: \"error\",\n name: \"UUPSUnsupportedProxiableUUID\",\n inputs: [{ name: \"slot\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"UnderlyingDenyListCallFailed\", inputs: [] },\n {\n type: \"error\",\n name: \"UnderlyingDenyListedAddress\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"UserAlreadyBlocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"UserAlreadyUnblocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ZamaProtocolUnsupported\", inputs: [] },\n] as const;\n","import type { Address, Hex } from \"viem\";\nimport { confidentialWrapperAbi } from \"../abi/confidential-wrapper.abi\";\nimport type { EncryptedValue } from \"../relayer/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 { address: tokenAddress, abi: erc20Abi, functionName: \"name\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read a token's symbol.\n *\n * @example\n * ```ts\n * const symbol = await provider.readContract(symbolContract(tokenAddress));\n * ```\n */\nexport function symbolContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"symbol\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read a token's decimals.\n *\n * @example\n * ```ts\n * const decimals = await provider.readContract(decimalsContract(tokenAddress));\n * ```\n */\nexport function decimalsContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"decimals\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 token's total supply.\n *\n * @example\n * ```ts\n * const supply = await provider.readContract(erc20TotalSupplyContract(tokenAddress));\n * ```\n */\nexport function erc20TotalSupplyContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"totalSupply\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 balance.\n *\n * @example\n * ```ts\n * const balance = await provider.readContract(\n * balanceOfContract(tokenAddress, account),\n * );\n * ```\n */\nexport function balanceOfContract(tokenAddress: Address, account: Address) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [account],\n } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 allowance.\n *\n * @example\n * ```ts\n * const allowance = await provider.readContract(\n * allowanceContract(tokenAddress, owner, spender),\n * );\n * ```\n */\nexport function allowanceContract(tokenAddress: Address, owner: Address, spender: Address) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"allowance\",\n args: [owner, spender],\n } as const;\n}\n\n/**\n * Returns the contract config for an ERC-20 approve.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * approveContract(tokenAddress, spender, amount),\n * );\n * ```\n */\nexport function approveContract(tokenAddress: Address, spender: Address, value: bigint) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"approve\",\n args: [spender, value],\n } as const;\n}\n","// DO NOT EDIT: generated by `pnpm abi:build` from\n// contracts/out/IERC165.sol/IERC165.json.\n// Regenerate after `pnpm contracts:build`; `pnpm abi:check` enforces this in CI.\nexport const erc165Abi = [\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n] as const;\n","import type { Address } from \"viem\";\nimport { erc165Abi } from \"../abi/erc165.abi\";\n\n/** ERC-165 interface ID for IERC7984 (confidential fungible token). */\nexport const ERC7984_INTERFACE_ID = \"0x4958f2a4\" as const;\n\n/** ERC-165 interface ID for IERC7984ERC20Wrapper (confidential wrapper). */\nexport const ERC7984_WRAPPER_INTERFACE_ID = \"0x1f1c62b2\" as const;\n\n/** ERC-165 interface ID for ERC-1363 (payable token — `transferAndCall`). */\nexport const ERC1363_INTERFACE_ID = \"0xb0202a11\" as const;\n\n/**\n * Returns the contract config for an ERC-165 `supportsInterface` check.\n *\n * Use with {@link ERC7984_INTERFACE_ID} to detect confidential tokens,\n * or {@link ERC7984_WRAPPER_INTERFACE_ID} to detect wrappers.\n *\n * @example\n * ```ts\n * const isConfidential = await provider.readContract(\n * supportsInterfaceContract(tokenAddress, ERC7984_INTERFACE_ID),\n * );\n * ```\n */\nexport function supportsInterfaceContract(tokenAddress: Address, interfaceId: Address) {\n return {\n address: tokenAddress,\n abi: erc165Abi,\n functionName: \"supportsInterface\",\n args: [interfaceId],\n } as const;\n}\n\n/**\n * Returns contract config to check if a token implements IERC7984 (confidential fungible token).\n *\n * @example\n * ```ts\n * const isConfidential = await provider.readContract(\n * isConfidentialTokenContract(\"0xTokenAddress\"),\n * );\n * ```\n */\nexport function isConfidentialTokenContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC7984_INTERFACE_ID);\n}\n\n/**\n * Returns contract config to check if a token implements IERC7984ERC20Wrapper (confidential wrapper).\n *\n * @example\n * ```ts\n * const isWrapper = await provider.readContract(\n * isConfidentialWrapperContract(\"0xWrapperAddress\"),\n * );\n * ```\n */\nexport function isConfidentialWrapperContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC7984_WRAPPER_INTERFACE_ID);\n}\n\n/**\n * Returns contract config to check if a token implements ERC-1363 (payable token).\n *\n * @example\n * ```ts\n * const isPayable = await provider.readContract(\n * isPayableTokenContract(\"0xTokenAddress\"),\n * );\n * ```\n */\nexport function isPayableTokenContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC1363_INTERFACE_ID);\n}\n","import type { Address } from \"viem\";\n\nexport const wrappersRegistryAbi = [\n {\n inputs: [],\n name: \"getTokenConfidentialTokenPairs\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair[]\",\n name: \"\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getTokenConfidentialTokenPairsLength\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"fromIndex\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"toIndex\", type: \"uint256\" },\n ],\n name: \"getTokenConfidentialTokenPairsSlice\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair[]\",\n name: \"\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"index\", type: \"uint256\" }],\n name: \"getTokenConfidentialTokenPair\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n { internalType: \"bool\", name: \"isValid\", type: \"bool\" },\n ],\n internalType: \"struct ConfidentialTokenWrappersRegistry.TokenWrapperPair\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"tokenAddress\", type: \"address\" }],\n name: \"getConfidentialTokenAddress\",\n outputs: [\n { internalType: \"bool\", name: \"\", type: \"bool\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"getTokenAddress\",\n outputs: [\n { internalType: \"bool\", name: \"\", type: \"bool\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"isConfidentialTokenValid\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"initialOwner\", type: \"address\" }],\n name: \"initialize\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"tokenAddress\", type: \"address\" },\n { internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" },\n ],\n name: \"registerConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"confidentialTokenAddress\", type: \"address\" }],\n name: \"revokeConfidentialToken\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\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,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,KAAM,aACN,QAAS,CAAC,EACV,gBAAiB,aACjB,KAAM,UACR,EACA,CACE,OAAQ,CACN,CAAE,aAAc,UAAW,KAAM,eAAgB,KAAM,SAAU,EACjE,CAAE,aAAc,UAAW,KAAM,2BAA4B,KAAM,SAAU,CAC/E,EACA,KAAM,4BACN,QAAS,CAAC,EACV,gBAAiB,aACjB,KAAM,UACR,EACA,CACE,OAAQ,CAAC,CAAE,aAAc,UAAW,KAAM,2BAA4B,KAAM,SAAU,CAAC,EACvF,KAAM,0BACN,QAAS,CAAC,EACV,gBAAiB,aACjB,KAAM,UACR,CACF,EAyCA,SAAgB,EAAsB,EAAmB,CACvD,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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return e instanceof Error?e:typeof e==`object`&&e&&`message`in e?Error(String(e.message)):Error(String(e))}function t(e){if(!(e instanceof Error))return!1;if(e.name===`ContractFunctionExecutionError`||e.name===`ContractFunctionRevertedError`||`code`in e&&e.code===`CALL_EXCEPTION`)return!0;let t=e.message.toLowerCase();return t.includes(`execution reverted`)||t.includes(`call revert exception`)}const n=[`cause`,`error`,`info`];function r(e,t,i=6){if(i<0||typeof e!=`object`||!e)return;let a=e;if(t(a))return a;for(let e of n){let n=a[e];if(typeof n==`object`&&n){let e=r(n,t,i-1);if(e)return e}}}const i=[`code`,`status`,`statusCode`,`retryAfter`];function a(e){let t=e.info;if(typeof t==`object`&&t){let e=t.responseStatus;if(typeof e==`string`)return e}}function o(e,t){if(t.code===void 0&&(typeof e.code==`string`||typeof e.code==`number`)&&(t.code=e.code),t.status===void 0&&typeof e.status==`number`&&(t.status=e.status),t.statusCode===void 0&&typeof e.statusCode==`number`&&(t.statusCode=e.statusCode),t.responseStatus===void 0){let n=a(e);n!==void 0&&(t.responseStatus=n)}if(t.retryAfter===void 0)if(typeof e.retryAfter==`number`)t.retryAfter=e.retryAfter;else{let n=S(e);n!==void 0&&(t.retryAfter=n)}}function s(e,t){t.code===void 0&&e.code!==void 0&&(t.code=e.code),t.status===void 0&&e.status!==void 0&&(t.status=e.status),t.statusCode===void 0&&e.statusCode!==void 0&&(t.statusCode=e.statusCode),t.responseStatus===void 0&&e.responseStatus!==void 0&&(t.responseStatus=e.responseStatus),t.retryAfter===void 0&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter)}function c(t,r=6){let i=e(t),a=typeof t==`object`&&t?t:i,l={name:i.name,message:i.message};if(o(a,l),r>0)for(let e of n){let t=a[e];if(typeof t==`object`&&t){let e=c(t,r-1);l.cause===void 0&&(l.cause=e),s(e,l)}}return l}function l(e){let t=Error(e.message);e.name&&(t.name=e.name);for(let n of i){let r=e[n];r!==void 0&&(t[n]=r)}return e.responseStatus!==void 0&&(t.info={responseStatus:e.responseStatus}),e.cause&&(t.cause=l(e.cause)),t}function u(e){if(e.code===-32005||e.status===429||e.code===429)return!0;if(e.code===`SERVER_ERROR`&&typeof e.info==`object`&&e.info!==null){let t=e.info.responseStatus;if(typeof t==`string`&&/^\s*429\b/.test(t))return!0}return!1}function d(e){if(u(e))return!0;if(typeof e.message==`string`){let t=e.message.toLowerCase();return t.includes(`too many requests`)||t.includes(`rate limit`)||t.includes(`rate-limit`)}return!1}function f(e){return r(e,e=>e.code===`RELAYER_FETCH_ERROR`)!==void 0}function p(e){return f(e)?!1:r(e,d)!==void 0}function m(e){return f(e)?!1:r(e,u)!==void 0}function h(e){let t=e.code;if(t===`NETWORK_ERROR`||t===`SERVER_ERROR`||t===`TIMEOUT`)return!0;let n=e.name;return n===`HttpRequestError`||n===`RpcRequestError`||n===`TimeoutError`||n===`WebSocketRequestError`}function g(e){return f(e)?!1:m(e)?!0:r(e,h)!==void 0}function _(e){if(!(e instanceof Error)||g(e))return!1;if(r(e,e=>e.code===`RELAYER_FETCH_ERROR`&&(e.status===502||e.status===503||e.status===504)))return!0;let t=e.message.toLowerCase();return t.includes(`econnreset`)||t.includes(`econnrefused`)||t.includes(`socket hang up`)||t.includes(`fetch failed`)||t.includes(`network`)}function v(e){let t=e.toLowerCase();return t.includes(`user address`)&&t.includes(`is not authorized to user decrypt`)}function y(e){return/handle (0x[0-9a-fA-F]{64})/.exec(e)?.[1]}function b(e){if(e==null)return;let t=e.trim();if(t!==``){if(/^\d+$/.test(t))return Number(t);if(/[a-zA-Z]/.test(t)){let e=Date.parse(t);if(!Number.isNaN(e))return Math.max(0,Math.round((e-Date.now())/1e3))}}}function x(e){if(typeof e!=`object`||!e)return;let t=e.get;if(typeof t==`function`)return b(t.call(e,`Retry-After`))}function S(e){let t=e.response;if(typeof t==`object`&&t)return x(t.headers)}function C(e){return typeof e.retryAfter==`number`&&Number.isFinite(e.retryAfter)&&e.retryAfter>0?e.retryAfter:S(e)}function w(e){let t=r(e,e=>C(e)!==void 0);return t?C(t):void 0}function T(e){let t=r(e,e=>typeof e.statusCode==`number`||typeof e.status==`number`);if(t)return typeof t.statusCode==`number`?t.statusCode:t.status}function E(e,t){if(e==null)throw TypeError(`${t} must not be null or undefined`)}function D(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`${t} must be an object, got ${typeof e}`)}function O(e,t){if(typeof e!=`string`)throw TypeError(`${t} must be a string, got ${typeof e}`)}function k(e,t){if(typeof e!=`function`)throw TypeError(`${t} must be a function, got ${typeof e}`)}function A(e,t){if(typeof e!=`bigint`)throw TypeError(`${t} must be a bigint, got ${typeof e}`)}function j(e,t,n){O(e[t],n)}function M(e,t,n){k(e[t],n)}function N(e,t){if(!e)throw TypeError(t)}export{e as _,D as a,T as c,t as d,v as f,c as g,y as h,E as i,w as l,p as m,N as n,j as o,_ as p,M as r,l as s,A as t,m as u};
|
|
2
|
+
//# sourceMappingURL=assertions-zYseN5Xz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions-zYseN5Xz.js","names":[],"sources":["../../src/utils/error.ts","../../src/utils/assertions.ts"],"sourcesContent":["/** Coerce an unknown caught value to an Error instance. */\nexport function toError(error: unknown): Error {\n if (error instanceof Error) {\n return error;\n }\n if (typeof error === \"object\" && error !== null && \"message\" in error) {\n return new Error(String(error.message));\n }\n return new Error(String(error));\n}\n\n/**\n * Returns true if the error is a contract call revert (as opposed to a network/transport error).\n * Detects viem's ContractFunctionExecutionError / ContractFunctionRevertedError\n * and ethers' CALL_EXCEPTION.\n */\nexport function isContractCallError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n // viem: ContractFunctionExecutionError, ContractFunctionRevertedError\n if (\n error.name === \"ContractFunctionExecutionError\" ||\n error.name === \"ContractFunctionRevertedError\"\n ) {\n return true;\n }\n // ethers: error.code === \"CALL_EXCEPTION\"\n if (\"code\" in error && error.code === \"CALL_EXCEPTION\") {\n return true;\n }\n // Fallback: common revert message patterns from various providers\n const msg = error.message.toLowerCase();\n return msg.includes(\"execution reverted\") || msg.includes(\"call revert exception\");\n}\n\n/** JSON-RPC error code providers use for rate limiting (\"limit exceeded\"). */\nconst JSON_RPC_LIMIT_EXCEEDED = -32005;\n\n/** Properties that may nest a lower-level cause across viem / ethers / fetch. */\nconst NESTED_ERROR_KEYS = [\"cause\", \"error\", \"info\"] as const;\n\n/**\n * Walk an error and its nested causes (`cause` / `error` / `info`, as used by\n * viem, ethers, and fetch wrappers), applying `predicate` to each object node.\n * Returns the first node for which `predicate` returns true, or `undefined`.\n * Depth-bounded to avoid pathological / cyclic structures.\n */\nfunction findInErrorChain(\n error: unknown,\n predicate: (node: Record<string, unknown>) => boolean,\n depth = 6,\n): Record<string, unknown> | undefined {\n if (depth < 0 || error === null || error === undefined || typeof error !== \"object\") {\n return undefined;\n }\n const node = error as Record<string, unknown>;\n if (predicate(node)) {\n return node;\n }\n for (const key of NESTED_ERROR_KEYS) {\n const next = node[key];\n if (next !== undefined && next !== null && typeof next === \"object\") {\n const found = findInErrorChain(next, predicate, depth - 1);\n if (found) {\n return found;\n }\n }\n }\n return undefined;\n}\n\n// ============================================================================\n// Cross-thread serialization\n// ============================================================================\n\n/**\n * A plain, structured-clone-safe snapshot of an error and its cause chain.\n *\n * The worker boundary (`postMessage`) strips prototypes, `code`/`status`, and —\n * critically — the `cause` chain, leaving only the message. Decryption errors\n * are classified on the **main thread** ({@link wrapDecryptError}), so the worker\n * only needs to faithfully hand the error across the boundary, not understand it.\n * `serializeError` is that mechanical, taxonomy-agnostic envelope: it copies the\n * scalar signal fields the classifier keys on and flattens the nested cause chain\n * into a single `cause` link. {@link deserializeError} rebuilds an `Error` whose\n * `.cause` chain mirrors the original, so the existing chain-walking detectors\n * work on it unchanged.\n */\nexport interface SerializedError {\n name: string;\n message: string;\n /** e.g. JSON-RPC -32005, \"RELAYER_FETCH_ERROR\", ethers \"CALL_EXCEPTION\". */\n code?: string | number;\n /** viem-style HTTP status. */\n status?: number;\n /** relayer / node-fetch-style HTTP status. */\n statusCode?: number;\n /** Server-driven retry delay in **seconds** (numeric prop or parsed `Retry-After`). */\n retryAfter?: number;\n /**\n * ethers surfaces an HTTP status only as a string on `info.responseStatus`\n * (e.g. `\"429 Too Many Requests\"`), not as a numeric `status`. It lives on a\n * nested `info` object the flattening would otherwise skip, so it is lifted\n * onto the envelope and rebuilt onto `error.info.responseStatus`, letting the\n * ethers rate-limit detector classify a worker-origin 429 exactly as it would\n * the same error on the main thread.\n */\n responseStatus?: string;\n cause?: SerializedError;\n}\n\n/** Scalar signal fields carried verbatim across the boundary, in both directions. */\nconst SERIALIZED_SCALAR_KEYS = [\"code\", \"status\", \"statusCode\", \"retryAfter\"] as const;\n\n/**\n * ethers reports its HTTP status only as a string on `info.responseStatus`\n * (e.g. `\"429 Too Many Requests\"`). Read it directly off the node — not via the\n * cause-chain flattening, which descends a single branch — so it survives even\n * when the error also carries an `error` link that would be walked first.\n */\nfunction responseStatusFromNode(node: Record<string, unknown>): string | undefined {\n const info = node.info;\n if (info !== null && typeof info === \"object\") {\n const responseStatus = (info as Record<string, unknown>).responseStatus;\n if (typeof responseStatus === \"string\") {\n return responseStatus;\n }\n }\n return undefined;\n}\n\n/**\n * Copy the scalar signal fields the classifier keys on from a raw error node\n * onto the envelope, only where not already set — so a shallower node keeps\n * priority. Also lifts ethers' string `info.responseStatus` and the relayer's\n * `Retry-After` header (both destroyed by structured clone: the header lives on\n * a non-cloneable `Headers`, the status on a nested `info` the flattening skips).\n */\nfunction captureNodeSignals(node: Record<string, unknown>, into: SerializedError): void {\n if (into.code === undefined && (typeof node.code === \"string\" || typeof node.code === \"number\")) {\n into.code = node.code;\n }\n if (into.status === undefined && typeof node.status === \"number\") {\n into.status = node.status;\n }\n if (into.statusCode === undefined && typeof node.statusCode === \"number\") {\n into.statusCode = node.statusCode;\n }\n if (into.responseStatus === undefined) {\n const responseStatus = responseStatusFromNode(node);\n if (responseStatus !== undefined) {\n into.responseStatus = responseStatus;\n }\n }\n if (into.retryAfter === undefined) {\n if (typeof node.retryAfter === \"number\") {\n into.retryAfter = node.retryAfter;\n } else {\n const fromHeader = retryAfterFromHeader(node);\n if (fromHeader !== undefined) {\n into.retryAfter = fromHeader;\n }\n }\n }\n}\n\n/** Lift any still-missing scalar signal from an already-serialized child up. */\nfunction hoistMissingSignals(from: SerializedError, into: SerializedError): void {\n if (into.code === undefined && from.code !== undefined) {\n into.code = from.code;\n }\n if (into.status === undefined && from.status !== undefined) {\n into.status = from.status;\n }\n if (into.statusCode === undefined && from.statusCode !== undefined) {\n into.statusCode = from.statusCode;\n }\n if (into.responseStatus === undefined && from.responseStatus !== undefined) {\n into.responseStatus = from.responseStatus;\n }\n if (into.retryAfter === undefined && from.retryAfter !== undefined) {\n into.retryAfter = from.retryAfter;\n }\n}\n\n/**\n * Flatten an error (and its `cause` / `error` / `info` chain) into a\n * structured-clone-safe {@link SerializedError}. Depth-bounded to mirror\n * {@link findInErrorChain} and guard against cyclic structures.\n */\nexport function serializeError(error: unknown, depth = 6): SerializedError {\n const coerced = toError(error);\n const node =\n typeof error === \"object\" && error !== null\n ? (error as Record<string, unknown>)\n : (coerced as unknown as Record<string, unknown>);\n\n const serialized: SerializedError = { name: coerced.name, message: coerced.message };\n captureNodeSignals(node, serialized);\n\n if (depth > 0) {\n // Walk *every* nested link (`cause` / `error` / `info`), not just the first\n // present one: an error commonly carries several (ethers puts the underlying\n // fault on `error` and the HTTP status on `info`), and the signal-bearing\n // branch is not always the first. Keep the first as the representative\n // `.cause` for message/chain fidelity, and lift any still-missing scalar\n // signal off the others so none is dropped.\n for (const key of NESTED_ERROR_KEYS) {\n const next = node[key];\n if (next !== undefined && next !== null && typeof next === \"object\") {\n const child = serializeError(next, depth - 1);\n if (serialized.cause === undefined) {\n serialized.cause = child;\n }\n hoistMissingSignals(child, serialized);\n }\n }\n }\n\n return serialized;\n}\n\n/**\n * Rebuild a real {@link Error} from a {@link SerializedError}, re-attaching the\n * scalar signal fields and reconstructing the `.cause` chain so chain-walking\n * detectors ({@link findInErrorChain}, {@link extractHttpStatus},\n * {@link isRpcRateLimitError}) operate on it exactly as on the original.\n */\nexport function deserializeError(serialized: SerializedError): Error {\n const error = new Error(serialized.message) as Error & Record<string, unknown>;\n if (serialized.name) {\n error.name = serialized.name;\n }\n for (const key of SERIALIZED_SCALAR_KEYS) {\n const value = serialized[key];\n if (value !== undefined) {\n error[key] = value;\n }\n }\n // Rebuild ethers' `info.responseStatus` on the same node as its `code`, so the\n // ethers rate-limit detector (`code: \"SERVER_ERROR\"` + `info.responseStatus`)\n // matches the round-tripped error exactly as it would the original.\n if (serialized.responseStatus !== undefined) {\n error.info = { responseStatus: serialized.responseStatus };\n }\n if (serialized.cause) {\n error.cause = deserializeError(serialized.cause);\n }\n return error;\n}\n\n// ============================================================================\n// Classification detectors (main-thread)\n// ============================================================================\n\n/**\n * Structured (unambiguous) consumer rate-limit signal across the RPC providers\n * the SDK reads through:\n * - JSON-RPC `-32005` (\"limit exceeded\");\n * - viem-style numeric `status: 429`, and viem's own `shouldRetry` shape where\n * the JSON-RPC error `code` is `429`;\n * - ethers' 429, which surfaces as `code: \"SERVER_ERROR\"` with the status only\n * in `info.responseStatus` (a string like `\"429 Too Many Requests\"`) and no\n * numeric top-level status — the leading code is parsed out of it.\n *\n * Deliberately NOT `statusCode: 429` — that is the relayer / node-fetch HTTP\n * shape, which stays {@link RelayerRequestFailedError} (SDK-236), so a relayer\n * 429 is never mistaken for a consumer-RPC throttle.\n */\nfunction nodeHasStructuredRateLimit(node: Record<string, unknown>): boolean {\n if (node.code === JSON_RPC_LIMIT_EXCEEDED || node.status === 429 || node.code === 429) {\n return true;\n }\n // ethers: `code: \"SERVER_ERROR\"`, status lives in `info.responseStatus`.\n if (node.code === \"SERVER_ERROR\" && typeof node.info === \"object\" && node.info !== null) {\n const responseStatus = (node.info as Record<string, unknown>).responseStatus;\n if (typeof responseStatus === \"string\" && /^\\s*429\\b/.test(responseStatus)) {\n return true;\n }\n }\n return false;\n}\n\nfunction nodeIsRpcRateLimit(node: Record<string, unknown>): boolean {\n if (nodeHasStructuredRateLimit(node)) {\n return true;\n }\n // Message fallback for providers without a structured code. Deliberately\n // narrow (specific throttling phrases, no bare \"429\") to avoid false positives\n // that would turn a terminal error into a retryable one.\n if (typeof node.message === \"string\") {\n const msg = node.message.toLowerCase();\n return (\n msg.includes(\"too many requests\") || msg.includes(\"rate limit\") || msg.includes(\"rate-limit\")\n );\n }\n return false;\n}\n\n/**\n * The relayer SDK tags its HTTP errors with `code: \"RELAYER_FETCH_ERROR\"`. These\n * stay the relayer's domain ({@link RelayerRequestFailedError} / SDK-236), never\n * {@link RpcRateLimitError}, even on a 429.\n */\nfunction isRelayerFetchError(error: unknown): boolean {\n return findInErrorChain(error, (node) => node.code === \"RELAYER_FETCH_ERROR\") !== undefined;\n}\n\n/**\n * True if the error is the consumer's RPC provider throttling an on-chain read\n * (HTTP 429 / JSON-RPC -32005). Relayer-originated 429s are excluded.\n */\nexport function isRpcRateLimitError(error: unknown): boolean {\n if (isRelayerFetchError(error)) {\n return false;\n }\n return findInErrorChain(error, nodeIsRpcRateLimit) !== undefined;\n}\n\n/**\n * Like {@link isRpcRateLimitError} but only matches an unambiguous **structured**\n * signal (`-32005` or a viem `status: 429`), ignoring message text. The classifier\n * promotes this ahead of any HTTP status, while a message-only throttle is only\n * trusted when no status is present — so a relayer HTTP error whose body happens\n * to say \"rate limit\" still maps to {@link RelayerRequestFailedError}.\n */\nexport function hasStructuredRpcRateLimitSignal(error: unknown): boolean {\n if (isRelayerFetchError(error)) {\n return false;\n }\n return findInErrorChain(error, nodeHasStructuredRateLimit) !== undefined;\n}\n\n/**\n * Transport-error signatures of the consumer's own RPC client (viem / ethers).\n * The worker's on-chain reads (the ACL `persistAllowed` pre-check) go through\n * that client, which already retries transport faults internally — so a failure\n * carrying one of these shapes must NOT be retried again by the SDK on top.\n */\nfunction nodeHasConsumerRpcSignature(node: Record<string, unknown>): boolean {\n // ethers transient transport codes.\n const code = node.code;\n if (code === \"NETWORK_ERROR\" || code === \"SERVER_ERROR\" || code === \"TIMEOUT\") {\n return true;\n }\n // viem transport error classes (the `name` survives the worker boundary).\n const name = node.name;\n return (\n name === \"HttpRequestError\" ||\n name === \"RpcRequestError\" ||\n name === \"TimeoutError\" ||\n name === \"WebSocketRequestError\"\n );\n}\n\n/**\n * True when a failure originates from the **consumer's RPC provider** (viem /\n * ethers) rather than the relayer. Keeps the SDK's relayer retry from\n * double-retrying transport faults the integrator's client already retried.\n * A relayer HTTP error (`RELAYER_FETCH_ERROR`) is never consumer-RPC.\n */\nexport function isConsumerRpcError(error: unknown): boolean {\n if (isRelayerFetchError(error)) {\n return false;\n }\n if (hasStructuredRpcRateLimitSignal(error)) {\n return true;\n }\n return findInErrorChain(error, nodeHasConsumerRpcSignature) !== undefined;\n}\n\n/**\n * True only for transient faults attributable to the **relayer transport** — the\n * one network actor the SDK owns retries for, since viem/ethers don't model the\n * relayer. This is the single gate for {@link withRetry}.\n *\n * Two-tier retry model:\n * - **Relayer transport** (here): a relayer HTTP 502/503/504 — tagged\n * `RELAYER_FETCH_ERROR` with a gateway status — or a relayer-boundary network\n * failure (the relayer SDK uses bare `fetch`, so a transport error with no\n * viem/ethers signature is the relayer connection itself). Retried.\n * - **Consumer RPC** ({@link isConsumerRpcError}): deferred to viem/ethers, never\n * retried here. Timeouts are owned by viem/ethers and the worker-level\n * operation timeout (SDK-237), so they are not auto-retried at this layer.\n *\n * Relayer back-pressure (HTTP 429) is deliberately excluded: it is surfaced to\n * the caller as a retryable {@link RelayerRequestFailedError} with `retryAfter`,\n * not silently retried.\n */\nexport function isRetryableRelayerError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n if (isConsumerRpcError(error)) {\n return false;\n }\n // Relayer HTTP gateway transients (502/503/504), tagged by the relayer SDK.\n const relayerGatewayError = findInErrorChain(\n error,\n (n) =>\n n.code === \"RELAYER_FETCH_ERROR\" &&\n (n.status === 502 || n.status === 503 || n.status === 504),\n );\n if (relayerGatewayError) {\n return true;\n }\n // Relayer-boundary transport failure (no consumer-RPC signature above).\n const msg = error.message.toLowerCase();\n return (\n msg.includes(\"econnreset\") ||\n msg.includes(\"econnrefused\") ||\n msg.includes(\"socket hang up\") ||\n msg.includes(\"fetch failed\") ||\n msg.includes(\"network\")\n );\n}\n\n/**\n * The relayer SDK's ACL gate (`validateAclPermissions`) throws a message-only\n * Error when the actor isn't allowed: `User address <a> is not authorized to\n * user decrypt handle <h>!`. Matching it here, once, against the pinned\n * `@zama-fhe/relayer-sdk`, is what lets {@link wrapDecryptError} surface a typed\n * NotEntitledError (the \"dapp contract … is not authorized\" variant is a dapp\n * misconfig and is intentionally left to DecryptionFailedError).\n *\n * This is a deliberate bridge, not a destination: `@zama-fhe/relayer-sdk` ships\n * a typed `ACLUserDecryptionError`, but its active `userDecrypt` path still\n * throws a plain Error. TODO(SDK-239 follow-up): once the relayer surfaces the\n * typed/coded ACL error from that path, key off the code instead of the message\n * and drop this matcher. The `error.test.ts` guard reads the installed relayer\n * source and fails loudly if the message drifts before then.\n */\nexport function isNotEntitledMessage(message: string): boolean {\n const m = message.toLowerCase();\n return m.includes(\"user address\") && m.includes(\"is not authorized to user decrypt\");\n}\n\n/** Parse the on-chain handle out of the relayer's not-entitled message. */\nexport function parseHandleFromMessage(message: string): string | undefined {\n return /handle (0x[0-9a-fA-F]{64})/.exec(message)?.[1];\n}\n\n/**\n * Parse an HTTP `Retry-After` header value into **seconds** (the SDK's duration\n * unit and the header's own unit), or `undefined` when absent/unparseable. Per\n * RFC 9110 the value is either a non-negative number of seconds (`\"120\"`) or an\n * HTTP-date; a past date floors to `0`.\n */\nexport function parseRetryAfterHeader(value: string | null | undefined): number | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const trimmed = value.trim();\n if (trimmed === \"\") {\n return undefined;\n }\n // delta-seconds: a non-negative integer (already the unit we want).\n if (/^\\d+$/.test(trimmed)) {\n return Number(trimmed);\n }\n // HTTP-date — an IMF-fixdate always carries alphabetic day/month names, so\n // require a letter before deferring to the lenient Date.parse.\n if (/[a-zA-Z]/.test(trimmed)) {\n const dateMs = Date.parse(trimmed);\n if (!Number.isNaN(dateMs)) {\n return Math.max(0, Math.round((dateMs - Date.now()) / 1000));\n }\n }\n return undefined;\n}\n\n/** Read a `Retry-After` header (→ seconds) off a `Headers`-like object, if present. */\nfunction readRetryAfterHeader(headers: unknown): number | undefined {\n if (headers === null || typeof headers !== \"object\") {\n return undefined;\n }\n const get = (headers as { get?: unknown }).get;\n if (typeof get !== \"function\") {\n return undefined;\n }\n return parseRetryAfterHeader(\n (get as (name: string) => string | null).call(headers, \"Retry-After\"),\n );\n}\n\n/**\n * A node's **relayer** `Retry-After` header (seconds), read from a wrapped fetch\n * `Response` (the relayer SDK's `cause.response.headers`). The SDK owns the\n * relayer fetch, so parsing the header there is legitimate.\n *\n * The viem/chain side (`HttpRequestError.headers`) is deliberately **not** read:\n * for consumer RPC the integrator's viem/ethers transport already honors\n * `Retry-After` in its own retry loop (and retries) before the error ever\n * surfaces, so re-reading it here would re-implement a transport concern.\n * Chain-RPC backoff is configured on the consumer's transport (`chain.network`).\n */\nfunction retryAfterFromHeader(node: Record<string, unknown>): number | undefined {\n const response = node.response;\n if (response !== null && typeof response === \"object\") {\n return readRetryAfterHeader((response as Record<string, unknown>).headers);\n }\n return undefined;\n}\n\n/**\n * A single node's server-driven retry delay (seconds): a numeric `retryAfter`\n * (a non-positive synthetic value is ignored), else a `Retry-After` header.\n */\nfunction retryAfterFromNode(node: Record<string, unknown>): number | undefined {\n if (\n typeof node.retryAfter === \"number\" &&\n Number.isFinite(node.retryAfter) &&\n node.retryAfter > 0\n ) {\n return node.retryAfter;\n }\n return retryAfterFromHeader(node);\n}\n\n/**\n * Best-effort extraction of a server-driven retry delay, in **seconds**, from\n * anywhere in an error's cause chain. Reads a numeric `retryAfter` property and\n * the **relayer's** `Retry-After` header (`cause.response.headers`). The\n * consumer-RPC/chain side is intentionally not read — viem/ethers own that\n * backoff (see {@link retryAfterFromHeader}). `undefined` when absent.\n */\nexport function extractRetryAfter(error: unknown): number | undefined {\n const node = findInErrorChain(error, (n) => retryAfterFromNode(n) !== undefined);\n return node ? retryAfterFromNode(node) : undefined;\n}\n\n/**\n * Extract an HTTP status code from an error or anywhere in its cause chain.\n * Relayer SDK errors may carry a `status` or `statusCode` property; walking the\n * full chain (rather than just depth-1) keeps this in step with the other\n * chain-walking detectors and avoids a depth asymmetry between them.\n */\nexport function extractHttpStatus(error: unknown): number | undefined {\n const node = findInErrorChain(\n error,\n (n) => typeof n.statusCode === \"number\" || typeof n.status === \"number\",\n );\n if (!node) {\n return undefined;\n }\n return (typeof node.statusCode === \"number\" ? node.statusCode : node.status) as number;\n}\n","export function assertNonNullable<T>(value: T, context: string): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new TypeError(`${context} must not be null or undefined`);\n }\n}\n\nexport function assertObject(\n value: unknown,\n context: string,\n): asserts value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new TypeError(`${context} must be an object, got ${typeof value}`);\n }\n}\n\nexport function assertString(value: unknown, context: string): asserts value is string {\n if (typeof value !== \"string\") {\n throw new TypeError(`${context} must be a string, got ${typeof value}`);\n }\n}\n\nexport function assertArray(value: unknown, context: string): asserts value is unknown[] {\n if (!Array.isArray(value)) {\n throw new TypeError(`${context} must be an array, got ${typeof value}`);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport function assertFunction(value: unknown, context: string): asserts value is Function {\n if (typeof value !== \"function\") {\n throw new TypeError(`${context} must be a function, got ${typeof value}`);\n }\n}\n\nexport function assertBigint(value: unknown, context: string): asserts value is bigint {\n if (typeof value !== \"bigint\") {\n throw new TypeError(`${context} must be a bigint, got ${typeof value}`);\n }\n}\n\n/** Assert that `obj[key]` is a string. Narrows `obj` to include `{ [key]: string }`. */\nexport function assertStringProp<\n K extends string,\n O extends Record<string, unknown> = Record<string, unknown>,\n>(obj: O, key: K, context: string): asserts obj is O & Record<K, string> {\n assertString(obj[key], context);\n}\n\n/** Assert that `obj[key]` is a function. Narrows `obj` to include `{ [key]: F }`. */\nexport function assertFunctionProp<\n K extends string,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n F extends Function,\n O extends Record<string, unknown> = Record<string, unknown>,\n>(obj: O, key: K, context: string): asserts obj is O & Record<K, F> {\n assertFunction(obj[key], context);\n}\n\nexport function assertCondition(condition: boolean, message: string): asserts condition {\n if (!condition) {\n throw new TypeError(message);\n }\n}\n"],"mappings":"AACA,SAAgB,EAAQ,EAAuB,CAO7C,OANI,aAAiB,MACZ,EAEL,OAAO,GAAU,UAAY,GAAkB,YAAa,EACnD,MAAM,OAAO,EAAM,OAAO,CAAC,EAE7B,MAAM,OAAO,CAAK,CAAC,CAChC,CAOA,SAAgB,EAAoB,EAAyB,CAC3D,GAAI,EAAE,aAAiB,OACrB,MAAO,GAUT,GANE,EAAM,OAAS,kCACf,EAAM,OAAS,iCAKb,SAAU,GAAS,EAAM,OAAS,iBACpC,MAAO,GAGT,IAAM,EAAM,EAAM,QAAQ,YAAY,EACtC,OAAO,EAAI,SAAS,oBAAoB,GAAK,EAAI,SAAS,uBAAuB,CACnF,CAGA,MAGM,EAAoB,CAAC,QAAS,QAAS,MAAM,EAQnD,SAAS,EACP,EACA,EACA,EAAQ,EAC6B,CACrC,GAAI,EAAQ,GAA8C,OAAO,GAAU,WAA1D,EACf,OAEF,IAAM,EAAO,EACb,GAAI,EAAU,CAAI,EAChB,OAAO,EAET,IAAK,IAAM,KAAO,EAAmB,CACnC,IAAM,EAAO,EAAK,GAClB,GAA2C,OAAO,GAAS,UAAvD,EAAiE,CACnE,IAAM,EAAQ,EAAiB,EAAM,EAAW,EAAQ,CAAC,EACzD,GAAI,EACF,OAAO,CAEX,CACF,CAEF,CA2CA,MAAM,EAAyB,CAAC,OAAQ,SAAU,aAAc,YAAY,EAQ5E,SAAS,EAAuB,EAAmD,CACjF,IAAM,EAAO,EAAK,KAClB,GAAqB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ACpE,MAAU,UAAU,GAAG,EAAQ,0BAA0B,OAAO,GAAO,CAE3E,CAEA,SAAgB,EAAa,EAAgB,EAA0C,CACrF,GAAI,OAAO,GAAU,SACnB,MAAU,UAAU,GAAG,EAAQ,yBAAyB,OAAO,GAAO,CAE1E,CASA,SAAgB,EAAe,EAAgB,EAA4C,CACzF,GAAI,OAAO,GAAU,WACnB,MAAU,UAAU,GAAG,EAAQ,2BAA2B,OAAO,GAAO,CAE5E,CAEA,SAAgB,EAAa,EAAgB,EAA0C,CACrF,GAAI,OAAO,GAAU,SACnB,MAAU,UAAU,GAAG,EAAQ,yBAAyB,OAAO,GAAO,CAE1E,CAGA,SAAgB,EAGd,EAAQ,EAAQ,EAAuD,CACvE,EAAa,EAAI,GAAM,CAAO,CAChC,CAGA,SAAgB,EAKd,EAAQ,EAAQ,EAAkD,CAClE,EAAe,EAAI,GAAM,CAAO,CAClC,CAEA,SAAgB,EAAgB,EAAoB,EAAoC,CACtF,GAAI,CAAC,EACH,MAAU,UAAU,CAAO,CAE/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as GenericSigner, I as WalletAccount, J as WriteContractArgs, R as WalletAccountListener, U as ContractAbi, X as WriteFunctionName, Y as WriteContractConfig, l as EIP712TypedData, z as WalletAccountStore } from "./relayer-cleartext-CSeMlmGO.js";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/signer/wallet-account-store.d.ts
|
|
@@ -60,4 +60,4 @@ declare abstract class BaseSigner implements GenericSigner, Disposable {
|
|
|
60
60
|
}
|
|
61
61
|
//#endregion
|
|
62
62
|
export { MutableWalletAccountStore as n, createWalletAccountStore as r, BaseSigner as t };
|
|
63
|
-
//# sourceMappingURL=base-signer-
|
|
63
|
+
//# sourceMappingURL=base-signer-C3Wc5oi9.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,t}from"./relayer-eavK5bfZ.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-C1oK8Bi6.js";import{_ as g,i as _}from"./assertions-zYseN5Xz.js";import{t as ee}from"./indexeddb-storage-Mi-fCWN3.js";import{t as te}from"./memory-storage-fp9RY5BQ.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-DLszOweh.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-DjytqPkd.js.map
|