module NostrManager class PublishZapReceipt < NostrManagerService def initialize(zap:, delayed: true) @zap, @delayed = zap, delayed end def call tags = parse_tags(@zap.request_event.tags) relays = tags[:relays].take(Setting.nostr_zaps_relay_limit) if Setting.nostr_relay_url.present? relays << Setting.nostr_relay_url end relays.uniq.each do |relay_url| if @delayed NostrPublishEventJob.perform_later(event: @zap.receipt, relay_url: relay_url) else NostrManager::PublishEvent.call(event: @zap.receipt_event, relay_url: relay_url) end end end end end