RE: RE: Part 6: Coding on Hive with Python - Interacting with the Hive-Engine Side Chain
You are viewing a single comment's thread from:

RE: Part 6: Coding on Hive with Python - Interacting with the Hive-Engine Side Chain

Words
174
Reading
1 min
Listen
Play
4y

Thank you for the feedback.

Just following up on your question about getting the list of incoming delegations to an account. I found a simple way to request this data using the hiveengine API object.

Here's what it looks like:

from hiveengine.api import Api
api = Api()
api.find("tokens", "delegations", query={"to": "learncode"})

In this case, the "tokens" string is the contract name, the "delegations" string is the table name, and the query is like a search filter for MongoDB.

There are additional filters you can use, as documented at https://github.com/hive-engine/steemsmartcontracts-wiki/blob/master/Tokens-Contract.md#delegations

fields:
from = account that initiated the delegation
to = account that received the delegation
symbol = symbol of the token delegated
quantity = quantity of tokens delegated

So you can request the list of delegations based on the account delegated to or from, the symbol for the token, and the quantity. I believe you can include logical statements in the query also, to do things like only return results where the quantity is greater than N.

Example:

api.find("tokens", "delegations", query={"to": "learncode", "from": "javivisan", "symbol": "BEE"})

@learncode: Thank you for | Ecency