diff --git a/package.json b/package.json index 62bf7cd..2b16d7c 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,11 @@ "@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git", "@multiformats/mafmt": "^11.1.2", "b4a": "^1.6.3", - "blockstore-core": "^3.0.0", + "blockstore-idb": "^1.1.0", "buffer": "^6.0.3", "compact-encoding": "^2.11.0", "datastore-core": "^8.0.4", + "datastore-idb": "^2.1.0", "helia": "^0.0.1", "ipfs-http-client": "^60.0.0", "ipfs-in-memory-repo": "^0.1.0", diff --git a/src/index.ts b/src/index.ts index 41d1d52..3352515 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,4 @@ import { createLibp2p } from "libp2p"; -import { MemoryDatastore } from "datastore-core"; -import { MemoryBlockstore } from "blockstore-core"; import { createHelia } from "helia"; import { yamux } from "@chainsafe/libp2p-yamux"; // @ts-ignore @@ -38,6 +36,8 @@ import { substr } from "runes2"; import { MultibaseDecoder } from "multiformats"; import { peerIdFromCID } from "@libp2p/peer-id"; import { bootstrap } from "@libp2p/bootstrap"; +import { IDBBlockstore } from "blockstore-idb"; +import { IDBDatastore } from "datastore-idb"; const basesByPrefix: { [prefix: string]: MultibaseDecoder } = Object.keys( bases @@ -113,10 +113,17 @@ async function handlePresentSeed() { pubsub: gossipsub(), }); - // @ts-ignore + const blockstore = new IDBBlockstore("ipfs_blocks"); + const datastore = new IDBDatastore("ipfs_data"); + + await blockstore.open(); + await datastore.open(); + PeerManager.instance.ipfs = await createHelia({ - blockstore: new MemoryBlockstore(), - datastore: new MemoryDatastore(), + // @ts-ignore + blockstore, + // @ts-ignore + datastore, libp2p, });