Greasy Fork 还支持 简体中文。

[0]Balance-Wingman Send shares on win to Vaulet

Every time you win a bet the script sends your desired % to the Vaulet

目前為 2020-08-12 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name [0]Balance-Wingman Send shares on win to Vaulet
  3. // @description Every time you win a bet the script sends your desired % to the Vaulet
  4. // @description Create your acc here to support my work https://stake.com/?c=263733c1bc
  5. // @version 1.6
  6. // @author Dauersendung
  7. // @namespace https://greasyfork.org/de/users/444902-dauersendung
  8. // @match https://stake.com/*
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12.  
  13.  
  14. var accessToken = localStorage.getItem('session').replace(/"/g, '');
  15. var oldBal = localStorage.getItem("oldBal");
  16. if (!oldBal) oldBal = 0;
  17. else oldBal = parseFloat(oldBal);
  18.  
  19.  
  20. function getCurrency() {
  21. return JSON.parse(localStorage.getItem("v2_currency")).currency;
  22. }
  23.  
  24. function getRate(cur) {
  25. return JSON.parse(localStorage.getItem('v2_currency')).conversions.rates[cur];
  26. }
  27.  
  28. function convertCurrency(cur, val) {
  29. return val * getRate(cur);
  30. }
  31.  
  32. function getConversionElem() {
  33. var ele = document.querySelector("#conversionElem");
  34. if(ele == null) {
  35. ele = document.createElement("span");
  36. ele.id = "conversionElem";
  37. ele.innerText = "$0.000";
  38. document.querySelector(".styles__Wrap-rlm06o-0.bGSyHm").insertBefore(ele, null);
  39. }
  40.  
  41. return ele;
  42. }
  43.  
  44. function depositBal(depositAmount) {
  45. var curr = getCurrency();
  46.  
  47. var data = [
  48. {
  49. operationName: "CreateVaultDeposit",
  50. query: "mutation CreateVaultDeposit($amount: Float!, $currency: CurrencyEnum!) { createVaultDeposit(amount: $amount, currency: $currency) { id amount currency user { id balances { available { amount currency __typename } vault { amount currency __typename } __typename } __typename } __typename } } ",
  51. variables: {
  52. amount: depositAmount,
  53. currency: curr,
  54. }
  55. }
  56. ]
  57. return fetch("https://api.stake.com/graphql", {
  58. "credentials": "omit",
  59. "headers": {
  60. "content-type": "application/json",
  61. 'x-access-token': accessToken,
  62. 'x-lockdown-token': undefined
  63. },
  64. "referrer": "https://stake.com/?currency=" + curr + "&modal=vault&operation=deposit",
  65. "body": JSON.stringify(data),
  66. "method": "POST",
  67. "mode": "cors"
  68. });
  69. }
  70.  
  71. function checkBalance() {
  72. var curBalEle = document.querySelector(".styles__Cashier-puey40-2.dMSTdD .styles__Content-rlm06o-1.ixoRjG");
  73. if (!curBalEle) return false;
  74.  
  75. var curBal = curBalEle.innerText;
  76. if (!curBal) return false;
  77.  
  78. if (curBal > oldBal) {
  79. var depositAmount = ((curBal - oldBal) * 20) / 100;
  80. depositBal(depositAmount).then(() => {
  81. oldBal = curBalEle.innerText
  82. localStorage.setItem("oldBal", oldBal);
  83. });
  84. }
  85.  
  86. getConversionElem().innerText = "$" + convertCurrency(getCurrency(), curBal).toFixed(3);
  87. }
  88.  
  89. window.setInterval(checkBalance, 3300);
  90.