Remove app date functions
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import {get} from "svelte/store"
|
||||
import {addToListPublicly, removeFromList, makeList, FOLLOWS, MUTES, PINS} from "@welshman/util"
|
||||
import {uniq} from "@welshman/lib"
|
||||
import {addToListPublicly, EventTemplate, removeFromList, makeList, FOLLOWS, MUTES, PINS} from "@welshman/util"
|
||||
import {Nip59, stamp} from "@welshman/signer"
|
||||
import {Router, addMaximalFallbacks} from "@welshman/router"
|
||||
import {userFollows, userMutes, userPins} from "./user.js"
|
||||
import {nip44EncryptToSelf} from "./session.js"
|
||||
import {publishThunk} from "./thunk.js"
|
||||
import {nip44EncryptToSelf, signer} from "./session.js"
|
||||
import {ThunkOptions, MergedThunk, publishThunk} from "./thunk.js"
|
||||
|
||||
export const unfollow = async (value: string) => {
|
||||
const list = get(userFollows) || makeList({kind: FOLLOWS})
|
||||
@@ -52,3 +54,24 @@ export const pin = async (tag: string[]) => {
|
||||
|
||||
return publishThunk({event, relays})
|
||||
}
|
||||
|
||||
export type SendWrappedOptions = Omit<ThunkOptions, "event" | "relays"> & {
|
||||
template: EventTemplate
|
||||
pubkeys: string[]
|
||||
}
|
||||
|
||||
export const sendWrapped = async ({template, pubkeys, ...options}: SendWrappedOptions) => {
|
||||
const nip59 = Nip59.fromSigner(signer.get()!)
|
||||
|
||||
return new MergedThunk(
|
||||
await Promise.all(
|
||||
uniq(pubkeys).map(async recipient =>
|
||||
publishThunk({
|
||||
event: await nip59.wrap(recipient, stamp(template)),
|
||||
relays: Router.get().PubkeyInbox(recipient).getUrls(),
|
||||
...options,
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user