Fix receive and send

This commit is contained in:
2026-03-16 06:48:29 +00:00
parent 9ef1720e1f
commit dd275593cd
28 changed files with 1918 additions and 769 deletions

View File

@@ -10,6 +10,7 @@ import { Invitation } from './invitation.js';
import { Storage } from './storage.js';
import { SyncServer } from '../utils/sync-server.js';
import { HistoryService } from './history.js';
import { ElectrumService } from './electrum.js';
import { EventEmitter } from '../utils/event-emitter.js';
@@ -26,6 +27,8 @@ export interface AppConfig {
syncServerUrl: string;
engineConfig: XOEngineOptions;
invitationStoragePath: string;
electrumHost?: string;
electrumApplicationIdentifier?: string;
}
export class AppService extends EventEmitter<AppEventMap> {
@@ -33,6 +36,7 @@ export class AppService extends EventEmitter<AppEventMap> {
public storage: Storage;
public config: AppConfig;
public history: HistoryService;
public electrum: ElectrumService;
public invitations: Invitation[] = [];
@@ -68,15 +72,21 @@ export class AppService extends EventEmitter<AppEventMap> {
const walletStorage = await storage.child(seedHash.slice(0, 8))
// Create the app service
return new AppService(engine, walletStorage, config);
const electrum = new ElectrumService({
host: config.electrumHost,
applicationIdentifier: config.electrumApplicationIdentifier,
});
return new AppService(engine, walletStorage, config, electrum);
}
constructor(engine: Engine, storage: Storage, config: AppConfig) {
constructor(engine: Engine, storage: Storage, config: AppConfig, electrum: ElectrumService) {
super();
this.engine = engine;
this.storage = storage;
this.config = config;
this.electrum = electrum;
this.history = new HistoryService(engine, this.invitations);
}
@@ -89,6 +99,7 @@ export class AppService extends EventEmitter<AppEventMap> {
engine: this.engine,
syncServer: invitationSyncServer,
storage: invitationStorage,
electrum: this.electrum,
};
// Create the invitation