feat: add zap

This commit is contained in:
2024-03-11 15:36:17 +07:00
parent bb6badfed6
commit e6b97ab9ae
13 changed files with 349 additions and 451 deletions

View File

@@ -404,17 +404,26 @@ export class Ark {
try {
const cmd: boolean = await invoke("set_nwc", { uri });
return cmd;
} catch {
return false;
} catch (e) {
throw new Error(String(e));
}
}
public async nwc_status() {
public async load_nwc() {
try {
const cmd: boolean = await invoke("nwc_status");
const cmd: boolean = await invoke("load_nwc");
return cmd;
} catch {
return false;
} catch (e) {
throw new Error(String(e));
}
}
public async get_balance() {
try {
const cmd: number = await invoke("get_balance");
return cmd;
} catch (e) {
throw new Error(String(e));
}
}
@@ -422,8 +431,8 @@ export class Ark {
try {
const cmd: boolean = await invoke("zap_profile", { id, amount, message });
return cmd;
} catch {
return false;
} catch (e) {
throw new Error(String(e));
}
}
@@ -431,8 +440,8 @@ export class Ark {
try {
const cmd: boolean = await invoke("zap_event", { id, amount, message });
return cmd;
} catch {
return false;
} catch (e) {
throw new Error(String(e));
}
}
@@ -486,8 +495,7 @@ export class Ark {
return content.url as string;
} catch (e) {
console.error(String(e));
return null;
throw new Error(String(e));
}
}
@@ -549,7 +557,16 @@ export class Ark {
});
}
public open_zap() {
// todo
public open_zap(id: string, pubkey: string, account: string) {
return new WebviewWindow(`zap-${id}`, {
title: "Nostr Wallet Connect",
url: `/zap/${id}?pubkey=${pubkey}&account=${account}`,
minWidth: 400,
width: 400,
height: 500,
hiddenTitle: true,
titleBarStyle: "overlay",
fileDropEnabled: true,
});
}
}