Auto register client plugins
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {SEARCH_RELAYS, asDecryptedEvent, readList} from "@welshman/util"
|
||||
import type {TrustedEvent} from "@welshman/util"
|
||||
import {RepositoryCollection} from "./repositoryCollection.js"
|
||||
import type {ClientContext} from "./client.js"
|
||||
import type {RelayLists} from "./relayLists.js"
|
||||
import {RelayLists} from "./relayLists.js"
|
||||
import type {IClient} from "./client.js"
|
||||
|
||||
/**
|
||||
* NIP-51 search relay lists (kind 10007), keyed by pubkey. Loaded via the
|
||||
@@ -10,10 +10,7 @@ import type {RelayLists} from "./relayLists.js"
|
||||
* collection.
|
||||
*/
|
||||
export class SearchRelayLists extends RepositoryCollection<ReturnType<typeof readList>> {
|
||||
constructor(
|
||||
ctx: ClientContext,
|
||||
readonly relayLists: RelayLists,
|
||||
) {
|
||||
constructor(ctx: IClient) {
|
||||
super(ctx, {
|
||||
filters: [{kinds: [SEARCH_RELAYS]}],
|
||||
eventToItem: (event: TrustedEvent) => readList(asDecryptedEvent(event)),
|
||||
@@ -22,6 +19,6 @@ export class SearchRelayLists extends RepositoryCollection<ReturnType<typeof rea
|
||||
}
|
||||
|
||||
fetch(pubkey: string, relayHints: string[] = []) {
|
||||
return this.relayLists.makeOutboxLoader(SEARCH_RELAYS)(pubkey, relayHints)
|
||||
return this.ctx.use(RelayLists).makeOutboxLoader(SEARCH_RELAYS)(pubkey, relayHints)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user