Code to claim SPS airdrop without login to Splinterlands

avatar

I will guide you how to claim sps airdrop by running this code:

exports.claim_sps = async (account) => {
    try {
        let ts = Date.now();
        const tx = 'hive' + account.username + ts;
        const sig = ecc.sign(tx, account.posting_key);

        let url = `https://ec-api.splinterlands.com/players/claim_sps_airdrop?platform=hive&address=${account.username}&sig=${sig}&ts=${ts}&username=${account.username}`;
        const {
            data
        } = await axios(url);

        if (data.success) {
            console.log(`${account.username.replace(' ', '').toLowerCase()} claimed ${data.data.qty} SPS`);
        } else {
            console.log(`${account.username.replace(' ', '').toLowerCase()}: No sps airdrop`);
        }

        return;
    } catch (error) {
        console.log(error.message);
        await new Promise((resolve) => setTimeout(resolve, 3000));
        return await this.claim_sps(account);
    }
};



0
0
0.000
4 comments
avatar

Congratulations @skymavis! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You received more than 200 upvotes.
Your next target is to reach 300 upvotes.
You made more than 10 comments.
Your next target is to reach 50 comments.
You got more than 10 replies.
Your next target is to reach 50 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Check out the last post from @hivebuzz:

Feedback from the March 1st Hive Power Up Day
Our Hive Power Delegations to the February PUM Winners
Support the HiveBuzz project. Vote for our proposal!
0
0
0.000
avatar

Hello friend, I have a question, I don't know if it's possible, I wanted to try to use this code as a basis to be able to claim the unstaked sps rewards but specifically I am not a professional programming so I could know, in the case of making this script work specifically what words i need to change for account-posting/ additionally the api that I should change in the future if I want to do the above asked? In the same way, I would greatly appreciate your answer if it is within your possibilities, and thank you very much for your contribution!

0
0
0.000