Fix all syntax errors in service.ts and websockets.ts

**Motivations:**
• Fix all compilation errors caused by missing parentheses and emojis
• Ensure proper object syntax in logging calls

**Modifications:**
• Fixed parentheses in service.ts lines 1016 and 2039
• Fixed object syntax in service.ts line 1199
• Fixed object syntax in service.ts lines 2347-2351
• Fixed syntax errors in websockets.ts lines 31-42
• Removed all duplicate logging calls

**Pages affected:**
• service.ts
• websockets.ts
This commit is contained in:
NicolasCantu 2025-10-30 08:20:04 +01:00
parent 162e5fd303
commit 25e0272959
2 changed files with 8 additions and 13 deletions

View File

@ -1013,7 +1013,7 @@ export default class Services {
roles = this.getRoles(process);
} else {
// We should check that we have the right to change the roles here, or maybe it's better leave it to the wasm
secureLogger.info('Provided new roles:', { component: 'Service', data: JSON.stringify(roles }));
secureLogger.info('Provided new roles:', { component: 'Service', data: JSON.stringify(roles) });
}
const privateSplitData = this.splitData(privateData);
const publicSplitData = this.splitData(publicData);
@ -1196,7 +1196,7 @@ export default class Services {
if (prevouts.includes(tip)) {
const processId = process.states[0].commited_in;
const newTip = this.sdkClient.get_txid(parsedMsg.transaction);
secureLogger.info('Transaction', { component: 'Service', data: newTip, 'spends the tip of process', processId });
secureLogger.info('Transaction spends the tip of process', { component: 'Service', data: { newTip, processId } });
// We take the data out of the output
const newStateId = this.sdkClient.get_opreturn(parsedMsg.transaction);
secureLogger.info('newStateId:', { component: 'Service', data: newStateId });
@ -2036,7 +2036,7 @@ export default class Services {
});
const walletStore = DATABASE_CONFIG.stores.wallet.name;
secureLogger.debug(' DEBUG: getDeviceFromDatabase - db opened directly, objectStoreNames:', { component: 'Service', data: Array.from(db.objectStoreNames }));
secureLogger.debug(' DEBUG: getDeviceFromDatabase - db opened directly, objectStoreNames:', { component: 'Service', data: Array.from(db.objectStoreNames) });
try {
const dbRes = await new Promise<any>((resolve, reject) => {
@ -2344,11 +2344,11 @@ export default class Services {
if (birthday === 0) {
// This is a new device, set birthday to scan from much earlier to catch faucet transactions
// Scan from 100 blocks earlier to ensure we catch all faucet transactions
secureLogger.info('🔧 Updating birthday for new device:', { component: 'Service', data: {
secureLogger.info('Updating birthday for new device:', { component: 'Service', data: {
old_birthday: device.sp_wallet.birthday,
new_birthday: Math.max(0, this.currentBlockHeight - 100 }),
new_birthday: Math.max(0, this.currentBlockHeight - 100),
current_block: this.currentBlockHeight
});
} });
device.sp_wallet.birthday = Math.max(0, this.currentBlockHeight - 100);
// We also set last_scan to the same value initially

View File

@ -28,16 +28,11 @@ export async function initWebsocket(url: string) {
if (typeof msgData === 'string') {
try {
// Valider le message avant traitement
secureLogger.debug('🔍 DEBUG: Raw WebSocket message:', { component: 'WebSocket', data: msgData });
secureLogger.debug('DEBUG: Raw WebSocket message:', { component: 'WebSocket', data: msgData });
const validation = messageValidator.validateWebSocketMessage(msgData);
secureLogger.debug('🔍 DEBUG: Validation result:', { component: 'WebSocket', data: validation });
secureLogger.debug('DEBUG: Validation result:', { component: 'WebSocket', data: validation });
if (!validation.isValid) {
secureLogger.warn('⚠️ Invalid WebSocket message received:', { component: 'WebSocket', data: {
errors: validation.errors,
messagePreview: msgData.substring(0, 100 })
});
secureLogger.error('🔍 DEBUG: Full validation errors:', { component: 'WebSocket', data: validation.errors });
secureLogger.warn('Invalid WebSocket message received', {
component: 'WebSocket',
operation: 'message_validation',