@zama-fhe/sdk 3.7.0 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/chains/index.cjs +1 -1
- package/dist/cjs/chains.cjs +1 -1
- package/dist/cjs/chains.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/telemetry.cjs +1 -1
- package/dist/esm/{base-signer-46j6PRq-.d.ts → base-signer-BxIDBDTF.d.ts} +2 -2
- package/dist/esm/base-signer-ClrhHzbm.js +2 -0
- package/dist/esm/{base-signer-b1ff2VPI.js.map → base-signer-ClrhHzbm.js.map} +1 -1
- package/dist/esm/chains/index.d.ts +2 -2
- package/dist/esm/chains/index.js +1 -1
- package/dist/esm/{chains-iPpnjXql.js → chains-BwlDI944.js} +2 -2
- package/dist/esm/chains-BwlDI944.js.map +1 -0
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-DInZ0vz-.d.ts → cleartext-BnTAN4-g.d.ts} +2 -2
- package/dist/esm/{cleartext-CiE1gO7Y.js → cleartext-Ck0gNKy1.js} +2 -2
- package/dist/esm/{cleartext-CiE1gO7Y.js.map → cleartext-Ck0gNKy1.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +4 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/{fhevm-relayer-DXLb4mIw.js → fhevm-relayer-DnAUqf3b.js} +2 -2
- package/dist/esm/{fhevm-relayer-DXLb4mIw.js.map → fhevm-relayer-DnAUqf3b.js.map} +1 -1
- package/dist/esm/{index-BKMce5ya.d.ts → index-BlY7CCPB.d.ts} +7 -7
- package/dist/esm/{index-CpQK8U4F.d.ts → index-CD2sMpst.d.ts} +2 -2
- package/dist/esm/{index-Cdbp_93f.d.ts → index-D1Wtji3m.d.ts} +4 -26
- package/dist/esm/{index-C1clixw5.d.ts → index-fsWBYM8S.d.ts} +4 -4
- package/dist/esm/index.d.ts +9 -9
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +5 -5
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +6 -6
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/{telemetry-Dll0Swdj.js → telemetry-IaHYnoo4.js} +2 -2
- package/dist/esm/{telemetry-Dll0Swdj.js.map → telemetry-IaHYnoo4.js.map} +1 -1
- package/dist/esm/{types-Bz42Emet.d.ts → types-C2ccCjoA.d.ts} +3 -3
- package/dist/esm/{types-BIgPY1yI.d.ts → types-CHepK8MK.d.ts} +2 -2
- package/dist/esm/{types-I9lJwH20.d.ts → types-Dc1fpXWt.d.ts} +3 -3
- package/dist/esm/vaults/index.d.ts +2 -2
- package/dist/esm/vaults/index.js +1 -1
- package/dist/esm/viem/index.d.ts +4 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/web/index.d.ts +1 -1
- package/dist/esm/web/index.js +1 -1
- package/package.json +1 -1
- package/dist/esm/base-signer-b1ff2VPI.js +0 -2
- package/dist/esm/chains-iPpnjXql.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as hoodi, c as
|
|
2
|
-
export { type AtLeastOneChain, type FheChain, type FheChainAuth, anvil, bscTestnet, chains, hardhat, hoodi,
|
|
1
|
+
import { a as hoodi, c as polygonAmoy, d as AtLeastOneChain, f as FheChain, i as hardhat, l as sepolia, n as bscTestnet, o as mainnet, p as FheChainAuth, r as chains, s as polygon, t as anvil, u as zenithTrexTestnet } from "../index-D1Wtji3m.js";
|
|
2
|
+
export { type AtLeastOneChain, type FheChain, type FheChainAuth, anvil, bscTestnet, chains, hardhat, hoodi, mainnet, polygon, polygonAmoy, sepolia, zenithTrexTestnet };
|
package/dist/esm/chains/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"../chains-BwlDI944.js";export{c as anvil,i as bscTestnet,o as chains,n as hardhat,e as hoodi,a as mainnet,s as polygon,t as polygonAmoy,r as sepolia,l as zenithTrexTestnet};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={id:1,gatewayChainId:261131,relayerUrl:`https://relayer.mainnet.zama.org`,network:`https://ethereum-rpc.publicnode.com`,aclContractAddress:`0xcA2E8f1F656CD25C01F05d0b243Ab1ecd4a8ffb6`,kmsContractAddress:`0x77627828a55156b04Ac0DC0eb30467f1a552BB03`,inputVerifierContractAddress:`0xCe0FC2e05CFff1B719EFF7169f7D80Af770c8EA2`,verifyingContractAddressDecryption:`0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24`,verifyingContractAddressInputVerification:`0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287`,registryAddress:`0xeb5015fF021DB115aCe010f23F55C2591059bBA0`},t={id:137,gatewayChainId:261131,relayerUrl:`https://relayer.mainnet.zama.org`,network:`https://polygon-bor-rpc.publicnode.com`,aclContractAddress:`0x6737F17e31cf26a1b62fb0362acC5a16CB156F49`,kmsContractAddress:`0x14e609595474874Dd6b6128376E336EfADfdBE37`,inputVerifierContractAddress:`0xf40BD204B035522EaAc8E5afAdc55113Acac96ca`,verifyingContractAddressDecryption:`0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24`,verifyingContractAddressInputVerification:`0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287`,registryAddress:`0xc8908569868758dAF814B5a8b96bBc44D1653d54`},n={id:11155111,gatewayChainId:10901,relayerUrl:`https://relayer.testnet.zama.org`,network:`https://ethereum-sepolia-rpc.publicnode.com`,aclContractAddress:`0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D`,kmsContractAddress:`0xbE0E383937d564D7FF0BC3b46c51f0bF8d5C311A`,inputVerifierContractAddress:`0xBBC1fFCdc7C316aAAd72E807D9b0272BE8F84DA0`,verifyingContractAddressDecryption:`0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478`,verifyingContractAddressInputVerification:`0x483b9dE06E4E4C7D35CCf5837A1668487406D955`,registryAddress:`0x2f0750Bbb0A246059d80e94c454586a7F27a128e`},r={id:80002,gatewayChainId:10901,relayerUrl:`https://relayer.testnet.zama.org`,network:`https://polygon-amoy-bor-rpc.publicnode.com`,aclContractAddress:`0xD99Cb9Fc3c42c87f2A4A12e8Fd60318d6bDdf985`,kmsContractAddress:`0xCD1D89E311bce4C8DEa9a0857a0c9A4E153D4041`,inputVerifierContractAddress:`0x6e5A7D8b0c645467Cba7e62D6624917085118631`,verifyingContractAddressDecryption:`0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478`,verifyingContractAddressInputVerification:`0x483b9dE06E4E4C7D35CCf5837A1668487406D955`,registryAddress:`0xF486c3D4F4562760A43883e72E8D6f6Cf2EFdA94`},i={id:560048,gatewayChainId:10901,relayerUrl:``,network:`https://rpc.hoodi.ethpandaops.io`,aclContractAddress:`0x6D3FAf6f86e1fF9F3B0831Dda920AbA1cBd5bd68`,kmsContractAddress:`0x822BE20679CfAfdc352F05dEdfe12a07E912212e`,inputVerifierContractAddress:`0xf3D9A51f32D9bC23E1eECb0fAbF1f1DA4d9Bba26`,verifyingContractAddressDecryption:`0x5ffdaAB0373E62E2ea2944776209aEf29E631A64`,verifyingContractAddressInputVerification:`0x812b06e1CDCE800494b79fFE4f925A504a9A9810`,registryAddress:`0x1807aE2f693F8530DFB126D0eF98F2F2518F292f`,executorAddress:`0xC316692627de536368d82e9121F1D44a550894E6`},a={id:
|
|
2
|
-
//# sourceMappingURL=chains-
|
|
1
|
+
const e={id:1,gatewayChainId:261131,relayerUrl:`https://relayer.mainnet.zama.org`,network:`https://ethereum-rpc.publicnode.com`,aclContractAddress:`0xcA2E8f1F656CD25C01F05d0b243Ab1ecd4a8ffb6`,kmsContractAddress:`0x77627828a55156b04Ac0DC0eb30467f1a552BB03`,inputVerifierContractAddress:`0xCe0FC2e05CFff1B719EFF7169f7D80Af770c8EA2`,verifyingContractAddressDecryption:`0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24`,verifyingContractAddressInputVerification:`0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287`,registryAddress:`0xeb5015fF021DB115aCe010f23F55C2591059bBA0`},t={id:137,gatewayChainId:261131,relayerUrl:`https://relayer.mainnet.zama.org`,network:`https://polygon-bor-rpc.publicnode.com`,aclContractAddress:`0x6737F17e31cf26a1b62fb0362acC5a16CB156F49`,kmsContractAddress:`0x14e609595474874Dd6b6128376E336EfADfdBE37`,inputVerifierContractAddress:`0xf40BD204B035522EaAc8E5afAdc55113Acac96ca`,verifyingContractAddressDecryption:`0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24`,verifyingContractAddressInputVerification:`0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287`,registryAddress:`0xc8908569868758dAF814B5a8b96bBc44D1653d54`},n={id:11155111,gatewayChainId:10901,relayerUrl:`https://relayer.testnet.zama.org`,network:`https://ethereum-sepolia-rpc.publicnode.com`,aclContractAddress:`0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D`,kmsContractAddress:`0xbE0E383937d564D7FF0BC3b46c51f0bF8d5C311A`,inputVerifierContractAddress:`0xBBC1fFCdc7C316aAAd72E807D9b0272BE8F84DA0`,verifyingContractAddressDecryption:`0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478`,verifyingContractAddressInputVerification:`0x483b9dE06E4E4C7D35CCf5837A1668487406D955`,registryAddress:`0x2f0750Bbb0A246059d80e94c454586a7F27a128e`},r={id:80002,gatewayChainId:10901,relayerUrl:`https://relayer.testnet.zama.org`,network:`https://polygon-amoy-bor-rpc.publicnode.com`,aclContractAddress:`0xD99Cb9Fc3c42c87f2A4A12e8Fd60318d6bDdf985`,kmsContractAddress:`0xCD1D89E311bce4C8DEa9a0857a0c9A4E153D4041`,inputVerifierContractAddress:`0x6e5A7D8b0c645467Cba7e62D6624917085118631`,verifyingContractAddressDecryption:`0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478`,verifyingContractAddressInputVerification:`0x483b9dE06E4E4C7D35CCf5837A1668487406D955`,registryAddress:`0xF486c3D4F4562760A43883e72E8D6f6Cf2EFdA94`},i={id:560048,gatewayChainId:10901,relayerUrl:``,network:`https://rpc.hoodi.ethpandaops.io`,aclContractAddress:`0x6D3FAf6f86e1fF9F3B0831Dda920AbA1cBd5bd68`,kmsContractAddress:`0x822BE20679CfAfdc352F05dEdfe12a07E912212e`,inputVerifierContractAddress:`0xf3D9A51f32D9bC23E1eECb0fAbF1f1DA4d9Bba26`,verifyingContractAddressDecryption:`0x5ffdaAB0373E62E2ea2944776209aEf29E631A64`,verifyingContractAddressInputVerification:`0x812b06e1CDCE800494b79fFE4f925A504a9A9810`,registryAddress:`0x1807aE2f693F8530DFB126D0eF98F2F2518F292f`,executorAddress:`0xC316692627de536368d82e9121F1D44a550894E6`},a={id:936486,gatewayChainId:10901,relayerUrl:``,network:`https://rpc.testnet.t-rex.zenith.network`,aclContractAddress:`0x061AAc7aAACc98d8e30459d4D858DaB9b6F3bd23`,kmsContractAddress:`0x85fBA21840059cB7E2E5BB7Fa2c5b2A324Ea7a7D`,inputVerifierContractAddress:`0xE90965601D10D42D3d88486b47b0Caf12C5C9fDe`,verifyingContractAddressDecryption:`0x5ffdaAB0373E62E2ea2944776209aEf29E631A64`,verifyingContractAddressInputVerification:`0x812b06e1CDCE800494b79fFE4f925A504a9A9810`,registryAddress:`0xde2e3948d35ef9C406A7317eAF332F3c2786a566`,executorAddress:`0x6C5036A4ad55DBA8007ae82c4e9C123F143e53ab`},o={id:97,gatewayChainId:10901,relayerUrl:``,network:`https://bsc-testnet.bnbchain.org`,aclContractAddress:`0x52470e945521E247Cb4754088a836Dc4b838AFBE`,kmsContractAddress:`0x788F5BB2d93aB4Cb67Fe2277757aE95006504F6F`,inputVerifierContractAddress:`0x49e0BAB39904E4192c30CFB58573Cbe27B7E398E`,verifyingContractAddressDecryption:`0x5ffdaAB0373E62E2ea2944776209aEf29E631A64`,verifyingContractAddressInputVerification:`0x812b06e1CDCE800494b79fFE4f925A504a9A9810`,registryAddress:`0xc0E8B73b1C58D846e1d4f8fAE2E1466C85BCeAeC`,executorAddress:`0x5985e48689550c1b2893ABfBbe4cc0eE3A22cc54`},s={id:31337,gatewayChainId:10901,relayerUrl:``,network:`http://127.0.0.1:8545`,aclContractAddress:`0x50157CFfD6bBFA2DECe204a89ec419c23ef5755D`,inputVerifierContractAddress:`0x36772142b74871f255CbD7A3e89B401d3e45825f`,kmsContractAddress:`0x901F8942346f7AB3a01F6D7613119Bca447Bb030`,verifyingContractAddressDecryption:`0x5ffdaAB0373E62E2ea2944776209aEf29E631A64`,verifyingContractAddressInputVerification:`0x812b06e1CDCE800494b79fFE4f925A504a9A9810`,registryAddress:void 0,executorAddress:`0xe3a9105a3a932253A70F126eb1E3b589C643dD24`},c=s,l={[e.id]:e,[t.id]:t,[n.id]:n,[r.id]:r,[i.id]:i,[a.id]:a,[o.id]:o,[s.id]:s};export{i as a,r as c,s as i,n as l,o as n,e as o,l as r,t as s,c as t,a as u};
|
|
2
|
+
//# sourceMappingURL=chains-BwlDI944.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains-BwlDI944.js","names":[],"sources":["../../src/chains/configs.ts"],"sourcesContent":["import type { FheChain } from \"./types\";\n\n/**\n * Mainnet network configuration (chainId 1).\n */\nexport const mainnet = {\n id: 1,\n gatewayChainId: 261131,\n relayerUrl: \"https://relayer.mainnet.zama.org\",\n network: \"https://ethereum-rpc.publicnode.com\",\n aclContractAddress: \"0xcA2E8f1F656CD25C01F05d0b243Ab1ecd4a8ffb6\",\n kmsContractAddress: \"0x77627828a55156b04Ac0DC0eb30467f1a552BB03\",\n inputVerifierContractAddress: \"0xCe0FC2e05CFff1B719EFF7169f7D80Af770c8EA2\",\n verifyingContractAddressDecryption: \"0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24\",\n verifyingContractAddressInputVerification: \"0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287\",\n registryAddress: \"0xeb5015fF021DB115aCe010f23F55C2591059bBA0\",\n} as const satisfies FheChain;\n\n/**\n * Polygon mainnet network configuration (chainId 137).\n */\nexport const polygon = {\n id: 137,\n gatewayChainId: 261131,\n relayerUrl: \"https://relayer.mainnet.zama.org\",\n network: \"https://polygon-bor-rpc.publicnode.com\",\n aclContractAddress: \"0x6737F17e31cf26a1b62fb0362acC5a16CB156F49\",\n kmsContractAddress: \"0x14e609595474874Dd6b6128376E336EfADfdBE37\",\n inputVerifierContractAddress: \"0xf40BD204B035522EaAc8E5afAdc55113Acac96ca\",\n verifyingContractAddressDecryption: \"0x0f6024a97684f7d90ddb0fAAD79cB15F2C888D24\",\n verifyingContractAddressInputVerification: \"0xcB1bB072f38bdAF0F328CdEf1Fc6eDa1DF029287\",\n registryAddress: \"0xc8908569868758dAF814B5a8b96bBc44D1653d54\",\n} as const satisfies FheChain;\n\n/**\n * Sepolia testnet network configuration (chainId 11155111).\n */\nexport const sepolia = {\n id: 11155111,\n gatewayChainId: 10901,\n relayerUrl: \"https://relayer.testnet.zama.org\",\n network: \"https://ethereum-sepolia-rpc.publicnode.com\",\n aclContractAddress: \"0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D\",\n kmsContractAddress: \"0xbE0E383937d564D7FF0BC3b46c51f0bF8d5C311A\",\n inputVerifierContractAddress: \"0xBBC1fFCdc7C316aAAd72E807D9b0272BE8F84DA0\",\n verifyingContractAddressDecryption: \"0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478\",\n verifyingContractAddressInputVerification: \"0x483b9dE06E4E4C7D35CCf5837A1668487406D955\",\n registryAddress: \"0x2f0750Bbb0A246059d80e94c454586a7F27a128e\",\n} as const satisfies FheChain;\n\n/**\n * Polygon Amoy testnet network configuration (chainId 80002).\n */\nexport const polygonAmoy = {\n id: 80002,\n gatewayChainId: 10901,\n relayerUrl: \"https://relayer.testnet.zama.org\",\n network: \"https://polygon-amoy-bor-rpc.publicnode.com\",\n aclContractAddress: \"0xD99Cb9Fc3c42c87f2A4A12e8Fd60318d6bDdf985\",\n kmsContractAddress: \"0xCD1D89E311bce4C8DEa9a0857a0c9A4E153D4041\",\n inputVerifierContractAddress: \"0x6e5A7D8b0c645467Cba7e62D6624917085118631\",\n verifyingContractAddressDecryption: \"0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478\",\n verifyingContractAddressInputVerification: \"0x483b9dE06E4E4C7D35CCf5837A1668487406D955\",\n registryAddress: \"0xF486c3D4F4562760A43883e72E8D6f6Cf2EFdA94\",\n} as const satisfies FheChain;\n\n/**\n * Hoodi testnet configuration (chainId 560048).\n *\n * Hoodi does not have full FHE infrastructure — use with `cleartext()` transport.\n * Contract addresses match the cleartext deployment.\n */\nexport const hoodi = {\n id: 560048,\n gatewayChainId: 10901,\n relayerUrl: \"\",\n network: \"https://rpc.hoodi.ethpandaops.io\",\n aclContractAddress: \"0x6D3FAf6f86e1fF9F3B0831Dda920AbA1cBd5bd68\",\n kmsContractAddress: \"0x822BE20679CfAfdc352F05dEdfe12a07E912212e\",\n inputVerifierContractAddress: \"0xf3D9A51f32D9bC23E1eECb0fAbF1f1DA4d9Bba26\",\n verifyingContractAddressDecryption: \"0x5ffdaAB0373E62E2ea2944776209aEf29E631A64\",\n verifyingContractAddressInputVerification: \"0x812b06e1CDCE800494b79fFE4f925A504a9A9810\",\n registryAddress: \"0x1807aE2f693F8530DFB126D0eF98F2F2518F292f\",\n executorAddress: \"0xC316692627de536368d82e9121F1D44a550894E6\",\n} as const satisfies FheChain;\n\n/**\n * T-Rex Zenith testnet configuration (chainId 936486).\n *\n * T-Rex's testnet instance on Zenith EVM (Reth execution, Canton-mediated\n * finality) — a separate chain from Zenith's shared testnet (chainId 936485).\n * It does not have full FHE infrastructure — use with `cleartext()` transport.\n */\nexport const zenithTrexTestnet = {\n id: 936486,\n gatewayChainId: 10901,\n relayerUrl: \"\",\n network: \"https://rpc.testnet.t-rex.zenith.network\",\n aclContractAddress: \"0x061AAc7aAACc98d8e30459d4D858DaB9b6F3bd23\",\n kmsContractAddress: \"0x85fBA21840059cB7E2E5BB7Fa2c5b2A324Ea7a7D\",\n inputVerifierContractAddress: \"0xE90965601D10D42D3d88486b47b0Caf12C5C9fDe\",\n verifyingContractAddressDecryption: \"0x5ffdaAB0373E62E2ea2944776209aEf29E631A64\",\n verifyingContractAddressInputVerification: \"0x812b06e1CDCE800494b79fFE4f925A504a9A9810\",\n registryAddress: \"0xde2e3948d35ef9C406A7317eAF332F3c2786a566\",\n executorAddress: \"0x6C5036A4ad55DBA8007ae82c4e9C123F143e53ab\",\n} as const satisfies FheChain;\n\n/**\n * BNB Smart Chain testnet configuration (chainId 97, Chapel).\n *\n * BSC testnet does not have full FHE infrastructure — use with `cleartext()` transport.\n * Contract addresses match the cleartext deployment.\n */\nexport const bscTestnet = {\n id: 97,\n gatewayChainId: 10901,\n relayerUrl: \"\",\n network: \"https://bsc-testnet.bnbchain.org\",\n aclContractAddress: \"0x52470e945521E247Cb4754088a836Dc4b838AFBE\",\n kmsContractAddress: \"0x788F5BB2d93aB4Cb67Fe2277757aE95006504F6F\",\n inputVerifierContractAddress: \"0x49e0BAB39904E4192c30CFB58573Cbe27B7E398E\",\n verifyingContractAddressDecryption: \"0x5ffdaAB0373E62E2ea2944776209aEf29E631A64\",\n verifyingContractAddressInputVerification: \"0x812b06e1CDCE800494b79fFE4f925A504a9A9810\",\n registryAddress: \"0xc0E8B73b1C58D846e1d4f8fAE2E1466C85BCeAeC\",\n executorAddress: \"0x5985e48689550c1b2893ABfBbe4cc0eE3A22cc54\",\n} as const satisfies FheChain;\n\n/**\n * Hardhat local network configuration (chainId 31337).\n *\n * The addresses in this configuration must match those of your deployment.\n */\nexport const hardhat = {\n id: 31337,\n gatewayChainId: 10901,\n relayerUrl: \"\",\n network: \"http://127.0.0.1:8545\",\n aclContractAddress: \"0x50157CFfD6bBFA2DECe204a89ec419c23ef5755D\",\n inputVerifierContractAddress: \"0x36772142b74871f255CbD7A3e89B401d3e45825f\",\n kmsContractAddress: \"0x901F8942346f7AB3a01F6D7613119Bca447Bb030\",\n verifyingContractAddressDecryption: \"0x5ffdaAB0373E62E2ea2944776209aEf29E631A64\",\n verifyingContractAddressInputVerification: \"0x812b06e1CDCE800494b79fFE4f925A504a9A9810\",\n registryAddress: undefined,\n executorAddress: \"0xe3a9105a3a932253A70F126eb1E3b589C643dD24\",\n} as const satisfies FheChain;\n\n/** Alias for {@link hardhat}. */\nexport const anvil = hardhat;\n\n/**\n * Built-in chain configurations keyed by chain ID.\n */\nexport const chains: Record<number, FheChain> = {\n [mainnet.id]: mainnet,\n [polygon.id]: polygon,\n [sepolia.id]: sepolia,\n [polygonAmoy.id]: polygonAmoy,\n [hoodi.id]: hoodi,\n [zenithTrexTestnet.id]: zenithTrexTestnet,\n [bscTestnet.id]: bscTestnet,\n [hardhat.id]: hardhat,\n} as const;\n"],"mappings":"AAKA,MAAa,EAAU,CACrB,GAAI,EACJ,eAAgB,OAChB,WAAY,mCACZ,QAAS,sCACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,4CACnB,EAKa,EAAU,CACrB,GAAI,IACJ,eAAgB,OAChB,WAAY,mCACZ,QAAS,yCACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,4CACnB,EAKa,EAAU,CACrB,GAAI,SACJ,eAAgB,MAChB,WAAY,mCACZ,QAAS,8CACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,4CACnB,EAKa,EAAc,CACzB,GAAI,MACJ,eAAgB,MAChB,WAAY,mCACZ,QAAS,8CACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,4CACnB,EAQa,EAAQ,CACnB,GAAI,OACJ,eAAgB,MAChB,WAAY,GACZ,QAAS,mCACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,6CACjB,gBAAiB,4CACnB,EASa,EAAoB,CAC/B,GAAI,OACJ,eAAgB,MAChB,WAAY,GACZ,QAAS,2CACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,6CACjB,gBAAiB,4CACnB,EAQa,EAAa,CACxB,GAAI,GACJ,eAAgB,MAChB,WAAY,GACZ,QAAS,mCACT,mBAAoB,6CACpB,mBAAoB,6CACpB,6BAA8B,6CAC9B,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,6CACjB,gBAAiB,4CACnB,EAOa,EAAU,CACrB,GAAI,MACJ,eAAgB,MAChB,WAAY,GACZ,QAAS,wBACT,mBAAoB,6CACpB,6BAA8B,6CAC9B,mBAAoB,6CACpB,mCAAoC,6CACpC,0CAA2C,6CAC3C,gBAAiB,IAAA,GACjB,gBAAiB,4CACnB,EAGa,EAAQ,EAKR,EAAmC,EAC7C,EAAQ,IAAK,GACb,EAAQ,IAAK,GACb,EAAQ,IAAK,GACb,EAAY,IAAK,GACjB,EAAM,IAAK,GACX,EAAkB,IAAK,GACvB,EAAW,IAAK,GAChB,EAAQ,IAAK,CAChB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as CleartextRelayerConfig } from "../types-
|
|
2
|
-
import { t as cleartext } from "../cleartext-
|
|
1
|
+
import { t as CleartextRelayerConfig } from "../types-CHepK8MK.js";
|
|
2
|
+
import { t as cleartext } from "../cleartext-BnTAN4-g.js";
|
|
3
3
|
export { type CleartextRelayerConfig, cleartext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../cleartext-
|
|
1
|
+
import{t as e}from"../cleartext-Ck0gNKy1.js";export{e as cleartext};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pn as RelayerOptions, t as CleartextRelayerConfig } from "./types-
|
|
1
|
+
import { pn as RelayerOptions, t as CleartextRelayerConfig } from "./types-CHepK8MK.js";
|
|
2
2
|
//#region src/config/cleartext.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Cleartext relayer — drives the FHE backend in cleartext mode (no FHE infrastructure).
|
|
@@ -15,4 +15,4 @@ import { pn as RelayerOptions, t as CleartextRelayerConfig } from "./types-BIgPY
|
|
|
15
15
|
declare function cleartext(options?: RelayerOptions): CleartextRelayerConfig;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { cleartext as t };
|
|
18
|
-
//# sourceMappingURL=cleartext-
|
|
18
|
+
//# sourceMappingURL=cleartext-BnTAN4-g.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./relayer-C3jVhqSK.js";import{t}from"./fhevm-relayer-
|
|
2
|
-
//# sourceMappingURL=cleartext-
|
|
1
|
+
import{t as e}from"./relayer-C3jVhqSK.js";import{t}from"./fhevm-relayer-DnAUqf3b.js";function n(n){return{type:`cleartext`,createRelayer:(r,i)=>{if(!r.executorAddress)throw new e(`Cleartext relayer requires an executorAddress. Either use a chain preset that includes it (e.g. hardhat, hoodi) or set it on the chain definition.`);return new t({chain:r,options:n,cleartext:!0,logger:i})}}}export{n as t};
|
|
2
|
+
//# sourceMappingURL=cleartext-Ck0gNKy1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleartext-
|
|
1
|
+
{"version":3,"file":"cleartext-Ck0gNKy1.js","names":[],"sources":["../../src/config/cleartext.ts"],"sourcesContent":["import { ConfigurationError } from \"../errors\";\nimport { FhevmRelayer } from \"../relayer/fhevm-relayer\";\nimport type { RelayerOptions } from \"../relayer/types\";\nimport type { CleartextRelayerConfig } from \"./types\";\n\n/**\n * Cleartext relayer — drives the FHE backend in cleartext mode (no FHE infrastructure).\n *\n * When `executorAddress` is set on the chain definition (e.g. `hardhat`, `hoodi`),\n * it is picked up automatically.\n *\n * @example\n * ```ts\n * // executorAddress comes from the chain preset:\n * relayers: { [hardhat.id]: cleartext({ batchRpcCalls: true }) }\n * ```\n */\nexport function cleartext(options?: RelayerOptions): CleartextRelayerConfig {\n return {\n type: \"cleartext\",\n createRelayer: (chain, logger) => {\n if (!chain.executorAddress) {\n throw new ConfigurationError(\n `Cleartext relayer requires an executorAddress. ` +\n `Either use a chain preset that includes it (e.g. hardhat, hoodi) ` +\n `or set it on the chain definition.`,\n );\n }\n return new FhevmRelayer({ chain, options, cleartext: true, logger });\n },\n };\n}\n"],"mappings":"qFAiBA,SAAgB,EAAU,EAAkD,CAC1E,MAAO,CACL,KAAM,YACN,eAAgB,EAAO,IAAW,CAChC,GAAI,CAAC,EAAM,gBACT,MAAM,IAAI,EACR,oJAGF,EAEF,OAAO,IAAI,EAAa,CAAE,QAAO,UAAS,UAAW,GAAM,QAAO,CAAC,CACrE,CACF,CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as SetOperatorSubmittedEvent, $t as TransactionReceipt, A as WalletAccountListener, B as ApproveUnderlyingSubmittedEvent, D as GenericSigner, F as ReadContractReturnType, G as DelegationSubmittedEvent, H as DecryptEndEvent, I as ReadFunctionName, J as EncryptStartEvent, K as EncryptEndEvent, L as WriteContractArgs, M as ContractAbi, N as ReadContractArgs, O as WalletAccount, P as ReadContractConfig, Q as RevokeDelegationSubmittedEvent, Qt as RawLog, R as WriteContractConfig, U as DecryptErrorEvent, V as BaseEvent, W as DecryptStartEvent, X as PermitErrorEvent, Y as FinalizeUnwrapSubmittedEvent, Z as PermitOperation, a as ZamaConfigBase, at as UnshieldPhase1SubmittedEvent, c as GenericStorage, cn as EncryptedValue, ct as UnwrapSubmittedEvent, dt as WrapSubmittedEvent, et as ShieldSubmittedEvent, fn as FhevmRuntimeConfig, ft as ZamaSDKEvent, ht as ZamaSDKEvents, i as ZamaConfig, in as EIP712TypedData, it as TransferSubmittedEvent, j as WalletAccountStore, k as WalletAccountChange, l as GenericProvider, mt as ZamaSDKEventType, n as RelayerConfig, nt as TransactionOperation, ot as UnshieldPhase2StartedEvent, pt as ZamaSDKEventListener, q as EncryptErrorEvent, rt as TransferFromSubmittedEvent, s as GenericLogger, st as UnshieldPhase2SubmittedEvent, tn as ClearValue, tt as TransactionErrorEvent, vt as ShieldPath, z as WriteFunctionName } from "../types-
|
|
3
|
-
import { t as ZamaConfigEthers } from "../types-
|
|
4
|
-
import { n as MutableWalletAccountStore, t as BaseSigner } from "../base-signer-
|
|
1
|
+
import { d as AtLeastOneChain, f as FheChain, p as FheChainAuth } from "../index-D1Wtji3m.js";
|
|
2
|
+
import { $ as SetOperatorSubmittedEvent, $t as TransactionReceipt, A as WalletAccountListener, B as ApproveUnderlyingSubmittedEvent, D as GenericSigner, F as ReadContractReturnType, G as DelegationSubmittedEvent, H as DecryptEndEvent, I as ReadFunctionName, J as EncryptStartEvent, K as EncryptEndEvent, L as WriteContractArgs, M as ContractAbi, N as ReadContractArgs, O as WalletAccount, P as ReadContractConfig, Q as RevokeDelegationSubmittedEvent, Qt as RawLog, R as WriteContractConfig, U as DecryptErrorEvent, V as BaseEvent, W as DecryptStartEvent, X as PermitErrorEvent, Y as FinalizeUnwrapSubmittedEvent, Z as PermitOperation, a as ZamaConfigBase, at as UnshieldPhase1SubmittedEvent, c as GenericStorage, cn as EncryptedValue, ct as UnwrapSubmittedEvent, dt as WrapSubmittedEvent, et as ShieldSubmittedEvent, fn as FhevmRuntimeConfig, ft as ZamaSDKEvent, ht as ZamaSDKEvents, i as ZamaConfig, in as EIP712TypedData, it as TransferSubmittedEvent, j as WalletAccountStore, k as WalletAccountChange, l as GenericProvider, mt as ZamaSDKEventType, n as RelayerConfig, nt as TransactionOperation, ot as UnshieldPhase2StartedEvent, pt as ZamaSDKEventListener, q as EncryptErrorEvent, rt as TransferFromSubmittedEvent, s as GenericLogger, st as UnshieldPhase2SubmittedEvent, tn as ClearValue, tt as TransactionErrorEvent, vt as ShieldPath, z as WriteFunctionName } from "../types-CHepK8MK.js";
|
|
3
|
+
import { t as ZamaConfigEthers } from "../types-C2ccCjoA.js";
|
|
4
|
+
import { n as MutableWalletAccountStore, t as BaseSigner } from "../base-signer-BxIDBDTF.js";
|
|
5
5
|
import { Abi, Address, ContractFunctionArgs, ContractFunctionName, ContractFunctionReturnType, EIP1193EventMap, EIP1193Events, EIP1193Provider, EIP1193Provider as EIP1193Provider$1, Hex, Hex as Hex$1, ProviderConnectInfo, ProviderMessage, ProviderRpcError } from "viem";
|
|
6
6
|
import { Signer, ethers } from "ethers";
|
|
7
7
|
//#region src/ethers/config.d.ts
|
package/dist/esm/ethers/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../relayer-C3jVhqSK.js";import{A as t,B as n,D as r,E as i,F as a,H as o,L as s,N as c,O as l,T as u,h as d,j as f,s as p,v as m,x as h,z as g}from"../erc165-BAd2z3ay.js";import{i as _,t as v}from"../base-signer-
|
|
1
|
+
import{t as e}from"../relayer-C3jVhqSK.js";import{A as t,B as n,D as r,E as i,F as a,H as o,L as s,N as c,O as l,T as u,h as d,j as f,s as p,v as m,x as h,z as g}from"../erc165-BAd2z3ay.js";import{i as _,t as v}from"../base-signer-ClrhHzbm.js";import{a as y,i as b,n as x,o as ee,r as S,s as C,t as w}from"../wrappers-registry-Cm3JJeqx.js";import{t as T}from"../eip1193-subscribe-CNxVHW6y.js";import{ProviderRpcError as E,decodeFunctionResult as D,encodeFunctionData as te,getAddress as O,isHex as k}from"viem";import{BrowserProvider as A,Contract as j,Transaction as M,ethers as N}from"ethers";function P(e){return{to:e.address,data:te({abi:e.abi,functionName:e.functionName,args:e.args}),...e.gas===void 0?{}:{gasLimit:e.gas},...e.value===void 0?{}:{value:e.value}}}async function F(e,t){let n=await e.call(P(t));if(!k(n))throw TypeError(`Expected hex string, got: ${n}`);return D({abi:t.abi,functionName:t.functionName,data:n})}async function I(e,t){let n=await e.sendTransaction(P(t));if(!k(n.hash))throw TypeError(`Expected hex string, got: ${n.hash}`);return n.hash}function L(e,t,n){return F(e,d(t,n))}function R(e,t){return F(e,i(t))}function z(e,t,n){return F(e,p(t,n))}function B(e,t,n,r,i){return I(e,m(t,n,r,i))}function V(e,t,n,i,a,o){return I(e,r(t,n,i,a,o))}function H(e,t,n,r,i){return I(e,l(t,n,r,i))}function U(e,t,n,r,i){return I(e,h(t,n,r,i))}function W(e,t,n,r){return I(e,u(t,n,r))}function G(e,n,r,i){return I(e,t(n,r,i))}function K(e,t){return F(e,b(t))}function q(e,t){return F(e,y(t))}function J(e,t,n,r){return F(e,ee(t,n,r))}function Y(e,t,n){return F(e,S(t,n))}function X(e,t,n){return F(e,w(t,n))}function Z(e,t,n){return F(e,x(t,n))}function ne(e,t,n){return F(e,C(t,n))}var Q=class{#e;constructor(e){`ethereum`in e?this.#e=new A(e.ethereum):this.#e=e.provider}async getChainId(){let e=await this.#e.getNetwork();return Number(e.chainId)}async readContract(e){return F(this.#e,{address:e.address,abi:e.abi,functionName:e.functionName,args:e.args})}async getBlockTimestamp(){let t=await this.#e.getBlock(`latest`);if(!t)throw new e(`EthersProvider.getBlockTimestamp: failed to fetch latest block`);if(t.timestamp===null)throw new e(`EthersProvider.getBlockTimestamp: latest block has no timestamp`);return BigInt(t.timestamp)}async waitForTransactionReceipt(e){let t=await this.#e.waitForTransaction(e);if(!t)throw new o(`EthersProvider.waitForTransactionReceipt: no receipt found for tx ${e}. The transaction may have been dropped from the mempool, or the RPC's wait timeout elapsed.`);return{logs:t.logs.map(e=>({address:e.address,topics:e.topics.filter(e=>e!==null),data:e.data}))}}async prepareTransaction(t){let{from:n,calldata:r}=t,i=new N.Interface(r.abi),a=[];i.forEachFunction(e=>{e.name===r.functionName&&a.push(e)});let s=r.args.length,l=a.length===1?a[0]:a.find(e=>e.inputs.length===s);if(!l)throw Error(`Function ${r.functionName}(${s} args) not found in ABI`);let u=i.encodeFunctionData(l,r.args);c(u,`data`);let d=r.value??0n,f=this.#e.getNetwork(),p=t.nonce===void 0?this.#e.getTransactionCount(n,`pending`):Promise.resolve(t.nonce),m=t.gasLimit===void 0?r.gas??this.#e.estimateGas({from:n,to:r.address,data:u,value:d}).catch(e=>{throw new o(`EthersProvider.prepareTransaction: gas estimation reverted for ${r.functionName} on ${r.address}`,{cause:e})}):Promise.resolve(t.gasLimit),h=t.fees??this.#e.getFeeData(),[g,_,v,y]=await Promise.all([f,p,m,h]),b=y.maxFeePerGas,x=y.maxPriorityFeePerGas;if(b===null||x===null)throw new e(`EthersProvider.prepareTransaction: EIP-1559 fee data unavailable (provider returned null maxFeePerGas). The connected chain may not support EIP-1559 type-2 transactions.`);return M.from({type:2,chainId:Number(g.chainId),nonce:_,to:r.address,data:u,value:d,gasLimit:v,maxFeePerGas:b,maxPriorityFeePerGas:x}).unsignedSerialized}},$=class extends v{#e;#t;#n;#r;#i;constructor(e){super(),`ethereum`in e?(this.#e=new A(e.ethereum),this.#n=e.ethereum,this.#r=T({provider:e.ethereum,getInitialWalletAccount:()=>this.#l(),onWalletAccountChange:({next:e})=>{this.walletAccount.setSnapshot(e)}})):(this.#t=e.signer,this.#r=()=>{},f(`refresh wallet account`,async()=>{await this.refreshWalletAccount()}))}requireWalletAccount(e){let t=this.walletAccount.getSnapshot();if(!t&&!this.walletAccount.isReady())throw new g(e);if(!t)throw new n(e);return t}refreshWalletAccount(){return this.#n?this.#c():this.#t?this.#s(this.#t):Promise.resolve(void 0)}onDispose(){this.#r()}async#a(){if(this.#t)return this.#t;if(!this.#e)throw new s(`resolveSigner`);return this.#e.getSigner()}async#o(e){let t=e.provider;if(!t)return;let[n,r]=await Promise.all([e.getAddress(),t.getNetwork()]);return{address:O(n),chainId:Number(r.chainId)}}async signTypedData(e){let t=await this.#a(),{domain:n,types:r,message:i}=e,{EIP712Domain:a,...o}=r,s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,[...t]])),c=await t.signTypedData(n,s,i);if(!k(c))throw TypeError(`Expected hex string, got: ${c}`);return c}async writeContract(e){let t=await this.#a(),n=new j(e.address,e.abi,t),r={};e.value!==void 0&&(r.value=e.value),e.gas!==void 0&&(r.gasLimit=e.gas);let i=await n.getFunction(e.functionName)(...e.args,r);if(!k(i.hash))throw TypeError(`Expected hex string, got: ${i.hash}`);return i.hash}async#s(e){return this.#i??=this.#o(e).then(e=>(this.walletAccount.setSnapshot(e),e)).finally(()=>{this.#i=void 0}),this.#i}async#c(){let e=await this.#l();return this.walletAccount.setSnapshot(e),e}async#l(){let e=this.#n;if(!e)return;let[t,n]=await Promise.all([e.request({method:`eth_accounts`}),e.request({method:`eth_chainId`})]);if(!Array.isArray(t)||typeof t[0]!=`string`)return;let r=Number(n);if(!(!Number.isSafeInteger(r)||r<=0))return{address:O(t[0]),chainId:r}}};function re(e){if(`signer`in e&&e.signer){let t=new $({signer:e.signer});if(!e.signer.provider)throw Error(`createConfig requires a Signer with an attached provider for chain reads`);return _(t,new Q({provider:e.signer.provider}),e)}return _(new $({ethereum:e.ethereum}),`provider`in e&&e.provider?new Q({provider:e.provider}):new Q({ethereum:e.ethereum}),e)}export{v as BaseSigner,Q as EthersProvider,$ as EthersSigner,E as ProviderRpcError,a as ZamaSDKEvents,re as createConfig,L as readConfidentialBalanceOfContract,X as readConfidentialTokenAddressContract,ne as readIsConfidentialTokenValidContract,z as readSupportsInterfaceContract,Z as readTokenAddressContract,Y as readTokenPairContract,K as readTokenPairsContract,q as readTokenPairsLengthContract,J as readTokenPairsSliceContract,R as readUnderlyingTokenContract,B as writeConfidentialTransferContract,U as writeFinalizeUnwrapContract,W as writeSetOperatorContract,V as writeUnwrapContract,H as writeUnwrapFromBalanceContract,G as writeWrapContract};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{t as e,x as t,y as n}from"./relayer-C3jVhqSK.js";import{n as r}from"./encryption-6AVd-82z.js";import{n as i,t as a}from"./applied-runtime-3fzqBC2V.js";import{n as o}from"./telemetry-
|
|
1
|
+
import{t as e,x as t,y as n}from"./relayer-C3jVhqSK.js";import{n as r}from"./encryption-6AVd-82z.js";import{n as i,t as a}from"./applied-runtime-3fzqBC2V.js";import{n as o}from"./telemetry-IaHYnoo4.js";import{createPublicClient as s,custom as c,http as l}from"viem";import{createUnsignedLegacyDecryptionPermitEip712 as u}from"@fhevm/sdk/actions/base";import{createFhevmBaseClient as ee,createFhevmDecryptClient as te,createFhevmEncryptClient as d,hasFhevmRuntimeConfig as f}from"@fhevm/sdk/viem";import{createFhevmCleartextBaseClient as ne,createFhevmCleartextDecryptClient as re,createFhevmCleartextEncryptClient as p}from"@fhevm/sdk/viem/cleartext";function m(e){return{id:e.id,fhevm:{contracts:{acl:{address:e.aclContractAddress},inputVerifier:{address:e.inputVerifierContractAddress},kmsVerifier:{address:e.kmsContractAddress},protocolConfig:void 0},relayerUrl:e.relayerUrl,gateway:{id:e.gatewayChainId,contracts:{decryption:{address:e.verifyingContractAddressDecryption},inputVerification:{address:e.verifyingContractAddressInputVerification}}}}}}
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
const h=Symbol(`Comlink.proxy`),g=Symbol(`Comlink.endpoint`),_=Symbol(`Comlink.releaseProxy`),v=Symbol(`Comlink.finalizer`),y=Symbol(`Comlink.thrown`),b=e=>typeof e==`object`&&!!e||typeof e==`function`,x=new Map([[`proxy`,{canHandle:e=>b(e)&&e[h],serialize(e){let{port1:t,port2:n}=new MessageChannel;return C(e,t),[n,[n]]},deserialize(e){return e.start(),T(e)}}],[`throw`,{canHandle:e=>b(e)&&y in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function S(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function C(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function r(i){if(!i||!i.data)return;if(!S(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(R),l;try{let t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(o){case`GET`:l=n;break;case`SET`:t[s.slice(-1)[0]]=R(i.data.value),l=!0;break;case`APPLY`:l=n.apply(t,c);break;case`CONSTRUCT`:l=I(new n(...c));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;C(e,n),l=F(t,[t])}break;case`RELEASE`:l=void 0;break;default:return}}catch(e){l={value:e,[y]:0}}Promise.resolve(l).catch(e=>({value:e,[y]:0})).then(n=>{let[i,s]=L(n);t.postMessage(Object.assign(Object.assign({},i),{id:a}),s),o===`RELEASE`&&(t.removeEventListener(`message`,r),w(t),v in e&&typeof e[v]==`function`&&e[v]())}).catch(e=>{let[n,r]=L({value:TypeError(`Unserializable return value`),[y]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function ie(e){return e.constructor.name===`MessagePort`}function w(e){ie(e)&&e.close()}function T(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),M(e,n,[],t)}function E(e){if(e)throw Error(`Proxy has been released and is not useable`)}function D(e){return z(e,new Map,{type:`RELEASE`}).then(()=>{w(e)})}const O=new WeakMap,k=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(O.get(e)||0)-1;O.set(e,t),t===0&&D(e)});function A(e,t){let n=(O.get(t)||0)+1;O.set(t,n),k&&k.register(e,t,e)}function j(e){k&&k.unregister(e)}function M(e,t,n=[],r=function(){}){let i=!1,a=new Proxy(r,{get(r,o){if(E(i),o===_)return()=>{j(a),D(e),t.clear(),i=!0};if(o===`then`){if(n.length===0)return{then:()=>a};let r=z(e,t,{type:`GET`,path:n.map(e=>e.toString())}).then(R);return r.then.bind(r)}return M(e,t,[...n,o])},set(r,a,o){E(i);let[s,c]=L(o);return z(e,t,{type:`SET`,path:[...n,a].map(e=>e.toString()),value:s},c).then(R)},apply(r,a,o){E(i);let s=n[n.length-1];if(s===g)return z(e,t,{type:`ENDPOINT`}).then(R);if(s===`bind`)return M(e,t,n.slice(0,-1));let[c,l]=N(o);return z(e,t,{type:`APPLY`,path:n.map(e=>e.toString()),argumentList:c},l).then(R)},construct(r,a){E(i);let[o,s]=N(a);return z(e,t,{type:`CONSTRUCT`,path:n.map(e=>e.toString()),argumentList:o},s).then(R)}});return A(a,e),a}function ae(e){return Array.prototype.concat.apply([],e)}function N(e){let t=e.map(L);return[t.map(e=>e[0]),ae(t.map(e=>e[1]))]}const P=new WeakMap;function F(e,t){return P.set(e,t),e}function I(e){return Object.assign(e,{[h]:!0})}function L(e){for(let[t,n]of x)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},P.get(e)||[]]}function R(e){switch(e.type){case`HANDLER`:return x.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function z(e,t,n,r){return new Promise(i=>{let a=B();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function B(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}function V(e){return typeof e==`object`&&!!e&&e.wireError===!0}const H=[`statusCode`,`status`,`retryAfter`,`timeoutMs`,`relayerApiError`,`code`,`data`,`shortMessage`,`details`,`error`,`info`];function U(e){try{return structuredClone(e),!0}catch{return!1}}function W(e){let n=e.response;return t(n?.headers)}function G(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function K(e){let t={};for(let n of H){let r=e[n];r!==void 0&&U(r)&&(t[n]=r)}if(!n(t.retryAfter)){let n=W(e);n!==void 0&&(t.retryAfter=n)}return t}function q(e,t=6){if(V(e))return e;let n=e=>t>0&&e!==void 0?q(e,t-1):void 0;if(e instanceof Error)return{wireError:!0,name:e.name,message:e.message,stack:e.stack,props:K(e),cause:n(e.cause)};if(typeof e==`object`&&e){let{message:t,cause:r}=e;return{wireError:!0,name:`Error`,message:typeof t==`string`?t:G(e),stack:void 0,props:K(e),cause:n(r)}}return{wireError:!0,name:`Error`,message:typeof e==`string`?e:G(e),stack:void 0,props:{},cause:void 0}}function J(e){let t=Error(e.message,e.cause?{cause:J(e.cause)}:{});return t.name=e.name,e.stack!==void 0&&(t.stack=e.stack),Object.assign(t,e.props),t}function oe(){return new Worker(new URL(`./encrypt.worker.js`,import.meta.url),{type:`module`,name:`zama-fhe-encrypt`})}const Y={spawn:1e4,init:3e5},X=new WeakSet;var Z=class extends Error{crashed;constructor(e,t){super(e,t),this.name=`WorkerUnavailableError`,this.crashed=t?.crashed??!1}};function se(e){if(typeof e!=`object`||!e)return!1;let{name:t,message:n}=e;return t===`DataCloneError`||t===`TypeError`&&typeof n==`string`&&n.includes(`Unserializable return value`)}function Q(e){if(e?.aborted)throw e.reason??new DOMException(`The operation was aborted.`,`AbortError`)}const $={count:0,last:void 0,warnedFor:-1};function ce(e){if(e===void 0)return{key:e,transfers:[]};let t=e.publicKeyBytes.bytes,n=e.crsBytes.bytes;if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array))return{key:e,transfers:[]};let r=t.slice(),i=n.slice();return{key:{...e,publicKeyBytes:{...e.publicKeyBytes,bytes:r},crsBytes:{...e.crsBytes,bytes:i}},transfers:[r.buffer,i.buffer]}}function le(){let e,t=new Promise((t,n)=>{e=n});return t.catch(()=>{}),{initPromise:void 0,worker:void 0,api:void 0,doomed:t,doom:e}}var ue=class{#e;#t;#n=!1;#r=$;#i=0;#a=new Map;#o;#s=0;#c=!1;constructor(e){this.#e=e}init=()=>{let e=this.#t??=le();if(e.initPromise===void 0){let t=this.#f(()=>this.#u(e)).catch(n=>{throw e.initPromise===t&&(e.initPromise=void 0),n});e.initPromise=t}return e.initPromise};encryptValue=e=>this.#f(()=>this.#l(t=>t.encryptValue(e),(t,n,r)=>t.encryptValue(n,{...e,options:r}),e.options));encryptValues=e=>this.#f(()=>this.#l(t=>t.encryptValues(e),(t,n,r)=>t.encryptValues(n,{...e,options:r}),e.options));dispose(){this.#c=!0,this.#p()}async#l(e,t,n){let{signal:r,onProgress:i,...a}=n??{};Q(r),await this.init(),Q(r);let o=this.#t,s=o?.api;if(this.#o!==void 0&&(this.#n||s===void 0))return e(await this.#o);if(o===void 0||s===void 0)return e(await this.#b(o,this.#r.last??new Z(`Encrypt worker not running.`)));let c=this.#i++,l=()=>void s.abort(c).catch(()=>{});r?.addEventListener(`abort`,l,{once:!0}),i&&this.#a.set(c,i);try{let e=await this.#v(o,t(s,c,a));return this.#r=$,e}catch(t){if(t instanceof Z)return e(await this.#b(o,t));throw t}finally{this.#a.delete(c),r?.removeEventListener(`abort`,l)}}async#u(e){if(this.#n)return;let t=this.#e.blockedReason;if(t!==void 0){await this.#b(e,new Z(t));return}let n=await this.#e.prefetchKey();try{let t=await this.#h(e),r=this.#e.network,i=typeof r==`string`?null:I(async e=>{try{return await r.request(e)}catch(e){throw q(e)}}),a=I((e,t)=>{try{this.#e.logger[e](t)}catch(e){this.#d(`logger`,e)}}),o=I((e,t)=>{try{this.#a.get(e)?.(t)}catch(e){this.#d(`onProgress`,e)}}),s=ce(n);await this.#v(e,t.init(F({...this.#e.initPayload,clientOptions:{...this.#e.initPayload.clientOptions,fheEncryptionKey:s.key},rpcUrl:typeof r==`string`?r:void 0},s.transfers),i,a,o),{ms:this.#e.timeouts.init,operation:`init`}),e.api=t,this.#r={...this.#r,last:void 0}}catch(t){if(!(t instanceof Z))throw this.#y(e,new Z(`Encrypt worker init failed.`)),t;await this.#b(e,t)}}#d(e,t){let n=t instanceof Error?t.message:String(t);try{this.#e.logger.warn(`Encrypt offload ${e} callback threw: ${n}`)}catch{}}async#f(e){this.#s++;try{return await e()}finally{this.#s--,this.#p()}}#p(){!this.#c||this.#s>0||(this.#c=!1,this.#t?.worker?.terminate(),this.#t=void 0,this.#o=void 0,this.#n=!1,this.#r=$)}#m(){let e=this.#e.workerSource;if(e===void 0)return oe();if(typeof e==`function`){let t=e();return X.has(t)&&this.#e.logger.warnAlways(`The offloadWorker factory returned a worker it already handed out; each call must construct a fresh Worker.`),X.add(t),t}return new Worker(e,{type:`module`,name:`zama-fhe-encrypt`})}async#h(e){let t;try{t=this.#m()}catch(e){throw new Z(e instanceof Error?e.message:String(e),{cause:e})}e.worker=t;let n=await this.#g(e,t);return this.#_(e,t),n}#g(e,t){return new Promise((n,r)=>{let i=()=>{clearTimeout(a),t.removeEventListener(`message`,o),t.removeEventListener(`error`,s)},a=setTimeout(()=>{i(),r(new Z(`Encrypt worker did not start within ${this.#e.timeouts.spawn}ms.`))},this.#e.timeouts.spawn),o=e=>{e.data===`zama-encrypt-worker-ready`&&(i(),n(T(t)))},s=t=>{i();let n=t.message||`Encrypt worker error.`;r(new Z(n)),this.#y(e,new Z(n))};t.addEventListener(`message`,o),t.addEventListener(`error`,s)})}#_(e,t){t.addEventListener(`error`,t=>{if(this.#t!==e)return;let n=new Z(t.message||`Encrypt worker error.`,{crashed:!0});this.#r={...this.#r,count:this.#r.count+1,last:n},this.#y(e,n)})}async#v(e,t,n){let r=n===void 0?void 0:setTimeout(()=>{this.#y(e,new Z(`Encrypt worker ${n.operation} timed out after ${n.ms}ms.`))},n.ms);try{return await Promise.race([t.catch(e=>{let t=V(e)?J(e):e;throw se(t)?new Z(t.message,{cause:t}):t}),e.doomed])}finally{r!==void 0&&clearTimeout(r)}}#y(e,t){e!==void 0&&(this.#t===e&&(this.#t=void 0),e.worker?.terminate(),e.worker=void 0,e.api=void 0,e.initPromise=void 0,e.doom(t))}async#b(e,t){let n=t instanceof Error?t.message:String(t);if(this.#e.strict)throw this.#y(e,new Z(`Encrypt worker unavailable.`)),new r(`Encrypt offload required (offloadEncrypt: true) but unavailable: ${n}`,{cause:t});let{transient:i,pinning:a}=this.#x(t);if(this.#n||=!i,this.#y(e,new Z(`Encrypt worker degraded to inline.`)),this.#S(n,i,a),this.#o===void 0){let e=(async()=>{let e=this.#e.createInlineClient();return await e.init(),e})().catch(t=>{throw this.#o===e&&(this.#o=void 0),this.#e.logger.warnAlways(`Encrypt inline fallback failed to initialize: ${t instanceof Error?t.message:String(t)}`),t});this.#o=e}return this.#o}#x(e){let t=e instanceof Z&&e.crashed&&this.#r.count<2;return{transient:t,pinning:!t&&!this.#n}}#S(e,t,n){if(!n&&this.#r.warnedFor===this.#r.count)return;this.#r={...this.#r,warnedFor:this.#r.count};let r=t?`in-flight encryption falls back`:`encryption falls back`;this.#e.logger.warnAlways(`Encrypt offload unavailable, ${r} to the calling thread: ${e}`)}},de=class{#e;#t;#n;#r;#i;#a;#o;constructor(e){this.#e=e.chain;let{timeout:t,debug:n,batchRpcCalls:r,moduleVersions:i,fheEncryptionKey:a}=e.options??{},o=this.#e.auth?me(this.#e.auth):void 0,u={publicClient:s({transport:typeof this.#e.network==`string`?l(this.#e.network):c(this.#e.network)}),chain:m(this.#e),options:{batchRpcCalls:r,moduleVersions:i,fheEncryptionKey:a}};this.#i={...o!==void 0&&{auth:o},...t!==void 0&&{timeout:t},...n!==void 0&&{debug:n}},this.#a=e.telemetry;let f=()=>this.#t.fetchFheEncryptionKeyBytes({options:this.#c(void 0)}),h=e=>({init:async()=>{await f(),await e.init()},encryptValue:t=>e.encryptValue(t),encryptValues:t=>e.encryptValues(t),fetchFheEncryptionKeyBytes:t=>e.fetchFheEncryptionKeyBytes(t)});e.cleartext?(this.#t=ne(u),this.#n=re(u),this.#r=h(p(u))):(this.#t=ee(u),this.#n=te(u),this.#r=this.#s(e,u,{prefetchKey:f,createInlineClient:()=>h(d(u))}))}#s(e,t,n){let r=e.offloadEncrypt??!1,i=r===!0,o=typeof Worker==`function`&&(e.offloadWorker!==void 0||!0);if(r===!1||!(i||o))return n.createInlineClient();let s=a(),c=pe(s);if(c!==void 0&&!i)return e.logger.warnAlways(`Encryption runs on the calling thread: ${c}.`),n.createInlineClient();let l=new ue({initPayload:{chain:t.chain,clientOptions:t.options,runtime:s??{}},network:this.#e.network,prefetchKey:n.prefetchKey,createInlineClient:n.createInlineClient,logger:e.logger,timeouts:e.offloadTimeouts??Y,workerSource:e.offloadWorker,blockedReason:c,strict:i});return{init:()=>l.init(),encryptValue:e=>l.encryptValue(e),encryptValues:e=>l.encryptValues(e),fetchFheEncryptionKeyBytes:e=>this.#t.fetchFheEncryptionKeyBytes(e),dispose:()=>l.dispose()}}get chain(){return this.#e}#c(e){let{operation:t,...n}={...this.#i,...e};return this.#a===void 0?n:{...n,headers:{...n.headers,...o(this.#a,t)}}}#l=()=>(this.#o??=this.#r.init().catch(e=>{throw this.#o=void 0,e}),this.#o);dispose=()=>{this.#o=void 0,this.#r.dispose?.()};decryptPublicValue=async e=>(await this.#t.init(),this.#t.decryptPublicValue({...e,options:this.#c(e.options)}));decryptPublicValues=async e=>(await this.#t.init(),this.#t.decryptPublicValues({...e,options:this.#c(e.options)}));decryptPublicValuesWithSignatures=async e=>(await this.#t.init(),this.#t.decryptPublicValuesWithSignatures({...e,options:this.#c(e.options)}));encryptValue=async e=>(await this.#l(),this.#r.encryptValue({...e,options:this.#c(e.options)}));encryptValues=async e=>(await this.#l(),this.#r.encryptValues({...e,options:this.#c(e.options)}));decryptValue=async e=>(await this.#n.init(),this.#n.decryptValue({...e,options:this.#c(e.options)}));decryptValues=async e=>(await this.#n.init(),this.#n.decryptValues({...e,options:this.#c(e.options)}));decryptValuesFromPairs=async e=>(await this.#n.init(),this.#n.decryptValuesFromPairs({...e,options:this.#c(e.options)}));fetchFheEncryptionKeyBytes=async e=>(await this.#t.init(),this.#t.fetchFheEncryptionKeyBytes({...e,options:this.#c(e?.options)}));signDecryptionPermit=async e=>(await this.#t.init(),this.#t.signDecryptionPermit(e));createUnsignedLegacyDecryptionPermitEip712=e=>u(this.#t,e);serializeTransportKeyPair=e=>this.#n.serializeTransportKeyPair(e);serializeSignedDecryptionPermit=e=>this.#t.serializeSignedDecryptionPermit(e);parseTransportKeyPair=async e=>(await this.#n.init(),this.#n.parseTransportKeyPair(e));parseSignedDecryptionPermit=async e=>{await this.#t.init();let{serializedPermit:t}=e;return this.#t.parseSignedDecryptionPermit({...e,serializedPermit:{...t,signature:fe(t.signature)}})};generateTransportKeyPair=async()=>(await this.#n.init(),this.#n.generateTransportKeyPair())};function fe(e){if(e.length!==132)return e;let t=parseInt(e.slice(130),16);return t!==0&&t!==1?e:`${e.slice(0,130)}${t===0?`1b`:`1c`}`}function pe(e){if(i())return`a runtime locateFile cannot cross the encrypt worker boundary`;if(e===void 0&&f())return`a runtime config set outside createConfig cannot be replicated in the encrypt worker realm`}function me(t){let n=t.__type;switch(n){case`ApiKeyHeader`:return{type:n,value:t.value,header:t.header};case`ApiKeyCookie`:return{type:n,value:t.value,cookie:t.cookie};case`BearerToken`:return{type:n,token:t.token};default:throw new e(`Unknown auth type: ${String(n)}`)}}export{Y as n,de as t};
|
|
8
|
-
//# sourceMappingURL=fhevm-relayer-
|
|
8
|
+
//# sourceMappingURL=fhevm-relayer-DnAUqf3b.js.map
|