morphit/node_modules/@beblurt/dblurt/lib/chain/nexus.d.ts
Morphit Team 24240cef4c
Some checks failed
morphit-release / Build + publish release tarball (push) Has been cancelled
Reputation flags clearable across all four signals; names and avatars stop vanishing
2026-07-23 14:28:04 -07:00

411 lines
12 KiB
TypeScript

/**
* @file Blurt type definitions related to Nexus.
* @author BeBlurt <https://beblurt.com/@beblurt>
* @description adaptation from Johan Nordberg <code@johan-nordberg.com> type definitions related to comments and posting.
* @license
* Copyright (c) 2017 Johan Nordberg. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You acknowledge that this software is not designed, licensed or intended for use
* in the design, construction, operation or maintenance of any military facility.
*/
import { Asset } from './asset';
import { BeneficiaryRoute } from './comment';
/** Community Identifier */
export declare const communityAccountRegexp: RegExp;
export declare const isValidCommunityAccountRegexp: (communityAccount: string) => boolean;
export type NexusTypeNotification = 'new_community' | 'set_role' | 'set_props' | 'set_label' | 'mute_post' | 'unmute_post' | 'pin_post' | 'unpin_post' | 'flag_post' | 'error' | 'subscribe' | 'reply' | 'reply_comment' | 'reblog' | 'follow' | 'mention' | 'vote' | 'referral';
export interface NexusAccountNotifications {
id: number;
type: NexusTypeNotification;
score: number;
date: string;
msg: string;
url: string;
}
export interface NexusNotificationQuery {
account: string;
min_score?: number;
last_id?: number | null;
limit?: number;
}
export interface NexusPostNotificationQuery {
author: string;
permlink: string;
min_score?: number;
last_id?: number | null;
limit?: number;
}
export interface NexusUnreadNotificationsQuery {
account: string;
min_score?: number;
}
export interface NexusUnreadNotifications {
lastread: string;
unread: number;
}
export type NexusAccountPostSort = 'blog' | 'feed' | 'posts' | 'comments' | 'replies' | 'payout';
export interface NexusAccountPostsQuery {
sort: NexusAccountPostSort;
account: string;
start_author?: string | null;
start_permlink?: string | null;
limit?: number;
observer?: string | null;
}
export interface NexusPostQuery {
author: string;
permlink: string;
observer?: string | null;
}
export interface NexusCommunityQuery {
name: string;
observer?: string | null;
}
export interface NexusProfileQuery {
account: string;
observer?: string | null;
}
export type NexusCommunitySort = 'rank' | 'new' | 'subs';
export interface NexusListCommunitiesQuery {
last?: string | null;
limit?: number;
query?: string | null;
sort?: NexusCommunitySort;
observer?: string | null;
}
export interface NexusRankedPostsQuery {
sort: NexusSortGetRankedPost;
start_author?: string | null;
start_permlink?: string | null;
limit?: number;
tag?: string | null;
observer?: string | null;
}
export interface NexusReferralAccountsQuery {
referrer?: string | null;
campaign_id?: string | null;
limit?: number;
last_created_at?: string | null;
}
export interface NexusReferralAccountsCountQuery {
referrer?: string | null;
campaign_id?: string | null;
start_date?: string | null;
end_date?: string | null;
}
export interface NexusReferralAccountsCount {
referrer: string | null;
campaign_id: string | null;
count: number;
}
export type NexusCommunitySubscription = [community: string, title: string, role: string, userTitle: string | null];
export type NexusCommunityRole = [account: string, role: string, title: string | null];
export type NexusCommunityTitle = [account: string, role: string, title: string | null];
export type NexusCommunitySummary = [community: string, title: string];
export type NexusCommunitySubscriber = [account: string, role: string, title: string | null, createdAt: string];
export interface NexusPost {
post_id: number;
author: string;
permlink: string;
category: string;
title: string;
body: string;
json_metadata: {
tags?: string[];
users?: string[];
image?: string[];
links?: string[];
app?: string;
format?: string;
description?: string;
community?: string;
flow?: {
tags: string[];
pictures: {
id: number;
name: string;
mime: string;
url: string;
tags: string[];
caption: string;
}[];
};
type?: string | '3speak/video';
video: {
info: {
platform: string | '3speak';
title: string;
author: string;
permlink: string;
duration: number;
filesize: number;
file: string;
lang: string;
firstUpload: boolean;
ipfs: string | null;
ipfsThumbnail: string | null;
video_v2: string | null;
sourceMap: {
type: string | 'video';
url: string;
format: string | 'm3u8';
}[];
};
content: {
description: string;
tags: string[];
};
};
};
created: string;
updated: string;
depth: number;
children: number;
net_rshares: number | string;
is_paidout: boolean;
payout_at: string;
payout: number;
pending_payout_value: Asset | string;
author_payout_value: Asset | string;
curator_payout_value: Asset | string;
promoted: Asset | string;
replies: [];
active_votes: {
voter: string;
rshares: number | string;
}[];
stats: {
hide: boolean;
gray: boolean;
total_votes: number;
flag_weight: number;
is_pinned?: boolean;
is_muted?: boolean;
referrer?: string;
};
beneficiaries: BeneficiaryRoute[];
max_accepted_payout: Asset | string;
percent_blurt: number;
parent_author?: string;
parent_permlink?: string;
url: string;
blacklists: [];
reblogged_by?: string[];
community?: string;
community_title?: string;
author_role?: string;
author_title?: string;
}
export interface NexusCommunityContext {
role: string;
subscribed: boolean;
title: string;
}
export interface NexusProfile {
id: number;
name: string;
created: string;
active: string;
post_count: number;
blacklists: [];
stats: {
/** Estimated BLURT Power, canonical Nexus field name. */
bp: number;
rank: number;
following: number;
followers: number;
referrer: string | null;
};
metadata: {
profile: {
name: string;
about: string;
website: string;
location: string;
cover_image: string;
profile_image: string;
};
};
context?: {
followed: boolean;
};
}
export interface NexusPostHeader {
author: string;
permlink: string;
category: string;
depth: number;
}
export interface NexusCommunity {
id: number;
name: string;
title: string;
about: string;
lang: string;
type_id: number;
is_nsfw: boolean;
subscribers: number;
sum_pending: number;
num_pending: number;
num_authors: number;
created_at: string;
avatar_url: string;
cover_url?: string;
context: {
subscribed: boolean;
role: string;
title: string;
};
admins: string[];
}
export interface NexusCommunityExtended extends Omit<NexusCommunity, 'admins'> {
description: string;
flag_text: string;
settings: {
avatar_url: string;
cover_url?: string;
default_view: 'list' | 'blog' | 'grid';
comment_display: 'votes' | 'trending' | 'age' | 'forum';
};
team: [string, string, string | ''][];
}
export interface NexusPayoutStats {
items: [
string,
string,
number,
number,
// number of posts
number | null
][];
total: number;
blogs: number;
}
/** Possible sort for `get_ranked_posts`. */
export type NexusSortGetRankedPost = 'trending' | 'hot' | 'created' | 'promoted' | 'payout' | 'payout_comments' | 'muted';
export interface NexusUpdateProps {
community: string;
props: {
/** 32 chars maximum */
title: string;
/** 120 chars maximum */
about: string;
/** ISO 639-1 (en, fr, de) */
lang: string;
/** true if this community is 18+. UI to automatically tag all posts/comments nsfw */
is_nsfw: boolean;
/** a blob of markdown to describe purpose, enumerate rules, etc. (5000 chars) */
description: string;
/** custom text for reporting content */
flag_text: string;
settings: {
/** same format as account avatars; usually rendered as a circle */
avatar_url: string;
/** same format as account covers; used as header background image */
cover_url: string;
default_view: 'list' | 'blog' | 'grid';
};
};
}
export interface NexusUpdatePropsOperation {
0: 'updateProps';
1: NexusUpdateProps;
}
export interface NexusSetRoleOperation {
0: 'setRole';
1: {
community: string;
account: string;
role: 'muted' | 'guest' | 'member' | 'mod' | 'admin' | 'owner';
};
}
export interface NexusSetUserTitleOperation {
0: 'setUserTitle';
1: {
community: string;
account: string;
title: string;
};
}
export interface NexusMutePostOperation {
0: 'mutePost';
1: {
community: string;
account: string;
permlink: string;
notes: string;
};
}
export interface NexusUnMutePostOperation {
0: 'unmutePost';
1: {
community: string;
account: string;
permlink: string;
notes: string;
};
}
export interface NexusPinPostOperation {
0: 'pinPost';
1: {
community: string;
account: string;
permlink: string;
};
}
export interface NexusUnPinPostOperation {
0: 'unpinPost';
1: {
community: string;
account: string;
permlink: string;
};
}
export interface NexusFlagPostOperation {
0: 'flagPost';
1: {
community: string;
account: string;
permlink: string;
notes: string;
};
}
export interface ReferralAccount {
account: string;
referrer: string;
campaign_id: string;
created: string;
}
export interface NexusSetRoleOperation {
0: 'setRole';
1: {
community: string;
account: string;
role: 'muted' | 'guest' | 'member' | 'mod' | 'admin' | 'owner';
};
}