nectar.account module
- class nectar.account.Account(account: str | dict, full: bool = True, lazy: bool = False, blockchain_instance=None, **kwargs)
Bases:
BlockchainObjectThis class allows to easily access Account data
- Parameters:
account (str) – Name of the account
blockchain_instance (Blockchain) – Blockchain instance
lazy (bool) – Use lazy loading
full (bool) – Obtain all account data including orders, positions, etc.
- Returns:
Account data
- Return type:
dictionary
- Raises:
nectar.exceptions.AccountDoesNotExistsException – if account does not exist
Instances of this class are dictionaries that come with additional methods (see below) that allow dealing with an account and its corresponding functions.
>>> from nectar.account import Account >>> from nectar import Hive >>> from nectar.nodelist import NodeList >>> nodelist = NodeList() >>> nodelist.update_nodes() >>> hv = Hive(node=nodelist.get_hive_nodes()) >>> account = Account("gtg", blockchain_instance=hv) >>> print(account) <Account gtg> >>> print(account.balances)
Note
This class comes with its own caching function to reduce the load on the API server. Instances of this class can be refreshed with
Account.refresh(). The cache can be cleared withAccount.clear_cache()- allow(foreign: str, weight: int | None = None, permission: str = 'posting', account: str | Account | None = None, threshold: int | None = None, **kwargs) dict[str, Any]
Give additional access to an account by some other public key or account.
- Parameters:
foreign (str) – The foreign account that will obtain access
weight (int) – (optional) The weight to use. If not define, the threshold will be used. If the weight is smaller than the threshold, additional signatures will be required. (defaults to threshold)
permission (str) – (optional) The actual permission to modify (defaults to
posting)account (str) – (optional) the account to allow access to (defaults to
default_account)threshold (int) – (optional) The threshold that needs to be reached by signatures to be able to interact
- approvewitness(witness: str, account: str | None = None, approve: bool = True, **kwargs) dict[str, Any]
Approve a witness
- Parameters:
witness (list) – list of Witness name or id
account (str) – (optional) the account to allow access to (defaults to
default_account)
- property available_balances: list[Amount]
Return a list of the account’s available balances as Amount objects.
Includes liquid HIVE (“balance”), HBD (“hbd_balance”) when present, and vesting shares (“vesting_shares”). Balances are returned in that order when available and are shallow copies of the stored Amount objects.
- blog_history(limit: int | None = None, start: int = -1, reblogs: bool = True, account: str | Account | None = None) Any
Yield blog entries for an account in reverse chronological order.
Streams Discussion entries from the account’s blog (newest first). Results are limited by RPC node history and may not include very old posts.
- Parameters:
limit (int, optional): Maximum number of entries to yield. Must be > 0 if provided; otherwise all available entries are streamed. start (int, optional): (Currently ignored) kept for backward compatibility. reblogs (bool, optional): If True (default), include reblogs; if False, only original posts by the account are yielded. account (str|Account, optional): Account name or Account object to stream; defaults to this Account instance.
- Returns:
generator: Yields discussion dicts (post objects) as returned by Discussions_by_blog.
- Raises:
AssertionError: If limit is provided but is not an int > 0.
- cancel_transfer_from_savings(request_id: int, account: str | Account | None = None, **kwargs) dict[str, Any]
Cancel a withdrawal from ‘savings’ account.
- Parameters:
request_id (str) – Identifier for tracking or cancelling the withdrawal
account (str) – (optional) the source account for the transfer if not
default_account
- change_recovery_account(new_recovery_account: str, account: str | Account | None = None, **kwargs) dict[str, Any]
Request a change of the recovery account.
Note
It takes 30 days until the change applies. Another request within this time restarts the 30 day period. Setting the current recovery account again cancels any pending change request.
- Parameters:
new_recovery_account (str) – account name of the new recovery account
account (str) – (optional) the account to change the recovery account for (defaults to
default_account)
- claim_reward_balance(reward_hive: int | float | str | Amount = 0, reward_hbd: int | float | str | Amount = 0, reward_vests: int | float | str | Amount = 0, account: str | Account | None = None, **kwargs) dict[str, Any]
Claim the account’s pending reward balances (HIVE, HBD, and/or VESTS).
If all reward amounts are left at their default (0), this will claim all outstanding rewards for the target account. Otherwise only the nonzero amounts will be claimed.
- Parameters:
reward_hive (str|float|Amount, optional): Amount of HIVE to claim (default: 0). reward_hbd (str|float|Amount, optional): Amount of HBD to claim (default: 0). reward_vests (str|float|Amount, optional): Amount of VESTS to claim (default: 0). account (str|Account, optional): Account to claim rewards for; if None, uses self. Must be a valid account.
- Returns:
dict: The broadcast/finalization result returned by the blockchain finalizeOp call.
- Raises:
ValueError: If no account is provided or the resolved account is falsy.
- collateralized_convert(amount: int | float | str | Amount, account: str | Account | None = None, request_id: int | None = None, **kwargs) dict[str, Any]
Convert HBD to HIVE using the HF25 collateralized convert operation and broadcast the resulting transaction.
This builds a Collateralized_convert operation for the specified HBD amount and finalizes it with the account’s active authority. If account is omitted, the method uses the current Account object. If request_id is not provided, a random 32-bit id is generated.
- Parameters:
- amount: Amount, str, int, or float
Amount of HBD to convert (symbol must match the chain’s backed token symbol).
- account: str or Account, optional
Source account name or Account instance; defaults to the calling account.
- request_id: int, optional
Numeric identifier for the conversion request; if omitted a random id is used.
- Returns:
- dict
Result of finalizeOp (the broadcasted operation response).
- comment_history(limit: int | None = None, start_permlink: str | None = None, account: str | Account | None = None) Any
Yield comments authored by an account in reverse chronological order.
Streams available comment entries from the node’s discussions_by_comments index. Results are returned newest-first and may be truncated by RPC node history limits; older comments might not be available.
- Parameters:
limit (int, optional): Maximum number of comments to yield. If None, yields all available comments. start_permlink (str, optional): If set, start streaming from this permlink (inclusive). If None, starts from the latest available entry. account (str or Account, optional): Account name or Account instance to stream comments for. Defaults to the Account instance this method is called on.
- Yields:
dict: Discussion/comment dictionaries as returned by the Discussions_by_comments helper.
- Raises:
AssertionError: If limit is provided and is not a positive integer.
- convert(amount: int | float | str | Amount, account: str | Account | None = None, request_id: int | None = None) dict[str, Any]
Convert HBD to HIVE (takes ~3.5 days to settle).
- Parameters:
amount: HBD amount to convert — accepts numeric, string, or Amount-compatible input; will be normalized to the chain’s backed token symbol. account (str | Account, optional): Source account performing the conversion. If omitted, uses this account. request_id (int | str, optional): Numeric identifier for the conversion request. If omitted, a random request id is generated.
- Returns:
The result of broadcasting the Convert operation (as returned by blockchain.finalizeOp).
- curation_stats() dict[str, float]
Returns the curation reward of the last 24h and 7d and the average of the last 7 days
- Returns:
Account curation
- Return type:
dictionary
Sample output:
{ '24hr': 0.0, '7d': 0.0, 'avg': 0.0 }
Delegate vesting shares (Hive Power) from one account to another.
- Parameters:
to_account (str or Account): Receiver of the delegated vesting shares (delegatee). vesting_shares (str|Amount): Amount to delegate, e.g. “10000 VESTS” or an Amount-like object. account (str or Account, optional): Source account (delegator). If omitted, uses this Account instance.
- Returns:
dict: Result of broadcasting the Delegate_vesting_shares operation (transaction/result object).
- Raises:
ValueError: If to_account is not provided or cannot be resolved.
- disallow(foreign: str, permission: str = 'posting', account: str | Account | None = None, weight: int | None = None, threshold: int | None = None, **kwargs) dict[str, Any]
Remove additional access to an account by some other public key or account.
- Parameters:
foreign (str) – The foreign account that will obtain access
permission (str) – (optional) The actual permission to modify (defaults to
posting)account (str) – (optional) the account to allow access to (defaults to
default_account)threshold (int) – The threshold that needs to be reached by signatures to be able to interact
- disapprovewitness(witness: str, account: str | None = None, **kwargs) dict[str, Any]
Disapprove a witness
- Parameters:
witness (list) – list of Witness name or id
account (str) – (optional) the account to allow access to (defaults to
default_account)
- ensure_full() None
Ensure that all data are loaded
- estimate_virtual_op_num(blocktime: int | datetime | date | time, stop_diff: int = 0, max_count: int = 100, min_index: int | None = None) int
Returns an estimation of an virtual operation index for a given time or blockindex
- Parameters:
blocktime (int, datetime) – start time or start block index from which account operation should be fetched
stop_diff (int) – Sets the difference between last estimation and new estimation at which the estimation stops. Must not be zero. (default is 1)
max_count (int) – sets the maximum number of iterations. -1 disables this (default 100)
start_time = datetime.now() - timedelta(days=7) acc = Account("gtg") start_op = acc.estimate_virtual_op_num(start_time) b = Blockchain() start_block_num = b.get_estimated_block_num(start_time) start_op2 = acc.estimate_virtual_op_num(start_block_num)
acc = Account("gtg") block_num = 21248120 start = t.time() op_num = acc.estimate_virtual_op_num(block_num, stop_diff=1, max_count=10) stop = t.time() print(stop - start) for h in acc.get_account_history(op_num, 0): block_est = h["block"] print(block_est - block_num)
- feed_history(limit: int | None = None, start_author: str | None = None, start_permlink: str | None = None, account: str | Account | None = None) Any
Yield feed entries for an account in reverse chronological order.
Streams discussion entries from the account’s feed using paginated calls to the discussions API. Entries are yielded one at a time until the optional limit is reached or no more entries are available. Note that RPC nodes keep only a limited feed history, so older entries may be unavailable.
- Parameters:
limit (int, optional): Maximum number of entries to yield. If omitted, yields all available entries. start_author (str, optional): Author name to start from. Must be provided together with start_permlink to page from a specific position. start_permlink (str, optional): Permlink to start from. Must be provided together with start_author. account (str|Account, optional): Account whose feed to stream. If omitted, uses this Account instance.
- Raises:
AssertionError: If limit is not a positive integer, or if only one of start_author / start_permlink is provided.
- Yields:
dict or Comment-like object: Discussion/feed entries returned by the discussions API, in reverse time order.
- follow(other: str | list[str], what: list[str] = ['blog'], account: str | None = None) dict[str, Any]
Follow/Unfollow/Mute/Unmute another account’s blog
Note
what can be one of the following on HIVE:
blog, ignore, blacklist, unblacklist, follow_blacklist, unfollow_blacklist, follow_muted, unfollow_muted
- Parameters:
other (str/list) – Follow this account / accounts (only hive)
what (list) – List of states to follow.
['blog']means to followother,[]means to unfollow/unmuteother,['ignore']means to ignoreother, (defaults to['blog'])account (str) – (optional) the account to allow access to (defaults to
default_account)
- getSimilarAccountNames(limit: int = 5) list[str] | None
Deprecated, please use get_similar_account_names
- get_account_bandwidth()
- get_account_history(index: int, limit: int, order: int = -1, start: int | datetime | date | time | None = None, stop: int | datetime | date | time | None = None, use_block_num: bool = True, only_ops: list[str] | tuple = [], exclude_ops: list[str] | tuple = [], raw_output: bool = False) Any
Yield account history operations for a single account.
Generates account history entries (one at a time) between a starting index and limit, optionally filtered and ordered. Each yielded item is either the raw RPC (index, event) tuple when raw_output is True, or an enriched dict containing operation fields plus metadata (account, type, index, _id).
- Parameters:
index (int): starting index for history retrieval (passed to underlying fetch). limit (int): maximum number of entries to request from the node. order (int): 1 for chronological, -1 for reverse chronological (default -1). start (int | datetime | date | time | None): inclusive start boundary. Interpreted as a block number
when use_block_num is True, otherwise as an operation index; a datetime/value restricts by timestamp.
stop (int | datetime | date | time | None): inclusive stop boundary, interpreted like start. use_block_num (bool): when True, treat numeric start/stop as blockchain block numbers; otherwise as op indices. only_ops (list[str]): if non-empty, only yield operations whose type is in this list. exclude_ops (list[str]): skip operations whose type is in this list. raw_output (bool): when True yield the raw (index, event) tuple from the RPC; when False yield an enriched dict.
- Returns:
generator: yields history entries as described above.
- Raises:
ValueError: if order is not 1 or -1.
- get_account_posts(sort: str = 'feed', limit: int = 20, account: str | None = None, observer: str | None = None, raw_data: bool = False) Any
Returns account feed
- get_account_votes(account: str | None = None, start_author: str = '', start_permlink: str = '', limit: int = 1000, start_date: datetime | None = None) list[dict[str, Any]]
Return a list of vote operations made by an account.
Retrieves votes by paging through the node’s list_votes (database) API ordered by voter+comment. Returns vote objects (dicts) that include fields such as voter, author, permlink, weight, and last_update. Results are filtered so only votes cast by account are included and, if start_date is provided, only votes with last_update >= start_date are returned. Pagination state is advanced using start_author / start_permlink.
- Parameters:
account (str|dict|Account, optional): Account to query. If None, uses this Account’s name. start_author (str, optional): Author permlink paging start key (used to continue from a previous page). start_permlink (str, optional): Permlink paging start key paired with start_author. limit (int, optional): Maximum number of votes to request per RPC call (page size). start_date (datetime.datetime, optional): If provided, stop and exclude votes older than this datetime.
- Returns:
list[dict]: List of vote dictionaries in descending retrieval order (newest first as returned by the node).
- Raises:
OfflineHasNoRPCException: If called while the blockchain instance is offline (no RPC available).
- get_balance(balances: str | list[dict[str, Any]] | list[Amount], symbol: str) Amount | None
Return a specific balance Amount for this account.
Accepts either a list of balance dicts or a balance category name and returns the Amount for the requested symbol. Valid balance category names are “available”, “savings”, “rewards”, and “total”. The symbol may be a string (e.g., “HBD”, “HIVE”, “VESTS”) or a dict containing a “symbol” key.
- Parameters:
balances (str | list[dict]): A balance category name or a list of balance dicts (each with keys “amount” and “symbol”). symbol (str | dict): The asset symbol to look up, or a dict containing {“symbol”: <str>}.
- Returns:
nectar.amount.Amount: The matching Amount from the provided balances, or Amount(0, symbol) if no matching entry is found.
- get_balances() dict[str, list[Amount]]
Return the account’s balances grouped by category.
Returns a dictionary with keys: - “available”: list of Amounts currently spendable (e.g., HIVE, HBD, VESTS) - “savings”: list of Amounts held in savings - “rewards”: list of pending reward Amounts - “total”: list of total Amounts combining available, savings, and rewards
- Returns:
dict: Mapping of balance category to a list of Amount objects (or empty list for absent symbols).
- get_bandwidth() dict[str, int | None]
Returns used and allocated bandwidth
- Return type:
dictionary
Sample output:
{ 'used': 0, 'allocated': 2211037 }
- get_blog(start_entry_id=0, limit=50, raw_data=False, short_entries=False, account=None)
Return the blog entries for an account.
By default this returns a list of Comment objects for the account’s blog. If raw_data=True the raw API dicts are returned instead. When both raw_data and short_entries are True the get_blog_entries API is used (returns shorter entry objects). If account is None the current Account’s name is used.
- Parameters:
start_entry_id (int): ID offset to start from (default 0). limit (int): Maximum number of entries to return (default 50, max 100). raw_data (bool): If True, return raw API dictionaries instead of Comment objects. short_entries (bool): When True and raw_data is True, use the shorter get_blog_entries API. account (str|Account|dict|None): Account to query; if None uses this Account.
- Returns:
list: A list of Comment objects (when raw_data is False) or raw entry dictionaries (when raw_data is True).
- Raises:
OfflineHasNoRPCException: If called while offline (no RPC available).
- get_blog_authors(account: str | None = None) list[str]
Return a list of author account names whose posts have been reblogged on the specified blog account.
If account is omitted, uses this Account object’s name. Raises OfflineHasNoRPCException if called while offline. Returns a list of strings (author account names).
- get_blog_entries(start_entry_id: int = 0, limit: int = 50, raw_data: bool = True, account=None)
Return the account’s blog entries.
By default returns up to limit entries starting at start_entry_id for this account. When raw_data is True the entries are returned as raw dictionaries from the RPC; when False they are returned as processed Comment objects.
- Parameters:
start_entry_id (int): Entry index to start from (default 0). limit (int): Maximum number of entries to return (default 50, max 100). raw_data (bool): If True return raw RPC dicts; if False return Comment objects (default True). account (str): Optional account name to fetch entries for (default is this Account’s name).
- Returns:
list: A list of entries (dicts when raw_data is True, Comment objects when False).
- get_conversion_requests(account: str | None = None) list[dict[str, Any]]
Return the list of pending HBD conversion requests for an account.
If account is omitted, the method queries conversion requests for this Account instance.
- Parameters:
account (str, optional): Account name or Account-like object. Defaults to this account’s name.
- Returns:
list: A list of conversion request dictionaries (empty list if none).
- Raises:
OfflineHasNoRPCException: If called while the blockchain is in offline mode (no RPC available).
- get_creator() str | None
Returns the account creator or None if the account was mined
- get_curation_reward(days: int = 7) float
Returns the curation reward of the last days days
- Parameters:
days (int) – limit number of days to be included int the return value
- get_downvote_manabar() dict[str, int | float | Amount] | None
Return the account’s downvote manabar state and regeneration progress.
If the account has no ‘downvote_manabar’ field returns None.
- Returns a dict with:
last_mana (int): stored mana at last update.
last_update_time (int): POSIX timestamp of the last update.
current_mana (int): estimated current mana after regeneration (clamped to max_mana).
max_mana (int): maximum possible downvote mana (derived from effective vesting shares or account creation fee fallback).
current_mana_pct (float): current_mana expressed as a percentage of max_mana (0–100).
- get_downvoting_power(with_regeneration: bool = True) float
Returns the account downvoting power in the range of 0-100%
- Parameters:
with_regeneration (bool) – When True, downvoting power regeneration is included into the result (default True)
Return the account’s effective vesting shares as an integer.
Calculates vesting shares adjusted for active delegations and pending withdrawals: - Starts from vesting_shares. - Subtracts delegated_vesting_shares and adds received_vesting_shares when present. - If a future next_vesting_withdrawal exists and withdrawal fields are present,
subtracts the remaining amount that will be withdrawn (bounded by vesting_withdraw_rate).
- Returns:
int: Effective vesting shares in the same internal units stored on the account.
- get_escrow(escrow_id: int = 0, account: str | None = None) list[dict[str, Any]]
Return escrow(s) related to this account.
If called in appbase mode, returns all escrows for the given account (the legacy escrow_id parameter is ignored). In legacy (pre-appbase) mode, returns the escrow with the specified escrow_id for the account.
- Parameters:
escrow_id (int): Escrow identifier used by legacy RPC (pre-appbase). Default 0. account (str | Account, optional): Account to query; defaults to this account’s name.
- Returns:
list[dict]: A list of escrow objects (empty if none found).
- Raises:
OfflineHasNoRPCException: If called while the blockchain client is offline.
- get_expiring_vesting_delegations(after: datetime | str | None = None, limit: int = 1000, account: str | None = None) list[dict[str, Any]]
Return upcoming vesting-delegation expirations for an account.
If account is None the current Account’s name is used. On appbase-compatible nodes this queries the database API and returns the list under the “delegations” key; on legacy nodes it calls the legacy RPC which accepts after (a datetime) and limit.
- Parameters:
after (datetime, optional): Only used on pre-appbase nodes — include expirations after this time. limit (int, optional): Only used on pre-appbase nodes — maximum number of entries to return. account (str or object, optional): Account name or object to query. Defaults to the current account.
- Returns:
list: A list of vesting delegation expiration records.
- Raises:
OfflineHasNoRPCException: If called while the blockchain instance is offline.
- get_feed(start_entry_id: int = 0, limit: int = 100, raw_data: bool = False, short_entries: bool = False, account=None)
Return the feed entries for an account.
By default this returns a list of Comment objects for the account’s feed. If raw_data=True the raw API dicts are returned instead. When both raw_data and short_entries are True the get_feed_entries API is used (returns shorter entry objects). If account is None the current Account’s name is used.
- Parameters:
start_entry_id (int): ID offset to start from (default 0). limit (int): Maximum number of entries to return (default 100, max 100). raw_data (bool): If True, return raw API dictionaries instead of Comment objects. short_entries (bool): If True, use get_feed_entries API (shorter entries). account (str, optional): Override account name to fetch feed for (default uses this Account).
- Returns:
list: A list of feed entries (Comment objects or raw dicts depending on raw_data).
- get_feed_entries(start_entry_id: int = 0, limit: int = 100, raw_data: bool = True, account=None)
Return a list of feed entries for the account.
If account is provided, entries for that account are returned; otherwise uses this Account’s name. This method delegates to the internal feed retrieval implementation and requests short-form entries.
- Parameters:
start_entry_id (int): Entry index to start from (default 0). limit (int): Maximum number of entries to return (default 100). raw_data (bool): If True, return raw API dictionaries; if False, return wrapped objects (default True). account (str, optional): Override account name to fetch feed for (default uses this Account).
- Returns:
list: A list of feed entries (raw dicts or wrapped objects depending on raw_data).
- get_follow_count()
- get_follow_list(follow_type: str, starting_account: str | None = None, raw_name_list: bool = True) list[dict[str, Any]] | Accounts
Return the account follow list for a given follow_type (requires Hive HF >= 24).
Normalizes legacy aliases (‘blacklisted’ -> ‘follow_blacklist’, ‘muted’ -> ‘follow_muted’) and queries the blockchain bridge API for the observer’s follow list. Supports pagination via an optional starting_account cursor.
- Parameters:
follow_type (str): One of ‘follow_blacklist’ or ‘follow_muted’ (aliases ‘blacklisted’ and ‘muted’ accepted). starting_account (Optional[str]): Optional pagination start cursor (name of the account to start from). raw_name_list (bool): If True, return the raw list of dicts from the bridge API (each dict typically contains a ‘name’ key).
If False, return an Accounts collection built from the returned names.
- Returns:
- Union[List[Dict[str, Any]], Accounts]: Raw list of follow entries (dicts) when raw_name_list is True,
otherwise an Accounts instance containing the followed account names.
- Raises:
OfflineHasNoRPCException: If called while the blockchain instance is in offline mode (no RPC available). ValueError: If follow_type is not one of the supported values or aliases.
- get_followers(raw_name_list: bool = True, limit: int = 100) list[str] | Accounts
Returns the account followers as list
- get_following(raw_name_list: bool = True, limit: int = 100) list[str] | Accounts
Returns who the account is following as list
- get_manabar() dict[str, int | float | Amount]
Return the account’s voting manabar state.
Calculates current voting mana from the stored voting_manabar using the account’s effective vesting shares as max_mana. If effective vesting shares are zero, a fallback is computed from the chain’s account creation fee converted to vests.
- Returns:
- dict: Manabar values with the following keys:
last_mana (int): Stored current_mana at the last update.
last_update_time (int): Unix timestamp (seconds) of the last manabar update.
current_mana (int): Estimated current mana (capped at max_mana).
max_mana (int): Maximum mana derived from effective vesting shares.
current_mana_pct (float): Current mana as a percentage of max_mana.
- Notes:
Regeneration uses HIVE_VOTING_MANA_REGENERATION_SECONDS to convert elapsed seconds since last_update_time into regenerated mana.
- get_manabar_recharge_time(manabar: dict[str, Any], recharge_pct_goal: float = 100) datetime
Return the UTC datetime when the given manabar will reach the specified recovery percentage.
- Parameters:
- manabar (dict): Manabar state as returned by get_manabar() or get_rc_manabar().
Expected keys include ‘current_mana’ (int), ‘max_mana’ (int) and ‘last_update_time’ (datetime or ISO string).
recharge_pct_goal (float): Target recovery level as a percentage (0–100). Defaults to 100.
- Returns:
datetime: Timezone-aware UTC datetime when the manabar is expected to reach the target percentage.
- get_manabar_recharge_time_str(manabar: dict[str, Any], recharge_pct_goal: float = 100) str
Returns the account manabar recharge time as string
- Parameters:
manabar (dict) – manabar dict from get_manabar() or get_rc_manabar()
recharge_pct_goal (float) – mana recovery goal in percentage (default is 100)
- get_manabar_recharge_timedelta(manabar: dict[str, Any], recharge_pct_goal: float = 100) timedelta
Return the time remaining for a manabar to recharge to a target percentage.
- Parameters:
- manabar (dict): Manabar structure returned by get_manabar() or get_rc_manabar().
Expected to contain either ‘current_mana_pct’ or ‘current_pct’ (value in percent).
recharge_pct_goal (float): Target recharge percentage (0–100). Defaults to 100.
- Returns:
datetime.timedelta or int: Time required to reach the target as a timedelta. If the manabar is already at or above the target, returns 0.
- get_muters(raw_name_list: bool = True, limit: int = 100) list[str] | Accounts
Returns the account muters as list
- get_mutings(raw_name_list: bool = True, limit: int = 100) list[str] | Accounts
Return the list of accounts this account has muted.
- Parameters:
raw_name_list (bool): If True (default), return a list of account names (str). If False, return an Accounts collection of Account objects. limit (int): Maximum number of muted accounts to fetch (default 100).
- Returns:
list[str] | Accounts: Either a list of account names or an Accounts object containing the muted accounts.
- get_notifications(only_unread: bool = True, limit: int | None = 100, raw_data: bool = False, account=None)
Returns account notifications
- Parameters:
only_unread (bool) – When True, only unread notifications are shown
limit (int) – When set, the number of shown notifications is limited (max limit = 100)
raw_data (bool) – When True, the raw data from the api call is returned.
account (str) – (optional) the account for which the notification should be received to (defaults to
default_account)
- get_owner_history(account: str | None = None) list[dict[str, Any]]
Return the owner authority history for an account.
If account is provided, fetches the owner history for that account; otherwise uses this Account’s name. Returns a list of owner-authority history entries (RPC dicts, typically those under the owner_auths key).
- Parameters:
account (str, optional): Account name or Account-like object to query. Defaults to this Account’s name.
- Returns:
list: Owner history entries as returned by the node RPC.
- Raises:
OfflineHasNoRPCException: If called while the blockchain is in offline mode (no RPC available).
- get_rc() dict[str, Any] | list[dict[str, Any]] | None
Return RC of account.
- get_rc_manabar() dict[str, int | float | Amount]
Return the account’s current and maximum Resource Credit (RC) mana.
Calculates RC mana regeneration since the stored rc_manabar.last_update_time and returns both raw and computed values.
- Returns:
- dict: {
“last_mana” (int): stored mana at the last update (raw value from account data), “last_update_time” (int): UNIX timestamp (seconds) of the last manabar update, “current_mana” (int): estimated current mana after regeneration (capped at max_mana), “max_mana” (int): maximum possible mana (from max_rc), “current_pct” (float): current_mana / max_mana * 100 (0 if max_mana == 0), “max_rc_creation_adjustment” (Amount): Amount object representing max RC creation adjustment
}
- get_recharge_time(voting_power_goal: float = 100, starting_voting_power: float | None = None) datetime
Returns the account voting power recharge time in minutes
- Parameters:
voting_power_goal (float) – voting power goal in percentage (default is 100)
starting_voting_power (float) – returns recharge time if current voting power is the provided value.
- get_recharge_time_str(voting_power_goal: float = 100, starting_voting_power: float | None = None) str
Returns the account recharge time as string
- Parameters:
voting_power_goal (float) – voting power goal in percentage (default is 100)
starting_voting_power (float) – returns recharge time if current voting power is the provided value.
- get_recharge_timedelta(voting_power_goal: float = 100, starting_voting_power: float | None = None) timedelta
Return the timedelta required to recharge the account’s voting power to a target percentage.
If starting_voting_power is omitted, the current voting power is used. voting_power_goal and starting_voting_power are percentages (e.g., 100 for full power). If the starting power already meets or exceeds the goal, the function returns 0.
- Parameters:
voting_power_goal (float): Target voting power percentage (default 100). starting_voting_power (float | int | None): Optional starting voting power percentage to
use instead of the account’s current voting power.
- Returns:
datetime.timedelta | int: Time required to recharge to the goal as a timedelta, or 0 if the starting power is already at or above the goal.
- Raises:
ValueError: If starting_voting_power is provided but is not a number.
- get_recovery_request(account: str | None = None) list[dict[str, Any]]
Returns the recovery request for an account
- Parameters:
account (str) – When set, a different account is used for the request (Default is object account name)
- Return type:
list
>>> from nectar.account import Account >>> from nectar import Hive >>> from nectar.nodelist import NodeList >>> nodelist = NodeList() >>> nodelist.update_nodes() >>> hv = Hive(node=nodelist.get_hive_nodes()) >>> account = Account("nectarflower", blockchain_instance=hv) >>> account.get_recovery_request() []
- get_reputation() float
Return the account’s normalized reputation score.
If the node is offline, returns a default reputation score. When connected, tries the HAF reputation API first which returns the final normalized score directly. Falls back to the cached reputation field if HAF fails.
- get_savings_withdrawals(direction: str = 'from', account: str | None = None) list[dict[str, Any]]
Return the list of savings withdrawal requests for an account.
If no account is provided, uses this Account’s name. On nodes using the appbase/database API the node determines which withdrawals are returned; on legacy (non-appbase) nodes the direction parameter selects between withdrawals originating “from” the account or destined “to” the account.
- Parameters:
account (str, optional): Account name to query. Defaults to this account. direction (str, optional): “from” or “to” (default “from”). Only used on non-appbase RPC nodes.
- Returns:
list: A list of savings withdrawal records (each record is a dict as returned by the node).
- Raises:
OfflineHasNoRPCException: If called while in offline mode (no RPC available).
- get_similar_account_names(limit: int = 5) list[str] | None
Returns
limitaccount names similar to the current account name as a list- Parameters:
limit (int) – limits the number of accounts, which will be returned
- Returns:
Similar account names as list
- Return type:
list
This is a wrapper around
nectar.blockchain.Blockchain.get_similar_account_names()using the current account name as reference.
- get_tags_used_by_author(account: str | None = None) list[dict[str, Any]]
Returns a list of tags used by an author.
- Parameters:
account (str) – When set, a different account is used for the request (Default is object account name)
- Return type:
list
- get_token_power(only_own_vests: bool = False, use_stored_data: bool = True) Amount
Return the account’s Hive Power (HP), including staked tokens and delegated amounts.
- Parameters:
only_own_vests (bool): If True, only the account’s owned vesting shares are considered (delegations excluded). use_stored_data (bool): If False, fetch the current vests-to-token-power conversion from the chain; if True, use cached conversion values.
- Returns:
float: Hive Power (HP) equivalent for the account’s vesting shares.
- get_vesting_delegations(start_account: str = '', limit: int = 100, account: str | None = None) list[dict[str, Any]]
Return the list of vesting delegations made by an account.
If account is omitted, the method uses this Account object’s name. Results can be paginated by specifying start_account (delegatee name to start from) and limit (maximum number of entries returned). In appbase mode the call filters returned delegations to those where the delegator matches account.
- Parameters:
start_account (str): Delegatee name to start listing from (for pagination). Default is empty string (start from first). limit (int): Maximum number of results to return. Default is 100. account (str | Account, optional): Account to query; accepts an account name or Account-like object. If None, uses this Account.
- Returns:
list: A list of delegation dictionaries as returned by the node RPC.
- Raises:
OfflineHasNoRPCException: If called while the blockchain instance is offline (no RPC available).
- get_vests(only_own_vests: bool = False) Amount
Returns the account vests
- Parameters:
only_own_vests (bool) – When True, only owned vests is returned without delegation (default False)
- get_vote(comment: str | Any) dict[str, Any] | None
Returns a vote if the account has already voted for comment.
- Parameters:
comment (str, Comment) – can be a Comment object or a authorpermlink
- get_vote_pct_for_HBD(hbd, post_rshares=0, voting_power=None, hive_power=None, not_broadcasted_vote=True)
Return the voting percentage (weight) required for this account to produce a vote worth the given HBD amount.
- Parameters:
hbd (str | int | Amount): Desired vote value in HBD (can be numeric, string, or an Amount). post_rshares (int): Current rshares of the post; used in the vote value calculation. Defaults to 0. voting_power (int | None): Current voting power to use (in internal units). If None, the account’s current voting power is used. hive_power (Amount | None): Token power (HP) to use for the calculation. If None, the account’s current HP is used. not_broadcasted_vote (bool): If True, accounts for a non-broadcasted (simulated) vote when estimating required percentage.
- Returns:
int: Vote weight as an integer in the range -10000..10000 (where 10000 == 100%). Values outside that range indicate the requested HBD value is unattainable with this account (e.g., greater than 10000 or less than -10000).
- get_vote_pct_for_vote_value(token_units: int | float | Amount, post_rshares: int = 0, voting_power: int | float | None = None, token_power: int | float | None = None, not_broadcasted_vote: bool = True) float
Return the voting percentage required to produce a specified vote value in the blockchain’s backed token (HBD).
Given a desired token-backed amount (token_units), compute the internal vote percentage (in the same scale used by the chain, e.g. 10000 == 100%) required to yield that payout for a post with post_rshares. If the returned value is larger than 10000 or smaller than -10000, the requested value is outside what the account can reasonably produce.
- Parameters:
token_units (str|int|Amount): Desired vote value expressed in the blockchain’s backed token (HBD). Strings and numbers will be converted to an Amount using the account’s blockchain context. post_rshares (int, optional): Current rshares for the post; used when converting rshares to a percentage. Default 0. voting_power (float|int, optional): Account voting power as returned by get_voting_power (expected on a 0–100 scale). If omitted, the account’s current voting power is used. token_power (float|int, optional): Account token power (HP). If omitted, the account’s current token power is used. not_broadcasted_vote (bool, optional): Passed to the conversion routine when estimating rshares from HBD; controls whether broadcast-specific adjustments are applied. Default True.
- Returns:
int: The vote percentage in chain units (e.g., 10000 == 100%). May exceed ±10000 when the requested value is unattainable.
- Raises:
AssertionError: If token_units is not expressed in the blockchain’s backed token symbol (HBD).
- get_voting_power(with_regeneration: bool = True) float
Return the account’s current voting power as a percentage (0–100).
If the account stores a voting_manabar, the result is derived from that manabar and optionally includes regeneration. If the legacy voting_power field is present, the method uses that value and, when with_regeneration is True, adds the amount regenerated since last_vote_time.
- Parameters:
with_regeneration (bool): If True (default), include regenerated voting power since the last update.
- Returns:
float: Voting power percentage in the range 0 to 100 (clamped).
- get_voting_value(post_rshares: int = 0, voting_weight: int | float = 100, voting_power: int | float | None = None, token_power: int | float | None = None, not_broadcasted_vote: bool = True) Amount
Estimate the vote value expressed in HBD for a potential vote by this account.
Detailed description: Computes the HBD value that a vote would produce given post rshares and voting settings. Uses the account’s token power (HP) by default and delegates the numeric conversion to the blockchain instance.
- Parameters:
post_rshares (int): The post’s rshares contribution (can be 0 for an upvote-only estimate). voting_weight (float|int, optional): The vote weight as a percentage in the range 0–100 (default 100). voting_power (float|int, optional): The account’s current voting power as a percentage in the range 0–100.
If omitted, the account’s current voting power is used.
token_power (float|int, optional): Token power (HP) to use for the calculation. If omitted, the account’s current HP is used. not_broadcasted_vote (bool, optional): If True, treat the vote as not yet broadcast when estimating (affects regeneration logic).
- Returns:
Amount: Estimated vote value denominated in HBD.
- get_voting_value_HBD(post_rshares=0, voting_weight=100, voting_power=None, hive_power=None, not_broadcasted_vote=True)
Return the estimated voting value expressed in HBD for the account.
This is a thin wrapper around get_voting_value that maps hive_power to the underlying token_power parameter.
- Parameters:
post_rshares (int): Total rshares for the target post (default 0). voting_weight (int): Weight of the vote as a percentage (0-100, default 100). voting_power (int | None): Current voting power percentage to use; if None the account’s current power is used. hive_power (float | None): Token power (Hive Power / HP) to use for the calculation; if None the account’s current token power is used. not_broadcasted_vote (bool): If True, calculate value as if the vote is not yet broadcast (default True).
- Returns:
Estimated vote value expressed in HBD.
- get_withdraw_routes(account: str | None = None) list[dict[str, Any]]
Return the account’s withdraw vesting routes.
If account is omitted, uses this Account object’s name. Each route is returned as a dict in the format provided by the node RPC (fields include destination account, percentage, auto_vest, etc.).
- Parameters:
account (str, optional): Account name to query. Defaults to this Account’s name.
- Returns:
list: A list of withdraw-route dictionaries as returned by the node RPC.
- Raises:
OfflineHasNoRPCException: If called while the blockchain instance is in offline mode.
- has_voted(comment: str | Any) bool
Returns if the account has already voted for comment
- Parameters:
comment (str, Comment) – can be a Comment object or a authorpermlink
- history(start=None, stop=None, use_block_num: bool = True, only_ops: list[str] | tuple = [], exclude_ops: list[str] | tuple = [], batch_size: int = 1000, raw_output: bool = False)
Returns a generator for individual account transactions. The earliest operation will be first. This call can be used in a
forloop.- Parameters:
start (int, datetime) – start number/date of transactions to return (optional)
stop (int, datetime) – stop number/date of transactions to return (optional)
use_block_num (bool) – if true, start and stop are block numbers, otherwise virtual OP count numbers.
only_ops (array) – Limit generator by these operations (optional)
exclude_ops (array) – Exclude thse operations from generator (optional)
batch_size (int) – internal api call batch size (optional)
raw_output (bool) – if False, the output is a dict, which includes all values. Otherwise, the output is list.
Note
only_ops and exclude_ops takes an array of strings: The full list of operation ID’s can be found in nectarbase.operationids.ops. Example: [‘transfer’, ‘vote’]
acc = Account("gtg") max_op_count = acc.virtual_op_count() # Returns the 100 latest operations acc_op = [] for h in acc.history(start=max_op_count - 99, stop=max_op_count, use_block_num=False): acc_op.append(h) len(acc_op)
100
acc = Account("test") max_block = 21990141 # Returns the account operation inside the last 100 block. This can be empty. acc_op = [] for h in acc.history(start=max_block - 99, stop=max_block, use_block_num=True): acc_op.append(h) len(acc_op)
0
acc = Account("test") start_time = datetime(2018, 3, 1, 0, 0, 0) stop_time = datetime(2018, 3, 2, 0, 0, 0) # Returns the account operation from 1.4.2018 back to 1.3.2018 acc_op = [] for h in acc.history(start=start_time, stop=stop_time): acc_op.append(h) len(acc_op)
0
- history_reverse(start: int | datetime | date | time | None = None, stop: int | datetime | date | time | None = None, use_block_num: bool = True, only_ops: list[str] | tuple = [], exclude_ops: list[str] | tuple = [], batch_size: int = 1000, raw_output: bool = False) Any
Returns a generator for individual account transactions. The latest operation will be first. This call can be used in a
forloop.- Parameters:
start (int, datetime) – start number/date of transactions to return. If negative the virtual_op_count is added. (optional)
stop (int, datetime) – stop number/date of transactions to return. If negative the virtual_op_count is added. (optional)
use_block_num (bool) – if true, start and stop are block numbers, otherwise virtual OP count numbers.
only_ops (array) – Limit generator by these operations (optional)
exclude_ops (array) – Exclude thse operations from generator (optional)
batch_size (int) – internal api call batch size (optional)
raw_output (bool) – if False, the output is a dict, which includes all values. Otherwise, the output is list.
Note
only_ops and exclude_ops takes an array of strings: The full list of operation ID’s can be found in nectarbase.operationids.ops. Example: [‘transfer’, ‘vote’]
acc = Account("gtg") max_op_count = acc.virtual_op_count() # Returns the 100 latest operations acc_op = [] for h in acc.history_reverse(start=max_op_count, stop=max_op_count - 99, use_block_num=False): acc_op.append(h) len(acc_op)
100
max_block = 21990141 acc = Account("test") # Returns the account operation inside the last 100 block. This can be empty. acc_op = [] for h in acc.history_reverse(start=max_block, stop=max_block-100, use_block_num=True): acc_op.append(h) len(acc_op)
0
acc = Account("test") start_time = datetime(2018, 4, 1, 0, 0, 0) stop_time = datetime(2018, 3, 1, 0, 0, 0) # Returns the account operation from 1.4.2018 back to 1.3.2018 acc_op = [] for h in acc.history_reverse(start=start_time, stop=stop_time): acc_op.append(h) len(acc_op)
0
- interest() dict[str, float | datetime | timedelta]
Calculate interest for an account
- Parameters:
account (str) – Account name to get interest for
- Return type:
dictionary
Sample output:
{ 'interest': 0.0, 'last_payment': datetime.datetime(2018, 1, 26, 5, 50, 27, tzinfo=<UTC>), 'next_payment': datetime.datetime(2018, 2, 25, 5, 50, 27, tzinfo=<UTC>), 'next_payment_duration': datetime.timedelta(-65, 52132, 684026), 'interest_rate': 0.0 }
- property is_fully_loaded: bool
Is this instance fully loaded / e.g. all data available?
- Return type:
bool
- json() dict
Return a JSON-serializable representation of the account data with normalized field types.
Converts internal Python objects to plain JSON-friendly types: - Specific integer fields are converted to strings (to preserve large integers) or to strings only when non-zero. - Elements of proxied_vsf_votes are converted to strings when they are non-zero integers; other elements are left unchanged. - Datetime, date, and time objects listed in time fields are converted to ISO-like strings via formatTimeString; non-datetime values are passed through. - Amount-like fields (e.g., balances, vesting shares) are converted by calling their .json() method.
- Returns:
dict: A JSON-serializable dictionary representing the account suitable for serialization.
- property json_metadata: dict
- list_all_subscriptions(account: str | None = None) list[dict[str, Any]]
Returns all subscriptions
- mark_notifications_as_read(last_read: str | None = None, account: str | None = None) dict[str, Any]
Broadcast a mark all notification as read custom_json
- Parameters:
last_read (str) – When set, this datestring is used to set the mark as read date
account (str) – (optional) the account to broadcast the custom_json to (defaults to
default_account)
- mute(mute: str, account: str | None = None) dict[str, Any]
Mute another account
- Parameters:
mute (str) – Mute this account
account (str) – (optional) the account to allow access to (defaults to
default_account)
- property name: str
Returns the account name
- property posting_json_metadata: dict
- print_info(force_refresh: bool = False, return_str: bool = False, use_table: bool = False, **kwargs) str | None
Print account summary information, either printed or returned as a string.
If force_refresh is True the account data and shared blockchain data are refreshed before computing values. The summary includes reputation, voting/downvoting power and recharge times, estimated vote value (HBD), token power (HP), balances, and (when available) RC manabar estimates and approximate RC costs for common ops.
- Parameters:
force_refresh (bool): If True, refresh account and blockchain data before generating the summary. return_str (bool): If True, return the formatted summary string instead of printing it. use_table (bool): If True, format the output as a two-column PrettyTable; otherwise produce a plain text block. **kwargs: Forwarded to PrettyTable.get_string when use_table is True (e.g., sortby, border). These are ignored for plain text output.
- Returns:
str | None: The formatted summary string when return_str is True; otherwise None (the summary is printed).
- property profile: dict
Returns the account profile
- recurring_transfer(to: str | Account, amount: int | float | str | Amount, asset: str, recurrence: int, executions: int, memo: str = '', skip_account_check: bool = False, account: str | Account | None = None, **kwargs) dict[str, Any]
Schedule a recurring transfer of a token from this account to another.
Schedules a recurring on-chain transfer operation that will execute executions times every recurrence hours.
- Parameters:
to (str | Account): Recipient account name or Account object. amount (int | float | str | Amount): Amount to transfer each occurrence. Must match the asset’s precision (commonly 3 decimals). asset (str): Asset symbol (e.g., “HIVE”, “HBD”). recurrence (int): Interval between executions in hours. executions (int): Number of times the transfer will be executed. memo (str, optional): Memo for the transfer. If it starts with ‘#’, the remainder is encrypted to the recipient. skip_account_check (bool, optional): If True, skip resolving/checking Account objects for to and account (faster when making many calls). account (str | Account, optional): Source account name or Account object; defaults to this Account.
- Returns:
dict: The broadcasted transaction result returned by finalizeOp.
- refresh() None
Refresh/Obtain an account’s data from the API server
- property rep: float
Returns the account reputation
- reply_history(limit: int | None = None, start_author: str | None = None, start_permlink: str | None = None, account: str | Account | None = None) Any
Stream the replies to an account in reverse time order.
Note
RPC nodes keep a limited history of entries for the replies to an author. Older replies to an account may not be available via this call due to these node limitations.
- Parameters:
limit (int) – (optional) stream the latest limit replies. If unset (default), all available replies are streamed.
start_author (str) – (optional) start streaming the replies from this author. start_permlink=None (default) starts with the latest available entry. If set, start_permlink has to be set as well.
start_permlink (str) – (optional) start streaming the replies from this permlink. start_permlink=None (default) starts with the latest available entry. If set, start_author has to be set as well.
account (str) – (optional) the account to get replies to (defaults to
default_account)
comment_history_reverse example:
from nectar.account import Account acc = Account("ned") for reply in acc.reply_history(limit=10): print(reply)
- property reward_balances: list[Amount]
Return the account’s reward balances as a list of Amount objects.
Checks for reward-related fields (‘reward_hive_balance’, ‘reward_hbd_balance’, ‘reward_vesting_balance’) on the account and returns copies of any that exist, preserving the original stored Amount objects. The list order is: reward_hive_balance, reward_hbd_balance, reward_vesting_balance (when present).
- Returns:
list: A list of Amount instances (copies) for each available reward balance.
- property saving_balances: list[Amount]
Return the account’s savings balances.
Returns a list of Amount objects representing savings balances present on the account. Includes “savings_balance” and, if present, “savings_hbd_balance”. Returns an empty list if no savings balances are available.
- set_withdraw_vesting_route(to: str | Account, percentage: float = 100, account: str | Account | None = None, auto_vest: bool = False, **kwargs) dict[str, Any]
Set or update a vesting withdraw route for an account.
When the source account withdraws vesting shares, a portion of the withdrawn amount is routed to to according to percentage. If auto_vest is True the recipient receives VESTS; otherwise the recipient receives liquid HIVE.
- Parameters:
to (str): Recipient account name. percentage (float): Percentage of each withdraw to route to to (0.0–100.0). Internally converted to protocol units (multiplied by HIVE_1_PERCENT). account (str|Account, optional): Source account performing the route change. If omitted, self is used. auto_vest (bool): If True route is added as VESTS; if False route is converted to HIVE.
- Returns:
dict: Result of broadcasting the set_withdraw_vesting_route operation (as returned by finalizeOp).
- Notes:
Operation is broadcast with the source account’s active authority.
- setproxy(proxy: str = '', account: str | Account | None = None) dict[str, Any]
Set the witness and proposal system proxy of an account
- property sp: Amount
Return the account’s Hive Power (HP).
This is a compatibility alias that delegates to get_token_power() and returns the account’s effective Hive Power as computed by that method.
- transfer(to: str | Account, amount: int | float | str | Amount, asset: str, memo: str = '', skip_account_check: bool = False, account=None, **kwargs) dict
Transfer an asset from this account to another account.
Creates and broadcasts a Transfer operation using the account’s active authority.
- Parameters:
to (str | Account): Recipient account name or Account object. amount (int | float | str | Amount): Amount to transfer; will be normalized to an Amount with the given asset. asset (str): Asset symbol (e.g., “HIVE”, “HBD”). memo (str, optional): Optional memo; if it starts with ‘#’, the remainder is encrypted with the sender’s and receiver’s memo keys. skip_account_check (bool, optional): If True, skip resolving the to and account parameters to Account objects (faster for repeated transfers). account (str | Account, optional): Source account name or Account object; defaults to this Account instance. **kwargs: Passed through to finalizeOp (e.g., broadcast options).
- Returns:
dict: Result from blockchain.finalizeOp (signed/broadcast transaction response).
- transfer_from_savings(amount: int | float | str | Amount, asset: str, memo: str, request_id: int | None = None, to: str | Account | None = None, account: str | Account | None = None, **kwargs) dict[str, Any]
Withdraw an amount from the account’s savings into a liquid balance (HIVE or HBD).
Creates and broadcasts a transfer_from_savings operation. If request_id is not provided a random 32-bit id will be generated. If account is omitted the operation will be created for the current account; if to is omitted the funds are transferred back to the same account.
- Parameters:
amount (float|str|Amount): Amount to withdraw. asset (str): Symbol of the asset to withdraw, must be the chain token or its backed token (e.g., “HIVE” or “HBD”). memo (str): Memo for the transfer (may be empty). request_id (int, optional): Identifier for this withdrawal request; used to cancel or track the withdrawal. If omitted one is generated. to (str|Account, optional): Destination account name or Account; defaults to the source account. account (str|Account, optional): Source account name or Account; defaults to the current account.
- Returns:
dict: Result of finalizeOp / broadcast (operation confirmation).
- Raises:
AssertionError: If asset is not a supported token symbol for this chain.
- transfer_to_savings(amount: int | float | str | Amount, asset: str, memo: str, to: str | Account | None = None, account: str | Account | None = None, **kwargs) dict[str, Any]
Transfer HBD or HIVE from an account into its savings balance (or into another account’s savings) and broadcast the transfer_to_savings operation.
- Parameters:
amount (float | str | Amount): Amount to transfer; may be numeric, string, or an Amount instance. asset (str): Asset symbol, must be the chain token or its backed token (e.g. “HIVE” or “HBD”). memo (str): Memo to include with the transfer (may be empty). to (str | Account, optional): Destination account name or Account whose savings will receive the funds.
If omitted, the source account’s own savings is used.
- account (str | Account, optional): Source account name or Account performing the transfer.
If omitted, self is used.
**kwargs: Additional keyword arguments passed to the underlying finalizeOp call.
- Returns:
dict: Result of finalizeOp (the broadcast/transaction result).
- Raises:
AssertionError: If asset is not one of the allowed symbols.
- transfer_to_vesting(amount: int | float | str | Amount, to=None, account=None, skip_account_check: bool = False, **kwargs) dict
Power up HIVE by converting liquid HIVE into vesting shares (VESTS).
Performs a Transfer_to_vesting operation from the source account to the recipient (defaults to the account itself). The amount is normalized to the chain token symbol before broadcasting. Use skip_account_check=True to avoid resolving/validating Account objects for to or account when sending many transfers in a loop (faster but skips existence checks).
- Parameters:
amount: Amount to transfer; accepts numeric, string, or Amount-like inputs and will be normalized to the blockchain token symbol. to (str|Account, optional): Recipient account name or Account object. Defaults to the calling account. account (str|Account, optional): Source account name or Account object. If omitted, the caller account is used. skip_account_check (bool, optional): If True, do not resolve/validate account names to Account objects (speeds up bulk transfers).
- Returns:
The result of finalizeOp (broadcast/transaction result) for the Transfer_to_vesting operation.
- type_id = 2
- unfollow(unfollow: str, account: str | None = None) dict[str, Any]
Unfollow/Unmute another account’s blog
- Parameters:
unfollow (str) – Unfollow/Unmute this account
account (str) – (optional) the account to allow access to (defaults to
default_account)
- update_account_jsonmetadata(metadata, account=None, **kwargs) dict
Update an account’s profile in json_metadata using the posting key
- Parameters:
metadata (dict) – The new metadata to use
account (str) – (optional) the account to allow access to (defaults to
default_account)
- update_account_keys(new_password: str, account: str | Account | None = None, **kwargs) dict[str, Any]
Updates all account keys
This method does not add any private keys to your wallet but merely changes the public keys.
- Parameters:
new_password (str) – is used to derive the owner, active, posting and memo key
account (str) – (optional) the account to allow access to (defaults to
default_account)
- update_account_metadata(metadata: dict[str, Any] | str, account: str | Account | None = None, **kwargs) dict[str, Any]
Update an account’s profile in json_metadata
- Parameters:
metadata (dict) – The new metadata to use
account (str) – (optional) the account to allow access to (defaults to
default_account)
- update_account_profile(profile: dict[str, Any], account: str | None = None, **kwargs) dict[str, Any]
Update an account’s profile in json_metadata
- Parameters:
profile (dict) – The new profile to use
account (str) – (optional) the account to allow access to (defaults to
default_account)
Sample profile structure:
{ 'name': 'TheCrazyGM', 'about': 'hive-nectar Developer', 'location': 'United States', 'profile_image': 'https://.jpg', 'cover_image': 'https://.jpg', 'website': 'https://github.com/thecrazygm' }
from nectar.account import Account account = Account("test") profile = account.profile profile["about"] = "test account" account.update_account_profile(profile)
- update_memo_key(key: str, account: str | Account | None = None, **kwargs) dict[str, Any]
Update an account’s memo public key
This method does not add any private keys to your wallet but merely changes the memo public key.
- Parameters:
key (str) – New memo public key
account (str) – (optional) the account to allow access to (defaults to
default_account)
- verify_account_authority(keys: list[str] | str, account: str | None = None) dict[str, Any]
Return whether the provided signers (public keys) are sufficient to authorize the specified account.
If account is omitted, uses this Account object’s name. keys may be a single key or a list of public keys. Returns a dictionary as returned by the node RPC (e.g., {“valid”: True} or {“valid”: False}). Raises OfflineHasNoRPCException when the instance is offline. If the RPC raises MissingRequiredActiveAuthority during verification, the method returns {“valid”: False}.
- virtual_op_count(until: int | None = None) int
Returns the number of individual account transactions
- Return type:
list
- property vp: float
Returns the account voting power in the range of 0-100%
- withdraw_vesting(amount: int | float | str | Amount, account: str | Account | None = None, **kwargs) dict[str, Any]
Withdraw VESTS from the vesting account.
- Parameters:
amount (float) – number of VESTS to withdraw over a period of 13 weeks
account (str) – (optional) the source account for the transfer if not
default_account
- class nectar.account.Accounts(name_list, batch_limit=100, lazy=False, full=True, blockchain_instance=None)
Bases:
AccountsObjectObtain a list of accounts
- Parameters:
name_list (list) – list of accounts to fetch
batch_limit (int) – (optional) maximum number of accounts to fetch per call, defaults to 100
blockchain_instance (Blockchain) – Blockchain instance to use when accessing the RPC
- class nectar.account.AccountsObject(iterable=(), /)
Bases:
list- printAsTable() None
- print_summarize_table(tag_type: str = 'Follower', return_str: bool = False, **kwargs) str | None
Print or return a one-line summary table aggregating metrics for the accounts in this collection.
Calculates and reports: - total count of accounts, - summed MVest value (own vesting shares / 1e6), - mean and max reputation (if available), - summed, mean, and max effective HP (Hive Power) (if available), - mean time since last vote (hours) and mean time since last post (days) excluding accounts inactive >= 365 days, - counts of accounts without a vote or a post in the last 365 days.
- Parameters:
tag_type (str): Label used for counting rows (default “Follower”). return_str (bool): If True, return the formatted table as a string; if False, print it. **kwargs: Passed through to PrettyTable.get_string (formatting options).
- Returns:
Optional[str]: The table string when return_str is True; otherwise None.