Created
January 24, 2018 16:36
-
-
Save code-with-sam/9635cc73e6d0ea81b987058c35754478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tutorial 07 - Schedule Steem-Js Tasks | |
const steem = require('steem') | |
const schedule = require('node-schedule') | |
const ACCOUNT_NAME = '' | |
const ACCOUNT_KEY = '' | |
steem.api.setOptions({ url: 'https://api.steemit.com' }); | |
schedule.scheduleJob('* 18 * * *', function(){ | |
claimBalance() | |
}); | |
function claimBalance(){ | |
steem.api.getAccounts([ACCOUNT_NAME], function(err, result){ | |
console.log(err, result) | |
let sbdReward = result[0].reward_sbd_balance | |
let steemReward = result[0].reward_steem_balance | |
let steemPowerInVests = result[0].reward_vesting_balance | |
steem.broadcast.claimRewardBalance(ACCOUNT_KEY, ACCOUNT_NAME, steemReward, sbdReward, steemPowerInVests, function(err, result) { | |
console.log(err, result); | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment