moonwall 1.0.0-dev.0

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 (301) hide show
  1. package/LICENSE +681 -0
  2. package/README.md +54 -0
  3. package/config_schema.json +811 -0
  4. package/dist/api/constants/accounts.d.ts +36 -0
  5. package/dist/api/constants/accounts.d.ts.map +1 -0
  6. package/dist/api/constants/accounts.js +67 -0
  7. package/dist/api/constants/chain.d.ts +134 -0
  8. package/dist/api/constants/chain.d.ts.map +1 -0
  9. package/dist/api/constants/chain.js +149 -0
  10. package/dist/api/constants/index.d.ts +4 -0
  11. package/dist/api/constants/index.d.ts.map +1 -0
  12. package/dist/api/constants/index.js +3 -0
  13. package/dist/api/constants/smartContract.d.ts +29 -0
  14. package/dist/api/constants/smartContract.d.ts.map +1 -0
  15. package/dist/api/constants/smartContract.js +118 -0
  16. package/dist/api/testing/blocks.d.ts +59 -0
  17. package/dist/api/testing/blocks.d.ts.map +1 -0
  18. package/dist/api/testing/blocks.js +147 -0
  19. package/dist/api/testing/contracts.d.ts +5 -0
  20. package/dist/api/testing/contracts.d.ts.map +1 -0
  21. package/dist/api/testing/contracts.js +32 -0
  22. package/dist/api/testing/ethers.d.ts +3 -0
  23. package/dist/api/testing/ethers.d.ts.map +1 -0
  24. package/dist/api/testing/ethers.js +38 -0
  25. package/dist/api/testing/events.d.ts +12 -0
  26. package/dist/api/testing/events.d.ts.map +1 -0
  27. package/dist/api/testing/events.js +23 -0
  28. package/dist/api/testing/extrinsics.d.ts +5 -0
  29. package/dist/api/testing/extrinsics.d.ts.map +1 -0
  30. package/dist/api/testing/extrinsics.js +10 -0
  31. package/dist/api/testing/index.d.ts +9 -0
  32. package/dist/api/testing/index.d.ts.map +1 -0
  33. package/dist/api/testing/index.js +8 -0
  34. package/dist/api/testing/jumping.d.ts +8 -0
  35. package/dist/api/testing/jumping.d.ts.map +1 -0
  36. package/dist/api/testing/jumping.js +78 -0
  37. package/dist/api/testing/providers.d.ts +18 -0
  38. package/dist/api/testing/providers.d.ts.map +1 -0
  39. package/dist/api/testing/providers.js +34 -0
  40. package/dist/api/testing/viem.d.ts +139 -0
  41. package/dist/api/testing/viem.d.ts.map +1 -0
  42. package/dist/api/testing/viem.js +247 -0
  43. package/dist/api/types/config.d.ts +609 -0
  44. package/dist/api/types/config.d.ts.map +1 -0
  45. package/dist/api/types/config.js +1 -0
  46. package/dist/api/types/context.d.ts +125 -0
  47. package/dist/api/types/context.d.ts.map +1 -0
  48. package/dist/api/types/context.js +1 -0
  49. package/dist/api/types/contracts.d.ts +66 -0
  50. package/dist/api/types/contracts.d.ts.map +1 -0
  51. package/dist/api/types/contracts.js +1 -0
  52. package/dist/api/types/eth.d.ts +3 -0
  53. package/dist/api/types/eth.d.ts.map +1 -0
  54. package/dist/api/types/eth.js +1 -0
  55. package/dist/api/types/foundations.d.ts +11 -0
  56. package/dist/api/types/foundations.d.ts.map +1 -0
  57. package/dist/api/types/foundations.js +1 -0
  58. package/dist/api/types/helpers.d.ts +7 -0
  59. package/dist/api/types/helpers.d.ts.map +1 -0
  60. package/dist/api/types/helpers.js +1 -0
  61. package/dist/api/types/index.d.ts +8 -0
  62. package/dist/api/types/index.d.ts.map +1 -0
  63. package/dist/api/types/index.js +7 -0
  64. package/dist/api/types/runner.d.ts +490 -0
  65. package/dist/api/types/runner.d.ts.map +1 -0
  66. package/dist/api/types/runner.js +1 -0
  67. package/dist/cli/cmds/components/LogViewer.d.ts +17 -0
  68. package/dist/cli/cmds/components/LogViewer.d.ts.map +1 -0
  69. package/dist/cli/cmds/components/LogViewer.js +171 -0
  70. package/dist/cli/cmds/entrypoint.d.ts +6 -0
  71. package/dist/cli/cmds/entrypoint.d.ts.map +1 -0
  72. package/dist/cli/cmds/entrypoint.js +192 -0
  73. package/dist/cli/cmds/interactiveCmds/chopsticksIntCmds.d.ts +2 -0
  74. package/dist/cli/cmds/interactiveCmds/chopsticksIntCmds.d.ts.map +1 -0
  75. package/dist/cli/cmds/interactiveCmds/chopsticksIntCmds.js +117 -0
  76. package/dist/cli/cmds/interactiveCmds/devIntCmds.d.ts +2 -0
  77. package/dist/cli/cmds/interactiveCmds/devIntCmds.d.ts.map +1 -0
  78. package/dist/cli/cmds/interactiveCmds/devIntCmds.js +103 -0
  79. package/dist/cli/cmds/interactiveCmds/index.d.ts +4 -0
  80. package/dist/cli/cmds/interactiveCmds/index.d.ts.map +1 -0
  81. package/dist/cli/cmds/interactiveCmds/index.js +3 -0
  82. package/dist/cli/cmds/interactiveCmds/zombieIntCmds.d.ts +2 -0
  83. package/dist/cli/cmds/interactiveCmds/zombieIntCmds.d.ts.map +1 -0
  84. package/dist/cli/cmds/interactiveCmds/zombieIntCmds.js +32 -0
  85. package/dist/cli/cmds/main.d.ts +2 -0
  86. package/dist/cli/cmds/main.d.ts.map +1 -0
  87. package/dist/cli/cmds/main.js +336 -0
  88. package/dist/cli/cmds/runNetwork.d.ts +3 -0
  89. package/dist/cli/cmds/runNetwork.d.ts.map +1 -0
  90. package/dist/cli/cmds/runNetwork.js +292 -0
  91. package/dist/cli/cmds/runTests.d.ts +12 -0
  92. package/dist/cli/cmds/runTests.d.ts.map +1 -0
  93. package/dist/cli/cmds/runTests.js +257 -0
  94. package/dist/cli/internal/cmdFunctions/downloader.d.ts +4 -0
  95. package/dist/cli/internal/cmdFunctions/downloader.d.ts.map +1 -0
  96. package/dist/cli/internal/cmdFunctions/downloader.js +49 -0
  97. package/dist/cli/internal/cmdFunctions/fetchArtifact.d.ts +10 -0
  98. package/dist/cli/internal/cmdFunctions/fetchArtifact.d.ts.map +1 -0
  99. package/dist/cli/internal/cmdFunctions/fetchArtifact.js +145 -0
  100. package/dist/cli/internal/cmdFunctions/index.d.ts +5 -0
  101. package/dist/cli/internal/cmdFunctions/index.d.ts.map +1 -0
  102. package/dist/cli/internal/cmdFunctions/index.js +4 -0
  103. package/dist/cli/internal/cmdFunctions/initialisation.d.ts +20 -0
  104. package/dist/cli/internal/cmdFunctions/initialisation.d.ts.map +1 -0
  105. package/dist/cli/internal/cmdFunctions/initialisation.js +150 -0
  106. package/dist/cli/internal/cmdFunctions/tempLogs.d.ts +3 -0
  107. package/dist/cli/internal/cmdFunctions/tempLogs.d.ts.map +1 -0
  108. package/dist/cli/internal/cmdFunctions/tempLogs.js +37 -0
  109. package/dist/cli/internal/commandParsers.d.ts +59 -0
  110. package/dist/cli/internal/commandParsers.d.ts.map +1 -0
  111. package/dist/cli/internal/commandParsers.js +305 -0
  112. package/dist/cli/internal/deriveTestIds.d.ts +8 -0
  113. package/dist/cli/internal/deriveTestIds.d.ts.map +1 -0
  114. package/dist/cli/internal/deriveTestIds.js +123 -0
  115. package/dist/cli/internal/effect/index.d.ts +6 -0
  116. package/dist/cli/internal/effect/index.d.ts.map +1 -0
  117. package/dist/cli/internal/effect/index.js +5 -0
  118. package/dist/cli/internal/fileCheckers.d.ts +11 -0
  119. package/dist/cli/internal/fileCheckers.d.ts.map +1 -0
  120. package/dist/cli/internal/fileCheckers.js +165 -0
  121. package/dist/cli/internal/foundations/index.d.ts +4 -0
  122. package/dist/cli/internal/foundations/index.d.ts.map +1 -0
  123. package/dist/cli/internal/foundations/index.js +4 -0
  124. package/dist/cli/internal/index.d.ts +12 -0
  125. package/dist/cli/internal/index.d.ts.map +1 -0
  126. package/dist/cli/internal/index.js +11 -0
  127. package/dist/cli/internal/launcherCommon.d.ts +4 -0
  128. package/dist/cli/internal/launcherCommon.d.ts.map +1 -0
  129. package/dist/cli/internal/launcherCommon.js +130 -0
  130. package/dist/cli/internal/localNode.d.ts +16 -0
  131. package/dist/cli/internal/localNode.d.ts.map +1 -0
  132. package/dist/cli/internal/localNode.js +362 -0
  133. package/dist/cli/internal/logging.d.ts +2 -0
  134. package/dist/cli/internal/logging.d.ts.map +1 -0
  135. package/dist/cli/internal/logging.js +26 -0
  136. package/dist/cli/internal/node.d.ts +33 -0
  137. package/dist/cli/internal/node.d.ts.map +1 -0
  138. package/dist/cli/internal/node.js +228 -0
  139. package/dist/cli/internal/processHelpers.d.ts +17 -0
  140. package/dist/cli/internal/processHelpers.d.ts.map +1 -0
  141. package/dist/cli/internal/processHelpers.js +56 -0
  142. package/dist/cli/internal/providerFactories.d.ts +48 -0
  143. package/dist/cli/internal/providerFactories.d.ts.map +1 -0
  144. package/dist/cli/internal/providerFactories.js +442 -0
  145. package/dist/cli/internal/testIdParser.d.ts +34 -0
  146. package/dist/cli/internal/testIdParser.d.ts.map +1 -0
  147. package/dist/cli/internal/testIdParser.js +167 -0
  148. package/dist/cli/lib/binariesHelpers.d.ts +15 -0
  149. package/dist/cli/lib/binariesHelpers.d.ts.map +1 -0
  150. package/dist/cli/lib/binariesHelpers.js +99 -0
  151. package/dist/cli/lib/configReader.d.ts +8 -0
  152. package/dist/cli/lib/configReader.d.ts.map +1 -0
  153. package/dist/cli/lib/configReader.js +115 -0
  154. package/dist/cli/lib/contractFunctions.d.ts +2 -0
  155. package/dist/cli/lib/contractFunctions.d.ts.map +1 -0
  156. package/dist/cli/lib/contractFunctions.js +2 -0
  157. package/dist/cli/lib/globalContext.d.ts +46 -0
  158. package/dist/cli/lib/globalContext.d.ts.map +1 -0
  159. package/dist/cli/lib/globalContext.js +710 -0
  160. package/dist/cli/lib/governanceProcedures.d.ts +27 -0
  161. package/dist/cli/lib/governanceProcedures.d.ts.map +1 -0
  162. package/dist/cli/lib/governanceProcedures.js +458 -0
  163. package/dist/cli/lib/handlers/index.d.ts +5 -0
  164. package/dist/cli/lib/handlers/index.d.ts.map +1 -0
  165. package/dist/cli/lib/handlers/index.js +5 -0
  166. package/dist/cli/lib/repoDefinitions/index.d.ts +6 -0
  167. package/dist/cli/lib/repoDefinitions/index.d.ts.map +1 -0
  168. package/dist/cli/lib/repoDefinitions/index.js +21 -0
  169. package/dist/cli/lib/repoDefinitions/moonbeam.d.ts +4 -0
  170. package/dist/cli/lib/repoDefinitions/moonbeam.d.ts.map +1 -0
  171. package/dist/cli/lib/repoDefinitions/moonbeam.js +30 -0
  172. package/dist/cli/lib/repoDefinitions/polkadot.d.ts +4 -0
  173. package/dist/cli/lib/repoDefinitions/polkadot.d.ts.map +1 -0
  174. package/dist/cli/lib/repoDefinitions/polkadot.js +11 -0
  175. package/dist/cli/lib/repoDefinitions/tanssi.d.ts +4 -0
  176. package/dist/cli/lib/repoDefinitions/tanssi.d.ts.map +1 -0
  177. package/dist/cli/lib/repoDefinitions/tanssi.js +14 -0
  178. package/dist/cli/lib/rpcFunctions.d.ts +2 -0
  179. package/dist/cli/lib/rpcFunctions.d.ts.map +1 -0
  180. package/dist/cli/lib/rpcFunctions.js +26 -0
  181. package/dist/cli/lib/runnerContext.d.ts +32 -0
  182. package/dist/cli/lib/runnerContext.d.ts.map +1 -0
  183. package/dist/cli/lib/runnerContext.js +156 -0
  184. package/dist/cli/lib/shardManager.d.ts +40 -0
  185. package/dist/cli/lib/shardManager.d.ts.map +1 -0
  186. package/dist/cli/lib/shardManager.js +80 -0
  187. package/dist/cli/lib/upgradeProcedures.d.ts +5 -0
  188. package/dist/cli/lib/upgradeProcedures.d.ts.map +1 -0
  189. package/dist/cli/lib/upgradeProcedures.js +221 -0
  190. package/dist/cli.d.ts +4 -0
  191. package/dist/cli.d.ts.map +1 -0
  192. package/dist/cli.js +3 -0
  193. package/dist/contracts/contractInteraction.d.ts +17 -0
  194. package/dist/contracts/contractInteraction.d.ts.map +1 -0
  195. package/dist/contracts/contractInteraction.js +170 -0
  196. package/dist/contracts/index.d.ts +2 -0
  197. package/dist/contracts/index.d.ts.map +1 -0
  198. package/dist/contracts/index.js +1 -0
  199. package/dist/foundations/chopsticks/handler.d.ts +3 -0
  200. package/dist/foundations/chopsticks/handler.d.ts.map +1 -0
  201. package/dist/foundations/chopsticks/handler.js +93 -0
  202. package/dist/foundations/chopsticks/helpers.d.ts +27 -0
  203. package/dist/foundations/chopsticks/helpers.d.ts.map +1 -0
  204. package/dist/foundations/chopsticks/helpers.js +133 -0
  205. package/dist/foundations/dev/handler.d.ts +3 -0
  206. package/dist/foundations/dev/handler.d.ts.map +1 -0
  207. package/dist/foundations/dev/handler.js +136 -0
  208. package/dist/foundations/dev/helpers.d.ts +27 -0
  209. package/dist/foundations/dev/helpers.d.ts.map +1 -0
  210. package/dist/foundations/dev/helpers.js +161 -0
  211. package/dist/foundations/read-only/handler.d.ts +3 -0
  212. package/dist/foundations/read-only/handler.d.ts.map +1 -0
  213. package/dist/foundations/read-only/handler.js +32 -0
  214. package/dist/foundations/zombie/handler.d.ts +3 -0
  215. package/dist/foundations/zombie/handler.d.ts.map +1 -0
  216. package/dist/foundations/zombie/handler.js +92 -0
  217. package/dist/foundations/zombie/helpers.d.ts +16 -0
  218. package/dist/foundations/zombie/helpers.d.ts.map +1 -0
  219. package/dist/foundations/zombie/helpers.js +97 -0
  220. package/dist/index.d.ts +17 -0
  221. package/dist/index.d.ts.map +1 -0
  222. package/dist/index.js +47 -0
  223. package/dist/internal/common.d.ts +3 -0
  224. package/dist/internal/common.d.ts.map +1 -0
  225. package/dist/internal/common.js +41 -0
  226. package/dist/internal/index.d.ts +4 -0
  227. package/dist/internal/index.d.ts.map +1 -0
  228. package/dist/internal/index.js +3 -0
  229. package/dist/internal/logger.d.ts +24 -0
  230. package/dist/internal/logger.d.ts.map +1 -0
  231. package/dist/internal/logger.js +66 -0
  232. package/dist/internal/logging.d.ts +7 -0
  233. package/dist/internal/logging.d.ts.map +1 -0
  234. package/dist/internal/logging.js +36 -0
  235. package/dist/moondebug.d.ts +3 -0
  236. package/dist/moondebug.d.ts.map +1 -0
  237. package/dist/moondebug.js +2 -0
  238. package/dist/services/cache/FileLock.d.ts +11 -0
  239. package/dist/services/cache/FileLock.d.ts.map +1 -0
  240. package/dist/services/cache/FileLock.js +68 -0
  241. package/dist/services/cache/StartupCacheService.d.ts +23 -0
  242. package/dist/services/cache/StartupCacheService.d.ts.map +1 -0
  243. package/dist/services/cache/StartupCacheService.js +159 -0
  244. package/dist/services/cache/index.d.ts +3 -0
  245. package/dist/services/cache/index.d.ts.map +1 -0
  246. package/dist/services/cache/index.js +2 -0
  247. package/dist/services/chopsticks/ChopsticksMultiChain.d.ts +158 -0
  248. package/dist/services/chopsticks/ChopsticksMultiChain.d.ts.map +1 -0
  249. package/dist/services/chopsticks/ChopsticksMultiChain.js +282 -0
  250. package/dist/services/chopsticks/ChopsticksService.d.ts +313 -0
  251. package/dist/services/chopsticks/ChopsticksService.d.ts.map +1 -0
  252. package/dist/services/chopsticks/ChopsticksService.js +77 -0
  253. package/dist/services/chopsticks/chopsticksConfigParser.d.ts +40 -0
  254. package/dist/services/chopsticks/chopsticksConfigParser.d.ts.map +1 -0
  255. package/dist/services/chopsticks/chopsticksConfigParser.js +201 -0
  256. package/dist/services/chopsticks/index.d.ts +5 -0
  257. package/dist/services/chopsticks/index.d.ts.map +1 -0
  258. package/dist/services/chopsticks/index.js +4 -0
  259. package/dist/services/chopsticks/launchChopsticksEffect.d.ts +225 -0
  260. package/dist/services/chopsticks/launchChopsticksEffect.d.ts.map +1 -0
  261. package/dist/services/chopsticks/launchChopsticksEffect.js +623 -0
  262. package/dist/services/config/configAccessors.d.ts +41 -0
  263. package/dist/services/config/configAccessors.d.ts.map +1 -0
  264. package/dist/services/config/configAccessors.js +149 -0
  265. package/dist/services/config/index.d.ts +2 -0
  266. package/dist/services/config/index.d.ts.map +1 -0
  267. package/dist/services/config/index.js +1 -0
  268. package/dist/services/errors.d.ts +72 -0
  269. package/dist/services/errors.d.ts.map +1 -0
  270. package/dist/services/errors.js +31 -0
  271. package/dist/services/index.d.ts +7 -0
  272. package/dist/services/index.d.ts.map +1 -0
  273. package/dist/services/index.js +6 -0
  274. package/dist/services/network/NodeReadinessService.d.ts +35 -0
  275. package/dist/services/network/NodeReadinessService.d.ts.map +1 -0
  276. package/dist/services/network/NodeReadinessService.js +120 -0
  277. package/dist/services/network/PortDiscoveryService.d.ts +22 -0
  278. package/dist/services/network/PortDiscoveryService.d.ts.map +1 -0
  279. package/dist/services/network/PortDiscoveryService.js +77 -0
  280. package/dist/services/network/RpcPortDiscoveryService.d.ts +25 -0
  281. package/dist/services/network/RpcPortDiscoveryService.d.ts.map +1 -0
  282. package/dist/services/network/RpcPortDiscoveryService.js +136 -0
  283. package/dist/services/network/index.d.ts +4 -0
  284. package/dist/services/network/index.d.ts.map +1 -0
  285. package/dist/services/network/index.js +3 -0
  286. package/dist/services/process/ProcessManagerService.d.ts +49 -0
  287. package/dist/services/process/ProcessManagerService.d.ts.map +1 -0
  288. package/dist/services/process/ProcessManagerService.js +162 -0
  289. package/dist/services/process/index.d.ts +3 -0
  290. package/dist/services/process/index.d.ts.map +1 -0
  291. package/dist/services/process/index.js +2 -0
  292. package/dist/services/process/launchNodeEffect.d.ts +40 -0
  293. package/dist/services/process/launchNodeEffect.d.ts.map +1 -0
  294. package/dist/services/process/launchNodeEffect.js +86 -0
  295. package/dist/util/functions/index.d.ts +3 -0
  296. package/dist/util/functions/index.d.ts.map +1 -0
  297. package/dist/util/functions/index.js +4 -0
  298. package/dist/util/index.d.ts +4 -0
  299. package/dist/util/index.d.ts.map +1 -0
  300. package/dist/util/index.js +2 -0
  301. package/package.json +157 -0
