Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console

The feature to delegate SPS rewards to other accounts has been integrated in the API of Splinterlands for about 2 months. I don't know why the development team hasn't written a frontend feature yet, so that other developers have to help themselves and integrate the features into their own pages. But it doesn't feel like a big job for the Splinterlands developers to fully integrate the feature themselves. It is already possible via API and SL. Thanks to the browser console for developers, it is possible to perform the transaction for an SPS delegation. How you can do this via the website Splinterlands.com, you can read here now.


1. Open Splinterlands and open the browser console.

The first thing we do is open Splinterlands.com, which is the game. In the background, every time the page loads, all the information we need is already loaded. We log into Splinterlands into the account that will deliver the delegations. If we are logged in and e.g. on the Battle page, we open the developer console. Either by Ctrl + Shift + J or by pressing the F12 key and then switch to the console.

The whole thing will look something like this:

image.png

2. perform the SM.Broadcast transaction

The next step is to enter a command in the Console, which we then confirm with Hive-Keychain in the post.
Important: Customize the templates below to your needs.

SM.BroadcastCustomJson('sm_delegate_rewards','Delegate Rewards', {"username":"SPLINTERLANDSACCOUNT","percent":"100","type":"modern"})

image.png

Explanation / Adjustments.
SPLINTERLANDSACCOUNT = The account that should receive the SPS Rewards when you claim the rewards.
percent = Number of % that should go to the account. 0 - 100 (2 decimal places are possible. e.g. 25.87% "percent": "25.87")
type = Which type of rewards should be delegated? There are currently 8 different values to choose from: modern, wild, focus, season, nightmare, license, land, brawl.

If you simply want to transfer all the rewards your account receives to another account with one command, you can simply leave out the type and enter the following command:
SM.BroadcastCustomJson('sm_delegate_rewards','Delegate Rewards', {"username":"SPLINTERLANDSACCOUNT","percent":"100"})

2.1 Confirm with Keychain and Submit

Now that our code snippet is ready, we press Enter once and let the Splinterlands page perform the broadcast transaction for us. Immediately Hive-Keychain should come up as a popup where we can take a closer look at the data:

image.png

3. cross-check transactions

Now we can take a look at the current state of current delegations - We can do this easily directly via an API call to Splinterlands. You can get all the necessary information in the following AP Call:
https://api.splinterlands.com/players/reward_delegations?username=YOUR_SL_USERNAME

Replace to your Username at the End of the API Call

4. set delegations back to 0.

This works by simply setting the value of the percentage written above in step 2 to 0. You can optionally set everything here directly to 0 by leaving out the type or by sending a specific type one by one. By resending a valid transaction, the previous value is simply overwritten, i.e. an update is performed. This also means that it is possible to change an existing delegation from e.g. 10 to 20%, if the scholar should perform better and earn more.


Actually a nice workaround to do the delegations at least without frontend function at Splinterlands but still at Splinterlands.

If you have any questions about this, feel free to ask in the comments.

3.21694982 BEE
10 comments

Hello, cool Post!
BTW, I started a new Splinterlands Giveaway Account, you are welcome to join my daily giveaways :)

Posted using Splintertalk

0E-8 BEE

Interesting post as the way to delegate SPS using the browser developer console!
!CTP
@tipu curate

0E-8 BEE
0E-8 BEE

Great tip!!

0E-8 BEE

0E-8 BEE

Hi brother, cool post. Thanks :)

0E-8 BEE

Wow, that looks like a hacking challenge to me. There certainly is some API documentation to do other fancy things like reading results, is there? I'd love to go into this more but don't know where to start. I'd appreciate a hint or two.

Here is a fresh slice of !PIZZA and I hope it is received well.

0E-8 BEE

🍕 PIZZA !

I gifted $PIZZA slices here:
@anjanida(3/5) tipped @louis88 (x1)

Please vote for pizza.witness!

0E-8 BEE

thanks so much for posting this very helpful

0E-8 BEE

does this still work? I tried to run it but without success

0E-8 BEE

Yes, it's working. Just tested it.

0.00019507 BEE

I tried to configure my account called splinterlandspro to delegate assets to the main account called viniciotricolor.

https://api.splinterlands.com/players/reward_delegations?username=splinterlandspro

According to the API, it seems to be configured correctly. I don't know if one thing out of the ordinary is that it starts with [ and ends with ]. I'm not sure if this is normal or not.

I also have a question about how it works. Does it send assets automatically? Do I need to do something to start it, or does it work automatically at intervals of hours?

0E-8 BEE

perform the SM.Broadcast transaction
The next step is to enter a command in the Console, which we then confirm with Hive-Keychain in the post.
Important: Customize the templates below to your needs.
SM.BroadcastCustomJson('sm_delegate_rewards','Delegate Rewards', {"username":"SPLINTERLANDSACCOUNT","percent":"100","type":"modern"})

How can I perform this to WILD, MODERN, and FOCUS without having to enter the single line of JSON every time for WILD, MODERN, and FOCUS?

0E-8 BEE