Design decisions on a library: A new event listener idea on Lightsteem

in #lightsteem6 years ago (edited)

Streaming blockchain for the incoming transfers of a specific account


events = EventListener(client)

for transfer in events.on('transfer', filter={"to": "emrebeyler"}):
    print(transfer)

Streaming for incoming witness vote actions


events = EventListener(client)

for witness_vote in events.on('account_witness_vote', filter={"witness": "emrebeyler"}):
    print(witness_vote)

Callables (Filtering on conditions)


Let's get the comments and posts tagged with utopian-io:

def filter_tags(comment_body):
    return "utopian-io" in comment_body["json_metadata"]["tags"]:


for op in events.on("comment", condition=filter_tags):
    print("only comments has a tag with utopian-io")

Stream everything


for op in events.stream():
    print(op)

Hooks


events = EventListener(client)

def send_to_discord(data):
    # r = requests.post(...)
    pass

for witness_vote in events.on('account_witness_vote', 
        filter={"witness": "emrebeyler"}, 
        hook=send_to_discord):
    print(witness_vote)

Any thoughts?

Sort:  

I use the word event a lot in this context, when I try to explain my code in plain words.

I am deep into my JS project, but I hope I can make use of lightsteem some time in the future.

How is the wallet going on?

I have the backend figured out ( comes with steem-js pretty much )

I am stuck with UI decisions and my latest idea is to just go retro; 800x600 and style it pixel by pixel.
I am not sure how to proceed and I am waiting for another rush of inspiration ...

Those are the droids I am looking for

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.039
BTC 70310.43
ETH 3568.34
USDT 1.00
SBD 4.73