@@ -0,0 +1,26 @@
1
+ import { vitestAutoUrl } from "../internal/providerFactories.js";
2
+ import { getEnvironmentFromConfig } from "./configReader.js";
3
+ import { normalizeUrlToHttps } from "../../util/index.js";
4
+ export async function customDevRpcRequest(method, params = []) {
5
+ const env = getEnvironmentFromConfig();
6
+ const endpoint = normalizeUrlToHttps(env.connections ? env.connections[0].endpoints[0] : vitestAutoUrl());
7
+ const data = {
8
+ jsonrpc: "2.0",
9
+ id: 1,
10
+ method,
11
+ params,
12
+ };
13
+ if (endpoint.startsWith("ws")) {
14
+ console.log("you've passed a websocket to fetch, is this intended?");
15
+ }
16
+ const response = await fetch(endpoint, {
17
+ method: "POST",
18
+ body: JSON.stringify(data),
19
+ headers: { "Content-Type": "application/json" },
20
+ });
21
+ const responseData = (await response.json());
22
+ if (responseData.error) {
23
+ throw new Error(responseData.error.message);
24
+ }
25
+ return responseData.result;
26
+ }
@@ -0,0 +1,32 @@
1
+ import type { FoundationType, ITestSuiteType } from "../../api/types/index.js";
2
+ /**
3
+ * * Defines a suite of tests based on provided parameters.
4
+ *
5
+ * @param {object} params - The setup parameters for the test suite.
6
+ * @param {string} params.id - A unique identifier for the test suite (e.g. D03).
7
+ * @param {string} params.title - The title of the test suite (e.g. 'Fee calculation: congestion handling').
8
+ * @param {function} params.testCases - A callback function that houses the individual test cases of this suite.
9
+ * @param {string} params.foundationMethods - Explicitly specify which foundation these tests will run against reveal which methods to make available.
10
+ * @param {number} [params.minRtVersion] - The minimum runtime version required for the test suite, otherwise will be skipped.
11
+ * @param {string} [params.chainType] - The required runtime name required for the test suite, otherwise will be skipped.
12
+ * @param {string} [params.notChainType] - The runtime name to not run against this test suite, otherwise will not be skipped.
13
+ *
14
+ * @returns {void} - No explicit return value, this function results is wrapped and handled by the vitest instance.
15
+ * @example
16
+ * describeSuite({
17
+ * id: "D01",
18
+ * title: "Sample test suite",
19
+ * foundationMethods: "dev",
20
+ * testCases: ({ it, context, log }) => {
21
+ * it({
22
+ * id: "T01",
23
+ * title: "Sample test case",
24
+ * testds: async function () {
25
+ * expect(true).to.be.true;
26
+ * },
27
+ * });
28
+ * },
29
+ * });
30
+ */
31
+ export declare function describeSuite<T extends FoundationType>({ id: suiteId, title, testCases, foundationMethods, minRtVersion, chainType, notChainType, options, }: ITestSuiteType<T>): void;
32
+ //# sourceMappingURL=runnerContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerContext.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/runnerContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EAGd,cAAc,EAOf,iCAAiC;AAmBlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,EACtD,EAAE,EAAE,OAAO,EACX,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,OAAO,GACR,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CA6G1B"}
@@ -0,0 +1,156 @@
1
+ import Bottleneck from "bottleneck";
2
+ import { createLogger } from "../../util/index.js";
3
+ import { afterAll, beforeAll, describe, it } from "vitest";
4
+ import { getEnvironmentFromConfig } from "./configReader.js";
5
+ import { MoonwallContext, contextCreator } from "./globalContext.js";
6
+ import { chopsticksHandler, devHandler, readOnlyHandler, zombieHandler } from "./handlers/index.js";
7
+ const RT_VERSION = Number(process.env.MOON_RTVERSION);
8
+ const RT_NAME = process.env.MOON_RTNAME;
9
+ let limiter;
10
+ // About: This has been designed in the handler pattern so that eventually we can integrate it to vitest
11
+ // https://vitest.dev/advanced/runner.html
12
+ /**
13
+ * * Defines a suite of tests based on provided parameters.
14
+ *
15
+ * @param {object} params - The setup parameters for the test suite.
16
+ * @param {string} params.id - A unique identifier for the test suite (e.g. D03).
17
+ * @param {string} params.title - The title of the test suite (e.g. 'Fee calculation: congestion handling').
18
+ * @param {function} params.testCases - A callback function that houses the individual test cases of this suite.
19
+ * @param {string} params.foundationMethods - Explicitly specify which foundation these tests will run against reveal which methods to make available.
20
+ * @param {number} [params.minRtVersion] - The minimum runtime version required for the test suite, otherwise will be skipped.
21
+ * @param {string} [params.chainType] - The required runtime name required for the test suite, otherwise will be skipped.
22
+ * @param {string} [params.notChainType] - The runtime name to not run against this test suite, otherwise will not be skipped.
23
+ *
24
+ * @returns {void} - No explicit return value, this function results is wrapped and handled by the vitest instance.
25
+ * @example
26
+ * describeSuite({
27
+ * id: "D01",
28
+ * title: "Sample test suite",
29
+ * foundationMethods: "dev",
30
+ * testCases: ({ it, context, log }) => {
31
+ * it({
32
+ * id: "T01",
33
+ * title: "Sample test case",
34
+ * testds: async function () {
35
+ * expect(true).to.be.true;
36
+ * },
37
+ * });
38
+ * },
39
+ * });
40
+ */
41
+ export function describeSuite({ id: suiteId, title, testCases, foundationMethods, minRtVersion, chainType, notChainType, options, }) {
42
+ if ((minRtVersion && minRtVersion > RT_VERSION) ||
43
+ (chainType && chainType !== RT_NAME) ||
44
+ (notChainType && notChainType === RT_NAME)) {
45
+ describe.skip(`🗃️ ${suiteId} ${title}`);
46
+ return;
47
+ }
48
+ let ctx = null;
49
+ const logger = createLogger({ name: suiteId });
50
+ beforeAll(async () => {
51
+ const env = getEnvironmentFromConfig();
52
+ ctx = env.foundation.type === "dev" ? await contextCreator(options) : await contextCreator();
53
+ if (env.foundation.type === "read_only") {
54
+ const settings = loadParams(env.foundation.launchSpec);
55
+ limiter = new Bottleneck(settings);
56
+ }
57
+ });
58
+ afterAll(async () => {
59
+ // The termination reason will be set by the test runner or signal handlers
60
+ // Default to "tests finished" if not set explicitly
61
+ const reason = global.MOONWALL_TERMINATION_REASON || "tests finished";
62
+ await MoonwallContext.destroy(reason);
63
+ ctx = null;
64
+ });
65
+ const testCase = (params) => {
66
+ if (params.modifier) {
67
+ it[params.modifier](`📁 ${suiteId.concat(params.id)} ${params.title}`, params.test, params.timeout);
68
+ return;
69
+ }
70
+ if ((params.minRtVersion && params.minRtVersion > RT_VERSION) ||
71
+ (params.chainType && params.chainType !== RT_NAME) ||
72
+ (params.notChainType && params.notChainType === RT_NAME)) {
73
+ it.skip(`📁 ${suiteId.concat(params.id)} ${params.title}`, params.test, params.timeout);
74
+ return;
75
+ }
76
+ it(`📁 ${suiteId.concat(params.id)} ${params.title}`, params.test, params.timeout);
77
+ };
78
+ describe(`🗃️ ${suiteId} ${title}`, () => {
79
+ const getApi = (apiType, apiName) => {
80
+ if (!ctx) {
81
+ throw new Error("Context not initialized");
82
+ }
83
+ const provider = ctx.providers.find((prov) => {
84
+ if (apiType && apiName) {
85
+ return prov.type === apiType && prov.name === apiName;
86
+ }
87
+ if (apiType && !apiName) {
88
+ return prov.type === apiType;
89
+ }
90
+ if (!apiType && apiName) {
91
+ return prov.name === apiName;
92
+ }
93
+ return false;
94
+ });
95
+ if (!provider) {
96
+ throw new Error(`API of type ${apiType} ${apiName ? `and name ${apiName}` : ""} could not be found`);
97
+ }
98
+ return !limiter
99
+ ? provider.api
100
+ : scheduleWithBottleneck(provider.api);
101
+ };
102
+ const context = {
103
+ api: (type, name) => getApi(type, name),
104
+ viem: (apiName) => getApi("viem", apiName),
105
+ polkadotJs: (apiName) => getApi("polkadotJs", apiName),
106
+ ethers: (apiName) => getApi("ethers", apiName),
107
+ web3: (apiName) => getApi("web3", apiName),
108
+ papi: (apiName) => getApi("papi", apiName),
109
+ };
110
+ const foundationHandlers = {
111
+ dev: devHandler,
112
+ chopsticks: chopsticksHandler,
113
+ zombie: zombieHandler,
114
+ read_only: readOnlyHandler,
115
+ };
116
+ const handler = foundationHandlers[foundationMethods];
117
+ if (!handler) {
118
+ throw new Error(`Unsupported foundation methods: ${foundationMethods}`);
119
+ }
120
+ handler({
121
+ testCases: testCases,
122
+ context,
123
+ testCase,
124
+ logger,
125
+ ctx,
126
+ });
127
+ });
128
+ }
129
+ const loadParams = (config) => {
130
+ const defaultParams = { maxConcurrent: 5, minTime: 100 };
131
+ if (!config || config.rateLimiter === undefined || config.rateLimiter === true) {
132
+ return defaultParams;
133
+ }
134
+ if (config.rateLimiter === false) {
135
+ return {};
136
+ }
137
+ if (typeof config.rateLimiter === "object") {
138
+ return config.rateLimiter;
139
+ }
140
+ };
141
+ const scheduleWithBottleneck = (api) => {
142
+ return new Proxy(api, {
143
+ get(target, propKey) {
144
+ const origMethod = target[propKey];
145
+ if (typeof origMethod === "function" && propKey !== "rpc" && propKey !== "tx") {
146
+ return (...args) => {
147
+ if (!limiter) {
148
+ throw new Error("Limiter not initialized");
149
+ }
150
+ return limiter.schedule(() => origMethod.apply(target, args));
151
+ };
152
+ }
153
+ return origMethod;
154
+ },
155
+ });
156
+ };
@@ -0,0 +1,40 @@
1
+ interface ShardInfo {
2
+ readonly current: number;
3
+ readonly total: number;
4
+ readonly isSharded: boolean;
5
+ }
6
+ export declare class ShardManager {
7
+ private static instance;
8
+ private _shardInfo;
9
+ private constructor();
10
+ static getInstance(): ShardManager;
11
+ /**
12
+ * Initialize shard configuration from command line argument or environment
13
+ * @param shardArg Optional shard argument from CLI (format: "current/total")
14
+ */
15
+ initializeSharding(shardArg?: string): void;
16
+ /**
17
+ * Get current shard information
18
+ */
19
+ getShardInfo(): ShardInfo;
20
+ /**
21
+ * Get shard index (0-based) for port calculations
22
+ */
23
+ getShardIndex(): number;
24
+ /**
25
+ * Get total number of shards
26
+ */
27
+ getTotalShards(): number;
28
+ /**
29
+ * Check if sharding is enabled
30
+ */
31
+ isSharded(): boolean;
32
+ /**
33
+ * Reset shard configuration (mainly for testing)
34
+ */
35
+ reset(): void;
36
+ private parseShardString;
37
+ }
38
+ export declare const shardManager: ShardManager;
39
+ export {};
40
+ //# sourceMappingURL=shardManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shardManager.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/shardManager.ts"],"names":[],"mappings":"AAAA,UAAU,SAAS;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IACpD,OAAO,CAAC,UAAU,CAA0B;IAE5C,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;;OAGG;IACH,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAY3C;;OAEG;IACH,YAAY,IAAI,SAAS;IAOzB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,gBAAgB;CA2BzB;AAGD,eAAO,MAAM,YAAY,cAA6B,CAAC"}
@@ -0,0 +1,80 @@
1
+ export class ShardManager {
2
+ static instance = null;
3
+ _shardInfo = null;
4
+ constructor() { }
5
+ static getInstance() {
6
+ if (!ShardManager.instance) {
7
+ ShardManager.instance = new ShardManager();
8
+ }
9
+ return ShardManager.instance;
10
+ }
11
+ /**
12
+ * Initialize shard configuration from command line argument or environment
13
+ * @param shardArg Optional shard argument from CLI (format: "current/total")
14
+ */
15
+ initializeSharding(shardArg) {
16
+ if (shardArg) {
17
+ this._shardInfo = this.parseShardString(shardArg);
18
+ process.env.MOONWALL_TEST_SHARD = shardArg;
19
+ }
20
+ else if (process.env.MOONWALL_TEST_SHARD) {
21
+ this._shardInfo = this.parseShardString(process.env.MOONWALL_TEST_SHARD);
22
+ }
23
+ else {
24
+ // Default: no sharding
25
+ this._shardInfo = { current: 1, total: 1, isSharded: false };
26
+ }
27
+ }
28
+ /**
29
+ * Get current shard information
30
+ */
31
+ getShardInfo() {
32
+ if (!this._shardInfo) {
33
+ this.initializeSharding();
34
+ }
35
+ return this._shardInfo;
36
+ }
37
+ /**
38
+ * Get shard index (0-based) for port calculations
39
+ */
40
+ getShardIndex() {
41
+ return this.getShardInfo().current - 1;
42
+ }
43
+ /**
44
+ * Get total number of shards
45
+ */
46
+ getTotalShards() {
47
+ return this.getShardInfo().total;
48
+ }
49
+ /**
50
+ * Check if sharding is enabled
51
+ */
52
+ isSharded() {
53
+ return this.getShardInfo().isSharded;
54
+ }
55
+ /**
56
+ * Reset shard configuration (mainly for testing)
57
+ */
58
+ reset() {
59
+ this._shardInfo = null;
60
+ delete process.env.MOONWALL_TEST_SHARD;
61
+ }
62
+ parseShardString(shardString) {
63
+ if (!shardString.includes("/")) {
64
+ throw new Error(`Invalid shard format: "${shardString}". Expected format: "current/total" (e.g., "1/3")`);
65
+ }
66
+ const [currentStr, totalStr] = shardString.split("/");
67
+ const current = parseInt(currentStr, 10);
68
+ const total = parseInt(totalStr, 10);
69
+ if (Number.isNaN(current) || Number.isNaN(total) || current < 1 || total < 1) {
70
+ throw new Error(`Invalid shard numbers in "${shardString}". Both current and total must be positive integers.`);
71
+ }
72
+ if (current > total) {
73
+ throw new Error(`Invalid shard configuration: current shard ${current} cannot be greater than total ${total}`);
74
+ }
75
+ const isSharded = total > 1;
76
+ return { current, total, isSharded };
77
+ }
78
+ }
79
+ // Export singleton instance for convenience
80
+ export const shardManager = ShardManager.getInstance();
@@ -0,0 +1,5 @@
1
+ import type { ChopsticksContext, UpgradePreferences } from "../../api/types/index.js";
2
+ import type { ApiPromise } from "@polkadot/api";
3
+ export declare function upgradeRuntimeChopsticks(context: ChopsticksContext, path: string, providerName?: string): Promise<void>;
4
+ export declare function upgradeRuntime(api: ApiPromise, preferences: UpgradePreferences): Promise<number>;
5
+ //# sourceMappingURL=upgradeProcedures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgradeProcedures.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/upgradeProcedures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iCAAiC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAahD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,iBAkCtB;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,mBAoPpF"}
@@ -0,0 +1,221 @@
1
+ import { blake2AsHex } from "@polkadot/util-crypto";
2
+ import chalk from "chalk";
3
+ import { sha256 } from "ethers";
4
+ import fs, { existsSync, readFileSync } from "node:fs";
5
+ import { getRuntimeWasm } from "./binariesHelpers.js";
6
+ import { cancelReferendaWithCouncil, executeOpenTechCommitteeProposal, executeProposalWithCouncil, } from "./governanceProcedures.js";
7
+ export async function upgradeRuntimeChopsticks(context, path, providerName) {
8
+ if (!existsSync(path)) {
9
+ throw new Error(`Runtime wasm not found at path: ${path}`);
10
+ }
11
+ const rtWasm = readFileSync(path);
12
+ const rtHex = `0x${rtWasm.toString("hex")}`;
13
+ const rtHash = blake2AsHex(rtHex);
14
+ const api = context.polkadotJs(providerName);
15
+ const signer = context.keyring.alice;
16
+ if ("authorizedUpgrade" in api.query.system) {
17
+ await context.setStorage({
18
+ providerName,
19
+ module: "system",
20
+ method: "authorizedUpgrade",
21
+ methodParams: `${rtHash}01`, // 01 is for the RT ver check = true
22
+ });
23
+ await context.createBlock({ providerName });
24
+ await api.tx.system.applyAuthorizedUpgrade(rtHex).signAndSend(signer);
25
+ }
26
+ else {
27
+ await context.setStorage({
28
+ providerName,
29
+ module: "parachainSystem",
30
+ method: "authorizedUpgrade",
31
+ methodParams: `${rtHash}01`, // 01 is for the RT ver check = true
32
+ });
33
+ await context.createBlock({ providerName });
34
+ await api.tx.parachainSystem.enactAuthorizedUpgrade(rtHex).signAndSend(signer);
35
+ }
36
+ await context.createBlock({ providerName, count: 3 });
37
+ }
38
+ export async function upgradeRuntime(api, preferences) {
39
+ const options = {
40
+ waitMigration: true,
41
+ upgradeMethod: "Sudo",
42
+ ...preferences,
43
+ };
44
+ return new Promise(async (resolve, reject) => {
45
+ const log = (text) => {
46
+ if (options.logger) {
47
+ // Check if logger is a function (backward compatibility) or an object with methods
48
+ if (typeof options.logger === "function") {
49
+ return options.logger(text);
50
+ }
51
+ if (typeof options.logger.info === "function") {
52
+ return options.logger.info(text);
53
+ }
54
+ }
55
+ return;
56
+ };
57
+ if (!options.runtimeName) {
58
+ throw new Error("'runtimeName' is required to upgrade runtime");
59
+ }
60
+ if (!options.runtimeTag) {
61
+ throw new Error("'runtimeTag' is required to upgrade runtime");
62
+ }
63
+ if (!options.from) {
64
+ throw new Error("'from' is required to upgrade runtime");
65
+ }
66
+ try {
67
+ const code = fs
68
+ .readFileSync(await getRuntimeWasm(options.runtimeName, options.runtimeTag, options.localPath))
69
+ .toString();
70
+ log("Checking if upgrade is needed...");
71
+ const existingCode = await api.rpc.state.getStorage(":code");
72
+ if (!existingCode) {
73
+ throw "No existing runtime code found";
74
+ }
75
+ if (existingCode.toString() === code) {
76
+ reject(`Runtime upgrade with same code: ${existingCode.toString().slice(0, 20)} vs ${code
77
+ .toString()
78
+ .slice(0, 20)}`);
79
+ }
80
+ let nonce = (await api.rpc.system.accountNextIndex(options.from.address)).toNumber();
81
+ switch (options.upgradeMethod) {
82
+ case "Sudo": {
83
+ log(`Sending sudo.setCode (${sha256(Buffer.from(code))} [~${Math.floor(code.length / 1024)} kb])...`);
84
+ const isWeightV1 = !api.registry.createType("Weight").proofSize;
85
+ await api.tx.sudo
86
+ .sudoUncheckedWeight(await api.tx.system.setCodeWithoutChecks(code), isWeightV1
87
+ ? "1"
88
+ : {
89
+ proofSize: 1,
90
+ refTime: 1,
91
+ })
92
+ .signAndSend(options.from, { nonce: nonce++ });
93
+ log("✅");
94
+ break;
95
+ }
96
+ case "Governance": {
97
+ log("Using governance...");
98
+ // TODO: remove support for old style after all chains upgraded to 2400+
99
+ const proposal = api.consts.system.version.specVersion.toNumber() >= 2400
100
+ ? api.tx.parachainSystem.authorizeUpgrade(blake2AsHex(code), true)
101
+ : api.tx.parachainSystem.authorizeUpgrade(blake2AsHex(code));
102
+ const encodedProposal = proposal.method.toHex();
103
+ const encodedHash = blake2AsHex(encodedProposal);
104
+ log("Checking if preimage already exists...");
105
+ // Check if already in governance
106
+ const preImageExists = api.query.preimage && (await api.query.preimage.statusFor(encodedHash));
107
+ const democracyPreImageExists = !api.query.preimage && (await api.query.democracy.preimages(encodedHash));
108
+ if (api.query.preimage && preImageExists.isSome && preImageExists.unwrap().isRequested) {
109
+ log(`Preimage ${encodedHash} already exists !\n`);
110
+ }
111
+ else if (!api.query.preimage && democracyPreImageExists) {
112
+ log(`Preimage ${encodedHash} already exists !\n`);
113
+ }
114
+ else {
115
+ log(`Registering preimage (${sha256(Buffer.from(code))} [~${Math.floor(code.length / 1024)} kb])...`);
116
+ if (api.query.preimage) {
117
+ await api.tx.preimage
118
+ .notePreimage(encodedProposal)
119
+ .signAndSend(options.from, { nonce: nonce++ });
120
+ }
121
+ else {
122
+ // TODO: remove support for democracy after 2000
123
+ await api.tx.democracy
124
+ .notePreimage(encodedProposal)
125
+ .signAndSend(options.from, { nonce: nonce++ });
126
+ }
127
+ log("Complete ✅");
128
+ }
129
+ // Check if already in referendum
130
+ const referendum = await api.query.democracy.referendumInfoOf.entries();
131
+ // TODO: remove support for democracy after 2000
132
+ const referendaIndex = api.query.preimage
133
+ ? referendum
134
+ .filter((ref) => ref[1].unwrap().isOngoing &&
135
+ ref[1].unwrap().asOngoing.proposal.isLookup &&
136
+ ref[1].unwrap().asOngoing.proposal.asLookup.hash.toHex() === encodedHash)
137
+ .map((ref) => api.registry.createType("u32", ref[0].toU8a().slice(-4)).toNumber())?.[0]
138
+ : referendum
139
+ .filter((ref) => ref[1].unwrap().isOngoing &&
140
+ ref[1].unwrap().asOngoing.proposalHash.toHex() === encodedHash)
141
+ .map((ref) => api.registry.createType("u32", ref[0].toU8a().slice(-4)).toNumber())?.[0];
142
+ if (referendaIndex !== null && referendaIndex !== undefined) {
143
+ log("Vote for upgrade already in referendum, cancelling it.");
144
+ await cancelReferendaWithCouncil(api, referendaIndex);
145
+ }
146
+ await executeProposalWithCouncil(api, encodedHash);
147
+ // Needs to retrieve nonce after those governance calls
148
+ nonce = (await api.rpc.system.accountNextIndex(options.from.address)).toNumber();
149
+ log("Enacting authorized upgrade...");
150
+ await api.tx.parachainSystem
151
+ .enactAuthorizedUpgrade(code)
152
+ .signAndSend(options.from, { nonce: nonce++ });
153
+ log("Complete ✅");
154
+ break;
155
+ }
156
+ case "WhiteListedCaller": {
157
+ log("Using WhiteListed Caller...");
158
+ const proposal = api.tx.parachainSystem.authorizeUpgrade(blake2AsHex(code), true);
159
+ const encodedProposal = proposal.method.toHex();
160
+ const encodedHash = blake2AsHex(encodedProposal);
161
+ log("Checking if preimage already exists...");
162
+ const preImageExists = api.query.preimage && (await api.query.preimage.statusFor(encodedHash));
163
+ if (preImageExists.isSome && preImageExists.unwrap().isRequested) {
164
+ log(`Preimage ${encodedHash} already exists !\n`);
165
+ }
166
+ else {
167
+ log(`Registering preimage (${sha256(Buffer.from(code))} [~${Math.floor(code.length / 1024)} kb])...`);
168
+ await api.tx.preimage
169
+ .notePreimage(encodedProposal)
170
+ .signAndSend(options.from, { nonce: nonce++ });
171
+ log("Complete ✅");
172
+ }
173
+ const referendum = await api.query.referenda.referendumInfoFor.entries();
174
+ const _referendaIndex = referendum
175
+ .filter((ref) => ref[1].unwrap().isOngoing &&
176
+ ref[1].unwrap().asOngoing.proposal.isLookup &&
177
+ ref[1].unwrap().asOngoing.proposal.asLookup.hash.toHex() === encodedHash)
178
+ .map((ref) => api.registry.createType("u32", ref[0].toU8a().slice(-4)).toNumber())?.[0];
179
+ await executeOpenTechCommitteeProposal(api, encodedHash);
180
+ break;
181
+ }
182
+ }
183
+ log(`Waiting to apply new runtime (${chalk.red("~4min")})...`);
184
+ let isInitialVersion = true;
185
+ const unsub = await api.rpc.state.subscribeStorage([":code"], async (newCode) => {
186
+ if (!isInitialVersion) {
187
+ const blockNumber = (await api.rpc.chain.getHeader()).number.toNumber();
188
+ log(`Complete ✅ [New Code: ${newCode.toString().slice(0, 5)}...${newCode
189
+ .toString()
190
+ .slice(-4)} , Old Code:${existingCode.toString().slice(0, 5)}...${existingCode
191
+ .toString()
192
+ .slice(-4)}] [#${blockNumber}]`);
193
+ unsub();
194
+ if (newCode.toString() !== code) {
195
+ reject(`Unexpected new code: ${newCode.toString().slice(0, 20)} vs ${code
196
+ .toString()
197
+ .slice(0, 20)}`);
198
+ }
199
+ if (options.waitMigration) {
200
+ const blockToWait = (await api.rpc.chain.getHeader()).number.toNumber() + 1;
201
+ await new Promise(async (resolve) => {
202
+ const subBlocks = await api.rpc.chain.subscribeNewHeads(async (header) => {
203
+ if (header.number.toNumber() === blockToWait) {
204
+ subBlocks();
205
+ resolve(blockToWait);
206
+ }
207
+ });
208
+ });
209
+ }
210
+ resolve(blockNumber);
211
+ }
212
+ isInitialVersion = false;
213
+ });
214
+ }
215
+ catch (e) {
216
+ console.error(e);
217
+ console.error("Failed to setCode");
218
+ reject(e);
219
+ }
220
+ });
221
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env -S node --no-warnings --no-deprecation
2
+ import "./cli/internal/logging.js";
3
+ import "./cli/cmds/entrypoint.js";
4
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,mCAAmC;AACnC,kCAAkC"}
package/dist/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env -S node --no-warnings --no-deprecation
2
+ import "./cli/internal/logging.js";
3
+ import "./cli/cmds/entrypoint.js";
@@ -0,0 +1,17 @@
1
+ import type { ContractCallOptions, ContractDeploymentOptions, DevModeContext, GenericContext, MoonwallContract, PrecompileCallOptions } from "../api/types/index.js";
2
+ import type { Abi } from "viem";
3
+ import { type Log } from "viem";
4
+ export declare function fetchCompiledContract<TAbi extends Abi>(contractName: string): MoonwallContract<TAbi>;
5
+ export declare function recursiveSearch(dir: string, filename: string): string | null;
6
+ export declare function interactWithPrecompileContract(context: GenericContext, callOptions: PrecompileCallOptions): Promise<any>;
7
+ export declare function interactWithContract(context: GenericContext, callOptions: ContractCallOptions): Promise<any>;
8
+ export declare function deployCreateCompiledContract<TOptions extends ContractDeploymentOptions>(context: DevModeContext, contractName: string, options?: TOptions): Promise<{
9
+ contractAddress: `0x${string}`;
10
+ logs: Log<bigint, number>[];
11
+ hash: `0x${string}`;
12
+ status: "success" | "reverted";
13
+ abi: Abi;
14
+ bytecode: `0x${string}`;
15
+ methods: any;
16
+ }>;
17
+ //# sourceMappingURL=contractInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractInteraction.d.ts","sourceRoot":"","sources":["../../src/contracts/contractInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,8BAA8B;AAY/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,KAAK,GAAG,EAAmD,MAAM,MAAM,CAAC;AAoCjF,wBAAgB,qBAAqB,CAAC,IAAI,SAAS,GAAG,EACpD,YAAY,EAAE,MAAM,GACnB,gBAAgB,CAAC,IAAI,CAAC,CAUxB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB5E;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,qBAAqB,gBAoBnC;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,mBAAmB,gBAkGjC;AAED,wBAAsB,4BAA4B,CAAC,QAAQ,SAAS,yBAAyB,EAC3F,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,QAAQ,GACjB,OAAO,CAAC;IACT,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,GAAG,CAAC;CACd,CAAC,CA2BD"}