diff --git a/src/startup.ts b/src/startup.ts index 21df4d50..f3282d73 100644 --- a/src/startup.ts +++ b/src/startup.ts @@ -1,7 +1,6 @@ // Starts up applications required to run before the HTTP server is on. import { Conf } from '@/config.ts'; -import { seedZapSplits } from '@/utils/zap-split.ts'; import { cron } from '@/cron.ts'; import { startFirehose } from '@/firehose.ts'; @@ -12,5 +11,3 @@ if (Conf.firehoseEnabled) { if (Conf.cronEnabled) { cron(); } - -await seedZapSplits(); diff --git a/src/storages.ts b/src/storages.ts index 303a6eb7..c8229880 100644 --- a/src/storages.ts +++ b/src/storages.ts @@ -7,6 +7,7 @@ import { SearchStore } from '@/storages/search-store.ts'; import { InternalRelay } from '@/storages/InternalRelay.ts'; import { NPool, NRelay1 } from '@nostrify/nostrify'; import { getRelays } from '@/utils/outbox.ts'; +import { seedZapSplits } from '@/utils/zap-split.ts'; export class Storages { private static _db: Promise | undefined; @@ -20,7 +21,9 @@ export class Storages { if (!this._db) { this._db = (async () => { const kysely = await DittoDB.getInstance(); - return new EventsDB(kysely); + const store = new EventsDB(kysely); + await seedZapSplits(store); + return store; })(); } return this._db; diff --git a/src/utils/zap-split.ts b/src/utils/zap-split.ts index 553d9c8c..80d6cb2e 100644 --- a/src/utils/zap-split.ts +++ b/src/utils/zap-split.ts @@ -1,10 +1,8 @@ import { AdminSigner } from '@/signers/AdminSigner.ts'; import { Conf } from '@/config.ts'; -import { handleEvent } from '@/pipeline.ts'; import { NSchema as n, NStore } from '@nostrify/nostrify'; import { nostrNow } from '@/utils.ts'; import { percentageSchema } from '@/schema.ts'; -import { Storages } from '@/storages.ts'; type Pubkey = string; type ExtraMessage = string; @@ -39,11 +37,10 @@ export async function getZapSplits(store: NStore, pubkey: string): Promise