How to claim all pending token rewards at once - improved claim command

in #scot5 years ago (edited)

As most are active in more than one tribe, claiming all pending token at once would be handy. I improved the claim custom_json for scotbot so that all pending token can be given in an array:

Instead of

{"symbol": "TOKEN"}

a list with symbols can be given

[{"symbol": "TOKEN1"}, {"symbol": "TOKEN2"}]

The custom_json id is for both scot_claim_token

Python script to claim all pending token

from beem import Steem
from beem.nodelist import NodeList
import json
import six
import requests
import getpass

if __name__ == "__main__":

    
    if six.PY2:
        username = raw_input("Username: ")
    else:
        username = input("Username: ")

    url = "http://scot-api.steem-engine.com/@" + username
    r = requests.get(url)
    result = r.json()
    
    json_data = []
    for token in result:
        scot = result[token]
        if int(scot["pending_token"]) > 0:
            json_data.append({"symbol": token})
            print("%s can be claimed" % (token))
    
    if len(json_data) > 0:
        nodes = NodeList()
        nodes.update_nodes()
        stm = Steem(nodes.get_nodes())    
        pwd = getpass.getpass("Enter Walletpassword or posting key for %s" % username) 
        
        try:
            stm.unlock(pwd)
        except:
            stm = Steem(node=nodes.get_nodes(), keys=[pwd])        
        stm.custom_json("scot_claim_token", json_data, required_posting_auths=[username])
    else:
        print("Nothing to claim")

In order to run this script, beem and steemengine must be installed:

pip install beem steemengine

When the script is saved as claim_all_scot.py
it can be run by

python claim_all_scot.py

The script asks for the username and checks of there is something to claim. When token can be claimed, it asks for the beem wallet password or for the posting key. One of both can be entered. Then the custom_json is broadcasted.

Sort:  

This will be great to see how it works out

Great!

but I also suggest adding the following format:

{"symbol": ["TOKEN1","TOKEN2"]} instead of [{"symbol": "TOKEN1"}, {"symbol": "TOKEN2"}] to save RC. This way is much shorter for many tokens.

I think you can still distinguish between single & multiple tokens by chechking the type.

ps. I'm also running Scotauto: Scot token claim automation as a service: https://economicstudio.github.io/scotauto/

If you're running a similar thing via steemrewarding, I may stop this unless many people still use it. I actually waited for you to introduce that feature in your service :) Thank you.

I've gradually adding scot-bot features to my own bots, SteemClerk and @we-are-one. I like the suggestion of the tokens being an array of strings / token names. The other method seems unnecessarily wordy. Thanks for the github links! Hope you don't mind if I raid them for snippets.

thanks and sure np :)

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 7.512 which ranks you at #53 across all Steem accounts.
Your rank has improved 1 places in the last three days (old rank 54).

In our last Algorithmic Curation Round, consisting of 173 contributions, your post is ranked at #3. Congratulations!

Evaluation of your UA score:
  • Your follower network is great!
  • The readers appreciate your great work!
  • Great user engagement! You rock!

Feel free to join our @steem-ua Discord server

I was also suggesting claim all button. Do you think they will add this code to steem-engine? Very handy!

I was wondering the same thing. Considering how easy it is now, I'm sure they will.

Need to ask for aggroed this question. I don't understand why everyone must click claim every token.

Each claim has a performance hit, not just for the claim but also to do the lookup. If SCOT is going to scale to hundreds of thousands of users, doing lookups for every account whether they have pending claims or not would be very expensive. These solutions limit most of the lookups and updates only to active users instead.

Great time saver, thanks!

is there any chance you might come to Steemfest 4 in Bangkok?

Posted using Partiko Android

@organduo here's the solution...

Thanks! Very handy...

Posted using Partiko Android

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

Nice. I assume this format will be available in keychain?

An interesting way to do this @holger80 it would however be nice to have a way this can be done for those of us who are not programmers.

I actually understood some of the pink code for a change. I have been trying to learn a little bit while I build my own desktop entry page to My Steem World.It will be nice when/if this is added to the Steem Engine Claim system.

Great fix @holger80 It would be nice to have this pulled into steem-engine?

One button to rule them all :-)

U+R

how about applying to steem-engine site with claim all button 💙
it will be great !

Posted using Partiko Android

i agree this would be awesome!!

thanks ! :) 💙 for comments

Posted using Partiko Android

It’s a good thing when I see several tokens that need to be claimed.
Steem-engine is going to propel Steem forward!🤗

agreed 💙

Posted using Partiko Android

Hi, @holger80!

You just got a 4.15% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

I dont get it, do I actually have to type in all this stuff!? When I go to Steem- engine I still have to claim the rewards one by one. There is still no button to Claim All Tokens. Glad to see its being worked on though, what a awesome time saver it will be!! Upped and resteemed!👍👍👍😎 #palnet #neoxian #stem

This kicks ASS!!! It works perfectly. I edited it so I have no inputs needed, just run the script in a terminal window and BOOM, all claimed. Super easy and I see no reason this couldn't be implemented on steem-engine.

Edit: That is nice. I setup my desktop icon to launch the script without having to open the terminal. Get a lovely terminal box pop-up showing the results, then it's gone. Perfect.

Tolle Idee. Wird das auch für "Unwissende" wie mich gehen - also mit verständlichen Anweisungen? ;-)

Posted using Partiko Android

WOW, nice, this was my suggestion! 🤙🤙
You are pretty damn smart bro! UPVOTE EARNED!