JS版一次领取所有代领取SCOT代币

JS版一次领取所有代领取SCOT代币



(Image source: Pixabay)

昨天看到@holger80介绍怎么通过python一次性领取所有待领的Steem-engine代币: How to claim all pending token rewards at once - improved claim command

我对Python不熟,加上Python在windows系统安装麻烦,所以我一般使用JS。

之前用JS写过一个自动领取代币的小程序,现在SCOT支持一次领取多个代币后,对现有的版本进行了小修改。有兴趣的可以使用:

const fetch = require("node-fetch");
const request = require('request');
const steem = require('steem');
const account = 'steem id';//你的steem id
const wif = 'posting Key'; //你的发帖密钥

(async() => {
    let tokens = await getClaimable(account);
    if (tokens.length > 0) {
        claimToken(tokens);
    } else {
        console.log("Nothing to claim.")
    }

})();

function claimToken(tokens) {
    let json = [];
    for (let i in tokens) {
        json.push({
            symbol: tokens[i].symbol
        })
    }
    steem.broadcast.customJson(wif, [], [account], 'scot_claim_token', JSON.stringify(json), (err, result) => {
        if (err)
            console.log(err);
        else {
            console.log(tokens.length + " tokens claimed");
        }

    });

}

async function getClaimable(account) {
    let claimable = [];
    let token = await(await fetch('https://scot-api.steem-engine.com/@' + account, {
                method: 'GET'
            })).json();
    for (let i in token) {
        if (token[i].pending_token > 0) {
            claimable.push({
                symbol: i,
                token: token[i].pending_token
            })
        }
    }
    return claimable;
}


如果你不会编程,也不会运行程序。那你可以使用阿盐@robertyan弄的自动领取SCOT 代币奖励的程序. 具体查看:自动领取 SCOT 代币奖励

自己动手弄点小程序也是挺有意思的,@windenchanter来尝试一下吧。 —


This page is synchronized from the post: ‘JS版一次领取所有代领取SCOT代币’

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×