MCPcopy Create free account
hub / github.com/block/buzz / relayQuery

Function relayQuery

desktop/src/testing/e2eBridge.ts:4394–4417  ·  view source on GitHub ↗

* 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>>,
)

Source from the content-addressed store, hash-verified

4392 * Returns an array of raw Nostr events matching the filters.
4393 */
4394async 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
4419async function submitSignedEvent(
4420 config: E2eConfig | undefined,

Callers 15

handleGetThreadRepliesFunction · 0.85
executeFunction · 0.85
handleGetUserNotesFunction · 0.85
handleGetGlobalNotesFunction · 0.85
handleGetChannelsFunction · 0.85
handleGetProfileFunction · 0.85
handleUpdateProfileFunction · 0.85
handleGetUserProfileFunction · 0.85
handleGetUsersBatchFunction · 0.85
handleSearchUsersFunction · 0.85
handleGetPresenceFunction · 0.85

Calls 4

getRelayIdentityFunction · 0.85
isPGatedFilterAuthorizedFunction · 0.85
assertOkFunction · 0.85
getRelayHttpUrlFunction · 0.70

Tested by

no test coverage detected