Add setProfile and sync helper
This commit is contained in:
@@ -15,6 +15,9 @@ import {
|
||||
makeRoomEditEvent,
|
||||
makeRoomJoinEvent,
|
||||
makeRoomLeaveEvent,
|
||||
isPublishedProfile,
|
||||
createProfile,
|
||||
editProfile,
|
||||
RelayMode,
|
||||
INBOX_RELAYS,
|
||||
FOLLOWS,
|
||||
@@ -22,7 +25,7 @@ import {
|
||||
MUTES,
|
||||
PINS,
|
||||
} from "@welshman/util"
|
||||
import type {RoomMeta} from "@welshman/util"
|
||||
import type {RoomMeta, Profile} from "@welshman/util"
|
||||
import {Nip59, stamp} from "@welshman/signer"
|
||||
import {Router, addMaximalFallbacks} from "@welshman/router"
|
||||
import {
|
||||
@@ -86,6 +89,16 @@ export const addInboxRelay = async (url: string) => {
|
||||
return publishThunk({event, relays})
|
||||
}
|
||||
|
||||
// NIP 01
|
||||
|
||||
export const setProfile = (profile: Profile) => {
|
||||
const router = Router.get()
|
||||
const relays = router.merge([router.Index(), router.FromUser()]).getUrls()
|
||||
const event = isPublishedProfile(profile) ? editProfile(profile) : createProfile(profile)
|
||||
|
||||
return publishThunk({event, relays})
|
||||
}
|
||||
|
||||
// NIP 02
|
||||
|
||||
export const unfollow = async (value: string) => {
|
||||
|
||||
Reference in New Issue
Block a user