Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 7913299

Browse files
tabcataphelionz
authored andcommitted
update store.js to new ipfs api
1 parent af5df41 commit 7913299

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

src/store.js

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const ipfsConfig = {
1111
// Websocket:
1212
// '/dns4/ws-star-signal-1.servep2p.com/tcp/443/wss/p2p-websocket-star',
1313
// '/dns4/ws-star-signal-2.servep2p.com/tcp/443/wss/p2p-websocket-star',
14-
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
14+
// '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
1515
// WebRTC:
1616
// '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star',
1717
// Use local signal server
@@ -37,24 +37,14 @@ const dbConfig = {
3737
}
3838

3939
const store = async (name) => {
40-
return new Promise((resolve, reject) => {
41-
// Create IPFS instance
42-
const ipfs = new Ipfs(ipfsConfig)
43-
44-
ipfs.on('error', (e) => console.error(e))
45-
ipfs.on('ready', async () => {
46-
try {
47-
// Create an OrbitDB instance
48-
const orbitdb = await OrbitDB.createInstance(ipfs)
49-
// Open (or create) database
50-
const db = await orbitdb.docstore(name, dbConfig)
51-
// ToDo: remove this line
52-
window.db = db
53-
// Done
54-
resolve(db)
55-
} catch (e) {
56-
reject(e)
57-
}
58-
})
59-
})
40+
// Create IPFS instance
41+
const ipfs = await Ipfs.create(ipfsConfig)
42+
// Create an OrbitDB instance
43+
const orbitdb = await OrbitDB.createInstance(ipfs)
44+
// Open (or create) database
45+
const db = await orbitdb.docstore(name, dbConfig)
46+
// ToDo: remove this line
47+
window.db = db
48+
// Done
49+
return db
6050
}

0 commit comments

Comments
 (0)