diff --git a/src/pages/home/home.html b/src/pages/home/home.html
index 1bd4749..e8d9a6c 100755
--- a/src/pages/home/home.html
+++ b/src/pages/home/home.html
@@ -16,7 +16,7 @@
-
+
diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts
index 5180d93..15c8de0 100755
--- a/src/pages/home/home.ts
+++ b/src/pages/home/home.ts
@@ -120,7 +120,7 @@ export async function initHomePage(): Promise {
// Set up main pairing interface
setupMainPairing();
-
+
// Set up account actions
setupAccountActions();
@@ -604,9 +604,9 @@ async function handleMainPairing(): Promise {
// Account Actions
export function setupAccountActions(): void {
const container = getCorrectDOM('login-4nk-component') as HTMLElement;
-
+
const deleteAccountButton = container.querySelector('#deleteAccountButton') as HTMLButtonElement;
-
+
if (deleteAccountButton) {
deleteAccountButton.addEventListener('click', async () => {
await handleDeleteAccount();
@@ -617,25 +617,25 @@ export function setupAccountActions(): void {
async function handleDeleteAccount(): Promise {
const container = getCorrectDOM('login-4nk-component') as HTMLElement;
const mainStatus = container.querySelector('#main-status') as HTMLElement;
-
+
// Confirmation dialog
const confirmed = confirm(
'⚠️ WARNING: This will permanently delete your account and all associated data.\n\n' +
'This action cannot be undone!\n\n' +
'Are you sure you want to delete your account?'
);
-
+
if (!confirmed) {
return;
}
-
+
// Double confirmation
const doubleConfirmed = confirm(
'🚨 FINAL WARNING: You are about to permanently delete your account.\n\n' +
'All your data, credentials, and pairings will be lost forever.\n\n' +
'Type "DELETE" to confirm (case sensitive):'
);
-
+
if (doubleConfirmed) {
const userInput = prompt('Type "DELETE" to confirm account deletion:');
if (userInput !== 'DELETE') {
@@ -647,23 +647,23 @@ async function handleDeleteAccount(): Promise {
} else {
return;
}
-
+
try {
if (mainStatus) {
mainStatus.innerHTML = 'Deleting account and all data...';
}
-
+
// Get services
const service = await Services.getInstance();
const { secureCredentialsService } = await import('../../services/secure-credentials.service');
-
+
// Delete all credentials
await secureCredentialsService.deleteCredentials();
-
+
// Clear all local storage
localStorage.clear();
sessionStorage.clear();
-
+
// Clear IndexedDB
if ('indexedDB' in window) {
const databases = await indexedDB.databases();
@@ -673,7 +673,7 @@ async function handleDeleteAccount(): Promise {
}
}
}
-
+
// Clear service worker caches
if ('caches' in window) {
const cacheNames = await caches.keys();
@@ -681,19 +681,19 @@ async function handleDeleteAccount(): Promise {
cacheNames.map(cacheName => caches.delete(cacheName))
);
}
-
+
if (mainStatus) {
mainStatus.innerHTML = '✅ Account and all data deleted successfully';
}
-
+
// Reload the page to start fresh
setTimeout(() => {
window.location.reload();
}, 2000);
-
+
} catch (error) {
console.error('Account deletion failed:', error);
-
+
if (mainStatus) {
mainStatus.innerHTML = '❌ Failed to delete account';
}
diff --git a/src/services/service.ts b/src/services/service.ts
index 9619d7b..d52a3eb 100755
--- a/src/services/service.ts
+++ b/src/services/service.ts
@@ -890,13 +890,19 @@ export default class Services {
// console.log('relayAddress:', relayAddress, 'feeRate:', feeRate);
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(
encodedPrivateData,
roles,
encodedPublicData,
relayAddress,
feeRate,
- this.getAllMembers()
+ members
);
if (result.updated_process) {
@@ -1062,8 +1068,8 @@ export default class Services {
// await this.saveCipherTxToDb(parsedTx)
}
- async parseNewTx(newTxMsg: string) {
- const parsedMsg: NewTxMessage = JSON.parse(newTxMsg);
+ async parseNewTx(newTxMsg: string | NewTxMessage) {
+ const parsedMsg: NewTxMessage = typeof newTxMsg === 'string' ? JSON.parse(newTxMsg) : newTxMsg;
if (parsedMsg.error !== null) {
console.error('Received error in new tx message:', parsedMsg.error);
return;
@@ -2182,6 +2188,10 @@ export default class Services {
// Look for state id we don't know yet
let newStates: string[] = [];
let newRoles: Record[] = [];
+ if (!Array.isArray(process.states)) {
+ console.warn('process.states is not an array:', process.states);
+ continue;
+ }
for (const state of process.states) {
if (!state || !state.state_id) {
continue;