======================== CODE SNIPPETS ======================== TITLE: Manual Hive Nectar Installation from Repository DESCRIPTION: Installs the hive-nectar package directly from its GitHub repository. This method is useful for obtaining the latest, potentially unreleased, version of the software. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_7 LANGUAGE: bash CODE: ``` git clone https://github.com/thecrazygm/hive-nectar.git cd hive-nectar uv sync uv sync --dev ``` ---------------------------------------- TITLE: Install Hive Nectar Package DESCRIPTION: Installs the hive-nectar Python package using pip. It provides commands to install the latest version, with alternative commands for pip3 or using the python -m pip syntax. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_6 LANGUAGE: bash CODE: ``` pip install -U hive-nectar ``` LANGUAGE: bash CODE: ``` pip3 install -U hive-nectar ``` LANGUAGE: bash CODE: ``` python -m pip install hive-nectar ``` ---------------------------------------- TITLE: Run Project Tests DESCRIPTION: Executes the project's test suite using pytest. This command should be run after installation to verify that the software is functioning correctly. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_8 LANGUAGE: bash CODE: ``` pytest ``` ---------------------------------------- TITLE: Install Debian/Ubuntu Dependencies for Hive Nectar DESCRIPTION: Installs essential build and development packages required for Hive Nectar on Debian and Ubuntu systems using apt-get. These include build tools, SSL development libraries, and Python development headers. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_0 LANGUAGE: bash CODE: ``` sudo apt-get install build-essential libssl-dev python-dev curl ``` ---------------------------------------- TITLE: Install pip Package Manager DESCRIPTION: Downloads and executes the get-pip.py script to install or upgrade the pip package installer. This is a prerequisite for installing Python packages like hive-nectar. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_4 LANGUAGE: bash CODE: ``` curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py ``` ---------------------------------------- TITLE: Install hive-nectar from Repository DESCRIPTION: Clones the hive-nectar repository and installs it directly from the source code. This is useful for developers who want the latest, potentially unreleased, features. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_7 LANGUAGE: bash CODE: ``` git clone https://github.com/thecrazygm/hive-nectar.git cd hive-nectar uv sync uv sync --dev ``` ---------------------------------------- TITLE: Install Cryptography Package DESCRIPTION: Installs or upgrades the cryptography package using pip. This package can significantly speed up signing and verification processes for applications that rely on cryptographic operations. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_5 LANGUAGE: bash CODE: ``` pip install -U cryptography ``` ---------------------------------------- TITLE: Install secp256k1prp for Signing Speedup DESCRIPTION: Installs the 'secp256k1prp' package, an alternative method to enhance the speed of signing and verification processes. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_5 LANGUAGE: bash CODE: ``` pip3 install -U secp256k1prp ``` ---------------------------------------- TITLE: Install Ledger Support Package DESCRIPTION: Installs the 'ledgerblue' package, which is required for enabling Ledger Nano S signing capabilities within the hive-nectar library. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_9 LANGUAGE: bash CODE: ``` pip3 install ledgerblue ``` ---------------------------------------- TITLE: Install Fedora/RHEL Dependencies for Hive Nectar DESCRIPTION: Installs essential build and development packages required for Hive Nectar on Fedora and RHEL-based systems using yum. This includes the C compiler, OpenSSL development libraries, and Python development headers. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_1 LANGUAGE: bash CODE: ``` sudo yum install gcc openssl-devel python-devel ``` ---------------------------------------- TITLE: Run Tests DESCRIPTION: Executes the test suite for the hive-nectar library after installation. This command verifies the integrity and functionality of the installed package. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_8 LANGUAGE: bash CODE: ``` pytest ``` ---------------------------------------- TITLE: Install OSX Dependencies for Hive Nectar DESCRIPTION: Installs OpenSSL via Homebrew and sets environment variables for CFLAGS and LDFLAGS to ensure proper compilation of Hive Nectar on macOS. This is necessary for linking against the OpenSSL libraries. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_2 LANGUAGE: bash CODE: ``` brew install openssl export CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS" export LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS" ``` ---------------------------------------- TITLE: Install Termux Dependencies for Hive Nectar DESCRIPTION: Installs necessary development packages like clang, openssl-dev, and python-dev for Hive Nectar on Termux, the terminal emulator and Linux environment for Android. These packages provide the required build tools and libraries. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_3 LANGUAGE: bash CODE: ``` pkg install clang openssl-dev python-dev ``` ---------------------------------------- TITLE: Install Cryptography for Signing Speedup DESCRIPTION: Installs the 'cryptography' package to significantly speed up signing and verification operations. This is an optional but recommended step for performance enhancement. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_4 LANGUAGE: bash CODE: ``` pip3 install -U cryptography ``` ---------------------------------------- TITLE: Install Debian/Ubuntu Build Dependencies DESCRIPTION: Installs essential build tools and development packages required for compiling Python extensions on Debian and Ubuntu systems. These are prerequisites for installing and running the hive-nectar library. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_0 LANGUAGE: bash CODE: ``` sudo apt-get install build-essential libssl-dev python3-dev python3-pip python3-setuptools ``` ---------------------------------------- TITLE: Enable Basic Logging in Python DESCRIPTION: Configures basic logging in a Python script. It sets the logger name and configures the root logger to output messages with INFO level or higher to the console. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_9 LANGUAGE: python CODE: ``` import logging log = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) ``` ---------------------------------------- TITLE: Publish a Hive Post DESCRIPTION: Enables publishing a new post or article to the Hive blockchain. Requires title, body, author, and tags. Wallet must be unlocked. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_20 LANGUAGE: python CODE: ``` from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") hive.post("title", "body", author="test", tags=["a", "b", "c", "d", "e"], self_vote=True) ``` ---------------------------------------- TITLE: Setup Power Down Route DESCRIPTION: Configures a route for the power down process, potentially specifying how withdrawn VESTS should be handled. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_64 LANGUAGE: cli CODE: ``` powerdownroute ``` ---------------------------------------- TITLE: Steem Initialization and Market Setup DESCRIPTION: Initializes the Steem blockchain instance, optionally disabling broadcasting for testing, and sets up a market for trading operations. It demonstrates how to connect to the blockchain and define trading pairs. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst#_snippet_5 LANGUAGE: python CODE: ``` steem = Steem( nobroadcast=True, # <<--- set this to False when you want to fire! keys=[wif] # <<--- use your real keys, when going live! ) # # This defines the market we are looking at. # The first asset in the first argument is the *quote* # Sell and buy calls always refer to the *quote* # market = Market("STEEM:SBD", blockchain_instance=steem ) sell() ``` ---------------------------------------- TITLE: Install Fedora/RHEL Build Dependencies DESCRIPTION: Installs necessary development packages for Fedora and RHEL-based systems. These include GCC, OpenSSL development files, and Python development headers, crucial for building the library. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_1 LANGUAGE: bash CODE: ``` sudo yum install gcc openssl-devel python-devel ``` ---------------------------------------- TITLE: Install OSX Build Dependencies with Homebrew DESCRIPTION: Configures build environment on macOS using Homebrew. It installs OpenSSL and sets environment variables for CFLAGS and LDFLAGS to ensure proper linking during compilation. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_2 LANGUAGE: bash CODE: ``` brew install openssl export CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS" export LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS" ``` ---------------------------------------- TITLE: Viewing Configuration via CLI DESCRIPTION: Illustrates how to view the current configuration settings using the hive-nectar command-line tool. This provides a quick way to inspect the active configuration parameters. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_2 LANGUAGE: bash CODE: ``` hive-nectar config ``` ---------------------------------------- TITLE: Create and Unlock Wallet DESCRIPTION: Initializes or prepares the wallet for storing private keys. It includes an option to wipe an existing wallet and then unlocks it using a provided passphrase. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_6 LANGUAGE: python CODE: ``` from nectar import Hive hive = Hive() hive.wallet.wipe(True) hive.wallet.unlock("wallet-passphrase") ``` ---------------------------------------- TITLE: Loading Configuration Directly DESCRIPTION: Shows how to load the configuration storage directly from the nectar.storage module without initializing the Steem class. This is useful for accessing configuration settings independently. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_1 LANGUAGE: python CODE: ``` from nectar.storage import configStorage as config ``` ---------------------------------------- TITLE: Sell HIVE on the Market DESCRIPTION: Executes a sell order for HIVE on the market, specifying the quantity and price. Requires wallet unlocking and market initialization. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_21 LANGUAGE: python CODE: ``` from nectar.market import Market from nectar import Hive hive = Hive() hive.wallet.unlock("wallet-passphrase") market = Market("HBD:HIVE", blockchain_instance=hive) print(market.ticker()) market.hive.wallet.unlock("wallet-passphrase") print(market.sell(300, 100)) # sell 100 HIVE for 300 HIVE/HBD ``` ---------------------------------------- TITLE: Install or Update hive-nectar via Pip DESCRIPTION: Installs or updates the hive-nectar Python library using pip. This is the standard method for obtaining the latest stable release. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_6 LANGUAGE: bash CODE: ``` pip3 install -U hive-nectar ``` ---------------------------------------- TITLE: Install Termux Android Build Dependencies DESCRIPTION: Installs required packages for the Termux environment on Android. This includes Clang for compilation, OpenSSL for cryptographic functions, and Python. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/README.md#_snippet_3 LANGUAGE: bash CODE: ``` pkg install clang openssl python ``` ---------------------------------------- TITLE: Instantiate Hive Object and Account DESCRIPTION: Creates a Hive blockchain instance and an Account object, linking the account to the specific Hive instance. This allows operations on the account to be performed through the defined Hive connection. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_4 LANGUAGE: python CODE: ``` from nectar import Hive from nectar.account import Account hive = Hive() account = Account("test", blockchain_instance=hive) print(hive.is_hive) ``` ---------------------------------------- TITLE: Get Following Information DESCRIPTION: Retrieves information about the accounts that a specific account is following. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_38 LANGUAGE: cli CODE: ``` following ``` ---------------------------------------- TITLE: Testing Wallet Unlocking via CLI DESCRIPTION: Demonstrates how to test the wallet unlocking mechanism using the hive-nectar command-line tool. If no password prompt appears, it indicates successful automatic unlocking. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_15 LANGUAGE: bash CODE: ``` hive-nectar walletinfo --test-unlock ``` ---------------------------------------- TITLE: Access Market Ticker Data DESCRIPTION: Retrieves ticker information for a specified market pair. Requires initializing the Market class with the desired pair. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_16 LANGUAGE: python CODE: ``` from nectar.market import Market market = Market("HBD:HIVE") print(market.ticker()) ``` ---------------------------------------- TITLE: Send a Hive Transfer DESCRIPTION: Facilitates sending Hive or HBD tokens between accounts. Requires wallet unlocking and an initialized Hive instance. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_18 LANGUAGE: python CODE: ``` from nectar import Hive from nectar.account import Account hive = Hive() hive.wallet.unlock("wallet-passphrase") account = Account("test", blockchain_instance=hive) account.transfer("null", 1, "SBD", "test") ``` ---------------------------------------- TITLE: Add Private Keys to Wallet DESCRIPTION: Adds private keys to the nectar wallet after unlocking it with a passphrase. Multiple keys can be added to manage different accounts or permissions. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_7 LANGUAGE: python CODE: ``` from nectar import Steem hive = Hive() hive.wallet.unlock("wallet-passphrase") hive.wallet.addPrivateKey("xxxxxxx") hive.wallet.addPrivateKey("xxxxxxx") ``` ---------------------------------------- TITLE: Update Steem Nodes via CLI DESCRIPTION: Updates the node list for the Steem blockchain using the hive-nectar command-line tool. This command fetches the latest node information for the Steem network. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_1 LANGUAGE: bash CODE: ``` hive-nectar updatenodes ``` ---------------------------------------- TITLE: hive-nectar CLI Help and Options DESCRIPTION: Provides a comprehensive overview of all available commands and global options for the hive-nectar CLI. This includes network connection settings, broadcast controls, and blockchain selection. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_11 LANGUAGE: APIDOC CODE: ``` Usage: hive-nectar [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]... Options: -n, --node TEXT URL for public Steem API (e.g. https://api.steemit.com) Specifies the API endpoint to connect to. -o, --offline Prevent connecting to network Runs the CLI in offline mode, useful for generating unsigned transactions. -d, --no-broadcast Do not broadcast Prevents broadcasting signed transactions to the network. -p, --no-wallet Do not load the wallet Skips wallet loading, useful when using key files or unsigned operations. -x, --unsigned Nothing will be signed Generates unsigned transactions that need to be signed externally. -l, --create-link Creates hivesigner links from all broadcast operations Generates Hivesigner links for operations that can be signed via Hivesigner. -s, --steem Connect to the Steem blockchain Explicitly targets the Steem blockchain. -h, --hive Connect to the Hive blockchain Explicitly targets the Hive blockchain. -k, --keys TEXT JSON file that contains account keys, when set, the wallet cannot be used. Provides private keys via a JSON file, overriding wallet usage. -u, --use-ledger Uses the ledger device Nano S for signing. Enables signing transactions using a Ledger Nano S device. --path TEXT BIP32 path from which the keys are derived, when not set, default_path is used. Specifies the derivation path for keys when using hardware wallets or specific key generation schemes. -t, --token Uses a hivesigner token to broadcast (only broadcast operation with posting permission) Authenticates and broadcasts using a Hivesigner token, typically for posting key operations. -e, --expires INTEGER Delay in seconds until transactions are supposed to expire (defaults to 60) Sets the expiration time for broadcasted transactions. -v, --verbose INTEGER Verbosity Controls the level of detail in output messages. --version Show the version and exit. --help Show this message and exit. Commands: about About hive-nectar Displays information about the hive-nectar application. addkey Add key to wallet When no [OPTION] is given,... Adds a private key to the wallet for account access. addtoken Add key to wallet When no [OPTION] is given, a... Adds a token, likely for authentication or specific operations. allow Allow an account/key to interact with your... account... Grants permissions for another account or key to interact with the current account. approvewitness Approve a witnesses Votes for a witness on the blockchain. balance Shows balance Displays the balances of specified accounts. beneficiaries Set beneficaries Configures beneficiaries for post rewards. broadcast broadcast a signed transaction Broadcasts a pre-signed transaction to the blockchain. buy Buy STEEM/HIVE or SBD/HBD from the internal market... Executes a buy order on the internal market for cryptocurrencies. cancel Cancel order in the internal market Cancels an existing order on the internal market. changekeys Changes all keys for the specified account Keys... Updates all keys (posting, active, owner) for an account. changerecovery Changes the recovery account with the owner key... Updates the account's recovery account using the owner key. ``` ---------------------------------------- TITLE: Access Account Balances and History DESCRIPTION: Fetches an account's current balances and retrieves its transaction history. This provides insight into an account's financial activity and holdings. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_12 LANGUAGE: python CODE: ``` from nectar.account import Account account = Account("test") print(account.balances) for h in account.history(): print(h) ``` ---------------------------------------- TITLE: Set Shared Blockchain Instance DESCRIPTION: Configures a global shared instance of the Hive blockchain connection. Subsequent objects created without an explicit blockchain instance will use this shared instance. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_5 LANGUAGE: python CODE: ``` from nectar import Hive from nectar.account import Account from nectar.instance import set_shared_blockchain_instance hive = Hive() set_shared_blockchain_instance(hive) account = Account("test") ``` ---------------------------------------- TITLE: Viewing Configuration DESCRIPTION: Displays the current configuration settings for hive-nectar, including any set defaults. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_10 LANGUAGE: bash CODE: ``` hive-nectar config ``` ---------------------------------------- TITLE: Testing Wallet Unlocking via Python DESCRIPTION: Shows how to test if the wallet can be automatically unlocked using the configured password storage (environment variable or keyring). It prints the locked status of the wallet. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_14 LANGUAGE: python CODE: ``` from nectar import Steem steem = Steem() print(steem.wallet.locked()) ``` ---------------------------------------- TITLE: Wallet Management Operations DESCRIPTION: Provides examples for managing the nectar wallet, including wiping existing data, creating a new wallet with a passphrase, unlocking, adding private keys, and locking the wallet. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/index.rst#_snippet_4 LANGUAGE: python CODE: ``` from nectar.hive import Hive hive = Hive() hive.wallet.wipe(True) hive.wallet.create("wallet-passphrase") hive.wallet.unlock("wallet-passphrase") hive.wallet.addPrivateKey("512345678") hive.wallet.lock() ``` ---------------------------------------- TITLE: Get State using RecentByPath DESCRIPTION: Retrieves state information, potentially filtered by path. This example uses `RecentByPath` with a 'promoted' path. Imports `RecentByPath` from `nectar.comment`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_30 LANGUAGE: python CODE: ``` from nectar.comment import RecentByPath for p in RecentByPath(path="promoted"): print(p) ``` ---------------------------------------- TITLE: Enable Critical Logging Level in Python DESCRIPTION: Configures the Python logging system to only display messages with the CRITICAL level. This is useful for reducing log verbosity to show only the most severe errors. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/installation.rst#_snippet_10 LANGUAGE: python CODE: ``` import logging log = logging.getLogger(__name__) logging.basicConfig(level=logging.CRITICAL) ``` ---------------------------------------- TITLE: Accessing Configuration Dictionary DESCRIPTION: Demonstrates how to access the local configuration database of the pysteem library using the Steem class. It shows how to retrieve configuration items as a dictionary, allowing for direct access and modification of settings. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_0 LANGUAGE: python CODE: ``` from nectar import Steem steem = Steem() print(steem.config.items()) ``` ---------------------------------------- TITLE: Get Trending Tags using Discussions DESCRIPTION: Retrieves trending tags, ordered by popularity. Requires a `Query` object to specify parameters like limit and start tag. Imports `Query` and `Trending_tags` from `nectar.discussions`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_36 LANGUAGE: python CODE: ``` from nectar.discussions import Query, Trending_tags q = Query(limit=10, start_tag="steemit") for h in Trending_tags(q): print(h) ``` ---------------------------------------- TITLE: Connect to Steem Blockchain via Python DESCRIPTION: Initializes a connection to the Steem blockchain using the nectar library. It updates the node list and retrieves Steem-specific nodes to establish the connection, then prints a status indicator. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_3 LANGUAGE: python CODE: ``` from nectar import Steem from nectar.nodelist import NodeList nodelist = NodeList() nodelist.update_nodes() nodes = nodelist.get_steem_nodes() hive = Steem(node=nodes) print(hive.is_hive) ``` ---------------------------------------- TITLE: Get Replies by Last Update using Discussions DESCRIPTION: Retrieves replies to discussions, ordered by last update. Requires a `Query` object to specify parameters like start author and permlink. Imports `Query` and `Replies_by_last_update` from `nectar.discussions`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_25 LANGUAGE: python CODE: ``` from nectar.discussions import Query, Replies_by_last_update q = Query(limit=10, start_author="steemit", start_permlink="firstpost") for h in Replies_by_last_update(q): print(h) ``` ---------------------------------------- TITLE: Connect to Hive Blockchain via Python DESCRIPTION: Initializes a connection to the Hive blockchain using the nectar library. It updates the node list and retrieves Hive-specific nodes to establish the connection, then prints a status indicator. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_2 LANGUAGE: python CODE: ``` from nectar import Hive from nectar.nodelist import NodeList nodelist = NodeList() nodelist.update_nodes() nodes = nodelist.get_hive_nodes() hive = Hive(node=nodes) print(hive.is_hive) ``` ---------------------------------------- TITLE: Create Post DESCRIPTION: Generates a new markdown file for a post, including a YAML header for metadata. This is a common way to prepare content for broadcasting. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_17 LANGUAGE: cli CODE: ``` createpost ``` ---------------------------------------- TITLE: Get Follower Information DESCRIPTION: Retrieves information about the followers of a specific account. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_37 LANGUAGE: cli CODE: ``` follower ``` ---------------------------------------- TITLE: Simple Sell Script DESCRIPTION: A basic script to sell an asset on the market. It demonstrates how to instantiate Steem, define a market pair (e.g., SBD:STEEM), and use the `market.sell()` method with a specific price and amount. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst#_snippet_3 LANGUAGE: python CODE: ``` from nectar import Steem from nectar.market import Market from nectar.price import Price from nectar.amount import Amount # Only for testing not a real working key wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" # # Instantiate Steem (pick network via API node) # steem = Steem( nobroadcast=True, # <<--- set this to False when you want to fire! keys=[wif] # <<--- use your real keys, when going live! ) # # This defines the market we are looking at. # The first asset in the first argument is the *quote* # Sell and buy calls always refer to the *quote* # market = Market("SBD:STEEM", blockchain_instance=steem ) # # Sell an asset for a price with amount (quote) # print(market.sell( Price(100.0, "STEEM/SBD"), Amount("0.01 SBD") )) ``` ---------------------------------------- TITLE: Get Muting Information DESCRIPTION: Retrieves information about accounts that the current account has muted. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_51 LANGUAGE: cli CODE: ``` muting ``` ---------------------------------------- TITLE: Get Muter Information DESCRIPTION: Retrieves information about accounts that have muted the current account. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_50 LANGUAGE: cli CODE: ``` muter ``` ---------------------------------------- TITLE: Create New Account DESCRIPTION: Creates a new account on the blockchain. This command is used for new user registrations. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_52 LANGUAGE: cli CODE: ``` newaccount ``` ---------------------------------------- TITLE: Get Account Feature Flags DESCRIPTION: Retrieves the feature flags associated with a specific account. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_35 LANGUAGE: cli CODE: ``` featureflags ``` ---------------------------------------- TITLE: Get User Data DESCRIPTION: Retrieves user-specific data, such as email address and phone number, associated with an account. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_84 LANGUAGE: cli CODE: ``` userdata ``` ---------------------------------------- TITLE: Batch API Calls with AppBase Queue DESCRIPTION: Demonstrates how to leverage AppBase RPC nodes for batch API calls by queuing requests. Calls made with `add_to_queue=True` are collected and sent together when a call with `add_to_queue=False` is executed, returning a list of results. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst#_snippet_6 LANGUAGE: python CODE: ``` from nectar import Steem stm = Steem("https://api.steemit.com") stm.rpc.get_config(add_to_queue=True) stm.rpc.rpc_queue ``` LANGUAGE: python CODE: ``` result = stm.rpc.get_block({"block_num":1}, api="block", add_to_queue=False) len(result) ``` LANGUAGE: python CODE: ``` 2 ``` LANGUAGE: python CODE: ``` [{'method': 'condenser_api.get_config', 'jsonrpc': '2.0', 'params': [], 'id': 6}] ``` ---------------------------------------- TITLE: Show Local Configuration DESCRIPTION: Displays the current local configuration settings for the CLI tool. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_15 LANGUAGE: cli CODE: ``` config ``` ---------------------------------------- TITLE: Get Order Book DESCRIPTION: Retrieves the order book for the internal market, showing buy and sell orders. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_56 LANGUAGE: cli CODE: ``` orderbook ``` ---------------------------------------- TITLE: Get Interest Payment Information DESCRIPTION: Retrieves information related to interest payments, likely for savings or lending features. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_43 LANGUAGE: cli CODE: ``` interest ``` ---------------------------------------- TITLE: Using a JSON Key File DESCRIPTION: Illustrates how to provide private keys directly via a JSON file instead of using the encrypted wallet. This method bypasses the wallet entirely and requires specifying the key file path. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_2 LANGUAGE: json CODE: ``` { "account_a": {"posting": "5xx", "active": "5xx"}, "account_b": {"posting": "5xx"} } ``` LANGUAGE: bash CODE: ``` hive-nectar --keys key_file.json command ``` ---------------------------------------- TITLE: Get Account History DESCRIPTION: Returns the operation history for an account, presented in a table format. Useful for auditing transactions. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_40 LANGUAGE: cli CODE: ``` history ``` ---------------------------------------- TITLE: Follow Account DESCRIPTION: Initiates a follow action on another account, subscribing to their content. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_36 LANGUAGE: cli CODE: ``` follow ``` ---------------------------------------- TITLE: Stream Blockchain Operations DESCRIPTION: Iterates through all operations recorded on the blockchain in real-time. This is useful for monitoring network activity and processing events as they occur. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_10 LANGUAGE: python CODE: ``` from nectar.blockchain import Blockchain blockchain = Blockchain() for op in blockchain.stream(): print(op) ``` ---------------------------------------- TITLE: Get Witness Schedule using Steem DESCRIPTION: Fetches the witness schedule for the blockchain. Requires a `Steem` instance. Imports `Steem` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_42 LANGUAGE: python CODE: ``` from nectar import Steem stm = Steem() print(stm.get_witness_schedule()) ``` ---------------------------------------- TITLE: Checking Balances DESCRIPTION: Fetches and displays the cryptocurrency balances (e.g., STEEM, SBD, HIVE, HBD) for specified accounts. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_6 LANGUAGE: bash CODE: ``` hive-nectar balance account_name1 account_name2 ``` ---------------------------------------- TITLE: Get Ticker using Market DESCRIPTION: Retrieves the current ticker information for the market. Requires a `Market` instance. Imports `Market` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_32 LANGUAGE: python CODE: ``` from nectar.market import Market m = Market() print(m.ticker()) ``` ---------------------------------------- TITLE: Setting Password Storage via CLI DESCRIPTION: Demonstrates how to configure the method for storing the wallet's master password using the hive-nectar command-line tool. Options include 'environment' (default) and 'keyring'. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_12 LANGUAGE: bash CODE: ``` hive-nectar set password_storage environment hive-nectar set password_storage keyring ``` ---------------------------------------- TITLE: Get Reward Funds using Steem DESCRIPTION: Fetches information about reward funds. Requires a `Steem` instance. Imports `Steem` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_27 LANGUAGE: python CODE: ``` from nectar import Steem stm = Steem() print(stm.get_reward_funds()) ``` ---------------------------------------- TITLE: Get Follow List Information DESCRIPTION: Retrieves information about follow lists, specifying the type of follow list (e.g., following, followers, muting). SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_39 LANGUAGE: cli CODE: ``` followlist ``` ---------------------------------------- TITLE: Listing Accounts DESCRIPTION: Retrieves and displays a list of all accounts managed by or known to the hive-nectar wallet. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_5 LANGUAGE: bash CODE: ``` hive-nectar listaccounts ``` ---------------------------------------- TITLE: Access a Specific Block DESCRIPTION: Retrieves information about a single block from the blockchain by its block number. This allows inspection of block contents and associated transactions. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_11 LANGUAGE: python CODE: ``` from nectar.block import Block print(Block(1)) ``` ---------------------------------------- TITLE: Access All Votes from an Account DESCRIPTION: Retrieves a list of all votes cast by a specified account. This provides a comprehensive view of an account's voting history. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_14 LANGUAGE: python CODE: ``` from nectar.vote import AccountVotes allVotes = AccountVotes("gtg") ``` ---------------------------------------- TITLE: Sell at a Timely Rate DESCRIPTION: An example of selling an asset at a timed interval using Python's `threading.Timer`. The `sell` function is defined to execute a market sell operation and then reschedule itself to run again after a specified delay. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst#_snippet_4 LANGUAGE: python CODE: ``` import threading from nectar import Steem from nectar.market import Market from nectar.price import Price from nectar.amount import Amount # Only for testing not a real working key wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" def sell(): """ Sell an asset for a price with amount (quote) """ print(market.sell( Price(100.0, "SBD/STEEM"), Amount("0.01 STEEM") )) threading.Timer(60, sell).start() if __name__ == "__main__": # # Instantiate Steem (pick network via API node) # # This part of the code is incomplete in the provided text. # Assuming instantiation of Steem and Market similar to the Simple Sell Script. pass # Placeholder for incomplete code ``` ---------------------------------------- TITLE: Show Wallet Information DESCRIPTION: Displays general information about the user's wallet, including account balances and status. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_87 LANGUAGE: cli CODE: ``` walletinfo ``` ---------------------------------------- TITLE: Managing Default API Node URLs DESCRIPTION: Demonstrates how to retrieve the list of default API node URLs and how to set a new list of nodes using the Steem class. This allows for dynamic management of the nodes the library connects to. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/configuration.rst#_snippet_3 LANGUAGE: python CODE: ``` from nectar import Steem steem = Steem() node_list = steem.get_default_nodes() node_list = node_list[1:] + [node_list[0]] steem.set_default_nodes(node_list) ``` ---------------------------------------- TITLE: Access a Single Vote DESCRIPTION: Retrieves details for a specific vote on the blockchain, identified by a unique string. This allows examination of individual voting actions. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/quickstart.rst#_snippet_13 LANGUAGE: python CODE: ``` from nectar.vote import Vote vote = Vote(u"@gtg/ffdhu-gtg-witness-log|gandalf") print(vote.json()) ``` ---------------------------------------- TITLE: Get Witness Count using Witnesses DESCRIPTION: Retrieves the total number of active witnesses. Requires a `Witnesses` instance. Imports `Witnesses` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_41 LANGUAGE: python CODE: ``` from nectar.witness import Witnesses w = Witnesses() print(w.witness_count) ``` ---------------------------------------- TITLE: Test Transactions with nobroadcast DESCRIPTION: Demonstrates how to use `nobroadcast=True` to simulate transaction broadcasting without sending it to the network. This is useful for testing and debugging. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst#_snippet_1 LANGUAGE: python CODE: ``` from pprint import pprint from nectar import Steem from nectar.account import Account from nectar.instance import set_shared_blockchain_instance # Only for testing not a real working key wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" # set nobroadcast always to True, when testing testnet = Steem( nobroadcast=True, # Set to false when want to go live keys=[wif], ) # Set testnet as shared instance set_shared_blockchain_instance(testnet) # Account will use now testnet account = Account("test") pprint(account.transfer("test1", 1, "STEEM")) ``` ---------------------------------------- TITLE: Use Next Node DESCRIPTION: Switches the CLI to use the next available node in the configured list. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/cli.rst#_snippet_53 LANGUAGE: cli CODE: ``` nextnode ``` ---------------------------------------- TITLE: Get Vesting Delegations using Account DESCRIPTION: Fetches vesting delegations made by an account. Requires an `Account` object. Imports `Account` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_37 LANGUAGE: python CODE: ``` from nectar.account import Account acc = Account("gtg") for v in acc.get_vesting_delegations(): print(v) ``` ---------------------------------------- TITLE: Build and Broadcast a Multi-Operation Transaction DESCRIPTION: Builds and signs a transaction containing multiple operations, such as a 'Transfer' and a 'Vote'. It appends both operations, signs the transaction using a WIF key, and then broadcasts it. This demonstrates composing complex transactions. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/tutorials.rst#_snippet_10 LANGUAGE: python CODE: ``` from nectar import Steem from nectar.transactionbuilder import TransactionBuilder from nectarbase import operations stm = Steem() # Uncomment the following when using a wallet: # stm.wallet.unlock("secret_password") tx = TransactionBuilder(blockchain_instance=stm) ops = [] op = operations.Transfer(**{"from": 'user_a', "to": 'user_b', "amount": '1.000 SBD', "memo": 'test 2'})) ops.append(op) op = operations.Vote(**{"voter": v, "author": author, "permlink": permlink, "weight": int(percent * 100)}) ops.append(op) tx.appendOps(ops) # Comment appendWif out and uncomment appendSigner when using a stored key from the wallet tx.appendWif('5.....') # `user_a` # tx.appendSigner('user_a', 'active') tx.sign() tx.broadcast() ``` ---------------------------------------- TITLE: Get Transaction using Blockchain DESCRIPTION: Retrieves a specific transaction by its ID. Requires a `Blockchain` instance and the transaction ID. Imports `Blockchain` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_34 LANGUAGE: python CODE: ``` from nectar.blockchain import Blockchain b = Blockchain() print(b.get_transaction("6fde0190a97835ea6d9e651293e90c89911f933c")) ``` ---------------------------------------- TITLE: Get Trade History using Market DESCRIPTION: Retrieves the historical trade data from the market. Requires a `Market` instance. Imports `Market` from `nectar`. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/apidefinitions.rst#_snippet_33 LANGUAGE: python CODE: ``` from nectar.market import Market m = Market() for t in m.trade_history(): print(t) ``` ---------------------------------------- TITLE: Sphinx Autodoc for nectargraphenebase.account Module DESCRIPTION: This directive instructs Sphinx to automatically document the Python module `nectargraphenebase.account`. It includes all public members, undocumented members, and displays inheritance information, generating comprehensive API documentation. SOURCE: https://github.com/thecrazygm/hive-nectar/blob/main/docs/nectargraphenebase.account.rst#_snippet_0 LANGUAGE: APIDOC CODE: ``` .. automodule:: nectargraphenebase.account :members: :undoc-members: :show-inheritance: ```