morphit/node_modules/@beblurt/dblurt/lib/social.d.ts

70 lines
3.3 KiB
TypeScript

import { CustomJsonOperation } from './chain/operation';
export type CustomJsonPayload = unknown;
export interface CustomJsonBuilderOptions<TPayload = CustomJsonPayload> {
/** Account signing with posting authority. */
account: string;
/** Custom JSON protocol id, for example `follow`, `reblog`, `community`, or `notify`. */
id: string;
/** JSON payload before stringification. */
payload: TPayload;
/** Optional active/owner authorities for non-posting custom JSON conventions. Defaults to none. */
required_auths?: string[];
/** Override posting authorities. Defaults to `[account]`. */
required_posting_auths?: string[];
}
export type FollowWhat = 'blog' | 'ignore';
export type FollowJsonPayload = ['follow', {
follower: string;
following: string;
what: FollowWhat[];
}];
export type ReblogJsonPayload = ['reblog', {
account: string;
author: string;
permlink: string;
delete?: 'delete';
}];
export type CommunitySubscriptionAction = 'subscribe' | 'unsubscribe';
export type CommunitySubscriptionJsonPayload = [CommunitySubscriptionAction, {
community: string;
}];
export type ReadNotificationJsonPayload = ['setLastRead', {
date: string;
}];
export interface FollowOperationOptions {
follower: string;
following: string;
}
export interface ReblogOperationOptions {
account: string;
author: string;
permlink: string;
}
export interface CommunitySubscriptionOperationOptions {
account: string;
community: string;
}
export interface ReadNotificationOperationOptions {
account: string;
date: string;
}
/** Build a typed `custom_json` operation from an unstringified payload. */
export declare function buildCustomJsonOperation<TPayload = CustomJsonPayload>(options: CustomJsonBuilderOptions<TPayload>): CustomJsonOperation;
/** Build a `follow` custom_json operation using posting authority. */
export declare function buildFollowOperation(options: FollowOperationOptions): CustomJsonOperation;
/** Build an `unfollow` custom_json operation using the empty follow-list convention. */
export declare function buildUnfollowOperation(options: FollowOperationOptions): CustomJsonOperation;
/** Build a mute operation using the follow/ignore convention. */
export declare function buildMuteOperation(options: FollowOperationOptions): CustomJsonOperation;
/** Build an unmute operation using the empty follow-list convention. */
export declare function buildUnmuteOperation(options: FollowOperationOptions): CustomJsonOperation;
/** Build a reblog custom_json operation. */
export declare function buildReblogOperation(options: ReblogOperationOptions): CustomJsonOperation;
/** Build an undo-reblog custom_json operation. */
export declare function buildUndoReblogOperation(options: ReblogOperationOptions): CustomJsonOperation;
/** Build a community subscribe custom_json operation. */
export declare function buildCommunitySubscribeOperation(options: CommunitySubscriptionOperationOptions): CustomJsonOperation;
/** Build a community unsubscribe custom_json operation. */
export declare function buildCommunityUnsubscribeOperation(options: CommunitySubscriptionOperationOptions): CustomJsonOperation;
/** Build a notification read-marker custom_json operation. */
export declare function buildReadNotificationOperation(options: ReadNotificationOperationOptions): CustomJsonOperation;