hydrateEvent -> purifyEvent (it sounds cooler)

This commit is contained in:
Alex Gleason 2024-03-16 13:19:11 -05:00
parent 0df4ac7331
commit 09369a0122
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
4 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ import { Debug, LNURL, type NostrEvent } from '@/deps.ts';
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
import { isEphemeralKind } from '@/kinds.ts';
import { updateStats } from '@/stats.ts';
import { dehydrateEvent } from '@/storages/hydrate.ts';
import { purifyEvent } from '@/storages/hydrate.ts';
import { cache, client, eventsDB, reqmeister } from '@/storages.ts';
import { Sub } from '@/subs.ts';
import { getTagSet } from '@/tags.ts';
@ -225,7 +225,7 @@ async function payZap(event: DittoEvent, signal: AbortSignal) {
const { pr } = await LNURL.callback(
details.callback,
{ amount, nostr: dehydrateEvent(event), lnurl },
{ amount, nostr: purifyEvent(event), lnurl },
{ fetch: fetchWorker, signal },
);

View File

@ -6,7 +6,7 @@ import { DittoEvent } from '@/interfaces/DittoEvent.ts';
import { type DittoFilter } from '@/interfaces/DittoFilter.ts';
import { isDittoInternalKind, isParameterizedReplaceableKind, isReplaceableKind } from '@/kinds.ts';
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
import { dehydrateEvent } from '@/storages/hydrate.ts';
import { purifyEvent } from '@/storages/hydrate.ts';
import { isNostrId, isURL } from '@/utils.ts';
import { abortError } from '@/utils/abort.ts';
@ -67,7 +67,7 @@ class EventsDB implements NStore {
/** Insert an event (and its tags) into the database. */
async event(event: NostrEvent, _opts?: NStoreOpts): Promise<void> {
event = dehydrateEvent(event);
event = purifyEvent(event);
this.#debug('EVENT', JSON.stringify(event));
if (isDittoInternalKind(event.kind) && event.pubkey !== Conf.pubkey) {

View File

@ -30,7 +30,7 @@ async function hydrateEvents(opts: HydrateEventOpts): Promise<DittoEvent[]> {
}
/** Return a normalized event without any non-standard keys. */
function dehydrateEvent(event: DittoEvent): NostrEvent {
function purifyEvent(event: DittoEvent): NostrEvent {
return {
id: event.id,
pubkey: event.pubkey,
@ -42,4 +42,4 @@ function dehydrateEvent(event: DittoEvent): NostrEvent {
};
}
export { dehydrateEvent, hydrateEvents };
export { hydrateEvents, purifyEvent };

View File

@ -9,7 +9,7 @@ import {
type RelayPoolWorker,
} from '@/deps.ts';
import { normalizeFilters } from '@/filter.ts';
import { dehydrateEvent } from '@/storages/hydrate.ts';
import { purifyEvent } from '@/storages/hydrate.ts';
import { abortError } from '@/utils/abort.ts';
interface PoolStoreOpts {
@ -38,7 +38,7 @@ class PoolStore implements NStore {
if (opts.signal?.aborted) return Promise.reject(abortError());
const { relays = this.#relays } = opts;
event = dehydrateEvent(event);
event = purifyEvent(event);
this.#debug('EVENT', event);
this.#pool.publish(event, relays);