[0]Balance-Wingman https://stake.com/?c=263733c1bc

Setup the amount from each win to be sent to Vaulet in the line(66) /////////// Setup Profit here in Decimal: 50 % = 0.50 - 75 % = 0.75 - 15 % = 0.15

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

// ==UserScript==
// @name         [0]Balance-Wingman https://stake.com/?c=263733c1bc
// @description  Setup the amount from each win to be sent to Vaulet in the line(66) /////////// Setup Profit here in Decimal: 50 % = 0.50 - 75 % = 0.75 - 15 % = 0.15 
// @description  Cryptocurrency is shown in Crypto and $
// @description  Create your acc here to support my work https://stake.com/?c=263733c1bc
// @version      2.2
// @author       Dauersendung
// @namespace    https://greasyfork.org/de/users/444902-dauersendung
// @match        https://stake.com/*
// @run-at       document-start
// ==/UserScript==
var accessToken = localStorage.getItem('session').replace(/"/g, '');
var oldBal = 0;
var isRunning = false;

function getCurrency() {
    return JSON.parse(localStorage.getItem("v2_currency")).currency;
}
function getRate(cur) {
    return JSON.parse(localStorage.getItem('v2_currency')).conversions.rates[cur];
}
function convertCurrency(cur, val) {
    return val * getRate(cur);
}
function getConversionElem() {
    var ele = document.querySelector("#conversionElem");
    if (ele == null) {
        ele = document.createElement("span");
        ele.id = "conversionElem";
        document.querySelector(".styles__Wrap-rlm06o-0.bGSyHm").insertBefore(ele, null);
    }
    return ele;
}

function depositBal(depositAmount) {
    var curr = getCurrency();
    var data = [{
        operationName: "CreateVaultDeposit",
        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 } } ",
        variables: {
            amount: depositAmount,
            currency: curr,
        }
    }]
    return fetch("https://api.stake.com/graphql", {
        "credentials": "omit",
        "headers": {
            "content-type": "application/json",
            'x-access-token': accessToken,
            'x-lockdown-token': undefined
        },
        "referrer": "https://stake.com/?currency=" + curr + "&modal=vault&operation=deposit",
        "body": JSON.stringify(data),
        "method": "POST",
        "mode": "cors"
    });
}

function convertBal(bal) {
    getConversionElem().innerText = convertCurrency(getCurrency(), bal).toFixed(2) + "$";
}

function checkBalance() {
    var curBalEle = document.querySelector(".styles__Cashier-puey40-2.dMSTdD .styles__Content-rlm06o-1.ixoRjG");
    var curBal = parseFloat(curBalEle.innerText);
    if (curBal > oldBal) {
        var depositAmount = ((curBal - oldBal) * 0.75); /////////// Setup Profit here in Decimal: 50 % = 0.50 - 75 % = 0.75 - 15 % = 0.15 
        console.log("depositAmount", depositAmount);
        depositBal(depositAmount).then(() => {
            oldBal = parseFloat(curBalEle.innerText);
            console.log("new oldBal", oldBal);
            convertBal(oldBal);
            if(isRunning) setTimeout(checkBalance, 1010);
            else console.log("Stopping depostBal");
        });

    } else {
        if(isRunning) setTimeout(checkBalance, 1010);
        else console.log("Stopping");
        convertBal(curBal);
    }
}

var startBtn = document.createElement("button");
startBtn.id = "startBtn";
startBtn.style.zIndex = "999";
startBtn.style.position = "absolute";
startBtn.style.top = 0;
startBtn.style.left = 0;
startBtn.style.backgroundColor = "rgb(0, 123, 255)";
startBtn.style.color = "rgb(255, 255, 255)";
startBtn.style.borderRadius = "0.25rem";
startBtn.style.padding = "calc(0.5em + 2px) 1em";
startBtn.innerText = "Start";
startBtn.addEventListener("click", function() {
    if(isRunning) {
        this.style.backgroundColor = "rgb(0, 123, 255)";
        isRunning = false;
        this.innerText = "Start";
    } else {
        this.style.backgroundColor = "rgb(210, 20, 20)";
        oldBal = parseFloat(document.querySelector(".styles__Cashier-puey40-2.dMSTdD .styles__Content-rlm06o-1.ixoRjG").innerText);
        isRunning = true;
        this.innerText = "Stop";
        checkBalance();
    }
});

document.body.appendChild(startBtn);