@helia/ipns 9.2.1-73a28eda → 9.2.1-a464d83a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/dist/index.min.js +5 -5
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +9 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -8
- package/dist/src/index.js.map +1 -1
- package/package.json +9 -9
- package/src/index.ts +9 -8
package/README.md
CHANGED
|
@@ -134,29 +134,30 @@ and multiple peers are listening on the topic(s), otherwise update messages
|
|
|
134
134
|
may fail to be published with "Insufficient peers" errors.
|
|
135
135
|
|
|
136
136
|
```TypeScript
|
|
137
|
-
import { createHelia, libp2pDefaults } from 'helia'
|
|
138
137
|
import { ipns } from '@helia/ipns'
|
|
139
138
|
import { pubsub } from '@helia/ipns/routing'
|
|
139
|
+
import { withLibp2p, libp2pDefaults } from '@helia/libp2p'
|
|
140
140
|
import { unixfs } from '@helia/unixfs'
|
|
141
|
-
import { floodsub } from '@libp2p/floodsub'
|
|
142
141
|
import { generateKeyPair } from '@libp2p/crypto/keys'
|
|
142
|
+
import { floodsub } from '@libp2p/floodsub'
|
|
143
|
+
import { createHelia } from 'helia'
|
|
144
|
+
import type { Helia } from '@helia/interface'
|
|
143
145
|
import type { PubSub } from '@helia/ipns/routing'
|
|
146
|
+
import type { DefaultLibp2pServices } from '@helia/libp2p'
|
|
147
|
+
import type { FloodSub } from '@libp2p/floodsub'
|
|
144
148
|
import type { Libp2p } from '@libp2p/interface'
|
|
145
|
-
import type { DefaultLibp2pServices } from 'helia'
|
|
146
149
|
|
|
147
|
-
const libp2pOptions = libp2pDefaults()
|
|
150
|
+
const libp2pOptions = libp2pDefaults() as any
|
|
148
151
|
libp2pOptions.services.pubsub = floodsub()
|
|
149
152
|
|
|
150
|
-
const helia = await
|
|
151
|
-
|
|
152
|
-
})
|
|
153
|
+
const helia = await withLibp2p<Helia, { pubsub: FloodSub }>(createHelia(), libp2pOptions).start()
|
|
154
|
+
|
|
153
155
|
const name = ipns(helia, {
|
|
154
156
|
routers: [
|
|
155
157
|
pubsub(helia)
|
|
156
158
|
]
|
|
157
159
|
})
|
|
158
160
|
|
|
159
|
-
|
|
160
161
|
// store some data to publish
|
|
161
162
|
const fs = unixfs(helia)
|
|
162
163
|
const cid = await fs.addBytes(Uint8Array.from([0, 1, 2, 3, 4]))
|