Re-work address

This commit is contained in:
Jon Staab
2024-05-16 10:07:21 -07:00
parent 08d6d93661
commit eee279cefa
9 changed files with 78 additions and 73 deletions
+1 -3
View File
@@ -2,7 +2,7 @@ import {verifiedSymbol} from 'nostr-tools'
import {verifyEvent, getEventHash} from 'nostr-tools'
import {cached, pick, now} from '@welshman/lib'
import {Tags} from './Tags'
import {addressFromEvent, encodeAddress} from './Address'
import {getAddress} from './Address'
import {isEphemeralKind, isReplaceableKind, isPlainReplaceableKind, isParameterizedReplaceableKind} from './Kinds'
export type EventTemplate = {
@@ -98,8 +98,6 @@ export const hasValidSignature = cached<string, boolean, [SignedEvent]>({
},
})
export const getAddress = (e: HashedEvent) => encodeAddress(addressFromEvent(e))
export const getIdOrAddress = (e: HashedEvent) => isReplaceable(e) ? getAddress(e) : e.id
export const getIdAndAddress = (e: HashedEvent) => isReplaceable(e) ? [e.id, getAddress(e)] : [e.id]