Add database singleton

This commit is contained in:
omaroughriss 2025-11-27 16:29:40 +01:00
parent 3eeef3fc9a
commit 19dcb2000e

View File

@ -24,6 +24,7 @@ export default class Services {
private notifications: any[] | null = null;
private subscriptions: { element: Element; event: string; eventHandler: string }[] = [];
private database: any;
private db!: Database; // Database singleton
private relayAddresses: { [wsurl: string]: string } = {};
private membersList: Record<string, Member> = {};
private currentBlockHeight: number = -1;
@ -58,6 +59,7 @@ export default class Services {
this.notifications = this.getNotifications();
this.sdkClient = await import('../../pkg/sdk_client');
this.sdkClient.setup();
this.db = await Database.getInstance(); // Initialiser l'instance DB
for (const wsurl of Object.values(BOOTSTRAPURL)) {
this.updateRelay(wsurl, '');
}