Image source: Pixabay: Cash flow
I hate to hit the "REDEEM REWARDS" button, don't you? Let's do something to get rid of such boring task! Let the cash flow man!
First of all, claim_reward.lua is part of my lazy-steem project. If you are a witness take a look at my previous post: publish_feed.lua: Update your witness price feed with the power of Lua
There we go!
How to fetch the pending rewards balance
This is not dark magic, just a few lines of code and voila! claim_reward.lua relies on cli_wallet's JSON-RPC API. It requires two API calls: get_account and claim_reward_balance.
The output of get_account is huge, we only need this parameters:
{
...
"reward_sbd_balance": "0.000 SBD",
"reward_steem_balance": "0.000 STEEM",
"reward_vesting_steem": "0.000 STEEM",
...
}
It has everything required for claim_reward_balance, everything else is really easy!
Running the script automagically every X minutes
Installation is pretty easy, all instructions are available in my previous article about publish_feed.lua, nothing has changed... yet!
And this is what you can put into your crontab:
# m h dom mon dow command
10 5 * * * cd /path/to/lazy-steem/; ./claim_reward.lua dropahead http://localhost:8093 > /dev/null
Don't run away that fast!
If you liked this stuff then vote @dropahead for witness!
Talk is cheap, code is gold! You had better start a pull request if you want to say something about my precious code. Here: https://github.com/develCuy/lazy-steem
Happy hacking and keep steeming hard!