@recoillink/cli 0.0.0-stage → 45.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE.md +193 -0
  2. package/README.md +149 -2
  3. package/bundle/154.index.js +462 -0
  4. package/bundle/230.index.js +569 -0
  5. package/bundle/25.index.js +9569 -0
  6. package/bundle/267.index.js +1386 -0
  7. package/bundle/308.index.js +5121 -0
  8. package/bundle/367.index.js +4 -0
  9. package/bundle/369.index.js +3443 -0
  10. package/bundle/529.index.js +3596 -0
  11. package/bundle/576.index.js +36 -0
  12. package/bundle/610.index.js +86 -0
  13. package/bundle/617.index.js +1612 -0
  14. package/bundle/628.index.js +152 -0
  15. package/bundle/633.index.js +86 -0
  16. package/bundle/697.index.js +410 -0
  17. package/bundle/7183ea1c1bf0a5da980d.js +214 -0
  18. package/bundle/748.index.js +672 -0
  19. package/bundle/78.index.js +372 -0
  20. package/bundle/841.index.js +2093 -0
  21. package/bundle/868.index.js +290 -0
  22. package/bundle/902.index.js +173 -0
  23. package/bundle/956.index.js +9901 -0
  24. package/bundle/aleo_wasm.wasm +0 -0
  25. package/bundle/aleo_wasm1.wasm +0 -0
  26. package/bundle/build/Release/bigint_buffer.node +0 -0
  27. package/bundle/file.js +12 -0
  28. package/bundle/index.js +4 -0
  29. package/bundle/package.json +3 -0
  30. package/bundle/worker-pipeline.js +38 -0
  31. package/bundle/worker.js +54 -0
  32. package/bundle/worker1.js +171 -0
  33. package/bundle/worker2.js +19834 -0
  34. package/bundle/worker3.js +19834 -0
  35. package/examples/aleo/core-config.yaml +19 -0
  36. package/examples/ccip/ccip-warp-route.yaml +26 -0
  37. package/examples/ccip/multi-chain-ccip-warp-route.yaml +81 -0
  38. package/examples/chain-config.yaml +42 -0
  39. package/examples/contract-artifacts.yaml +20 -0
  40. package/examples/core-config.yaml +19 -0
  41. package/examples/cosmosnative/core-config.yaml +20 -0
  42. package/examples/cosmosnative/warp-route-deployment.yaml +21 -0
  43. package/examples/crosschain/README.md +31 -0
  44. package/examples/crosschain/cosmosnative/core-config.yaml +69 -0
  45. package/examples/crosschain/ethereum/core-config.yaml +70 -0
  46. package/examples/crosschain/radix/core-config.yaml +96 -0
  47. package/examples/fork/file-transactions.yaml +5 -0
  48. package/examples/fork/timelock-testing.yaml +36 -0
  49. package/examples/fork/warp-route-update.yaml +100 -0
  50. package/examples/hooks.yaml +70 -0
  51. package/examples/ism-advanced.yaml +33 -0
  52. package/examples/ism.yaml +13 -0
  53. package/examples/radix/core-config.yaml +29 -0
  54. package/examples/sealevel/core-config-apply.yaml +7 -0
  55. package/examples/sealevel/core-config-composite-ism.yaml +21 -0
  56. package/examples/sealevel/core-config.yaml +12 -0
  57. package/examples/sealevel/igp-hook-config.yaml +13 -0
  58. package/examples/sealevel/warp-config-routing-message-id-multisig-ism.yaml +21 -0
  59. package/examples/starknet/core-config.yaml +20 -0
  60. package/examples/submit/strategy/file-strategy.yaml +8 -0
  61. package/examples/submit/strategy/gnosis-chain-strategy.yaml +10 -0
  62. package/examples/submit/strategy/gnosis-chain-tx-builder-strategy.yaml +6 -0
  63. package/examples/submit/strategy/gnosis-strategy-avalanche.yaml +4 -0
  64. package/examples/submit/strategy/gnosis-tx-builder-ica-strategy.yaml +20 -0
  65. package/examples/submit/strategy/ica-timelock-strategy.yaml +15 -0
  66. package/examples/submit/strategy/impersonated-account-strategy.yaml +4 -0
  67. package/examples/submit/strategy/json-rpc-chain-strategy.yaml +8 -0
  68. package/examples/submit/strategy/json-rpc-ica-strategy.yaml +13 -0
  69. package/examples/submit/strategy/json-rpc-strategy.yaml +3 -0
  70. package/examples/submit/strategy/json-rpc-timelock-strategy.yaml +17 -0
  71. package/examples/submit/strategy/starknet-json-rpc-chain-strategy.yaml +11 -0
  72. package/examples/submit/transactions/anvil-transactions.yaml +10 -0
  73. package/examples/submit/transactions/avalanche-transactions.json +8 -0
  74. package/examples/submit/transactions/sepolia-transactions.json +8 -0
  75. package/examples/tron-core-config.yaml +18 -0
  76. package/examples/warp-base.yaml +24 -0
  77. package/examples/warp-config-predicate-mainnet.yaml +14 -0
  78. package/examples/warp-deployed-predicate-mainnet.yaml +19 -0
  79. package/examples/warp-ethereum.yaml +19 -0
  80. package/examples/warp-route-deployment.yaml +21 -0
  81. package/package.json +117 -3
