create account

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

View this thread on: hive.blogpeakd.comecency.com
· @louis88 ·
$39.87
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](https://files.peakd.com/file/peakd-hive/louis88/23tRvSbiMRKSw7hjupx6wgjL2m4YH5nQnhth1m4ztCpVGWMxG3ZfG9JAFujj3x2Fjifs6.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](https://files.peakd.com/file/peakd-hive/louis88/23tRv7NLaqbNwcGof1KBqxffN6KeWsxYTJmwk9zpHJEm5qB2USZdJF4V3cT6iBLGr3x9d.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](https://files.peakd.com/file/peakd-hive/louis88/23tRxGDeT7mcGBniFPYtCzPT763ZmhZp76mW7f6zB99EYRTobYJ5z7j8rvjjGeFcexbyf.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.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 258 others
👎  , , ,
properties (23)
authorlouis88
permlinkexecute-sps-delegation-directly-via-splinterlands-code-snippet-for-the-browser-console
categoryhive-13323
json_metadata{"app":"peakd/2022.11.1","format":"markdown","author":"louis88","tags":["splinterlands","development","hive","legendarydragons","spt","pob","gaming","oneup","leofinance","hive-engine"],"users":[],"image":["https://files.peakd.com/file/peakd-hive/louis88/23tRxGDeT7mcGBniFPYtCzPT763ZmhZp76mW7f6zB99EYRTobYJ5z7j8rvjjGeFcexbyf.png","https://files.peakd.com/file/peakd-hive/louis88/23tRvSbiMRKSw7hjupx6wgjL2m4YH5nQnhth1m4ztCpVGWMxG3ZfG9JAFujj3x2Fjifs6.png","https://files.peakd.com/file/peakd-hive/louis88/23tRv7NLaqbNwcGof1KBqxffN6KeWsxYTJmwk9zpHJEm5qB2USZdJF4V3cT6iBLGr3x9d.png"]}
created2022-11-24 23:26:06
last_update2022-11-24 23:26:06
depth0
children13
last_payout2022-12-01 23:26:06
cashout_time1969-12-31 23:59:59
total_payout_value19.962 HBD
curator_payout_value19.907 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,018
author_reputation1,181,020,901,175,086
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,592,407
net_rshares82,410,238,621,502
author_curate_reward""
vote details (326)
@anjanida ·
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.
properties (22)
authoranjanida
permlinkre-louis88-2022124t145446835z
categoryhive-13323
json_metadata{"tags":["splinterlands","development","hive","legendarydragons","spt","pob","gaming","oneup","leofinance","hive-engine"],"app":"ecency/3.0.29-vision","format":"markdown+html"}
created2022-12-04 13:54:45
last_update2022-12-04 13:54:45
depth1
children0
last_payout2022-12-11 13:54:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length302
author_reputation71,536,267,469,614
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,840,978
net_rshares0
@badprometeus ·
Great tip!! 
properties (22)
authorbadprometeus
permlinkre-louis88-20221124t223120201z
categoryhive-13323
json_metadata{"tags":["hive-13323","splinterlands","development","hive","legendarydragons","spt","pob","gaming","oneup","leofinance","hive-engine"],"app":"ecency/3.0.35-mobile","format":"markdown+html"}
created2022-11-25 04:31:18
last_update2022-11-25 04:31:18
depth1
children0
last_payout2022-12-02 04:31:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12
author_reputation100,908,842
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,597,435
net_rshares0
@gambit-x ·
> **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?
properties (22)
authorgambit-x
permlinkre-louis88-s2x7kw
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2023.10.1"}
created2023-10-22 08:00:36
last_update2023-10-22 08:00:36
depth1
children0
last_payout2023-10-29 08:00:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length481
author_reputation770,106,579
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id128,200,868
net_rshares0
@kaffee34 ·
Hi brother,  cool post. Thanks :)
properties (22)
authorkaffee34
permlinkre-louis88-20221126t20543464z
categoryhive-13323
json_metadata{"tags":["splinterlands","development","hive","legendarydragons","spt","pob","gaming","oneup","leofinance","hive-engine"],"app":"ecency/3.0.29-vision","format":"markdown+html"}
created2022-11-26 17:54:33
last_update2022-11-26 17:54:33
depth1
children0
last_payout2022-12-03 17:54:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length34
author_reputation910,869,212,955
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,634,888
net_rshares0
@libertycrypto27 ·
Interesting post as the way to delegate SPS using the browser developer console!
!CTP
@tipu curate
properties (22)
authorlibertycrypto27
permlinkre-louis88-rlvnqe
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2022.11.1"}
created2022-11-25 00:23:00
last_update2022-11-25 00:23:00
depth1
children1
last_payout2022-12-02 00:23:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length99
author_reputation1,975,689,180,600,078
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,593,645
net_rshares0
@tipu ·
<a href="https://tipu.online/hive_curator?libertycrypto27" target="_blank">Upvoted  &#128076;</a> (Mana: 7/47) <a href="https://peakd.com/hive/@reward.app/reward-app-quick-guide-updated" target="_blank">Liquid rewards</a>.
properties (22)
authortipu
permlinkre-re-louis88-rlvnqe-20221125t002308z
categoryhive-13323
json_metadata"{"app": "beem/0.24.26"}"
created2022-11-25 00:23:06
last_update2022-11-25 00:23:06
depth2
children0
last_payout2022-12-02 00:23:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length222
author_reputation55,916,319,164,488
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,593,650
net_rshares0
@pizzabot ·
<center>🍕 PIZZA !


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


