feat: mute list

This commit is contained in:
2023-07-30 00:26:16 +02:00
parent 99e5b9688f
commit 0a5623e74f
12 changed files with 248 additions and 97 deletions

View File

@ -9,7 +9,6 @@ import { bytesToHex } from "@noble/curves/abstract/utils";
import { formatSats } from "../number";
import { Icon } from "./icon";
import AsyncButton from "./async-button";
import { Relays } from "index";
import QrCode from "./qr-code";
import { useLogin } from "hooks/login";
import Copy from "./copy";
@ -21,7 +20,7 @@ export interface LNURLLike {
getInvoice(
amountInSats: number,
comment?: string,
zap?: NostrEvent
zap?: NostrEvent,
): Promise<{ pr?: string }>;
}
@ -55,7 +54,7 @@ export function SendZaps({
const [comment, setComment] = useState("");
const [invoice, setInvoice] = useState("");
const login = useLogin();
const relays = Object.keys(login.relays);
const name = targetName ?? svc?.name;
async function loadService(lnurl: string) {
const s = new LNURL(lnurl);
@ -78,7 +77,9 @@ export function SendZaps({
let pub = login?.publisher();
let isAnon = false;
if (!pub) {
pub = EventPublisher.privateKey(bytesToHex(secp256k1.utils.randomPrivateKey()));
pub = EventPublisher.privateKey(
bytesToHex(secp256k1.utils.randomPrivateKey()),
);
isAnon = true;
}
@ -88,7 +89,7 @@ export function SendZaps({
zap = await pub.zap(
amountInSats * 1000,
pubkey,
Relays,
relays,
undefined,
comment,
(eb) => {
@ -102,7 +103,7 @@ export function SendZaps({
eb.tag(["anon", ""]);
}
return eb;
}
},
);
}
const invoice = await svc.getInvoice(amountInSats, comment, zap);