add support for nip-94

This commit is contained in:
Ren Amamiya
2023-05-08 09:07:49 +07:00
parent b6ef52e38c
commit 348dc9009c
11 changed files with 75 additions and 30 deletions

View File

@@ -36,7 +36,7 @@ export const getParentID = (arr: string[], fallback: string) => {
let parentID = fallback;
if (tags.length > 0) {
if (tags[0][0] === 'e' || tags[0][2] === 'root' || tags[0][3] === 'root') {
if (tags[0][0] === 'e') {
parentID = tags[0][1];
} else {
tags.forEach((tag) => {
@@ -50,6 +50,19 @@ export const getParentID = (arr: string[], fallback: string) => {
return parentID;
};
// check id present in event tags
export const isTagsIncludeID = (id: string, arr: string[]) => {
const tags = destr(arr);
if (tags.length > 0) {
if (tags[0][1] === id) {
return true;
}
} else {
return false;
}
};
// get parent id from event tags
export const getQuoteID = (arr: string[]) => {
const tags = destr(arr);