diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 3d81747a..09652069 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -6,7 +6,8 @@ export * from "./lib/binariesHelpers"; export * from "./lib/configReader"; export * from "./lib/contextHelpers"; export * from "./lib/contractFunctions"; -export * from "./lib/globalContext"; +// export * from "./lib/globalContext"; +export * from "./lib/globalContextEffect"; export * from "./lib/governanceProcedures"; export * from "./lib/rpcFunctions"; export * from "./lib/runnerContext"; diff --git a/packages/cli/src/internal/foundations/chopsticksHelpers.ts b/packages/cli/src/internal/foundations/chopsticksHelpers.ts index 72b1dd40..1238964e 100644 --- a/packages/cli/src/internal/foundations/chopsticksHelpers.ts +++ b/packages/cli/src/internal/foundations/chopsticksHelpers.ts @@ -5,7 +5,7 @@ import { FrameSystemEventRecord } from "@polkadot/types/lookup"; import chalk from "chalk"; import { setTimeout } from "timers/promises"; import { assert } from "vitest"; -import { MoonwallContext } from "../../lib/globalContext"; +import { MoonwallContext } from "../../lib/globalContextEffect"; export async function getWsFromConfig(providerName?: string): Promise { if (providerName) { diff --git a/packages/cli/src/internal/foundations/devModeHelpers.ts b/packages/cli/src/internal/foundations/devModeHelpers.ts index 710757ff..5e10e004 100644 --- a/packages/cli/src/internal/foundations/devModeHelpers.ts +++ b/packages/cli/src/internal/foundations/devModeHelpers.ts @@ -16,7 +16,7 @@ import { setTimeout } from "timers/promises"; import { assert } from "vitest"; import { importAsyncConfig, isEthereumDevConfig } from "../../lib/configReader"; import { extractError } from "../../lib/contextHelpers"; -import { MoonwallContext } from "../../lib/globalContext"; +import { MoonwallContext } from "../../lib/globalContextEffect"; const debug = Debug("DevTest"); export async function getDevProviderPath() { diff --git a/packages/cli/src/lib/globalContextEffect.ts b/packages/cli/src/lib/globalContextEffect.ts index 8ccc69eb..13d2f624 100644 --- a/packages/cli/src/lib/globalContextEffect.ts +++ b/packages/cli/src/lib/globalContextEffect.ts @@ -32,6 +32,7 @@ import { } from "../internal/providerFactories"; import { importAsyncConfig, + importJsonConfig, isEthereumDevConfig, isEthereumZombieConfig, isOptionSet, @@ -437,9 +438,7 @@ export class MoonwallContext { public static getContext(config?: MoonwallConfig, force: boolean = false): MoonwallContext { if (!MoonwallContext.instance || force) { - if (!config) { - throw new Error("❌ Config must be provided on Global Context instantiation"); - } + const config = importJsonConfig(); MoonwallContext.instance = new MoonwallContext(config); debugSetup(`🟢 Moonwall context "${config.label}" created`); diff --git a/packages/cli/src/lib/handlers/chopsticksHandler.ts b/packages/cli/src/lib/handlers/chopsticksHandler.ts index 780ed149..cf127e00 100644 --- a/packages/cli/src/lib/handlers/chopsticksHandler.ts +++ b/packages/cli/src/lib/handlers/chopsticksHandler.ts @@ -10,7 +10,7 @@ import { createChopsticksBlock, sendSetStorageRequest, } from "../../internal/foundations/chopsticksHelpers"; -import { MoonwallContext } from "../globalContext"; +import { MoonwallContext } from "../globalContextEffect"; import { upgradeRuntimeChopsticks } from "../upgradeProcedures"; export const chopsticksHandler: FoundationHandler<"chopsticks"> = ({ diff --git a/packages/cli/src/lib/handlers/readOnlyHandler.ts b/packages/cli/src/lib/handlers/readOnlyHandler.ts index beda0572..c339cba8 100644 --- a/packages/cli/src/lib/handlers/readOnlyHandler.ts +++ b/packages/cli/src/lib/handlers/readOnlyHandler.ts @@ -1,6 +1,6 @@ import { ApiPromise } from "@polkadot/api"; import { FoundationHandler } from "@moonwall/types"; -import { MoonwallContext } from "../globalContext"; +import { MoonwallContext } from "../globalContextEffect"; export const readOnlyHandler: FoundationHandler<"read_only"> = ({ testCases, diff --git a/packages/cli/src/lib/handlers/zombieHandler.ts b/packages/cli/src/lib/handlers/zombieHandler.ts index ea07568a..9ce96b38 100644 --- a/packages/cli/src/lib/handlers/zombieHandler.ts +++ b/packages/cli/src/lib/handlers/zombieHandler.ts @@ -1,7 +1,7 @@ import { FoundationHandler, UpgradePreferences } from "@moonwall/types"; import { ApiPromise } from "@polkadot/api"; import { upgradeRuntime } from "../upgradeProcedures"; -import { MoonwallContext } from "../globalContext"; +import { MoonwallContext } from "../globalContextEffect"; import { alith } from "@moonwall/util"; import { sendIpcMessage } from "../../internal/foundations/zombieHelpers"; diff --git a/test/configs/moonbeamChopsticks.yml b/test/configs/moonbeamChopsticks.yml index 3d16d4da..b856d745 100644 --- a/test/configs/moonbeamChopsticks.yml +++ b/test/configs/moonbeamChopsticks.yml @@ -1,6 +1,6 @@ endpoint: wss://wss.api.moonbeam.network mock-signature-host: true -port: 12000 +port: 10000 db: ./tmp/db_mb.sqlite import-storage: diff --git a/test/moonwall.config.json b/test/moonwall.config.json index d4cb23f1..d8aec49d 100644 --- a/test/moonwall.config.json +++ b/test/moonwall.config.json @@ -226,7 +226,7 @@ "name": "mb", "type": "parachain", "buildBlockMode": "manual", - "configPath": "./configs/moonriverChopsticks.yml" + "configPath": "./configs/moonbeamChopsticks.yml" } ] }, diff --git a/test/suites/chopsticks/test-chopsticks-basic.ts b/test/suites/chopsticks/test-chopsticks-basic.ts index d8517a2a..17c30eb2 100644 --- a/test/suites/chopsticks/test-chopsticks-basic.ts +++ b/test/suites/chopsticks/test-chopsticks-basic.ts @@ -25,7 +25,7 @@ describeSuite({ const currentBlockHeight = (await api.rpc.chain.getHeader()).number.toNumber(); log(`You are now connected to ${chainName} at height #${currentBlockHeight}`); expect(currentBlockHeight).toBeGreaterThan(0); - expect(["dancebox", "moonriver"].includes(chainName)).toBe(true); + expect(["dancebox", "moonriver", "moonbeam"].includes(chainName)).toBe(true); log(JSON.stringify(await api.rpc.state.getStorage(":code")).slice(0, 20)); log(`This chain is an Ethereum chain: ${context.isEthereumChain}`); log(`Alith Address is: ${context.keyring.alice.address}`);