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

@@ -1,15 +1,22 @@
import { useArk } from "@lume/ark";
import { ZapIcon } from "@lume/icons";
import { toast } from "sonner";
import { useNoteContext } from "../provider";
export function NoteZap() {
const ark = useArk();
const event = useNoteContext();
const zap = async () => {
const nwc = await ark.nwc_status();
if (!nwc) {
ark.open_nwc();
} else {
ark.open_zap();
try {
const nwc = await ark.load_nwc();
if (!nwc) {
ark.open_nwc();
} else {
ark.open_zap(event.id, event.pubkey);
}
} catch (e) {
toast.error(String(e));
}
};