@@ -0,0 +1,152 @@
1
+ export const id = 628;
2
+ export const ids = [628];
3
+ export const modules = {
4
+
5
+ /***/ 12628:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ ZKSyncDeployer: () => (/* binding */ ZKSyncDeployer)
10
+ /* harmony export */ });
11
+ /* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(62418);
12
+ /* harmony import */ var zksync_ethers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31671);
13
+ /* harmony import */ var _recoillink_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16639);
14
+ /* harmony import */ var _recoillink_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21387);
15
+ /* harmony import */ var _providers_builders_zksync_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43597);
16
+ /* harmony import */ var _utils_zksync_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68927);
17
+
18
+
19
+
20
+
21
+
22
+ // Local zksync in-memory test node (era-test-node) defaults: chainId 260 on
23
+ // port 8011. Used when a ZKSyncDeployer is constructed without a
24
+ // provider-backed wallet.
25
+ const LOCAL_ZKSYNC_TEST_NODE = {
26
+ name: 'localZkSyncTestNode',
27
+ protocol: _recoillink_utils__WEBPACK_IMPORTED_MODULE_1__/* .ProtocolType */ .Hb.Ethereum,
28
+ chainId: 260,
29
+ domainId: 260,
30
+ rpcUrls: [{ http: 'http://127.0.0.1:8011' }],
31
+ };
32
+ /**
33
+ * Class for deploying contracts to the ZKSync network.
34
+ */
35
+ class ZKSyncDeployer {
36
+ zkWallet;
37
+ deploymentType;
38
+ constructor(zkWallet, deploymentType) {
39
+ this.deploymentType = deploymentType;
40
+ this.zkWallet = zkWallet.connect(zkWallet.provider ?? (0,_providers_builders_zksync_js__WEBPACK_IMPORTED_MODULE_2__/* .defaultZKProviderBuilder */ .T)(LOCAL_ZKSYNC_TEST_NODE));
41
+ }
42
+ /**
43
+ * Loads and validates a ZKSync contract artifact by name
44
+ * @param contractTitle - Contract name or qualified name (sourceName:contractName)
45
+ *
46
+ * @returns The ZKSync artifact
47
+ */
48
+ async loadArtifact(contractTitle) {
49
+ const artifact = await (0,_utils_zksync_js__WEBPACK_IMPORTED_MODULE_3__/* .getZKSyncArtifactByContractName */ .z)(contractTitle);
50
+ (0,_recoillink_utils__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .v)(artifact, `No ZKSync artifact for contract ${contractTitle} found!`);
51
+ return artifact;
52
+ }
53
+ /**
54
+ * Estimates the price of calling a deploy transaction in ETH.
55
+ *
56
+ * @param artifact The previously loaded artifact object.
57
+ * @param constructorArguments List of arguments to be passed to the contract constructor.
58
+ *
59
+ * @returns Calculated fee in ETH wei
60
+ */
61
+ async estimateDeployFee(artifact, constructorArguments) {
62
+ const gas = await this.estimateDeployGas(artifact, constructorArguments);
63
+ const gasPrice = await this.zkWallet.provider.getGasPrice();
64
+ return gas.mul(gasPrice);
65
+ }
66
+ /**
67
+ * Estimates the amount of gas needed to execute a deploy transaction.
68
+ *
69
+ * @param artifact The previously loaded artifact object.
70
+ * @param constructorArguments List of arguments to be passed to the contract constructor.
71
+ *
72
+ * @returns Calculated amount of gas.
73
+ */
74
+ async estimateDeployGas(artifact, constructorArguments) {
75
+ const factoryDeps = await this.extractFactoryDeps(artifact);
76
+ const factory = new zksync_ethers__WEBPACK_IMPORTED_MODULE_0__.ContractFactory(artifact.abi, artifact.bytecode, this.zkWallet, this.deploymentType);
77
+ // Encode deploy transaction so it can be estimated.
78
+ const deployTx = factory.getDeployTransaction(...constructorArguments, {
79
+ customData: {
80
+ factoryDeps,
81
+ },
82
+ });
83
+ deployTx.from = this.zkWallet.address;
84
+ return this.zkWallet.provider.estimateGas(deployTx);
85
+ }
86
+ /**
87
+ * Sends a deploy transaction to the zkSync network.
88
+ * For now, it will use defaults for the transaction parameters:
89
+ * - fee amount is requested automatically from the zkSync server.
90
+ *
91
+ * @param artifact The previously loaded artifact object.
92
+ * @param constructorArguments List of arguments to be passed to the contract constructor.
93
+ * @param overrides Optional object with additional deploy transaction parameters.
94
+ * @param additionalFactoryDeps Additional contract bytecodes to be added to the factory dependencies list.
95
+ *
96
+ * @returns A contract object.
97
+ */
98
+ async deploy(artifact, constructorArguments = [], overrides, additionalFactoryDeps) {
99
+ const baseDeps = await this.extractFactoryDeps(artifact);
100
+ const additionalDeps = additionalFactoryDeps
101
+ ? additionalFactoryDeps.map((val) => ethers__WEBPACK_IMPORTED_MODULE_5__.utils.hexlify(val))
102
+ : [];
103
+ const factoryDeps = [...baseDeps, ...additionalDeps];
104
+ const factory = new zksync_ethers__WEBPACK_IMPORTED_MODULE_0__.ContractFactory(artifact.abi, artifact.bytecode, this.zkWallet, this.deploymentType);
105
+ const { customData, ..._overrides } = overrides ?? {};
106
+ // Encode and send the deploy transaction providing factory dependencies.
107
+ const contract = await factory.deploy(...constructorArguments, {
108
+ ..._overrides,
109
+ customData: {
110
+ ...customData,
111
+ factoryDeps,
112
+ },
113
+ });
114
+ await contract.deployed();
115
+ return contract;
116
+ }
117
+ /**
118
+ * Extracts factory dependencies from the artifact.
119
+ *
120
+ * @param artifact Artifact to extract dependencies from
121
+ *
122
+ * @returns Factory dependencies in the format expected by SDK.
123
+ */
124
+ async extractFactoryDeps(artifact) {
125
+ const visited = new Set();
126
+ visited.add(`${artifact.sourceName}:${artifact.contractName}`);
127
+ return this.extractFactoryDepsRecursive(artifact, visited);
128
+ }
129
+ async extractFactoryDepsRecursive(artifact, visited) {
130
+ // Load all the dependency bytecodes.
131
+ // We transform it into an array of bytecodes.
132
+ const factoryDeps = [];
133
+ for (const dependencyHash in artifact.factoryDeps) {
134
+ if (Object.prototype.hasOwnProperty.call(artifact.factoryDeps, dependencyHash)) {
135
+ const dependencyContract = artifact.factoryDeps[dependencyHash];
136
+ if (!visited.has(dependencyContract)) {
137
+ const dependencyArtifact = await this.loadArtifact(dependencyContract);
138
+ factoryDeps.push(dependencyArtifact.bytecode);
139
+ visited.add(dependencyContract);
140
+ const transitiveDeps = await this.extractFactoryDepsRecursive(dependencyArtifact, visited);
141
+ factoryDeps.push(...transitiveDeps);
142
+ }
143
+ }
144
+ }
145
+ return factoryDeps;
146
+ }
147
+ }
148
+ //# sourceMappingURL=ZKSyncDeployer.js.map
149
+
150
+ /***/ })
151
+
152
+ };
@@ -0,0 +1,86 @@
1
+ export const id = 633;
2
+ export const ids = [633];
3
+ export const modules = {
4
+
5
+ /***/ 70633:
6
+ /***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ __webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ Address: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.pV),
12
+ /* harmony export */ Authorization: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.yR),
13
+ /* harmony export */ BHP1024: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.g4),
14
+ /* harmony export */ BHP256: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.I_),
15
+ /* harmony export */ BHP512: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.$g),
16
+ /* harmony export */ BHP768: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.wl),
17
+ /* harmony export */ Boolean: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.v8),
18
+ /* harmony export */ CallbackQuery: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Mm),
19
+ /* harmony export */ Ciphertext: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.z$),
20
+ /* harmony export */ ComputeKey: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Ji),
21
+ /* harmony export */ DynamicRecord: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.xN),
22
+ /* harmony export */ EncryptionToolkit: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.AU),
23
+ /* harmony export */ Execution: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Zc),
24
+ /* harmony export */ ExecutionRequest: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.US),
25
+ /* harmony export */ ExecutionResponse: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.qp),
26
+ /* harmony export */ Field: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.D0),
27
+ /* harmony export */ GraphKey: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.cm),
28
+ /* harmony export */ Group: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.YJ),
29
+ /* harmony export */ I128: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.tE),
30
+ /* harmony export */ I16: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.pt),
31
+ /* harmony export */ I32: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.jP),
32
+ /* harmony export */ I64: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.uv),
33
+ /* harmony export */ I8: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.I8),
34
+ /* harmony export */ Metadata: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.OS),
35
+ /* harmony export */ OfflineQuery: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.c7),
36
+ /* harmony export */ Pedersen128: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.YS),
37
+ /* harmony export */ Pedersen64: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.L0),
38
+ /* harmony export */ Plaintext: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.wN),
39
+ /* harmony export */ Poseidon2: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.EC),
40
+ /* harmony export */ Poseidon4: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.ER),
41
+ /* harmony export */ Poseidon8: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.En),
42
+ /* harmony export */ PrivateKey: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.ZD),
43
+ /* harmony export */ PrivateKeyCiphertext: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.LW),
44
+ /* harmony export */ Program: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.BP),
45
+ /* harmony export */ ProgramImportsBuilder: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Jb),
46
+ /* harmony export */ ProgramManager: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Ao),
47
+ /* harmony export */ Proof: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Ri),
48
+ /* harmony export */ ProvingKey: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.$7),
49
+ /* harmony export */ ProvingRequest: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.rG),
50
+ /* harmony export */ QueryOption: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.wU),
51
+ /* harmony export */ RecordCiphertext: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.KC),
52
+ /* harmony export */ RecordPlaintext: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.ZF),
53
+ /* harmony export */ Scalar: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.X5),
54
+ /* harmony export */ Signature: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.to),
55
+ /* harmony export */ Transaction: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.ZX),
56
+ /* harmony export */ Transition: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.eB),
57
+ /* harmony export */ U128: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.xQ),
58
+ /* harmony export */ U16: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.R7),
59
+ /* harmony export */ U32: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.vD),
60
+ /* harmony export */ U64: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Em),
61
+ /* harmony export */ U8: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.U8),
62
+ /* harmony export */ Value: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.WT),
63
+ /* harmony export */ VerifyingKey: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.pF),
64
+ /* harmony export */ ViewKey: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.hv),
65
+ /* harmony export */ getMaxProgramImports: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.zF),
66
+ /* harmony export */ getOrInitConsensusVersionTestHeights: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.vy),
67
+ /* harmony export */ initThreadPool: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Fs),
68
+ /* harmony export */ setWasmLogLevel: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.zW),
69
+ /* harmony export */ snarkVerify: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.n1),
70
+ /* harmony export */ snarkVerifyBatch: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.LC),
71
+ /* harmony export */ stringToField: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.zK),
72
+ /* harmony export */ verifyFunctionExecution: () => (/* reexport safe */ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__.Yc)
73
+ /* harmony export */ });
74
+ /* harmony import */ var _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64446);
75
+ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__]);
76
+ _provablehq_wasm_testnet_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
77
+
78
+
79
+ //# sourceMappingURL=wasm-DM2k_rDG.js.map
80
+
81
+ __webpack_async_result__();
82
+ } catch(e) { __webpack_async_result__(e); } });
83
+
84
+ /***/ })
85
+
86
+ };
@@ -0,0 +1,410 @@
1
+ export const id = 697;
2
+ export const ids = [697];
3
+ export const modules = {
4
+
5
+ /***/ 73697:
6
+ /***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ __webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
9
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
+ /* harmony export */ createEvmForkManagerFactory: () => (/* binding */ createEvmForkManagerFactory)
11
+ /* harmony export */ });
12
+ /* unused harmony exports getAnvilCommand, waitForEvmRpcReady, EvmForkManager */
13
+ /* harmony import */ var _ethersproject_providers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(75024);
14
+ /* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(98396);
15
+ /* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30025);
16
+ /* harmony import */ var node_net__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77030);
17
+ /* harmony import */ var _recoillink_forking_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65310);
18
+ /* harmony import */ var _recoillink_sdk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(17023);
19
+ /* harmony import */ var _recoillink_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14918);
20
+ /* harmony import */ var _recoillink_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21387);
21
+ /* harmony import */ var _recoillink_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26400);
22
+ /* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(54321);
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ const LOCAL_HOST = 'http://127.0.0.1';
32
+ // Per-probe RPC timeout so a single hung request fails fast and the bounded
33
+ // readiness loop can continue.
34
+ const RPC_PROBE_TIMEOUT_MS = 5000;
35
+ class RunningEvmFork {
36
+ provider;
37
+ endpoint;
38
+ kill;
39
+ constructor(provider, endpoint, kill) {
40
+ this.provider = provider;
41
+ this.endpoint = endpoint;
42
+ this.kill = kill;
43
+ }
44
+ }
45
+ // The registry currently marks Arc's technicalStack as "other". Match its
46
+ // canonical name and known network IDs so custom metadata names also work.
47
+ const ARC_CHAIN_NAMES = new Set(['arc', 'arctestnet']);
48
+ const ARC_CHAIN_IDS = new Set(['5042', '5042002']);
49
+ function isArcChain(chainName, chainId) {
50
+ return ARC_CHAIN_NAMES.has(chainName) || ARC_CHAIN_IDS.has(String(chainId));
51
+ }
52
+ function getAnvilCommand(config) {
53
+ const isArc = isArcChain(config.chainName, config.chainId);
54
+ return {
55
+ binary: isArc ? 'arc-anvil' : 'anvil',
56
+ args: [
57
+ '--port',
58
+ String(config.port),
59
+ '--chain-id',
60
+ String(config.chainId),
61
+ '--fork-url',
62
+ config.upstreamRpcUrl,
63
+ // Arc derives its block gas limit from protocol configuration and rejects
64
+ // this flag. Keep the existing behavior for other EVM chains.
65
+ ...(!isArc ? ['--disable-block-gas-limit'] : []),
66
+ ],
67
+ };
68
+ }
69
+ function defaultSpawnAnvil(config) {
70
+ const { binary, args } = getAnvilCommand(config);
71
+ return (0,execa__WEBPACK_IMPORTED_MODULE_2__/* .execa */ .Ho)(binary, args);
72
+ }
73
+ /**
74
+ * execa renders the full Anvil command — including the credential-bearing
75
+ * `--fork-url` argument — into its error's message/command fields, and shell-
76
+ * quotes it, so a URL containing a quote survives an exact-string strip. We
77
+ * therefore surface a fixed error derived from none of execa's rendered-command
78
+ * fields, copying only non-command diagnostics so failures stay debuggable.
79
+ * Anvil has no env option for `--fork-url`, so the URL stays in argv (visible to
80
+ * a local-machine `ps` only); this keeps it out of every error we log or rethrow.
81
+ */
82
+ class AnvilStartError extends Error {
83
+ exitCode;
84
+ signal;
85
+ signalDescription;
86
+ code;
87
+ constructor(binary, missingBinary) {
88
+ super(missingBinary && binary === 'arc-anvil'
89
+ ? 'arc-anvil not found on PATH; install Arc Foundry from https://github.com/circlefin/arc-foundry'
90
+ : `${binary} failed to start`);
91
+ this.name = 'AnvilStartError';
92
+ }
93
+ }
94
+ function sanitizeAnvilError(error, config) {
95
+ const binary = getAnvilCommand(config).binary;
96
+ const missingBinary = typeof error === 'object' &&
97
+ error !== null &&
98
+ 'code' in error &&
99
+ error.code === 'ENOENT';
100
+ const sanitized = new AnvilStartError(binary, missingBinary);
101
+ if (typeof error === 'object' && error !== null) {
102
+ if ('exitCode' in error)
103
+ sanitized.exitCode = error.exitCode;
104
+ if ('signal' in error)
105
+ sanitized.signal = error.signal;
106
+ if ('signalDescription' in error) {
107
+ sanitized.signalDescription = error.signalDescription;
108
+ }
109
+ if ('code' in error)
110
+ sanitized.code = error.code;
111
+ }
112
+ return sanitized;
113
+ }
114
+ async function waitForEvmRpcReady(provider, signal, chainName, chainId) {
115
+ await (0,_recoillink_forking_sdk__WEBPACK_IMPORTED_MODULE_1__/* .waitUntilReady */ .bs)(() => (0,_recoillink_utils__WEBPACK_IMPORTED_MODULE_3__/* .timeout */ .wR)(provider.getNetwork(), RPC_PROBE_TIMEOUT_MS, 'anvil readiness probe timed out'), { attempts: 10, baseRetryMs: 500, signal });
116
+ if (isArcChain(chainName, chainId)) {
117
+ const nodeInfo = await (0,_recoillink_utils__WEBPACK_IMPORTED_MODULE_3__/* .timeout */ .wR)(provider.send('anvil_nodeInfo', []), RPC_PROBE_TIMEOUT_MS, 'Arc Anvil mode probe timed out');
118
+ (0,_recoillink_utils__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .v)(typeof nodeInfo === 'object' &&
119
+ nodeInfo !== null &&
120
+ 'network' in nodeInfo &&
121
+ nodeInfo.network === 'arc', 'Arc Anvil did not start in Arc mode');
122
+ }
123
+ }
124
+ const DEFAULT_START_EVM_FORK_DEPS = {
125
+ spawnAnvil: defaultSpawnAnvil,
126
+ waitForReady: waitForEvmRpcReady,
127
+ };
128
+ /**
129
+ * Rejects if `port` on 127.0.0.1 is already bound. A bind-test up front closes
130
+ * the port-collision race: proving RPC health after spawn can otherwise pass
131
+ * against an unrelated node already listening on the port, before our freshly
132
+ * spawned anvil fails with EADDRINUSE.
133
+ */
134
+ async function assertPortAvailable(port) {
135
+ await new Promise((resolve, reject) => {
136
+ const server = (0,node_net__WEBPACK_IMPORTED_MODULE_0__.createServer)();
137
+ server.once('error', (error) => {
138
+ const code = 'code' in error ? error.code : undefined;
139
+ reject(code === 'EADDRINUSE'
140
+ ? new Error(`port ${port} is already in use`)
141
+ : error);
142
+ });
143
+ server.once('listening', () => {
144
+ server.close(() => resolve());
145
+ });
146
+ server.listen(port, '127.0.0.1');
147
+ });
148
+ }
149
+ // A single process-level `exit` hook kills every still-running fork, rather than
150
+ // one listener per fork — which would trip MaxListenersExceededWarning past ten
151
+ // forks and retain each child's closure until process exit. A fork joins the
152
+ // registry on start and leaves when it is killed or its child exits.
153
+ const runningForkKills = new Set();
154
+ let forkExitHookInstalled = false;
155
+ function trackForkExit(killFork) {
156
+ runningForkKills.add(killFork);
157
+ if (!forkExitHookInstalled) {
158
+ forkExitHookInstalled = true;
159
+ process.once('exit', () => {
160
+ for (const kill of Array.from(runningForkKills)) {
161
+ kill();
162
+ }
163
+ });
164
+ }
165
+ return () => {
166
+ runningForkKills.delete(killFork);
167
+ };
168
+ }
169
+ async function startEvmFork(config, deps = DEFAULT_START_EVM_FORK_DEPS) {
170
+ const endpoint = `${LOCAL_HOST}:${config.port}`;
171
+ // Fail fast if the port is taken, before spawning, so we never treat another
172
+ // process's RPC as our fork.
173
+ await assertPortAvailable(config.port);
174
+ let killOnError;
175
+ try {
176
+ let anvilProcess;
177
+ try {
178
+ anvilProcess = deps.spawnAnvil(config);
179
+ }
180
+ catch (error) {
181
+ // A synchronous spawn throw (e.g. execa rejecting an argument that
182
+ // contains a NUL byte) can embed the credential-bearing URL in its
183
+ // message; sanitize it at the source so it never leaks.
184
+ throw sanitizeAnvilError(error, config);
185
+ }
186
+ const onProcessExit = () => {
187
+ void kill(false).catch((error) => (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logDebug */ .MD)(`Failed to kill anvil fork for chain ${config.chainName}`, error));
188
+ };
189
+ const kill = async (isPanicking) => {
190
+ untrackFork();
191
+ anvilProcess.kill(isPanicking ? 'SIGTERM' : 'SIGINT');
192
+ };
193
+ killOnError = kill;
194
+ // Kill this fork if the process exits; drop it from the registry once the
195
+ // child is gone (killed or exited) so a single process-level `exit` hook
196
+ // covers any number of forks without accumulating listeners. Registered
197
+ // before the readiness race so the failure path's kill can untrack it.
198
+ const untrackFork = trackForkExit(onProcessExit);
199
+ void anvilProcess.then(() => untrackFork(), () => untrackFork());
200
+ const provider = new _ethersproject_providers__WEBPACK_IMPORTED_MODULE_6__.JsonRpcProvider(endpoint);
201
+ // Abort the readiness probe the instant the race settles so no retry timer
202
+ // keeps polling a dead port after anvil exits before its RPC is ready.
203
+ const controller = new AbortController();
204
+ const readiness = deps.waitForReady(provider, controller.signal, config.chainName, config.chainId);
205
+ // Reject if anvil exits before its RPC is ready (e.g. the port is already
206
+ // occupied) so we never treat another process's RPC as our fork.
207
+ const exited = anvilProcess.then(() => {
208
+ throw new Error('anvil exited before its RPC was ready');
209
+ }, (error) => {
210
+ throw sanitizeAnvilError(error, config);
211
+ });
212
+ // A later exit (e.g. on kill once readiness has won) must not surface as an
213
+ // unhandled rejection after the race settles.
214
+ exited.catch(() => { });
215
+ try {
216
+ await Promise.race([readiness, exited]);
217
+ }
218
+ finally {
219
+ controller.abort();
220
+ }
221
+ return new RunningEvmFork(provider, endpoint, kill);
222
+ }
223
+ catch (error) {
224
+ // Kill any running anvil process otherwise the process will keep running
225
+ // in the background.
226
+ if (killOnError) {
227
+ await killOnError(true);
228
+ }
229
+ // Both anvil-error sources are sanitized at their source (the synchronous
230
+ // spawn throw above and the async `exited` mapping), so no URL-bearing error
231
+ // reaches here; rethrow verbatim to preserve real readiness/exit messages.
232
+ throw error;
233
+ }
234
+ }
235
+ class EvmForkManager {
236
+ config;
237
+ deps;
238
+ running;
239
+ constructor(config, deps) {
240
+ this.config = config;
241
+ this.deps = deps;
242
+ }
243
+ get requireRunning() {
244
+ const running = this.running;
245
+ (0,_recoillink_utils__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .v)(running, `Fork not started for chain ${this.config.chainName}`);
246
+ return running;
247
+ }
248
+ async start() {
249
+ this.running = await startEvmFork(this.config, this.deps);
250
+ }
251
+ async applyForkConfig(config) {
252
+ const { provider } = this.requireRunning;
253
+ await handleImpersonations(provider, this.config.chainName, config.impersonateAccounts);
254
+ await handleTransactions(provider, this.config.chainName, config.transactions);
255
+ }
256
+ getForkedChainMetadata() {
257
+ return {
258
+ rpcUrls: [{ http: this.requireRunning.endpoint }],
259
+ blocks: { confirmations: 1 },
260
+ };
261
+ }
262
+ kill() {
263
+ void this.running
264
+ ?.kill(false)
265
+ .catch((error) => (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logDebug */ .MD)(`Failed to kill anvil fork for chain ${this.config.chainName}`, error));
266
+ }
267
+ }
268
+ function createEvmForkManagerFactory(multiProvider) {
269
+ return (ctx) => {
270
+ const metadata = multiProvider.getChainMetadata(ctx.chainName);
271
+ return new EvmForkManager({
272
+ chainName: metadata.name,
273
+ chainId: metadata.chainId,
274
+ upstreamRpcUrl: ctx.upstreamRpcUrl,
275
+ port: ctx.port,
276
+ });
277
+ };
278
+ }
279
+ async function handleImpersonations(provider, chainName, accountsToImpersonate) {
280
+ if (accountsToImpersonate.length === 0) {
281
+ return;
282
+ }
283
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Impersonating accounts ${accountsToImpersonate} on chain ${chainName}`);
284
+ await Promise.all(accountsToImpersonate.map((address) => provider.send('anvil_impersonateAccount', [address])));
285
+ }
286
+ async function handleTransactions(provider, chainName, transactions) {
287
+ if (transactions.length === 0) {
288
+ return;
289
+ }
290
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Executing transactions on chain ${chainName}`);
291
+ let txCounter = 0;
292
+ for (const transaction of transactions) {
293
+ const signer = provider.getSigner(transaction.from);
294
+ await provider.send('anvil_setBalance', [
295
+ transaction.from,
296
+ '10000000000000000000',
297
+ ]);
298
+ let calldata;
299
+ if (transaction.data?.type === _recoillink_sdk__WEBPACK_IMPORTED_MODULE_7__/* .TransactionDataType */ .pp.RAW_CALLDATA) {
300
+ calldata = transaction.data.calldata;
301
+ }
302
+ else if (transaction.data?.type === _recoillink_sdk__WEBPACK_IMPORTED_MODULE_7__/* .TransactionDataType */ .pp.SIGNATURE) {
303
+ const functionInterface = new ethers__WEBPACK_IMPORTED_MODULE_8__.ethers.utils.Interface([
304
+ transaction.data.signature,
305
+ ]);
306
+ const [functionName] = Object.keys(functionInterface.functions);
307
+ calldata = functionInterface.encodeFunctionData(functionName, transaction.data.args);
308
+ }
309
+ const annotation = transaction.annotation ?? `#${txCounter}`;
310
+ // Advance once per iteration (before any `continue`) so fallback `#n`
311
+ // annotations stay unique even when a tx short-circuits on a revert assert.
312
+ txCounter++;
313
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Executing transaction on chain ${chainName}: "${annotation}"`);
314
+ let pendingTx;
315
+ try {
316
+ pendingTx = await signer.sendTransaction({
317
+ to: transaction.to,
318
+ data: calldata,
319
+ value: transaction.value,
320
+ });
321
+ }
322
+ catch (error) {
323
+ const reason = getRevertReason(error);
324
+ if (reason && transaction.revertAssertion) {
325
+ assertRevert(transaction.revertAssertion, reason, {
326
+ chainName: chainName,
327
+ transactionAnnotation: annotation,
328
+ });
329
+ continue;
330
+ }
331
+ // New unhandled error
332
+ throw error;
333
+ }
334
+ const txReceipt = await pendingTx.wait();
335
+ if (txReceipt.status == 0) {
336
+ throw new Error(`Transaction "${annotation}" reverted on chain ${chainName}`);
337
+ }
338
+ transaction.eventAssertions.forEach((eventAssertion, idx) => assertEvent(eventAssertion, txReceipt.logs, {
339
+ chainName: chainName,
340
+ assertionIdx: idx,
341
+ transactionAnnotation: annotation,
342
+ }));
343
+ if (transaction.timeSkip) {
344
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Forwarding time by "${transaction.timeSkip}" seconds on chain ${chainName}`);
345
+ await provider.send('evm_increaseTime', [transaction.timeSkip]);
346
+ }
347
+ }
348
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Successfully executed all transactions on chain ${chainName}`);
349
+ }
350
+ function getRevertReason(error) {
351
+ if (typeof error === 'object' &&
352
+ error !== null &&
353
+ 'reason' in error &&
354
+ typeof error.reason === 'string') {
355
+ return error.reason;
356
+ }
357
+ return undefined;
358
+ }
359
+ function assertRevert(revertAssertion, reason, meta) {
360
+ // If contract call reverts, then there should be a reason
361
+ // https://github.com/ethers-io/ethers.js/blob/v5.7/packages/providers/src.ts/json-rpc-provider.ts#L79
362
+ if (reason !== revertAssertion.reason) {
363
+ throw new Error(`Expected revert: ${revertAssertion.reason} does not match ${reason}`);
364
+ }
365
+ const annotation = revertAssertion.annotation ?? revertAssertion.type;
366
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Successfully completed revert assertion on chain "${meta.chainName}" and transaction "${meta.transactionAnnotation}": "${annotation}"`);
367
+ }
368
+ function assertEvent(eventAssertion, rawLogs, meta) {
369
+ const [rawLog] = rawLogs.filter((rawLog) => eventAssertion.type === _recoillink_sdk__WEBPACK_IMPORTED_MODULE_7__/* .EventAssertionType */ .l.RAW_TOPIC
370
+ ? assertEventByTopic(eventAssertion, rawLog)
371
+ : assertEventBySignature(eventAssertion, rawLog));
372
+ if (!rawLog) {
373
+ throw new Error(`Log ${eventAssertion.type === _recoillink_sdk__WEBPACK_IMPORTED_MODULE_7__/* .EventAssertionType */ .l.RAW_TOPIC
374
+ ? eventAssertion.topic
375
+ : eventAssertion.signature} not found in transaction!`);
376
+ }
377
+ const annotation = eventAssertion.annotation ?? `#${meta.assertionIdx}`;
378
+ (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Successfully completed assertion on chain "${meta.chainName}" and transaction "${meta.transactionAnnotation}": "${annotation}"`);
379
+ }
380
+ function assertEventByTopic(eventAssertion, rawLog) {
381
+ return rawLog.topics[0] === eventAssertion.topic;
382
+ }
383
+ function assertEventBySignature(eventAssertion, rawLog) {
384
+ const eventInterface = new ethers__WEBPACK_IMPORTED_MODULE_8__.ethers.utils.Interface([eventAssertion.signature]);
385
+ let parsedLog;
386
+ // parseLog throws if the event cannot be decoded
387
+ try {
388
+ parsedLog = eventInterface.parseLog(rawLog);
389
+ if (!parsedLog) {
390
+ return false;
391
+ }
392
+ }
393
+ catch {
394
+ return false;
395
+ }
396
+ if (!eventAssertion.args) {
397
+ return true;
398
+ }
399
+ const logArgs = parsedLog.args
400
+ .slice(0, eventAssertion.args.length)
401
+ .map((arg) => String(arg));
402
+ return (0,_recoillink_utils__WEBPACK_IMPORTED_MODULE_9__/* .deepEquals */ .c2)(logArgs, eventAssertion.args);
403
+ }
404
+ //# sourceMappingURL=EvmForkManager.js.map
405
+ __webpack_async_result__();
406
+ } catch(e) { __webpack_async_result__(e); } });
407
+
408
+ /***/ })
409
+
410
+ };