import { PLATFORM_SERVICE } from './platformConfig' import type { Article } from '@/types/nostr' /** * Build tags for purchase zap request (kind 9734) * These tags will be included in the zap receipt (kind 9735) by the Lightning wallet */ export function buildPurchaseZapRequestTags(article: Article): string[][] { const category = (() => { if (article.category === 'science-fiction') { return 'sciencefiction' } if (article.category === 'scientific-research') { return 'research' } return 'sciencefiction' })() return [ ['kind_type', 'purchase'], ['site', PLATFORM_SERVICE], ['category', category], ['author', article.pubkey], ['article', article.id], ...(article.seriesId ? [['series', article.seriesId]] : []), ] } /** * Build tags for review tip zap request (kind 9734) */ export function buildReviewTipZapRequestTags(params: { articleId: string reviewId: string authorPubkey: string reviewerPubkey: string category?: 'science-fiction' | 'scientific-research' seriesId?: string text?: string }): string[][] { const category = (() => { if (params.category === 'science-fiction') { return 'sciencefiction' } if (params.category === 'scientific-research') { return 'research' } return 'sciencefiction' })() return [ ['kind_type', 'review_tip'], ['site', PLATFORM_SERVICE], ['category', category], ['author', params.authorPubkey], ['article', params.articleId], ['reviewer', params.reviewerPubkey], ['review_id', params.reviewId], ...(params.seriesId ? [['series', params.seriesId]] : []), ...(params.text ? [['text', params.text]] : []), ] } /** * Build tags for sponsoring zap request (kind 9734) */ export function buildSponsoringZapRequestTags(params: { authorPubkey: string category?: 'science-fiction' | 'scientific-research' seriesId?: string articleId?: string text?: string }): string[][] { const category = (() => { if (params.category === 'science-fiction') { return 'sciencefiction' } if (params.category === 'scientific-research') { return 'research' } return 'sciencefiction' })() return [ ['kind_type', 'sponsoring'], ['site', PLATFORM_SERVICE], ['category', category], ['author', params.authorPubkey], ...(params.seriesId ? [['series', params.seriesId]] : []), ...(params.articleId ? [['article', params.articleId]] : []), ...(params.text ? [['text', params.text]] : []), ] }