mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 22:14:26 +01:00
update
This commit is contained in:
@@ -4,6 +4,8 @@ import type { Pub } from 'nostr-tools/relay';
|
||||
|
||||
import usePool from '@/clients/usePool';
|
||||
|
||||
const currentDate = (): number => Math.floor(Date.now() / 1000);
|
||||
|
||||
// NIP-20: Command Result
|
||||
const waitCommandResult = (pub: Pub): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -48,11 +50,10 @@ const useCommands = () => {
|
||||
const preSignedEvent: NostrEvent = {
|
||||
kind: 1,
|
||||
pubkey,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
created_at: currentDate(),
|
||||
tags: [],
|
||||
content,
|
||||
};
|
||||
// TODO define window.nostr
|
||||
return publishEvent(relayUrls, preSignedEvent);
|
||||
},
|
||||
// NIP-25
|
||||
@@ -73,14 +74,40 @@ const useCommands = () => {
|
||||
const preSignedEvent: NostrEvent = {
|
||||
kind: 7,
|
||||
pubkey,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
created_at: currentDate(),
|
||||
tags: [
|
||||
['e', eventId],
|
||||
['p', notifyPubkey],
|
||||
],
|
||||
content,
|
||||
};
|
||||
// TODO define window.nostr
|
||||
return publishEvent(relayUrls, preSignedEvent);
|
||||
},
|
||||
// NIP-18
|
||||
publishDeprecatedRepost({
|
||||
relayUrls,
|
||||
pubkey,
|
||||
eventId,
|
||||
notifyPubkey,
|
||||
}: {
|
||||
relayUrls: string[];
|
||||
pubkey: string;
|
||||
eventId: string;
|
||||
notifyPubkey: string;
|
||||
}): Promise<Promise<void>[]> {
|
||||
const preSignedEvent: NostrEvent = {
|
||||
kind: 6,
|
||||
pubkey,
|
||||
created_at: currentDate(),
|
||||
tags: [
|
||||
['e', eventId],
|
||||
['p', notifyPubkey],
|
||||
],
|
||||
// Some clients includes some contents here.
|
||||
// Damus includes an original event. Iris includes #[0] as a mention.
|
||||
// We just follow the specification.
|
||||
content: '',
|
||||
};
|
||||
return publishEvent(relayUrls, preSignedEvent);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user