aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrien Hopkins <[email protected]>2026-01-28 12:51:57 -0500
committerAdrien Hopkins <[email protected]>2026-01-28 12:51:57 -0500
commit59f5c9c042b54151abca61913626f2edbce7667a (patch)
treec5225e8efd906896e3124c48359d784a4c138ee7 /src
parent7d4564e7f9d152059936b880b3831ce9cd4385eb (diff)
downloadcoinos-ui-59f5c9c042b54151abca61913626f2edbce7667a.tar.gz
coinos-ui-59f5c9c042b54151abca61913626f2edbce7667a.zip
Add doc comments to my exported $lib methods
Diffstat (limited to 'src')
-rw-r--r--src/lib/nip01.ts1
-rw-r--r--src/lib/nip07.ts1
-rw-r--r--src/lib/nip17.ts2
-rw-r--r--src/lib/nip51.ts3
4 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/nip01.ts b/src/lib/nip01.ts
index f7653fa4..a5d3f4b5 100644
--- a/src/lib/nip01.ts
+++ b/src/lib/nip01.ts
@@ -5,6 +5,7 @@ const USERINFO_RELAYS = [ ...DM_RELAYS_LIST, PUBLIC_COINOS_RELAY ];
import { SimplePool } from 'nostr-tools/pool';
const pool = new SimplePool();
+// Returns the content of the kind-0 event of the provided pubkey.
export const getNostrUserInfo = async (pubkey: string) => {
const events = await pool.querySync(
USERINFO_RELAYS, { kinds: [0], limit: 1, authors: [pubkey] }
diff --git a/src/lib/nip07.ts b/src/lib/nip07.ts
index 7191da33..9f675950 100644
--- a/src/lib/nip07.ts
+++ b/src/lib/nip07.ts
@@ -5,6 +5,7 @@ import { getPrivateKey } from '$lib/nostr';
import * as libnip44 from '$lib/nip44';
import { u } from '$lib/nip44';
+// Signs an event using NIP-07 if available, otherwise getPrivateKey()
export const signEvent = async (event: object, user: object): object => {
if (await window.nostr.getPublicKey() === user.pubkey) {
return window.nostr.signEvent(event);
diff --git a/src/lib/nip17.ts b/src/lib/nip17.ts
index a8cadd2f..b128dab9 100644
--- a/src/lib/nip17.ts
+++ b/src/lib/nip17.ts
@@ -169,6 +169,8 @@ export const getMessageRumours = async (user: object): object[] => {
return rumours;
}
+// Returns the preferred relays of the user with the provided pubkey,
+// according to their kind-10050 event.
export const getPreferredRelays = async (pubkey: string): string[] => {
if (relayListCache.has(pubkey))
return relayListCache.get(pubkey);
diff --git a/src/lib/nip51.ts b/src/lib/nip51.ts
index 8d6f76db..b1b0b613 100644
--- a/src/lib/nip51.ts
+++ b/src/lib/nip51.ts
@@ -6,6 +6,7 @@ const pool = new SimplePool();
import { PUBLIC_DM_RELAYS } from '$env/static/public';
const DM_RELAYS_LIST = PUBLIC_DM_RELAYS.split(',');
+// Mute the provided pubkey, as the provided user.
export const mute = async (user: object, pubkey: string, hide: bool) => {
let { shown, hidden } = await getMuteLists(user);
if (hide) {
@@ -19,6 +20,7 @@ export const mute = async (user: object, pubkey: string, hide: bool) => {
const tagMatches = (tag: string[], pubkey: string): bool =>
tag.length >= 2 && tag[0] === "p" && tag[1] === pubkey;
+// Unmute the provided pubkey, as the provided user.
export const unmute = async (user: object, pubkey: string) => {
let { shown, hidden } = await getMuteLists(user);
shown = shown.filter(tag => !tagMatches(tag, pubkey));
@@ -26,6 +28,7 @@ export const unmute = async (user: object, pubkey: string) => {
await publishMuteList(user, shown, hidden);
}
+// Returns a set of the provided user's muted accounts.
export const mutedAccounts = async (user: object): Set<string> => {
const { shown, hidden } = await getMuteLists(user);
let muted = new Set<string>();