|
1 | 1 | declare module "@orbitdb/core" { |
2 | | - import type { DefaultLibp2pServices, HeliaLibp2p } from "helia"; |
3 | | - import type { Libp2p } from "@libp2p/interface"; |
4 | | - import type { PeerId } from "@libp2p/interface"; |
| 2 | + import type { HeliaLibp2p } from "helia"; |
| 3 | + import type { Libp2p, PeerId, PrivateKey, ServiceMap } from "@libp2p/interface"; |
5 | 4 | import type { TypedEmitter } from "tiny-typed-emitter"; |
6 | | - import type { PrivateKey } from "@libp2p/interface"; |
7 | 5 | import type { ByteView, CID } from "multiformats"; |
8 | 6 |
|
9 | 7 | export function createOrbitDB< |
10 | | - T extends Libp2p = Libp2p<DefaultLibp2pServices>, |
| 8 | + T extends ServiceMap = ServiceMap, |
11 | 9 | >(args: { |
12 | | - ipfs: HeliaLibp2p<T>; |
| 10 | + ipfs: HeliaLibp2p<Libp2p<T>>; |
13 | 11 | id?: string; |
14 | 12 | identity?: Identity; |
15 | 13 | identities?: IdentitiesType; |
@@ -38,9 +36,9 @@ declare module "@orbitdb/core" { |
38 | 36 | referencesCount: number; |
39 | 37 | }>; |
40 | 38 |
|
41 | | - type CreateDatabaseOptions<T extends Libp2p = Libp2p<DefaultLibp2pServices>> = |
| 39 | + type CreateDatabaseOptions<T extends ServiceMap = ServiceMap> = |
42 | 40 | { |
43 | | - ipfs: HeliaLibp2p<T>; |
| 41 | + ipfs: HeliaLibp2p<Libp2p<T>>; |
44 | 42 | identity?: Identity; |
45 | 43 | address: string; |
46 | 44 | name?: string; |
@@ -142,14 +140,14 @@ declare module "@orbitdb/core" { |
142 | 140 | ) => Promise<boolean>; |
143 | 141 | }; |
144 | 142 |
|
145 | | - export type OrbitDB<T extends Libp2p = Libp2p<DefaultLibp2pServices>> = { |
| 143 | + export type OrbitDB<T extends ServiceMap = ServiceMap> = { |
146 | 144 | id: string; |
147 | 145 | open: ( |
148 | 146 | address: string, |
149 | 147 | options?: OpenDatabaseOptions, |
150 | 148 | ) => ReturnType<typeof Database>; |
151 | 149 | stop: () => Promise<void>; |
152 | | - ipfs: HeliaLibp2p<T>; |
| 150 | + ipfs: HeliaLibp2p<Libp2p<T>>; |
153 | 151 | directory: string; |
154 | 152 | keystore: KeyStoreType; |
155 | 153 | identities: IdentitiesType; |
@@ -255,12 +253,12 @@ declare module "@orbitdb/core" { |
255 | 253 | >; |
256 | 254 |
|
257 | 255 | export function Identities< |
258 | | - T extends Libp2p = Libp2p<DefaultLibp2pServices>, |
| 256 | + T extends ServiceMap = ServiceMap, |
259 | 257 | >(args: { |
260 | 258 | keystore?: KeyStoreType; |
261 | 259 | path?: string; |
262 | 260 | storage?: Storage; |
263 | | - ipfs?: HeliaLibp2p<T>; |
| 261 | + ipfs?: HeliaLibp2p<Libp2p<T>>; |
264 | 262 | }): Promise<{ |
265 | 263 | createIdentity: (options: object) => Promise<Identity>; |
266 | 264 | getIdentity: (hash: string) => Promise<Identity>; |
@@ -299,9 +297,9 @@ declare module "@orbitdb/core" { |
299 | 297 | get: (hash: string) => Promise<ByteView<unknown>>; |
300 | 298 | }; |
301 | 299 | export function IPFSBlockStorage< |
302 | | - T extends Libp2p = Libp2p<DefaultLibp2pServices>, |
| 300 | + T extends ServiceMap = ServiceMap, |
303 | 301 | >(args: { |
304 | | - ipfs: HeliaLibp2p<T>; |
| 302 | + ipfs: HeliaLibp2p<Libp2p<T>>; |
305 | 303 | pin?: boolean; |
306 | 304 | timeout?: number; |
307 | 305 | }): Promise<Storage>; |
|
0 commit comments