hive-stream 3.0.4 → 3.0.5

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.
package/dist/utils.d.ts CHANGED
@@ -363,5 +363,447 @@ export declare const Utils: {
363
363
  * @returns The complete Hivesigner transfer URL
364
364
  */
365
365
  getTransferUrl(to: string, memo: string, amount: string, redirectUri: string): string;
366
+ /**
367
+ * Follows a Hive user by broadcasting a custom_json 'follow' operation
368
+ * @param client - The Hive client instance
369
+ * @param config - Configuration containing the posting key
370
+ * @param follower - The account doing the following
371
+ * @param following - The account to follow
372
+ * @returns Promise resolving to the broadcast result
373
+ */
374
+ follow(client: Client, config: Partial<ConfigInterface>, follower: string, following: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
375
+ /**
376
+ * Unfollows a Hive user by broadcasting a custom_json 'follow' operation with empty what
377
+ * @param client - The Hive client instance
378
+ * @param config - Configuration containing the posting key
379
+ * @param follower - The account doing the unfollowing
380
+ * @param following - The account to unfollow
381
+ * @returns Promise resolving to the broadcast result
382
+ */
383
+ unfollow(client: Client, config: Partial<ConfigInterface>, follower: string, following: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
384
+ /**
385
+ * Mutes a Hive user by broadcasting a custom_json 'follow' operation with 'ignore'
386
+ * @param client - The Hive client instance
387
+ * @param config - Configuration containing the posting key
388
+ * @param follower - The account doing the muting
389
+ * @param following - The account to mute
390
+ * @returns Promise resolving to the broadcast result
391
+ */
392
+ mute(client: Client, config: Partial<ConfigInterface>, follower: string, following: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
393
+ /**
394
+ * Reblogs (resteems) a post on Hive
395
+ * @param client - The Hive client instance
396
+ * @param config - Configuration containing the posting key
397
+ * @param account - The account performing the reblog
398
+ * @param author - The original post author
399
+ * @param permlink - The permlink of the post to reblog
400
+ * @returns Promise resolving to the broadcast result
401
+ */
402
+ reblog(client: Client, config: Partial<ConfigInterface>, account: string, author: string, permlink: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
403
+ /**
404
+ * Powers up HIVE to Hive Power (VESTS) for an account
405
+ * @param client - The Hive client instance
406
+ * @param config - Configuration containing the active key
407
+ * @param from - The account providing the HIVE
408
+ * @param to - The account receiving the Hive Power (can be same as from)
409
+ * @param amount - The amount of HIVE to power up
410
+ * @returns Promise resolving to the broadcast result
411
+ */
412
+ powerUp(client: Client, config: Partial<ConfigInterface>, from: string, to: string, amount: string): any;
413
+ /**
414
+ * Initiates a power down (withdrawal of vesting shares) for an account
415
+ * @param client - The Hive client instance
416
+ * @param config - Configuration containing the active key
417
+ * @param account - The account to power down
418
+ * @param vestingShares - The amount of VESTS to power down (e.g. '1000.000000 VESTS')
419
+ * @returns Promise resolving to the broadcast result
420
+ */
421
+ powerDown(client: Client, config: Partial<ConfigInterface>, account: string, vestingShares: string): any;
422
+ /**
423
+ * Cancels an active power down by setting vesting shares to 0
424
+ * @param client - The Hive client instance
425
+ * @param config - Configuration containing the active key
426
+ * @param account - The account to cancel power down for
427
+ * @returns Promise resolving to the broadcast result
428
+ */
429
+ cancelPowerDown(client: Client, config: Partial<ConfigInterface>, account: string): any;
430
+ /**
431
+ * Delegates vesting shares (Hive Power) to another account
432
+ * @param client - The Hive client instance
433
+ * @param config - Configuration containing the active key
434
+ * @param delegator - The account delegating HP
435
+ * @param delegatee - The account receiving the delegation
436
+ * @param vestingShares - The amount of VESTS to delegate (e.g. '1000.000000 VESTS')
437
+ * @returns Promise resolving to the broadcast result
438
+ */
439
+ delegateVestingShares(client: Client, config: Partial<ConfigInterface>, delegator: string, delegatee: string, vestingShares: string): any;
440
+ /**
441
+ * Removes a vesting shares delegation by delegating 0 VESTS
442
+ * @param client - The Hive client instance
443
+ * @param config - Configuration containing the active key
444
+ * @param delegator - The account removing the delegation
445
+ * @param delegatee - The account to remove delegation from
446
+ * @returns Promise resolving to the broadcast result
447
+ */
448
+ undelegateVestingShares(client: Client, config: Partial<ConfigInterface>, delegator: string, delegatee: string): any;
449
+ /**
450
+ * Claims pending rewards for an account
451
+ * @param client - The Hive client instance
452
+ * @param config - Configuration containing the posting key
453
+ * @param account - The account to claim rewards for
454
+ * @param rewardHive - HIVE rewards to claim (e.g. '0.000 HIVE')
455
+ * @param rewardHbd - HBD rewards to claim (e.g. '0.000 HBD')
456
+ * @param rewardVests - VESTS rewards to claim (e.g. '0.000000 VESTS')
457
+ * @returns Promise resolving to the broadcast result
458
+ */
459
+ claimRewards(client: Client, config: Partial<ConfigInterface>, account: string, rewardHive: string, rewardHbd: string, rewardVests: string): any;
460
+ /**
461
+ * Votes for or unvotes a witness
462
+ * @param client - The Hive client instance
463
+ * @param config - Configuration containing the active key
464
+ * @param account - The account casting the witness vote
465
+ * @param witness - The witness account to vote for
466
+ * @param approve - true to vote, false to remove vote
467
+ * @returns Promise resolving to the broadcast result
468
+ */
469
+ witnessVote(client: Client, config: Partial<ConfigInterface>, account: string, witness: string, approve?: boolean): any;
470
+ /**
471
+ * Sets a governance proxy for an account (delegates witness voting to another account)
472
+ * @param client - The Hive client instance
473
+ * @param config - Configuration containing the active key
474
+ * @param account - The account setting the proxy
475
+ * @param proxy - The account to proxy votes to
476
+ * @returns Promise resolving to the broadcast result
477
+ */
478
+ setProxy(client: Client, config: Partial<ConfigInterface>, account: string, proxy: string): any;
479
+ /**
480
+ * Clears the governance proxy for an account
481
+ * @param client - The Hive client instance
482
+ * @param config - Configuration containing the active key
483
+ * @param account - The account clearing the proxy
484
+ * @returns Promise resolving to the broadcast result
485
+ */
486
+ clearProxy(client: Client, config: Partial<ConfigInterface>, account: string): any;
487
+ /**
488
+ * Updates an account's profile metadata using account_update2
489
+ * @param client - The Hive client instance
490
+ * @param config - Configuration containing the posting key
491
+ * @param account - The account to update
492
+ * @param profile - Profile data (name, about, location, website, profile_image, cover_image)
493
+ * @returns Promise resolving to the broadcast result
494
+ */
495
+ updateProfile(client: Client, config: Partial<ConfigInterface>, account: string, profile: {
496
+ name?: string;
497
+ about?: string;
498
+ location?: string;
499
+ website?: string;
500
+ profile_image?: string;
501
+ cover_image?: string;
502
+ [key: string]: any;
503
+ }): Promise<any>;
504
+ /**
505
+ * Fetches account data for a single account
506
+ * @param client - The Hive client instance
507
+ * @param username - The account name to look up
508
+ * @returns Promise resolving to the account data, or null if not found
509
+ */
510
+ getAccount(client: Client, username: string): Promise<any>;
511
+ /**
512
+ * Fetches account data for multiple accounts
513
+ * @param client - The Hive client instance
514
+ * @param usernames - Array of account names to look up
515
+ * @returns Promise resolving to array of account data
516
+ */
517
+ getAccounts(client: Client, usernames: string[]): Promise<any[]>;
518
+ /**
519
+ * Converts raw Hive reputation value to a human-readable score (roughly 25-75 range)
520
+ * @param rawReputation - The raw reputation value from the blockchain (can be string or number)
521
+ * @returns The human-readable reputation score
522
+ */
523
+ calculateReputation(rawReputation: string | number): number;
524
+ /**
525
+ * Converts VESTS to Hive Power (HP)
526
+ * @param vests - The amount of VESTS (as string or number)
527
+ * @param totalVestingFundHive - Total vesting fund in HIVE from dynamic global properties
528
+ * @param totalVestingShares - Total vesting shares from dynamic global properties
529
+ * @returns The equivalent Hive Power amount as a string with 3 decimal places
530
+ */
531
+ vestToHP(vests: string | number, totalVestingFundHive: string | number, totalVestingShares: string | number): string;
532
+ /**
533
+ * Converts Hive Power (HP) to VESTS
534
+ * @param hp - The amount of HP (as string or number)
535
+ * @param totalVestingFundHive - Total vesting fund in HIVE from dynamic global properties
536
+ * @param totalVestingShares - Total vesting shares from dynamic global properties
537
+ * @returns The equivalent VESTS amount as a string with 6 decimal places
538
+ */
539
+ hpToVest(hp: string | number, totalVestingFundHive: string | number, totalVestingShares: string | number): string;
540
+ /**
541
+ * Parses Hive account profile metadata from json_metadata or posting_json_metadata
542
+ * @param jsonMetadata - The raw JSON metadata string from the account
543
+ * @returns Parsed profile object, or empty object if parsing fails
544
+ */
545
+ parseProfileMetadata(jsonMetadata: string): {
546
+ name?: string;
547
+ about?: string;
548
+ location?: string;
549
+ website?: string;
550
+ profile_image?: string;
551
+ cover_image?: string;
552
+ [key: string]: any;
553
+ };
554
+ /**
555
+ * Converts a Hive Power (HP) amount to a formatted VESTS string suitable for delegation/power down
556
+ * @param hp - The amount of HP
557
+ * @param totalVestingFundHive - Total vesting fund in HIVE
558
+ * @param totalVestingShares - Total vesting shares
559
+ * @returns Formatted VESTS string (e.g. '1234.567890 VESTS')
560
+ */
561
+ hpToVestString(hp: string | number, totalVestingFundHive: string | number, totalVestingShares: string | number): string;
562
+ transferToSavings(client: Client, config: Partial<ConfigInterface>, from: string, to: string, amount: string, symbol: string, memo?: string): any;
563
+ transferFromSavings(client: Client, config: Partial<ConfigInterface>, from: string, to: string, amount: string, symbol: string, requestId: number, memo?: string): any;
564
+ cancelTransferFromSavings(client: Client, config: Partial<ConfigInterface>, from: string, requestId: number): any;
565
+ convert(client: Client, config: Partial<ConfigInterface>, owner: string, amount: string, requestId?: number): any;
566
+ collateralizedConvert(client: Client, config: Partial<ConfigInterface>, owner: string, amount: string, requestId?: number): any;
567
+ deleteComment(client: Client, config: Partial<ConfigInterface>, author: string, permlink: string): any;
568
+ commentOptions(client: Client, config: Partial<ConfigInterface>, author: string, permlink: string, options: {
569
+ max_accepted_payout?: string;
570
+ percent_hbd?: number;
571
+ allow_votes?: boolean;
572
+ allow_curation_rewards?: boolean;
573
+ extensions?: any[];
574
+ }): any;
575
+ limitOrderCreate(client: Client, config: Partial<ConfigInterface>, owner: string, orderId: number, amountToSell: string, minToReceive: string, fillOrKill?: boolean, expiration?: string | Date): any;
576
+ limitOrderCancel(client: Client, config: Partial<ConfigInterface>, owner: string, orderId: number): any;
577
+ setWithdrawVestingRoute(client: Client, config: Partial<ConfigInterface>, fromAccount: string, toAccount: string, percent: number, autoVest?: boolean, signingKeys?: HiveKeyInput | HiveKeyInput[]): any;
578
+ claimAccount(client: Client, config: Partial<ConfigInterface>, creator: string, fee?: string): any;
579
+ createClaimedAccount(client: Client, config: Partial<ConfigInterface>, creator: string, newAccountName: string, owner: AuthorityInput, active: AuthorityInput, posting: AuthorityInput, memoKey: string, jsonMetadata?: string): any;
580
+ feedPublish(client: Client, config: Partial<ConfigInterface>, publisher: string, baseAmount: string, quoteAmount?: string): any;
581
+ /**
582
+ * Calculates current voting mana percentage for an account
583
+ * @param account - Extended account object from getAccounts()
584
+ * @returns Voting mana as a percentage (0-100)
585
+ */
586
+ calculateVotingMana(account: any): number;
587
+ /**
588
+ * Gets the effective vesting shares for an account (own + received - delegated)
589
+ * @param account - Extended account object
590
+ * @returns Effective vesting shares as a number
591
+ */
592
+ getEffectiveVestingShares(account: any): number;
593
+ /**
594
+ * Estimates the value of a vote in USD
595
+ * @param votingPower - Current voting power percentage (0-100)
596
+ * @param weight - Vote weight percentage (0-100)
597
+ * @param effectiveVests - Effective vesting shares as number
598
+ * @param rewardFund - Reward fund object from condenser_api.get_reward_fund
599
+ * @param medianPrice - Median price object from getDynamicGlobalProperties
600
+ * @returns Estimated vote value in USD
601
+ */
602
+ estimateVoteValue(votingPower: number, weight: number, effectiveVests: number, rewardFund: {
603
+ reward_balance: string;
604
+ recent_claims: string;
605
+ }, medianPrice: {
606
+ base: string;
607
+ quote: string;
608
+ }): number;
609
+ /**
610
+ * Generates a URL-safe permlink from a title
611
+ * @param title - The post title
612
+ * @returns A valid Hive permlink string
613
+ */
614
+ generatePermlink(title: string): string;
615
+ /**
616
+ * Validates a Hive account name according to blockchain rules
617
+ * @param name - The account name to validate
618
+ * @returns null if valid, or an error message string
619
+ */
620
+ validateAccountName(name: string): string | null;
621
+ /**
622
+ * Returns true if the given string is a valid Hive account name
623
+ * @param name - The account name to check
624
+ * @returns true if valid, false otherwise
625
+ */
626
+ isValidAccountName(name: string): boolean;
627
+ /**
628
+ * Checks if an account exists on the blockchain
629
+ * @param client - The Hive client instance
630
+ * @param username - Account name to check
631
+ * @returns Promise resolving to true if account exists
632
+ */
633
+ accountExists(client: Client, username: string): Promise<boolean>;
634
+ /**
635
+ * Parses a Hive URL or link into its components
636
+ * @param url - URL like https://hive.blog/@author/permlink or @author/permlink
637
+ * @returns Parsed components { author, permlink, category? } or null if invalid
638
+ */
639
+ parseHiveUrl(url: string): {
640
+ author: string;
641
+ permlink: string;
642
+ category?: string;
643
+ } | null;
644
+ /**
645
+ * Generates a unique permlink with timestamp for replies
646
+ * @param parentPermlink - The parent post's permlink (optional)
647
+ * @returns A unique permlink string
648
+ */
649
+ generateReplyPermlink(parentPermlink?: string): string;
650
+ /**
651
+ * Creates the json_metadata string for a Hive post
652
+ * @param options - Post metadata options
653
+ * @returns JSON string for json_metadata field
654
+ */
655
+ createPostMetadata(options?: {
656
+ tags?: string[];
657
+ image?: string[];
658
+ links?: string[];
659
+ app?: string;
660
+ format?: string;
661
+ description?: string;
662
+ [key: string]: any;
663
+ }): string;
664
+ /**
665
+ * Encodes a memo with a shared secret (requires sender private memo key and receiver public memo key)
666
+ * Note: Requires @hiveio/dhive Memo support
667
+ */
668
+ encodeMemo(privateKey: string, publicKey: string, message: string): string;
669
+ /**
670
+ * Decodes an encrypted memo
671
+ * Note: Requires @hiveio/dhive Memo support
672
+ */
673
+ decodeMemo(privateKey: string, encodedMemo: string): string;
674
+ /**
675
+ * Checks if an account has granted posting authority to an app/account
676
+ */
677
+ hasPostingAuth(client: Client, account: string, authAccount: string): Promise<boolean>;
678
+ /**
679
+ * Grants posting authority to an app/account
680
+ */
681
+ grantPostingAuth(client: Client, config: Partial<ConfigInterface>, account: string, authAccount: string, signingKeys?: HiveKeyInput | HiveKeyInput[]): Promise<any>;
682
+ /**
683
+ * Revokes posting authority from an app/account
684
+ */
685
+ revokePostingAuth(client: Client, config: Partial<ConfigInterface>, account: string, authAccount: string, signingKeys?: HiveKeyInput | HiveKeyInput[]): Promise<any>;
686
+ /**
687
+ * Calculates the remaining power down schedule for an account
688
+ * @param account - Extended account object from getAccounts()
689
+ * @returns Array of weekly payment entries with dates and amounts
690
+ */
691
+ calculatePowerDownSchedule(account: any): Array<{
692
+ week: number;
693
+ date: Date;
694
+ amount: string;
695
+ vestingShares: string;
696
+ }>;
697
+ /**
698
+ * Calculates pending HBD savings interest
699
+ * @param hbdBalance - HBD savings balance (e.g. '100.000 HBD')
700
+ * @param lastInterestPayment - Date of last interest payment
701
+ * @param annualRate - Annual interest rate as percentage (default: 15)
702
+ * @returns Pending interest amount as a string
703
+ */
704
+ calculateHbdInterest(hbdBalance: string | number, lastInterestPayment: string | Date, annualRate?: number): string;
705
+ /**
706
+ * Checks if a post is still within its payout window (7 days)
707
+ */
708
+ isInPayoutWindow(post: any): boolean;
709
+ /**
710
+ * Returns milliseconds until payout, or 0 if already paid out
711
+ */
712
+ timeUntilPayout(post: any): number;
713
+ /**
714
+ * Calculates the pending payout value of a post in HBD
715
+ */
716
+ getPendingPayout(post: any): string;
717
+ /**
718
+ * Calculates total account value breakdown
719
+ * @param account - Extended account object
720
+ * @param hivePrice - Current HIVE price in USD
721
+ * @param hbdPrice - Current HBD price in USD (usually ~1.00)
722
+ * @param totalVestingFundHive - From dynamic global properties
723
+ * @param totalVestingShares - From dynamic global properties
724
+ * @returns Breakdown of account value
725
+ */
726
+ calculateAccountValue(account: any, hivePrice: number, hbdPrice?: number, totalVestingFundHive?: string | number, totalVestingShares?: string | number): {
727
+ hive: number;
728
+ hbd: number;
729
+ savings_hive: number;
730
+ savings_hbd: number;
731
+ hp: number;
732
+ total_hive: number;
733
+ total_usd: number;
734
+ };
735
+ /**
736
+ * Extracts all image URLs from a post body (markdown/HTML)
737
+ */
738
+ extractImagesFromBody(body: string): string[];
739
+ /**
740
+ * Extracts all hyperlinks from a post body
741
+ */
742
+ extractLinksFromBody(body: string): string[];
743
+ /**
744
+ * Generates a plain-text summary from a post body by stripping markdown/HTML
745
+ */
746
+ generatePostSummary(body: string, maxLength?: number): string;
747
+ /**
748
+ * Generates a Hivesigner signing URL for any operation
749
+ */
750
+ getHivesignerSignUrl(operationType: string, params: Record<string, any>, redirectUri?: string): string;
751
+ /**
752
+ * Generates a Hivesigner vote URL
753
+ */
754
+ getVoteUrl(voter: string, author: string, permlink: string, weight: number, redirectUri?: string): string;
755
+ /**
756
+ * Generates a Hivesigner delegation URL
757
+ */
758
+ getDelegateUrl(delegator: string, delegatee: string, vestingShares: string, redirectUri?: string): string;
759
+ /**
760
+ * Generates a Hivesigner follow URL
761
+ */
762
+ getFollowUrl(follower: string, following: string, redirectUri?: string): string;
763
+ /**
764
+ * Checks if a memo is encrypted (starts with #)
765
+ */
766
+ isEncryptedMemo(memo: string): boolean;
767
+ /**
768
+ * Creates a JSON-encoded memo string for structured data in transfers
769
+ */
770
+ createJsonMemo(data: Record<string, any>): string;
771
+ /**
772
+ * Attempts to parse a transfer memo as JSON, returns null if not valid JSON
773
+ */
774
+ parseJsonMemo(memo: string): Record<string, any> | null;
775
+ /**
776
+ * Derives all private and public keys from a Hive master password
777
+ * @param account - The Hive account name
778
+ * @param password - The master password
779
+ * @returns Object with owner, active, posting, memo keys (private and public)
780
+ */
781
+ deriveKeys(account: string, password: string): {
782
+ owner: string;
783
+ active: string;
784
+ posting: string;
785
+ memo: string;
786
+ ownerPublic: string;
787
+ activePublic: string;
788
+ postingPublic: string;
789
+ memoPublic: string;
790
+ };
791
+ /**
792
+ * Gets the public key from a private key string
793
+ */
794
+ getPublicKey(privateKey: string): string;
795
+ stakeEngineTokens(client: Client, config: Partial<ConfigInterface>, from: string, to: string, symbol: string, quantity: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
796
+ unstakeEngineTokens(client: Client, config: Partial<ConfigInterface>, from: string, symbol: string, quantity: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
797
+ buyEngineTokens(client: Client, config: Partial<ConfigInterface>, from: string, symbol: string, quantity: string, price: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
798
+ sellEngineTokens(client: Client, config: Partial<ConfigInterface>, from: string, symbol: string, quantity: string, price: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
799
+ cancelEngineOrder(client: Client, config: Partial<ConfigInterface>, from: string, type: "buy" | "sell", orderId: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
800
+ delegateEngineTokens(client: Client, config: Partial<ConfigInterface>, from: string, to: string, symbol: string, quantity: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
801
+ undelegateEngineTokens(client: Client, config: Partial<ConfigInterface>, from: string, to: string, symbol: string, quantity: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
802
+ subscribeCommunity(client: Client, config: Partial<ConfigInterface>, account: string, community: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
803
+ unsubscribeCommunity(client: Client, config: Partial<ConfigInterface>, account: string, community: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
804
+ pinCommunityPost(client: Client, config: Partial<ConfigInterface>, account: string, community: string, author: string, permlink: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
805
+ unpinCommunityPost(client: Client, config: Partial<ConfigInterface>, account: string, community: string, author: string, permlink: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
806
+ muteCommunityUser(client: Client, config: Partial<ConfigInterface>, account: string, community: string, targetAccount: string, notes?: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
807
+ unmuteCommunityUser(client: Client, config: Partial<ConfigInterface>, account: string, community: string, targetAccount: string, notes?: string): Promise<import("@hiveio/dhive").TransactionConfirmation>;
366
808
  };
367
809
  export {};