import { Account } from "../chain/account.js"; import { Manabar, RCAccount, RCParams, RCPool } from "../chain/rc.js"; import { Client } from "./../client.js"; /** * Helper for Hive Resource Credit and voting mana calculations. * * @remarks * `RCAPI` reads `rc_api` data and converts Hive manabar state into current * mana and percentage values. RC mana controls transaction capacity, while * voting mana controls curation influence; both regenerate over Hive's * five-day manabar window. * * @example * ```ts * const rc = await client.rc.getRCMana('srbde') * const vp = await client.rc.getVPMana('srbde') * * console.log(rc.percentage / 100, vp.percentage / 100) * ``` */ export declare class RCAPI { readonly client: Client; /** * Creates an RC helper bound to a client. * * @param client - Client used to call `rc_api` and condenser account data. */ constructor(client: Client); /** * Sends a raw `rc_api` call through the parent client. * * @param method - RC API method name. * @param params - Named parameter object accepted by the method. * @returns The decoded RPC result. * * @throws RPCError * Thrown when the active RPC node does not expose `rc_api` or rejects the * request. * * @example * ```ts * const result = await client.rc.call('find_rc_accounts', { * accounts: ['srbde'] * }) * ``` */ call(method: string, params?: unknown): Promise; /** * Fetches RC account records for one or more usernames. * * @param usernames - Account names to inspect. * @returns RC account records including max RC and current RC manabar state. * * @throws RPCError * Thrown when the node cannot serve `find_rc_accounts`. * * @example * ```ts * const [rcAccount] = await client.rc.findRCAccounts(['srbde']) * console.log(rcAccount.max_rc) * ``` */ findRCAccounts(usernames: string[]): Promise; /** * Fetches global RC resource parameters. * * @returns Chain-wide coefficients used to price CPU, state bytes, history, * execution time, and market bandwidth. * * @throws RPCError * Thrown when the node cannot serve `get_resource_params`. * * @example * ```ts * const params = await client.rc.getResourceParams() * console.log(params.resource_params) * ``` */ getResourceParams(): Promise; /** * Fetches the current RC resource pool. * * @returns Current pool levels for the chain's RC resource classes. * * @throws RPCError * Thrown when the node cannot serve `get_resource_pool`. * * @example * ```ts * const pool = await client.rc.getResourcePool() * console.log(pool.resource_pool) * ``` */ getResourcePool(): Promise; /** * Fetches and calculates current RC mana for an account. * * @param username - Account name to inspect. * @returns Manabar values with current mana, maximum mana, and percentage in * hundredths of a percent. * * @remarks * The calculation projects regeneration from the account's last RC manabar * update to the current wall-clock time. * * @throws RPCError * Thrown when RC account lookup fails. * * @example * ```ts * const mana = await client.rc.getRCMana('srbde') * console.log(`${mana.percentage / 100}% RC`) * ``` */ getRCMana(username: string): Promise; /** * Fetches and calculates current voting mana for an account. * * @param username - Account name to inspect. * @returns Voting manabar values with current mana, maximum mana, and * percentage in hundredths of a percent. * * @remarks * Maximum voting mana is derived from vesting shares, then regenerated across * Hive's five-day voting manabar window. * * @throws RPCError * Thrown when account lookup fails. * * @example * ```ts * const mana = await client.rc.getVPMana('srbde') * console.log(`${mana.percentage / 100}% voting mana`) * ``` */ getVPMana(username: string): Promise; /** * Calculates current RC mana from an RC account record. * * @param rc_account - Account record returned by {@link findRCAccounts}. * @returns Projected manabar state at the current wall-clock time. * * @example * ```ts * const [rcAccount] = await client.rc.findRCAccounts(['srbde']) * const mana = client.rc.calculateRCMana(rcAccount) * ``` */ calculateRCMana(rc_account: RCAccount): Manabar; /** * Calculates current voting mana from a condenser account record. * * @param account - Account object containing vesting shares and voting * manabar state. * @returns Projected voting manabar state at the current wall-clock time. * * @example * ```ts * const [account] = await client.database.getAccounts(['srbde']) * const mana = client.rc.calculateVPMana(account) * ``` */ calculateVPMana(account: Account): Manabar; /** * Internal convenience method to reduce redundant code */ private _calculateManabar; }