diff options
| author | Adam Soltys <[email protected]> | 2026-01-28 22:51:34 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-01-28 22:51:34 -0800 |
| commit | 568a936e08586b7ac07b4c7adaf5bf9b8ef6ba2f (patch) | |
| tree | 56a45c92cd37c8ba1d1d794d300af0462c86dbf3 /src/lib/nip11.ts | |
| parent | 685d085596a1a20d2b5680cf8000313173bbe6fd (diff) | |
| parent | 838f74effb5b45e545bf68a4659e1e36c14da81f (diff) | |
| download | coinos-ui-nip17dm-fixes.tar.gz coinos-ui-nip17dm-fixes.zip | |
Merge remote-tracking branch 'origin/nip17dm'nip17dm-fixes
# Conflicts:
# .env.sample
Diffstat (limited to 'src/lib/nip11.ts')
| -rw-r--r-- | src/lib/nip11.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/nip11.ts b/src/lib/nip11.ts new file mode 100644 index 00000000..af254b7e --- /dev/null +++ b/src/lib/nip11.ts @@ -0,0 +1,15 @@ +import { fetchRelayInformation } from 'nostr-tools/nip11'; + +// Accepts a list of relays, and returns a list of the relays that support all the provided NIPs. +export const relaysSupporting = async (relays: string[], nips: number[]) => { + let supportingRelays = []; + + for (const relay of relays) { + const relayInfo = await fetchRelayInformation(relay); + if (nips.every(relay => relayInfo.supported_nips.includes(relay))) { + supportingRelays.push(relay); + } + } + + return supportingRelays; +} |
