feat: NIP-43
This commit is contained in:
parent
6614a615c4
commit
850d92de28
25 changed files with 1132 additions and 26 deletions
|
|
@ -493,6 +493,25 @@ export function createRelayReviewDraftEvent(
|
|||
}
|
||||
}
|
||||
|
||||
// https://github.com/nostr-protocol/nips/blob/master/43.md
|
||||
export function createJoinDraftEvent(inviteCode: string): TDraftEvent {
|
||||
return {
|
||||
kind: 28934,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
tags: [['claim', inviteCode], ['-']],
|
||||
content: ''
|
||||
}
|
||||
}
|
||||
|
||||
export function createLeaveDraftEvent(): TDraftEvent {
|
||||
return {
|
||||
kind: 28936,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
tags: [['-']],
|
||||
content: ''
|
||||
}
|
||||
}
|
||||
|
||||
function generateImetaTags(imageUrls: string[]) {
|
||||
return imageUrls
|
||||
.map((imageUrl) => {
|
||||
|
|
|
|||
|
|
@ -363,3 +363,8 @@ export function getRetainedEvent(a: Event, b: Event): Event {
|
|||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// Descending sort
|
||||
export function sortEventsDesc(events: Event[]): Event[] {
|
||||
return events.sort((a, b) => compareEvents(b, a))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ export function checkSearchRelay(relayInfo: TRelayInfo | undefined) {
|
|||
return relayInfo?.supported_nips?.includes(50)
|
||||
}
|
||||
|
||||
export function checkNip43Support(relayInfo: TRelayInfo | undefined) {
|
||||
return relayInfo?.supported_nips?.includes(43) && !!relayInfo.pubkey
|
||||
}
|
||||
|
||||
export function filterOutBigRelays(relayUrls: string[]) {
|
||||
return relayUrls.filter((url) => !BIG_RELAY_URLS.includes(url))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue