fix: restore services initialization in block-sync and remove remaining commented imports
**Motivations :** - Corriger l'erreur de compilation dans block-sync.ts où services n'était plus défini - Supprimer les derniers imports commentés restants **Modifications :** - Restaurer l'initialisation de Services dans block-sync.ts après les vérifications de prérequis - Supprimer les imports commentés dans pairing.service.ts et iframe-pairing.service.ts **Pages affectées :** - src/pages/block-sync/block-sync.ts (restauration de l'initialisation Services) - src/services/pairing.service.ts (supprime imports commentés) - src/services/iframe-pairing.service.ts (supprime import commenté)
This commit is contained in:
parent
3f7c3b1dbe
commit
393b75c03b
@ -73,6 +73,50 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
throw new Error('Wallet found but missing required data (sp_wallet or birthday)');
|
||||
}
|
||||
|
||||
// Étape 2: Initialisation des services
|
||||
updateStatus('🔄 Initialisation des services...', 'loading');
|
||||
updateProgress(20);
|
||||
|
||||
const { default: Services } = await import('../../services/service');
|
||||
if (!Services) {
|
||||
throw new Error('Services class not found in default export');
|
||||
}
|
||||
|
||||
console.log('🔄 Waiting for services to be ready...');
|
||||
let attempts = 0;
|
||||
const maxAttempts = 30;
|
||||
const delayMs = 2000;
|
||||
|
||||
let services;
|
||||
while (attempts < maxAttempts) {
|
||||
try {
|
||||
console.log(`🔄 Attempting to get services (attempt ${attempts + 1}/${maxAttempts})...`);
|
||||
services = await Services.getInstance();
|
||||
console.log('✅ Services initialized successfully');
|
||||
break;
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
console.log(`⏳ Services not ready yet (attempt ${attempts + 1}/${maxAttempts}):`, errorMessage);
|
||||
|
||||
// Si c'est une erreur de mémoire, arrêter immédiatement
|
||||
if (errorMessage.includes('Out of memory') || errorMessage.includes('insufficient memory')) {
|
||||
console.error('🚫 Memory error detected - stopping retry attempts');
|
||||
updateStatus('❌ Erreur: Mémoire insuffisante. Veuillez actualiser la page.', 'error');
|
||||
throw new Error('WebAssembly initialization failed due to insufficient memory. Please refresh the page.');
|
||||
}
|
||||
|
||||
attempts++;
|
||||
if (attempts >= maxAttempts) {
|
||||
throw new Error(`Services failed to initialize after ${maxAttempts} attempts.`);
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, delayMs));
|
||||
}
|
||||
}
|
||||
|
||||
if (!services) {
|
||||
throw new Error('Services not initialized');
|
||||
}
|
||||
|
||||
// Vérifier que le birthday est configuré (> 0)
|
||||
if (!wallet.sp_wallet.birthday || wallet.sp_wallet.birthday === 0) {
|
||||
console.log('⚠️ Birthday not configured (birthday = 0), redirecting to birthday-setup...');
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { MessageType } from '../models/process.model';
|
||||
import Services from './service';
|
||||
import {
|
||||
// generateWordsDisplay, // Unused import
|
||||
discoverAndJoinPairingProcessWithWords,
|
||||
prepareAndSendPairingTx,
|
||||
} from '../utils/sp-address.utils';
|
||||
|
||||
@ -2,12 +2,10 @@
|
||||
* PairingService - Service spécialisé pour le pairing
|
||||
* Gère la logique métier du pairing sans couplage direct
|
||||
*/
|
||||
// import { Device } from '../../pkg/sdk_client';
|
||||
import { DeviceRepository } from '../repositories/device.repository';
|
||||
import { ProcessRepository } from '../repositories/process.repository';
|
||||
import { eventBus } from './event-bus';
|
||||
import { secureLogger } from './secure-logger';
|
||||
// import { secureKeyManager } from './secure-key-manager';
|
||||
import { SecureCredentialsService } from './secure-credentials.service';
|
||||
import { CredentialData } from './credentials/types';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user