bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
154 lines • 5.17 kB
TypeScript
import type { PrivateKey, PublicKey, Script, Transaction } from "@bsv/sdk";
import type { BapIdentity, FollowTransaction, PostTransaction, UnfollowTransaction } from "bmap-api-types";
import type { Identity, IdentityAttributes } from "bsv-bap";
import type { AuthUser } from "../../../lib/types.js";
import type { BapAddress, IdentityData, SchemaType } from "../../bap-identity/types/identity.js";
export type { Transaction, Script, PrivateKey, PublicKey, Identity, IdentityAttributes, };
export type { IdentityData, BapAddress, SchemaType, BapIdentity };
export declare const PROTOCOL_PREFIXES: {
readonly B: "19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut";
readonly MAP: "1PuQa7K62MiKCtssSLKy1kh56WWU7MtUR5";
readonly BAP: "1BAPSuaPnfGnSBM3GLV9yhxUdYe4vGbdMT";
readonly AIP: "15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva";
};
export type SocialActionType = "post" | "reply" | "like" | "unlike" | "follow" | "unfollow" | "friend" | "unfriend" | "message" | "share";
export type ContentType = "text/plain" | "text/markdown";
export interface SocialContext {
type: "tx" | "bapID" | "channel" | "url";
value: string;
}
export interface SocialTransaction {
type: SocialActionType;
content?: string;
contentType?: ContentType;
context?: SocialContext;
metadata?: Record<string, string>;
app?: string;
}
export type { PostTransaction, MessageTransaction, LikeTransaction, FollowTransaction, UnfollowTransaction, FriendTransaction, PostMeta, MessageMeta, } from "bmap-api-types";
export type { BData, MAPData, AIPSignature } from "bmap-api-types";
export interface AuthUserWithSigning extends AuthUser {
signingKey?: PrivateKey;
}
export interface Reaction {
emoji: string;
count: number;
userReacted: boolean;
bapIds?: string[];
}
export interface UIPostMeta {
shares?: number;
media?: MediaMeta;
tags?: string[];
}
export interface MediaMeta {
type: "image" | "video" | "audio" | "file";
url: string;
alt?: string;
width?: number;
height?: number;
size?: number;
mimeType?: string;
}
export interface ReactionMeta {
emoji: string;
count: number;
idKeys: string[];
}
export interface MessageAttachment {
type: "image" | "file" | "audio" | "video";
url: string;
filename: string;
size: number;
mimeType: string;
}
export interface SocialFriend {
idKey: string;
name?: string;
image?: string;
status: "pending" | "accepted" | "blocked";
mePublicKey?: string;
themPublicKey?: string;
txids?: string[];
lastActive?: number;
}
export interface SocialNotification {
id: string;
type: "like" | "reply" | "follow" | "friend_request" | "message";
from: BapIdentity;
content?: string;
targetTxId?: string;
timestamp: number;
read: boolean;
}
export interface FeedConfig {
type: "global" | "following" | "user" | "channel";
identifier?: string;
pageSize?: number;
includeReplies?: boolean;
includeReactions?: boolean;
}
export interface FeedResponse {
posts: PostTransaction[];
nextPage?: number;
hasMore: boolean;
totalCount?: number;
}
export interface UserSearchResult {
users: BapIdentity[];
hasMore: boolean;
nextPage?: number;
}
export interface SocialButtonProps {
className?: string;
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
size?: "default" | "sm" | "lg" | "icon";
disabled?: boolean;
loading?: boolean;
children?: React.ReactNode;
}
export interface PostButtonProps extends SocialButtonProps {
onPost?: (post: PostTransaction) => void;
defaultContent?: string;
placeholder?: string;
maxLength?: number;
}
export interface LikeButtonProps extends SocialButtonProps {
txid: string;
emoji?: string;
showCount?: boolean;
onLike?: (txid: string, emoji: string) => void;
onUnlike?: (txid: string, emoji: string) => void;
}
export interface FollowButtonProps extends SocialButtonProps {
idKey: string;
isFollowing?: boolean;
onFollow?: (transaction: FollowTransaction) => void;
onUnfollow?: (transaction: UnfollowTransaction) => void;
}
export interface MessageButtonProps extends SocialButtonProps {
recipient?: string;
onMessage?: (txid: string) => void;
defaultContent?: string;
}
export interface FriendButtonProps extends SocialButtonProps {
idKey: string;
status?: "none" | "pending" | "accepted" | "blocked";
onFriendRequest?: (idKey: string) => void;
onAcceptFriend?: (idKey: string) => void;
onUnfriend?: (idKey: string) => void;
}
export interface SocialError {
code: SocialErrorCode;
message: string;
details?: Error | Record<string, unknown>;
}
export type SocialErrorCode = "TRANSACTION_FAILED" | "INVALID_CONTENT" | "USER_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "NETWORK_ERROR" | "BROADCAST_FAILED" | "ENCRYPTION_FAILED" | "INVALID_BAP_ID" | "RATE_LIMITED" | "CONTENT_TOO_LONG" | "UNAUTHORIZED" | "UNKNOWN_ERROR";
export interface BroadcastResult {
success: boolean;
txid?: string;
rawTx?: string;
error?: string;
fee?: number;
}
//# sourceMappingURL=social.d.ts.map