Use default pool, make adapter context optional

This commit is contained in:
Jon Staab
2025-03-31 09:35:48 -07:00
parent 51dd44161a
commit 4237b145ae
17 changed files with 293 additions and 290 deletions
+3 -10
View File
@@ -1,13 +1,6 @@
import {Emitter, now} from "@welshman/lib"
import {TrustedEvent, SignedEvent, Filter} from "@welshman/util"
import {
multireq,
multicast,
Multireq,
Multicast,
RequestEventType,
AdapterContext,
} from "@welshman/net"
import {multireq, multicast, Multireq, Multicast, RequestEvent, AdapterContext} from "@welshman/net"
export enum DVMEvent {
Progress = "progress",
@@ -17,10 +10,10 @@ export enum DVMEvent {
export type DVMRequestOptions = {
event: SignedEvent
relays: string[]
context: AdapterContext
timeout?: number
autoClose?: boolean
reportProgress?: boolean
context?: AdapterContext
}
export type DVMRequest = {
@@ -47,7 +40,7 @@ export const makeDvmRequest = (request: DVMRequestOptions) => {
const sub = multireq({relays, filter, timeout, context})
const pub = multicast({relays, event, timeout, context})
sub.on(RequestEventType.Event, (event: TrustedEvent, url: string) => {
sub.on(RequestEvent.Event, (event: TrustedEvent, url: string) => {
if (event.kind === 7000) {
emitter.emit(DVMEvent.Progress, url, event)
} else {