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:
parent
162e5fd303
commit
25e0272959
@ -1013,7 +1013,7 @@ export default class Services {
|
|||||||
roles = this.getRoles(process);
|
roles = this.getRoles(process);
|
||||||
} else {
|
} else {
|
||||||
// We should check that we have the right to change the roles here, or maybe it's better leave it to the wasm
|
// 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 privateSplitData = this.splitData(privateData);
|
||||||
const publicSplitData = this.splitData(publicData);
|
const publicSplitData = this.splitData(publicData);
|
||||||
@ -1196,7 +1196,7 @@ export default class Services {
|
|||||||
if (prevouts.includes(tip)) {
|
if (prevouts.includes(tip)) {
|
||||||
const processId = process.states[0].commited_in;
|
const processId = process.states[0].commited_in;
|
||||||
const newTip = this.sdkClient.get_txid(parsedMsg.transaction);
|
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
|
// We take the data out of the output
|
||||||
const newStateId = this.sdkClient.get_opreturn(parsedMsg.transaction);
|
const newStateId = this.sdkClient.get_opreturn(parsedMsg.transaction);
|
||||||
secureLogger.info('newStateId:', { component: 'Service', data: newStateId });
|
secureLogger.info('newStateId:', { component: 'Service', data: newStateId });
|
||||||
@ -2036,7 +2036,7 @@ export default class Services {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const walletStore = DATABASE_CONFIG.stores.wallet.name;
|
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 {
|
try {
|
||||||
const dbRes = await new Promise<any>((resolve, reject) => {
|
const dbRes = await new Promise<any>((resolve, reject) => {
|
||||||
@ -2344,11 +2344,11 @@ export default class Services {
|
|||||||
if (birthday === 0) {
|
if (birthday === 0) {
|
||||||
// This is a new device, set birthday to scan from much earlier to catch faucet transactions
|
// 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
|
// 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,
|
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
|
current_block: this.currentBlockHeight
|
||||||
});
|
} });
|
||||||
|
|
||||||
device.sp_wallet.birthday = Math.max(0, this.currentBlockHeight - 100);
|
device.sp_wallet.birthday = Math.max(0, this.currentBlockHeight - 100);
|
||||||
// We also set last_scan to the same value initially
|
// We also set last_scan to the same value initially
|
||||||
|
|||||||
@ -28,16 +28,11 @@ export async function initWebsocket(url: string) {
|
|||||||
if (typeof msgData === 'string') {
|
if (typeof msgData === 'string') {
|
||||||
try {
|
try {
|
||||||
// Valider le message avant traitement
|
// 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);
|
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) {
|
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', {
|
secureLogger.warn('Invalid WebSocket message received', {
|
||||||
component: 'WebSocket',
|
component: 'WebSocket',
|
||||||
operation: 'message_validation',
|
operation: 'message_validation',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user