diff --git a/package.json b/package.json index 8524bc3..2ea0ade 100644 --- a/package.json +++ b/package.json @@ -13,15 +13,8 @@ "test": "npm run build && test-browser-example test" }, "dependencies": { - "@chainsafe/libp2p-noise": "^12.0.0", - "@chainsafe/libp2p-yamux": "^4.0.1", "@helia/unixfs": "^1.2.1", - "@libp2p/bootstrap": "^8.0.0", - "@libp2p/websockets": "^6.0.1", - "blockstore-core": "^4.1.0", - "datastore-core": "^9.1.1", "helia": "^1.0.0", - "libp2p": "^0.45.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/src/provider/HeliaProvider.jsx b/src/provider/HeliaProvider.jsx index 468e792..4c88386 100644 --- a/src/provider/HeliaProvider.jsx +++ b/src/provider/HeliaProvider.jsx @@ -1,15 +1,7 @@ /* eslint-disable no-console */ -import { noise } from '@chainsafe/libp2p-noise' -import { yamux } from '@chainsafe/libp2p-yamux' import { unixfs } from '@helia/unixfs' -import { bootstrap } from '@libp2p/bootstrap' -import { webSockets } from '@libp2p/websockets' -import { MemoryBlockstore } from 'blockstore-core' -import { MemoryDatastore } from 'datastore-core' import { createHelia } from 'helia' -import { createLibp2p } from 'libp2p' -import { identifyService } from 'libp2p/identify' import PropTypes from 'prop-types' import { React, @@ -42,45 +34,8 @@ export const HeliaProvider = ({ children }) => { setStarting(false) } else { try { - // the blockstore is where we store the blocks that make up files - const blockstore = new MemoryBlockstore() - - // application-specific data lives in the datastore - const datastore = new MemoryDatastore() - - // libp2p is the networking layer that underpins Helia - // Make sure to stick libp2p here when running react in strict mode - const libp2p = await createLibp2p({ - datastore, - transports: [ - webSockets() - ], - connectionEncryption: [ - noise() - ], - streamMuxers: [ - yamux() - ], - peerDiscovery: [ - bootstrap({ - list: [ - '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN', - '/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa', - '/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb', - '/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt' - ] - }) - ], - services: { - identify: identifyService() - } - }) console.info('Starting Helia') - const helia = await createHelia({ - datastore, - blockstore, - libp2p - }) + const helia = await createHelia() setHelia(helia) setFs(unixfs(helia)) setStarting(false)