From 6437e93fc4324ac3594c0cd21514feb2df95e2c1 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 31 Aug 2022 20:18:37 -0400 Subject: [PATCH] *switch to ipfs http client. ipfs-core used by mistake --- src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7c7ba09..2c5e76b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ import { CID } from "multiformats/cid"; // @ts-ignore import toStream from "it-to-stream"; import type { StatResult } from "ipfs-core/dist/src/components/files/stat"; -import * as IPFS from "ipfs-core"; +import * as IPFS from "ipfs-http-client"; interface StatFileResponse { exists: boolean; @@ -26,7 +26,7 @@ interface StatFileSubfile { size: number; } -let client: IPFS.IPFS; +let client: IPFS.IPFSHTTPClient; import { utils } from "ipfs-http-response"; @@ -138,7 +138,6 @@ async function fileExists( path?: string, fullPath?: string ): Promise { - client = client as IPFS.IPFS; let ipfsPath = normalizePath(hash, path, fullPath); try { const ret = await client.files.stat(`/ipfs/${ipfsPath}`); @@ -162,7 +161,7 @@ async function resolveIpns( const plugin: Plugin = { name: "ipfs", async plugin(api: PluginAPI): Promise { - client = await IPFS.create(); + client = await IPFS.create({ host: "127.0.0.1" }); api.registerMethod("stat_ipfs", { cacheable: false, async handler(request: RPCRequest): Promise {