diff --git a/README.rst b/README.rst index 6b6859be987c259047372531ad448cc7faf9b169..0e18af359858bf4639f6d18825a47899422cb019 100644 --- a/README.rst +++ b/README.rst @@ -158,7 +158,7 @@ Changelog ========= 0.19.39 ------- -* get_feed_entries, get_blog_authors, get_savings_withdrawals, get_escrow, verify_account_authority, get_expiring_vesting_delegations added to Account +* get_feed_entries, get_blog_authors, get_savings_withdrawals, get_escrow, verify_account_authority, get_expiring_vesting_delegations, get_vesting_delegations, get_tags_used_by_author added to Account * get_account_reputations, get_account_count added to Blockchain * ImageUploader class added diff --git a/beem/account.py b/beem/account.py index 1c2ae67feb3150f5b20174dd4cb10df812cea573..15f2d2a855a99b6070b44ea6b543a6b2143ebe00 100644 --- a/beem/account.py +++ b/beem/account.py @@ -504,8 +504,9 @@ class Account(BlockchainObject): >>> from beem.account import Account >>> account = Account("steemit") - >>> account.get_blog_entries(0, 1, raw_data=True) - [{'author': 'steemit', 'permlink': 'firstpost', 'blog': 'steemit', 'reblog_on': '1970-01-01T00:00:00', 'entry_id': 0}] + >>> entry = account.get_blog_entries(0, 1, raw_data=True)[0] + >>> print("%s - %s - %s - %s" % (entry["author"], entry["permlink"], entry["blog"], entry["reblog_on"])) + steemit - firstpost - steemit - 1970-01-01T00:00:00 """ return self.get_blog(start_entry_id=start_entry_id, limit=limit, raw_data=raw_data, short_entries=True, account=account) @@ -1088,8 +1089,8 @@ class Account(BlockchainObject): >>> from beem.account import Account >>> account = Account("steemit") - >>> account.verify_account_authority(["STM7Q2rLBqzPzFeteQZewv9Lu3NLE69fZoLeL6YK59t7UmssCBNTU"]) - {'valid': False} + >>> print(account.verify_account_authority(["STM7Q2rLBqzPzFeteQZewv9Lu3NLE69fZoLeL6YK59t7UmssCBNTU"])["valid"]) + False """ if account is None: @@ -1109,6 +1110,33 @@ class Account(BlockchainObject): except MissingRequiredActiveAuthority: return {'valid': False} + def get_tags_used_by_author(self, account=None): + """ Returns a list of tags used by an author. + + :param str account: When set, a different account is used for the request (Default is object account name) + + :rtype: list + + .. code-block:: python + + >>> from beem.account import Account + >>> account = Account("test") + >>> account.get_tags_used_by_author() + [] + + """ + if account is None: + account = self["name"] + elif isinstance(account, Account): + account = account["name"] + if not self.steem.is_connected(): + raise OfflineHasNoRPCException("No RPC available in offline mode!") + self.steem.rpc.set_next_node_on_empty_reply(False) + if self.steem.rpc.get_use_appbase(): + return self.steem.rpc.get_tags_used_by_author({'account': account}, api="tags")['tags'] + else: + return self.steem.rpc.get_tags_used_by_author(account, api="tags") + def get_expiring_vesting_delegations(self, after=None, limit=1000, account=None): """ Returns the expirations for vesting delegations. diff --git a/beem/block.py b/beem/block.py index 4e19a228b15ee3cee5f8a718a8df408d18bae6c0..7c112545cdaaafb4d18994ff8b58e99743ee2a53 100644 --- a/beem/block.py +++ b/beem/block.py @@ -89,7 +89,7 @@ class Block(BlockchainObject): block["transactions"][i]["expiration"] = formatTimeString(block["transactions"][i]["expiration"]) elif "operations" in block: for i in range(len(block["operations"])): - if 'timestamp' in block["operations"][i] and isinstance(block["operations"][i]["timestamp"], string_types): + if 'timestamp' in block["operations"][i] and isinstance(block["operations"][i]["timestamp"], string_types): block["operations"][i]["timestamp"] = formatTimeString(block["operations"][i]["timestamp"]) return block @@ -112,7 +112,7 @@ class Block(BlockchainObject): output["transactions"][i]["expiration"] = formatTimeString(output["transactions"][i]["expiration"]) elif "operations" in output: for i in range(len(output["operations"])): - if 'timestamp' in output["operations"][i] and isinstance(output["operations"][i]["timestamp"], (datetime, date)): + if 'timestamp' in output["operations"][i] and isinstance(output["operations"][i]["timestamp"], (datetime, date)): output["operations"][i]["timestamp"] = formatTimeString(output["operations"][i]["timestamp"]) ret = json.loads(str(json.dumps(output))) diff --git a/beem/blockchain.py b/beem/blockchain.py index 9f738d5c6910106e10b3b969cfa5046994569bb9..8808d54194749d95fde6af2d2612e6b0dbb77345 100644 --- a/beem/blockchain.py +++ b/beem/blockchain.py @@ -250,6 +250,20 @@ class Blockchain(object): ret = self.steem.rpc.get_transaction(transaction_id, api="database") return ret + def get_transaction_hex(self, transaction): + """ Returns a hexdump of the serialized binary form of a transaction. + + :param dict transaction: transaction + """ + if not self.steem.is_connected(): + raise OfflineHasNoRPCException("No RPC available in offline mode!") + self.steem.rpc.set_next_node_on_empty_reply(False) + if self.steem.rpc.get_use_appbase(): + ret = self.steem.rpc.get_transaction({'trx': transaction}, api="database")["hex"] + else: + ret = self.steem.rpc.get_transaction_hex(transaction, api="database") + return ret + def get_current_block_num(self): """ This call returns the current block number diff --git a/beem/discussions.py b/beem/discussions.py index 82409d88b1fedcf1c554f80af13c3de4de67c5d6..c95b4b6be7033e19d1d25a3eaad5108e2539432e 100644 --- a/beem/discussions.py +++ b/beem/discussions.py @@ -22,6 +22,7 @@ class Query(dict): :param array select_tags: :param str start_author: :param str start_permlink: + :param str start_tag: :param str parent_author: :param str parent_permlink: @@ -33,7 +34,7 @@ class Query(dict): """ def __init__(self, limit=0, tag="", truncate_body=0, filter_tags=[], select_authors=[], select_tags=[], - start_author=None, start_permlink=None, parent_author=None, parent_permlink=None): + start_author=None, start_permlink=None, start_tag=None, parent_author=None, parent_permlink=None): self["limit"] = limit self["truncate_body"] = truncate_body self["tag"] = tag @@ -42,6 +43,7 @@ class Query(dict): self["select_tags"] = select_tags self["start_author"] = start_author self["start_permlink"] = start_permlink + self["start_tag"] = start_tag self["parent_author"] = parent_author self["parent_permlink"] = parent_permlink @@ -362,3 +364,47 @@ class Discussions_by_promoted(list): for x in posts ] ) + + +class Replies_by_last_update(list): + """ Returns a list of replies by last update + + :param beem.discussions.Query: discussion_query, start_author and start_permlink must be set. + :param beem.steem.Steem steem_instance: Steem instance + """ + def __init__(self, discussion_query, steem_instance=None): + self.steem = steem_instance or shared_steem_instance() + limit_ok = "limit" in discussion_query and discussion_query["limit"] > 0 + self.steem.rpc.set_next_node_on_empty_reply(limit_ok) + if self.steem.rpc.get_use_appbase(): + posts = self.steem.rpc.get_replies_by_last_update(discussion_query, api="tags")['discussions'] + else: + posts = self.steem.rpc.get_replies_by_last_update(discussion_query["start_author"], discussion_query["start_permlink"], discussion_query["limit"]) + super(Replies_by_last_update, self).__init__( + [ + Comment(x, steem_instance=self.steem) + for x in posts + ] + ) + + +class Trending_tags(list): + """ Returns the list of trending tags. + + :param beem.discussions.Query: discussion_query, start_tag can be set. + :param beem.steem.Steem steem_instance: Steem instance + """ + def __init__(self, discussion_query, steem_instance=None): + self.steem = steem_instance or shared_steem_instance() + limit_ok = "limit" in discussion_query and discussion_query["limit"] > 0 + self.steem.rpc.set_next_node_on_empty_reply(limit_ok) + if self.steem.rpc.get_use_appbase(): + tags = self.steem.rpc.get_trending_tags(discussion_query, api="tags")['tags'] + else: + tags = self.steem.rpc.get_trending_tags(discussion_query["start_tag"], discussion_query["limit"], api="tags") + super(Trending_tags, self).__init__( + [ + x + for x in tags + ] + ) diff --git a/beem/witness.py b/beem/witness.py index 6bf457d9cdccd249d258bf59ef8f4ab7c803ff30..dd21e4766f53d7444de4a80426db5e1c98721201 100644 --- a/beem/witness.py +++ b/beem/witness.py @@ -272,6 +272,7 @@ class Witnesses(WitnessesObject): if self.steem.rpc.get_use_appbase(): self.active_witnessess = self.steem.rpc.get_active_witnesses(api="database")['witnesses'] self.schedule = self.steem.rpc.get_witness_schedule(api="database") + self.witness_count = self.steem.rpc.get_witness_count(api="condenser") else: self.active_witnessess = self.steem.rpc.get_active_witnesses() self.schedule = self.steem.rpc.get_witness_schedule() diff --git a/docs/apidefinitions.rst b/docs/apidefinitions.rst new file mode 100644 index 0000000000000000000000000000000000000000..756925203426c8fc8d9a0cc4120f623f9e93e8a4 --- /dev/null +++ b/docs/apidefinitions.rst @@ -0,0 +1,793 @@ +Api Definitions +=============== + +condenser_api +------------- + +broadcast_block +~~~~~~~~~~~~~~~ +not implemented + +broadcast_transaction +~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.transactionbuilder import TransactionBuilder + t = TransactionBuilder() + t.broadcast() + +broadcast_transaction_synchronous +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.transactionbuilder import TransactionBuilder + t = TransactionBuilder() + t.broadcast() + +get_account_bandwidth +~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + account = Account("test") + account.get_account_bandwidth() + +get_account_count +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.blockchain import Blockchain + b = Blockchain() + b.get_account_count() + +get_account_history +~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("steemit") + for h in acc.get_account_history(1,0): + print(h) + +get_account_reputations +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.blockchain import Blockchain + b = Blockchain() + for h in b.get_account_reputations(): + print(h) + +get_account_votes +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for h in acc.get_account_votes(): + print(h) + +get_active_votes +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.vote import ActiveVotes + acc = Account("gtg") + post = acc.get_feed(0,1)[0] + a = ActiveVotes(post["authorperm"]) + a.printAsTable() + +get_active_witnesses +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.witness import Witnesses + w = Witnesses() + w.printAsTable() + +get_block +~~~~~~~~~ + +.. code-block:: python + + from beem.block import Block + print(Block(1)) + +get_block_header +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.block import BlockHeader + print(BlockHeader(1)) + +get_blog +~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for h in acc.get_blog(): + print(h) + +get_blog_authors +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for h in acc.get_blog_authors(): + print(h) + +get_blog_entries +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for h in acc.get_blog_entries(): + print(h) + +get_chain_properties +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_chain_properties()) + +get_comment_discussions_by_payout +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Comment_discussions_by_payout + q = Query(limit=10) + for h in Comment_discussions_by_payout(q): + print(h) + +get_config +~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_config()) + +get_content +~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + from beem.comment import Comment + acc = Account("gtg") + post = acc.get_feed(0,1)[0] + print(Comment(post["authorperm"])) + + +get_content_replies +~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + from beem.comment import Comment + acc = Account("gtg") + post = acc.get_feed(0,1)[0] + c = Comment(post["authorperm"]) + for h in c.get_replies(): + print(h) + +get_conversion_requests +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_conversion_requests()) + +get_current_median_history_price +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_current_median_history()) + + +get_discussions_by_active +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_active + q = Query(limit=10) + for h in Discussions_by_active(q): + print(h) + +get_discussions_by_author_before_date +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_author_before_date + for h in Discussions_by_author_before_date(limit=10, author="gtg"): + print(h) + +get_discussions_by_blog +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_blog + q = Query(limit=10) + for h in Discussions_by_blog(q): + print(h) + +get_discussions_by_cashout +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_cashout + q = Query(limit=10) + for h in Discussions_by_cashout(q): + print(h) + +get_discussions_by_children +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_children + q = Query(limit=10) + for h in Discussions_by_children(q): + print(h) + +get_discussions_by_comments +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_comments + q = Query(limit=10, start_author="steemit", start_permlink="firstpost") + for h in Discussions_by_comments(q): + print(h) + +get_discussions_by_created +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_created + q = Query(limit=10) + for h in Discussions_by_created(q): + print(h) + +get_discussions_by_feed +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_feed + q = Query(limit=10, tag="steem") + for h in Discussions_by_feed(q): + print(h) + +get_discussions_by_hot +~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_hot + q = Query(limit=10, tag="steem") + for h in Discussions_by_hot(q): + print(h) + +get_discussions_by_promoted +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_promoted + q = Query(limit=10, tag="steem") + for h in Discussions_by_promoted(q): + print(h) + +get_discussions_by_trending +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_trending + q = Query(limit=10, tag="steem") + for h in Discussions_by_trending(q): + print(h) + +get_discussions_by_votes +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Discussions_by_votes + q = Query(limit=10) + for h in Discussions_by_votes(q): + print(h) + +get_dynamic_global_properties +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_dynamic_global_properties()) + +get_escrow +~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_escrow()) + +get_expiring_vesting_delegations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_expiring_vesting_delegations()) + +get_feed +~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for f in acc.get_feed(): + print(f) + +get_feed_entries +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for f in acc.get_feed_entries(): + print(f) + +get_feed_history +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_feed_history()) + +get_follow_count +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_follow_count()) + +get_followers +~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for f in acc.get_followers(): + print(f) + +get_following +~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for f in acc.get_following(): + print(f) + +get_hardfork_version +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_hardfork_properties()["hf_version"]) + +get_key_references +~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + from beem.wallet import Wallet + acc = Account("gtg") + w = Wallet() + print(w.getAccountFromPublicKey(acc["posting"]["key_auths"][0][0])) + +get_market_history +~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + for t in m.market_history(): + print(t) + +get_market_history_buckets +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + for t in m.market_history_buckets(): + print(t) + +get_next_scheduled_hardfork +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_hardfork_properties()) + +get_open_orders +~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + print(m.accountopenorders(account="gtg")) + +get_ops_in_block +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.block import Block + b = Block(2e6, only_ops=True) + print(b) + +get_order_book +~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + print(m.orderbook()) + +get_owner_history +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_owner_history()) + +get_post_discussions_by_payout +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Post_discussions_by_payout + q = Query(limit=10) + for h in Post_discussions_by_payout(q): + print(h) + +get_potential_signatures +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.transactionbuilder import TransactionBuilder + from beem.blockchain import Blockchain + b = Blockchain() + block = b.get_current_block() + trx = block.json()["transactions"][0] + t = TransactionBuilder(trx) + print(t.get_potential_signatures()) + + +get_reblogged_by +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + from beem.comment import Comment + acc = Account("gtg") + post = acc.get_feed(0,1)[0] + c = Comment(post["authorperm"]) + for h in c.get_reblogged_by(): + print(h) + +get_recent_trades +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + for t in m.recent_trades(): + print(t) + +get_recovery_request +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_recovery_request()) + +get_replies_by_last_update +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.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) + +get_required_signatures +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.transactionbuilder import TransactionBuilder + from beem.blockchain import Blockchain + b = Blockchain() + block = b.get_current_block() + trx = block.json()["transactions"][0] + t = TransactionBuilder(trx) + print(t.get_required_signatures()) + +get_reward_fund +~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_reward_funds()) + +get_savings_withdraw_from +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_savings_withdrawals(direction="from")) + +get_savings_withdraw_to +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_savings_withdrawals(direction="to")) + +get_state +~~~~~~~~~ + +.. code-block:: python + + from beem.comment import RecentByPath + for p in RecentByPath(path="promoted"): + print(p) + +get_tags_used_by_author +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_tags_used_by_author()) + +get_ticker +~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + print(m.ticker()) + +get_trade_history +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + for t in m.trade_history(): + print(t) + +get_transaction +~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.blockchain import Blockchain + b = Blockchain() + print(b.get_transaction("6fde0190a97835ea6d9e651293e90c89911f933c")) + +get_transaction_hex +~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.blockchain import Blockchain + b = Blockchain() + block = b.get_current_block() + trx = block.json()["transactions"][0] + print(b.get_transaction_hex(trx)) + +get_trending_tags +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.discussions import Query, Trending_tags + q = Query(limit=10, start_tag="steemit") + for h in Trending_tags(q): + print(h) + +get_version +~~~~~~~~~~~ +not implemented + +get_vesting_delegations +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for v in acc.get_vesting_delegations(): + print(v) + +get_volume +~~~~~~~~~~ + +.. code-block:: python + + from beem.market import Market + m = Market() + print(m.volume24h()) + +get_withdraw_routes +~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + print(acc.get_withdraw_routes()) + +get_witness_by_account +~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.witness import Witness + w = Witness("gtg") + print(w) + +get_witness_count +~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.witness import Witnesses + w = Witnesses() + print(w.witness_count) + +get_witness_schedule +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem import Steem + stm = Steem() + print(stm.get_witness_schedule()) + +get_witnesses +~~~~~~~~~~~~~ +not implemented + +get_witnesses_by_vote +~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.witness import WitnessesRankedByVote + for w in WitnessesRankedByVote(): + print(w) + +lookup_account_names +~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg", full=False) + print(acc.json()) + +lookup_accounts +~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.account import Account + acc = Account("gtg") + for a in acc.get_similar_account_names(limit=100): + print(a) + +lookup_witness_accounts +~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.witness import ListWitnesses + for w in ListWitnesses(): + print(w) + +verify_account_authority +~~~~~~~~~~~~~~~~~~~~~~~~ +disabled and not implemented + +verify_authority +~~~~~~~~~~~~~~~~ + +.. code-block:: python + + from beem.transactionbuilder import TransactionBuilder + from beem.blockchain import Blockchain + b = Blockchain() + block = b.get_current_block() + trx = block.json()["transactions"][0] + t = TransactionBuilder(trx) + t.verify_authority() + print("ok") diff --git a/docs/index.rst b/docs/index.rst index 8237bc84b5dd19b47157cc4548a7c1bf5227ac70..dea3fe853915659d0c6fb0a9946921004e656870 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -118,6 +118,7 @@ General tutorials cli configuration + apidefinitions modules contribute support