hive-react-kit 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ declare const UserDetailProfilePage: () => import("react/jsx-runtime").JSX.Element;
2
+ export default UserDetailProfilePage;
@@ -1,14 +1,78 @@
1
1
  import { Follower, Following, UserProfileResponse, Account } from "@/types/user";
2
+ import { Post } from "@/types/post";
3
+ import type { Poll } from "@/types/poll";
4
+ import type { PendingAuthorRow, PendingCurationRow } from "@/types/reward";
2
5
  declare class UserService {
3
6
  private readonly HIVE_API_URL;
4
- getProfile(username: string): Promise<UserProfileResponse>;
5
- getFollowers(username: string): Promise<Follower[]>;
6
- getFollowing(username: string): Promise<Following[]>;
7
- getAccounts(usernames: string[]): Promise<Account[]>;
8
- getDynamicGlobalProperties(): Promise<any>;
7
+ /** Central fetch wrapper — threads AbortSignal to every network request */
8
+ private _fetch;
9
+ getProfile(username: string, signal?: AbortSignal): Promise<UserProfileResponse>;
10
+ getFollowers(username: string, startFollower?: string | null, limit?: number, signal?: AbortSignal): Promise<Follower[]>;
11
+ getFollowing(username: string, startFollowing?: string | null, limit?: number, signal?: AbortSignal): Promise<Following[]>;
12
+ getAccounts(usernames: string[], signal?: AbortSignal): Promise<Account[]>;
13
+ getDynamicGlobalProperties(signal?: AbortSignal): Promise<any>;
9
14
  convertVestingSharesToHive(vestingShares: string): Promise<string>;
10
- getFeedHistory(): Promise<any>;
15
+ getFeedHistory(signal?: AbortSignal): Promise<any>;
11
16
  getVoteValue(username: string, weight?: number): Promise<string>;
17
+ getUserBlogs(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
18
+ getUserPosts(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
19
+ getUserComments(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
20
+ getUserReplies(username: string, limit?: number, startAuthor?: string, startPermlink?: string, signal?: AbortSignal): Promise<Post[]>;
21
+ /**
22
+ * Fetch snap references for a user from PeakD API.
23
+ * Returns { id, author, permlink }[] with cursor for pagination.
24
+ */
25
+ getSnapReferences(username: string, startId?: number, signal?: AbortSignal): Promise<{
26
+ id: number;
27
+ author: string;
28
+ permlink: string;
29
+ }[]>;
30
+ /**
31
+ * Fetch full post data for multiple snaps via batch bridge.get_post.
32
+ * Fetches in batches of 5 to match PeakD's approach.
33
+ */
34
+ private batchGetPosts;
35
+ /**
36
+ * Fetch snaps for a user using PeakD API + Hive bridge.get_post.
37
+ * Step 1: Get snap references from PeakD (with pagination via startId)
38
+ * Step 2: Batch fetch full post data via bridge.get_post
39
+ */
40
+ getUserSnaps(username: string, startId?: number, observer?: string, signal?: AbortSignal): Promise<{
41
+ snaps: Post[];
42
+ nextStartId: number | null;
43
+ }>;
44
+ /**
45
+ * Fetch polls created by a user from the HiveHub polls API.
46
+ */
47
+ getUserPolls(username: string, signal?: AbortSignal): Promise<Poll[]>;
48
+ /**
49
+ * Fetch full poll detail (includes poll_voters) by author and permlink.
50
+ */
51
+ getPollDetail(author: string, permlink: string, signal?: AbortSignal): Promise<Poll | null>;
52
+ private delay;
53
+ private readonly API_THROTTLE_MS;
54
+ private parseAssetFloat;
55
+ private parseHiveTime;
56
+ /**
57
+ * Fetch pending author rewards for a user.
58
+ * Scans recent posts and comments with pending payouts.
59
+ */
60
+ getPendingAuthorRewards(username: string, onBatch?: (rows: PendingAuthorRow[], totalHbd: number, totalHpEq: number) => void, signal?: AbortSignal): Promise<{
61
+ rows: PendingAuthorRow[];
62
+ totalHbd: number;
63
+ totalHpEq: number;
64
+ }>;
65
+ /**
66
+ * Fetch pending curation rewards for a user.
67
+ * Scans vote history from last 10 days, then estimates curation per post.
68
+ */
69
+ getPendingCurationRewards(username: string, onBatch?: (rows: PendingCurationRow[], totalHp: number, totalHbd: number) => void, signal?: AbortSignal): Promise<{
70
+ rows: PendingCurationRow[];
71
+ totalHp: number;
72
+ totalHbd: number;
73
+ }>;
74
+ /** Generic RPC call helper */
75
+ private rpcCall;
12
76
  userAvatar(username: string): string;
13
77
  }
14
78
  export declare const userService: UserService;
@@ -0,0 +1,64 @@
1
+ export interface PollChoiceVotes {
2
+ total_votes: number;
3
+ hive_hp?: number;
4
+ hive_proxied_hp?: number;
5
+ hive_hp_incl_proxied?: number;
6
+ spl_spsp?: number;
7
+ he_token?: number | null;
8
+ colony_colonyp?: number;
9
+ glx_glxp?: number;
10
+ }
11
+ export interface PollChoice {
12
+ choice_num: number;
13
+ choice_text: string;
14
+ votes?: PollChoiceVotes | null;
15
+ }
16
+ export interface PollVoter {
17
+ name: string;
18
+ choices?: number[];
19
+ choice_num?: number;
20
+ hive_hp?: number;
21
+ glx_glxp?: number;
22
+ he_token?: number | null;
23
+ spl_spsp?: number;
24
+ colony_colonyp?: number;
25
+ hive_proxied_hp?: number;
26
+ hive_hp_incl_proxied?: number;
27
+ }
28
+ export interface PollStats {
29
+ total_voting_accounts_num: number;
30
+ total_hive_hp: number;
31
+ total_hive_proxied_hp: number;
32
+ total_hive_hp_incl_proxied: number;
33
+ total_spl_spsp: number;
34
+ total_he_token: number | null;
35
+ total_colony_colonyp: number;
36
+ total_glx_glxp: number;
37
+ }
38
+ export interface Poll {
39
+ poll_trx_id: string;
40
+ question: string;
41
+ post_title?: string;
42
+ post_body?: string;
43
+ author: string;
44
+ permlink: string;
45
+ created: string;
46
+ end_time: string;
47
+ status: "Active" | "Ended";
48
+ max_choices_voted: number | null;
49
+ filter_account_age_days: number;
50
+ preferred_interpretation: string;
51
+ token: string | null;
52
+ ui_hide_res_until_voted: boolean;
53
+ poll_choices: PollChoice[];
54
+ poll_voters?: PollVoter[];
55
+ poll_stats?: PollStats | null;
56
+ tags?: string[];
57
+ image?: string[] | null;
58
+ platform?: string;
59
+ allow_vote_changes?: boolean;
60
+ category?: string;
61
+ parent_permlink?: string;
62
+ parent_author?: string;
63
+ protocol_version?: number;
64
+ }
@@ -0,0 +1,22 @@
1
+ export interface PendingAuthorRow {
2
+ author: string;
3
+ permlink: string;
4
+ title: string;
5
+ isComment: boolean;
6
+ payoutMs: number;
7
+ hbd: number;
8
+ hpEq: number | null;
9
+ beneficiaryCut: number;
10
+ }
11
+ export interface PendingCurationRow {
12
+ hp: number;
13
+ hbd: number;
14
+ author: string;
15
+ permlink: string;
16
+ title: string;
17
+ payoutMs: number;
18
+ votedAfterMs: number | null;
19
+ weightPct: number;
20
+ efficiency: number | null;
21
+ isComment: boolean;
22
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hive-react-kit",
3
3
  "private": false,
4
- "version": "0.4.8",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.esm.js",