chore: upgrade applesauce packages to v4.0.0

- Update all applesauce packages from 3.1.0 to 4.0.0
- Add applesauce-factory dependency
- Version 4.0.0 includes app-data helpers needed for NIP-78
This commit is contained in:
Gigi
2025-10-05 02:35:28 +01:00
parent 1b381a0f8c
commit 1b8c276529
229 changed files with 2533 additions and 7592 deletions

View File

@@ -161,41 +161,30 @@ async function getZapEndpoint(metadata) {
}
return null;
}
function makeZapRequest({
profile,
event,
amount,
relays,
comment = ""
}) {
if (!amount)
throw new Error("amount not given");
if (!profile)
throw new Error("profile not given");
function makeZapRequest(params) {
let zr = {
kind: 9734,
created_at: Math.round(Date.now() / 1e3),
content: comment,
content: params.comment || "",
tags: [
["p", profile],
["amount", amount.toString()],
["relays", ...relays]
["p", "pubkey" in params ? params.pubkey : params.event.pubkey],
["amount", params.amount.toString()],
["relays", ...params.relays]
]
};
if (event && typeof event === "string") {
zr.tags.push(["e", event]);
}
if (event && typeof event === "object") {
if (isReplaceableKind(event.kind)) {
const a = ["a", `${event.kind}:${event.pubkey}:`];
if ("event" in params) {
zr.tags.push(["e", params.event.id]);
if (isReplaceableKind(params.event.kind)) {
const a = ["a", `${params.event.kind}:${params.event.pubkey}:`];
zr.tags.push(a);
} else if (isAddressableKind(event.kind)) {
let d = event.tags.find(([t, v]) => t === "d" && v);
} else if (isAddressableKind(params.event.kind)) {
let d = params.event.tags.find(([t, v]) => t === "d" && v);
if (!d)
throw new Error("d tag not found or is empty");
const a = ["a", `${event.kind}:${event.pubkey}:${d[1]}`];
const a = ["a", `${params.event.kind}:${params.event.pubkey}:${d[1]}`];
zr.tags.push(a);
}
zr.tags.push(["k", params.event.kind.toString()]);
}
return zr;
}