<sub>Please <a href="https://vote.hive.uno/@pizza.witness">vote for pizza.witness</a>!</sub></center>
properties (22)
authorpizzabot
permlinkre-execute-sps-delegation-directly-via-splinterlands-code-snippet-for-the-browser-console-20221204t135503z
categoryhive-13323
json_metadata"{"app": "beem/0.24.19"}"
created2022-12-04 13:55:03
last_update2022-12-04 13:55:03
depth1
children0
last_payout2022-12-11 13:55:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length216
author_reputation7,539,280,605,993
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,840,984
net_rshares0
@splintergifts ·
Hello, cool Post!
BTW, I started a new Splinterlands Giveaway Account, you are welcome to join my daily giveaways :)

Posted using [Splintertalk](https://www.splintertalk.io/@splintergifts/re-louis88-lavpja61)
properties (22)
authorsplintergifts
permlinkre-louis88-lavpja61
categoryhive-13323
json_metadata{"tags":["splintertalk"],"format":"markdown","canonical_url":"https://www.splintertalk.io/@splintergifts/re-louis88-lavpja61","app":"splintertalk/1.2.0"}
created2022-11-24 23:30:09
last_update2022-11-24 23:30:09
depth1
children0
last_payout2022-12-01 23:30:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length209
author_reputation586,429,753,333
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,592,503
net_rshares0
@steemmonsters ·
![](https://i.imgur.com/1BPE6TT.gif)![](https://i.imgur.com/Mjwa9E7.gif)
properties (22)
authorsteemmonsters
permlinkre-louis88-rlyuao
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2022.11.1"}
created2022-11-26 17:37:33
last_update2022-11-26 17:37:33
depth1
children0
last_payout2022-12-03 17:37:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length72
author_reputation421,569,175,715,329
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,634,603
net_rshares0
@tameshon ·
thanks so much for posting this very helpful
properties (22)
authortameshon
permlinkre-louis88-rmlxdh
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2022.11.2"}
created2022-12-09 04:48:54
last_update2022-12-09 04:48:54
depth1
children0
last_payout2022-12-16 04:48:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length44
author_reputation81,448,164,759
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id118,967,429
net_rshares0
@viniciotricolor ·
does this still work? I tried to run it but without success
properties (22)
authorviniciotricolor
permlinkre-louis88-s0wj1w
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2023.8.1"}
created2023-09-13 02:03:33
last_update2023-09-13 02:03:33
depth1
children2
last_payout2023-09-20 02:03:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length59
author_reputation47,217,878,239,098
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id127,097,958
net_rshares0
@louis88 ·
$0.02
Yes, it's working. Just tested it.
👍  ,
properties (23)
authorlouis88
permlinkre-viniciotricolor-s0x2xg
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2023.8.1"}
created2023-09-13 09:12:54
last_update2023-09-13 09:12:54
depth2
children1
last_payout2023-09-20 09:12:54
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length34
author_reputation1,181,020,901,175,086
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id127,105,388
net_rshares64,384,013,028
author_curate_reward""
vote details (2)
@viniciotricolor ·
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?	
properties (22)
authorviniciotricolor
permlinkre-louis88-s0xyvn
categoryhive-13323
json_metadata{"tags":["hive-13323"],"app":"peakd/2023.8.1"}
created2023-09-13 20:43:00
last_update2023-09-13 20:43:00
depth3
children0
last_payout2023-09-20 20:43:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length564
author_reputation47,217,878,239,098
root_title"Execute SPS delegation directly via Splinterlands - Code Snippet for the Browser Console"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id127,121,998
net_rshares0