diff --git a/packages/cli/src/internal/cmdFunctions/downloader.ts b/packages/cli/src/internal/cmdFunctions/downloader.ts index b3f4254f..2b1c244d 100644 --- a/packages/cli/src/internal/cmdFunctions/downloader.ts +++ b/packages/cli/src/internal/cmdFunctions/downloader.ts @@ -30,6 +30,10 @@ export async function downloader(url: string, outputPath: string): Promise const writeStream = fs.createWriteStream(tempPath); let transferredBytes = 0; + if (url.startsWith("ws")) { + console.log("you've passed a websocket to fetch, is this intended?"); + } + const response = await fetch(url); if (!response.body) { diff --git a/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts b/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts index 487ba7dc..018ab181 100644 --- a/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts +++ b/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts @@ -75,7 +75,6 @@ export async function fetchArtifact(args: fetchArtifactArgs) { throw new Error(`No releases found for ${repo.ghAuthor}.${repo.ghRepo}, try again later.`); } - // const releases = (await (await fetch(url)).json()) as Release[]; const release = binary.includes("-runtime") ? releases.data.find((release) => { if (args.ver === "latest") { diff --git a/packages/cli/src/lib/rpcFunctions.ts b/packages/cli/src/lib/rpcFunctions.ts index 6baf9011..451fd56a 100644 --- a/packages/cli/src/lib/rpcFunctions.ts +++ b/packages/cli/src/lib/rpcFunctions.ts @@ -1,12 +1,11 @@ import { vitestAutoUrl } from "../internal/providerFactories"; import { getEnvironmentFromConfig } from "./configReader"; -import fetch from "node-fetch"; export async function customDevRpcRequest(method: string, params: any[] = []): Promise { const env = getEnvironmentFromConfig(); const endpoint = env.connections - ? env.connections[0].endpoints[0].replace("ws://", "http://") - : vitestAutoUrl().replace("ws://", "http://").replace("wss://", "https://"); + ? env.connections[0].endpoints[0].replaceAll("ws://", "http://") + : vitestAutoUrl().replaceAll("ws://", "http://").replaceAll("wss://", "https://"); const data = { jsonrpc: "2.0", id: 1, @@ -14,6 +13,10 @@ export async function customDevRpcRequest(method: string, params: any[] = []): P params, }; + if (endpoint.startsWith("ws")) { + console.log("you've passed a websocket to fetch, is this intended?"); + } + const response = await fetch(endpoint, { method: "POST", body: JSON.stringify(data), diff --git a/packages/util/package.json b/packages/util/package.json index 65eb916b..736def49 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -73,7 +73,6 @@ "ethers": "6.13.1", "inquirer": "9.3.3", "inquirer-press-to-continue": "1.2.0", - "node-fetch": "3.3.2", "rlp": "3.0.0", "semver": "7.6.2", "viem": "2.17.0", diff --git a/packages/util/src/functions/common.ts b/packages/util/src/functions/common.ts index eedcde70..b48d35ae 100644 --- a/packages/util/src/functions/common.ts +++ b/packages/util/src/functions/common.ts @@ -1,6 +1,5 @@ import "@moonbeam-network/api-augment"; import { BN } from "@polkadot/util"; -import fetch from "node-fetch"; // Sort dict by key export function sortObjectByKeys(obj: Record): Record { @@ -124,6 +123,10 @@ export async function directRpcRequest( params, }; + if (endpoint.startsWith("ws")) { + console.log("you've passed a websocket to fetch, is this intended?"); + } + const response = await fetch(endpoint, { method: "POST", body: JSON.stringify(data), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04a05a37..9a68c430 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -302,9 +302,6 @@ importers: inquirer-press-to-continue: specifier: 1.2.0 version: 1.2.0(inquirer@9.3.3) - node-fetch: - specifier: 3.3.2 - version: 3.3.2 rlp: specifier: 3.0.0 version: 3.0.0