fix: Resolve WebSocket parsing and WASM serialization errors
**Motivations :** - Fix JSON parsing error in parseNewTx method - Fix process.states iteration error in handleHandshakeMsg - Add debugging for WASM serialization issues - Improve error handling for malformed data structures **Modifications :** - Fixed parseNewTx to handle both string and object inputs - Added Array.isArray check for process.states before iteration - Added debug logging for members data in createProcess - Enhanced error handling for WebSocket message processing **Pages affectées :** - src/services/service.ts - Fixed parsing and iteration errors
This commit is contained in:
parent
33935f4b18
commit
050351d52e
@ -890,13 +890,19 @@ export default class Services {
|
|||||||
// console.log('relayAddress:', relayAddress, 'feeRate:', feeRate);
|
// console.log('relayAddress:', relayAddress, 'feeRate:', feeRate);
|
||||||
|
|
||||||
await this.getTokensFromFaucet();
|
await this.getTokensFromFaucet();
|
||||||
|
|
||||||
|
const members = this.getAllMembers();
|
||||||
|
console.log('🔍 DEBUG: Members for create_new_process:', members);
|
||||||
|
console.log('🔍 DEBUG: Members type:', typeof members);
|
||||||
|
console.log('🔍 DEBUG: Members keys:', Object.keys(members));
|
||||||
|
|
||||||
const result = this.sdkClient.create_new_process(
|
const result = this.sdkClient.create_new_process(
|
||||||
encodedPrivateData,
|
encodedPrivateData,
|
||||||
roles,
|
roles,
|
||||||
encodedPublicData,
|
encodedPublicData,
|
||||||
relayAddress,
|
relayAddress,
|
||||||
feeRate,
|
feeRate,
|
||||||
this.getAllMembers()
|
members
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.updated_process) {
|
if (result.updated_process) {
|
||||||
@ -1062,8 +1068,8 @@ export default class Services {
|
|||||||
// await this.saveCipherTxToDb(parsedTx)
|
// await this.saveCipherTxToDb(parsedTx)
|
||||||
}
|
}
|
||||||
|
|
||||||
async parseNewTx(newTxMsg: string) {
|
async parseNewTx(newTxMsg: string | NewTxMessage) {
|
||||||
const parsedMsg: NewTxMessage = JSON.parse(newTxMsg);
|
const parsedMsg: NewTxMessage = typeof newTxMsg === 'string' ? JSON.parse(newTxMsg) : newTxMsg;
|
||||||
if (parsedMsg.error !== null) {
|
if (parsedMsg.error !== null) {
|
||||||
console.error('Received error in new tx message:', parsedMsg.error);
|
console.error('Received error in new tx message:', parsedMsg.error);
|
||||||
return;
|
return;
|
||||||
@ -2182,6 +2188,10 @@ export default class Services {
|
|||||||
// Look for state id we don't know yet
|
// Look for state id we don't know yet
|
||||||
let newStates: string[] = [];
|
let newStates: string[] = [];
|
||||||
let newRoles: Record<string, RoleDefinition>[] = [];
|
let newRoles: Record<string, RoleDefinition>[] = [];
|
||||||
|
if (!Array.isArray(process.states)) {
|
||||||
|
console.warn('process.states is not an array:', process.states);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (const state of process.states) {
|
for (const state of process.states) {
|
||||||
if (!state || !state.state_id) {
|
if (!state || !state.state_id) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user