feat: simplify account management

This commit is contained in:
2024-03-06 11:11:24 +07:00
parent 8eaf47f6d2
commit 95294a80cb
7 changed files with 49 additions and 558 deletions

View File

@@ -25,7 +25,7 @@ export class Ark {
const cmd: string[] = await invoke("get_all_nsecs");
for (const item of cmd) {
accounts.push({ npub: item.replace(".nsec", "") });
accounts.push({ npub: item.replace(".npub", "") });
}
this.accounts = accounts;
@@ -37,9 +37,8 @@ export class Ark {
public async load_selected_account(npub: string) {
try {
const fullNpub = `${npub}.nsec`;
const cmd: boolean = await invoke("load_selected_account", {
npub: fullNpub,
npub,
});
return cmd;
@@ -75,10 +74,6 @@ export class Ark {
password,
});
if (cmd) {
await invoke("update_signer", { nsec });
}
return cmd;
} catch (e) {
throw new Error(String(e));