diff --git a/src/services/service.ts b/src/services/service.ts index 41e0bbf..f5311ad 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -703,7 +703,7 @@ export default class Services { // Update UI status const { updateCreatorStatus } = await import('../utils/sp-address.utils'); updateCreatorStatus('⏳ Waiting for relays to be ready...'); - + await this.getRelayReadyPromise(); relayAddress = this.getAllRelays()[0]?.spAddress; } @@ -1674,6 +1674,10 @@ export default class Services { } public async getProcess(processId: string): Promise { + if (!processId) { + return null; + } + if (this.processesCache[processId]) { return this.processesCache[processId]; } else { @@ -2285,10 +2289,16 @@ export default class Services { console.log('Requesting data from peers'); const membersList = this.getAllMembers(); try { - const res = this.sdkClient.request_data(processId, stateIds, roles, membersList); + // Convert objects to strings for WASM compatibility + const rolesString = JSON.stringify(roles); + const membersString = JSON.stringify(membersList); + const stateIdsString = JSON.stringify(stateIds); + + const res = this.sdkClient.request_data(processId, stateIdsString, rolesString, membersString); await this.handleApiReturn(res); } catch (e) { - console.error(e); + console.error('Error requesting data from peers:', e); + throw e; } } diff --git a/src/utils/sp-address.utils.ts b/src/utils/sp-address.utils.ts index db998b0..ef78b21 100755 --- a/src/utils/sp-address.utils.ts +++ b/src/utils/sp-address.utils.ts @@ -2444,7 +2444,7 @@ function handleWordsInput() { } // Update creator status -function updateCreatorStatus(message: string, isError: boolean = false) { +export function updateCreatorStatus(message: string, isError: boolean = false) { const container = getCorrectDOM('login-4nk-component') as HTMLElement; const statusElement = container.querySelector('#creator-status'); if (statusElement) { @@ -2696,7 +2696,7 @@ export async function prepareAndSendPairingTx(): Promise { } console.log(`🔍 DEBUG: Creator address: ${creatorAddress}`); - + // Update UI with creator address updateCreatorStatus(`Creator address: ${creatorAddress}`);