* Query the relay via POST /query (pure Nostr HTTP bridge). * Returns an array of raw Nostr events matching the filters.
( config: E2eConfig | undefined, filters: Array<Record<string, unknown>>, )
| 4392 | * Returns an array of raw Nostr events matching the filters. |
| 4393 | */ |
| 4394 | async function relayQuery( |
| 4395 | config: E2eConfig | undefined, |
| 4396 | filters: Array<Record<string, unknown>>, |
| 4397 | ): Promise<RelayEvent[]> { |
| 4398 | const identity = getRelayIdentity(config); |
| 4399 | if ( |
| 4400 | !filters.every((filter) => |
| 4401 | isPGatedFilterAuthorized(filter, identity.pubkey), |
| 4402 | ) |
| 4403 | ) { |
| 4404 | throw new Error(P_GATED_REJECTION_MESSAGE); |
| 4405 | } |
| 4406 | |
| 4407 | const response = await fetch(`${getRelayHttpUrl(config)}/query`, { |
| 4408 | method: "POST", |
| 4409 | headers: { |
| 4410 | "Content-Type": "application/json", |
| 4411 | "X-Pubkey": identity.pubkey, |
| 4412 | }, |
| 4413 | body: JSON.stringify(filters), |
| 4414 | }); |
| 4415 | await assertOk(response); |
| 4416 | return response.json() as Promise<RelayEvent[]>; |
| 4417 | } |
| 4418 | |
| 4419 | async function submitSignedEvent( |
| 4420 | config: E2eConfig | undefined, |
no test coverage detected