import { NappletMessage, CommonNip19DecodeResult, CommonNip19EncodeInput, CommonNip19EncodeResult, CommonActionResult, CommonFollowsResult, CommonProfileTarget, CommonProfileResult, CommonReaction, CommonReportTarget, CommonReportReason } from '@napplet/core'; export { CommonActionResult, CommonEventReportTarget, CommonFollowsResult, CommonNip19DecodeResult, CommonNip19EncodeInput, CommonNip19EncodeResult, CommonNip19Type, CommonProfileData, CommonProfileResult, CommonProfileTarget, CommonPubkeyReportTarget, CommonReaction, CommonReportReason, CommonReportTarget } from '@napplet/core'; /** * Napplet NAP common types entrypoint. * * @module */ /** * @napplet/nap/common -- Common social action message types for the JSON envelope wire protocol. * * NAP-COMMON lets napplets ask the shell to perform common Nostr social tasks: * public NIP-19 encode/decode, profile lookup, follows, follow/unfollow, * reactions, and reports. The shell owns identity, consent, event construction, * signing, publishing, relay access, and NIP-19 handling. * * Defines the message types exchanged between napplet and shell: * - Napplet -> Shell: encodeNip19, decodeNip19, getProfile, follows, follow, unfollow, react, report * - Shell -> Napplet: corresponding *.result messages * * All types form a discriminated union on the envelope `type` field. */ /** The NAP domain name for common social action messages. */ declare const DOMAIN: "common"; /** Base interface for all common NAP messages. */ interface CommonMessage extends NappletMessage { /** Message type in "common." format. */ type: `common.${string}`; } /** Request public NIP-19 encoding. */ interface CommonEncodeNip19Message extends CommonMessage { type: 'common.encodeNip19'; /** Correlation ID for this request. */ id: string; /** Structured encode input. */ input: CommonNip19EncodeInput; } /** Result of public NIP-19 encoding. */ interface CommonEncodeNip19ResultMessage extends CommonMessage, CommonNip19EncodeResult { type: 'common.encodeNip19.result'; /** Correlation ID matching the original request. */ id: string; } /** Request public NIP-19 decoding. */ interface CommonDecodeNip19Message extends CommonMessage { type: 'common.decodeNip19'; /** Correlation ID for this request. */ id: string; /** NIP-19 value to decode. */ value: string; } /** Result of public NIP-19 decoding. */ interface CommonDecodeNip19ResultMessage extends CommonMessage, CommonNip19DecodeResult { type: 'common.decodeNip19.result'; /** Correlation ID matching the original request. */ id: string; } /** Request profile lookup by hex pubkey, npub, or nprofile. */ interface CommonGetProfileMessage extends CommonMessage { type: 'common.getProfile'; /** Correlation ID for this request. */ id: string; /** Profile target to resolve. */ target: CommonProfileTarget; } /** Result of profile lookup. */ interface CommonGetProfileResultMessage extends CommonMessage, CommonProfileResult { type: 'common.getProfile.result'; /** Correlation ID matching the original request. */ id: string; } /** Request the shell user's follows. */ interface CommonFollowsMessage extends CommonMessage { type: 'common.follows'; /** Correlation ID for this request. */ id: string; } /** Result of the follows request. */ interface CommonFollowsResultMessage extends CommonMessage, CommonFollowsResult { type: 'common.follows.result'; /** Correlation ID matching the original request. */ id: string; } /** Request following one or more npub targets. */ interface CommonFollowMessage extends CommonMessage { type: 'common.follow'; /** Correlation ID for this request. */ id: string; /** Npub targets to follow. */ pubkeys: string[]; } /** Result of a follow request. */ interface CommonFollowResultMessage extends CommonMessage, CommonActionResult { type: 'common.follow.result'; /** Correlation ID matching the original request. */ id: string; } /** Request unfollowing one or more npub targets. */ interface CommonUnfollowMessage extends CommonMessage { type: 'common.unfollow'; /** Correlation ID for this request. */ id: string; /** Npub targets to unfollow. */ pubkeys: string[]; } /** Result of an unfollow request. */ interface CommonUnfollowResultMessage extends CommonMessage, CommonActionResult { type: 'common.unfollow.result'; /** Correlation ID matching the original request. */ id: string; } /** Request a reaction to a native Nostr event. */ interface CommonReactMessage extends CommonMessage { type: 'common.react'; /** Correlation ID for this request. */ id: string; /** Event id to react to. */ targetEventId: string; /** Reaction content. */ reaction: CommonReaction; /** Optional custom emoji URL. */ customEmojiHref?: string; } /** Result of a reaction request. */ interface CommonReactResultMessage extends CommonMessage, CommonActionResult { type: 'common.react.result'; /** Correlation ID matching the original request. */ id: string; } /** Request a NIP-56 report. */ interface CommonReportMessage extends CommonMessage { type: 'common.report'; /** Correlation ID for this request. */ id: string; /** Event or pubkey report target. */ target: CommonReportTarget; /** NIP-56 report reason. */ reason: CommonReportReason; /** Report text. */ text: string; } /** Result of a report request. */ interface CommonReportResultMessage extends CommonMessage, CommonActionResult { type: 'common.report.result'; /** Correlation ID matching the original request. */ id: string; } /** Napplet -> Shell common messages. */ type CommonOutboundMessage = CommonEncodeNip19Message | CommonDecodeNip19Message | CommonGetProfileMessage | CommonFollowsMessage | CommonFollowMessage | CommonUnfollowMessage | CommonReactMessage | CommonReportMessage; /** Shell -> Napplet common messages. */ type CommonInboundMessage = CommonEncodeNip19ResultMessage | CommonDecodeNip19ResultMessage | CommonGetProfileResultMessage | CommonFollowsResultMessage | CommonFollowResultMessage | CommonUnfollowResultMessage | CommonReactResultMessage | CommonReportResultMessage; /** All common NAP message types (discriminated union on `type` field). */ type CommonNapMessage = CommonOutboundMessage | CommonInboundMessage; export { type CommonDecodeNip19Message, type CommonDecodeNip19ResultMessage, type CommonEncodeNip19Message, type CommonEncodeNip19ResultMessage, type CommonFollowMessage, type CommonFollowResultMessage, type CommonFollowsMessage, type CommonFollowsResultMessage, type CommonGetProfileMessage, type CommonGetProfileResultMessage, type CommonInboundMessage, type CommonMessage, type CommonNapMessage, type CommonOutboundMessage, type CommonReactMessage, type CommonReactResultMessage, type CommonReportMessage, type CommonReportResultMessage, type CommonUnfollowMessage, type CommonUnfollowResultMessage, DOMAIN };