BlackDragon Posted September 24, 2020 Share Posted September 24, 2020 // ==UserScript== // @name Wallet Balance // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author Devilla // @match https://bc.game/home // @grant none // ==/UserScript== (function() { 'use strict'; function getWallet(){ fetch("https://bc.game/api/user/amount/?source=", { "credentials": "include", "headers": { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0", "Accept": "application/json, text/plain, */*", "Accept-Language": "en-US,en;q=0.5", "Cache-Control": "max-age=0", "Cookie": `${document.cookie}` }, "referrer": "https://bc.game", "method": "GET", "mode": "cors" }).then(response => response.json()) .then((data) => { let total = 0, i = 0; const res = data.data; res.map((coin)=>{ fetch(`https://api.cryptonator.com/api/ticker/${coin.currencyName.toLowerCase()}-usd`) .then(response => response.json()) .then((data) => { total = data.ticker.price * coin.amount; console.log(total, coin.currencyName); var header = document.getElementById('header'); var coinIcon = header.getElementsByClassName('coin-icon')[i]; coinIcon.src=`https://bc.game/coin/${coin.currencyName}.black.png`; var coinAmount = header.getElementsByClassName('coin-amount')[i]; coinAmount.innerHTML = total; var coinName = header.getElementsByClassName('coin-name')[i]; coinName.innerHTML = 'USD'; i++; }) .catch(err=>{}) }) }) .catch(err => console.log(err)) } getWallet(); })(); Link to comment Share on other sites More sharing options...
BlackDragon Posted September 24, 2020 Author Share Posted September 24, 2020 wow thanks Yoko. So sweet of you. Link to comment Share on other sites More sharing options...
][NT3L][G3NC][ Posted September 24, 2020 Share Posted September 24, 2020 5 hours ago, BlackDragon said: // ==UserScript== // @name Wallet Balance // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author Devilla // @match https://bc.game/home // @grant none // ==/UserScript== (function() { 'use strict'; function getWallet(){ fetch("https://bc.game/api/user/amount/?source=", { "credentials": "include", "headers": { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0", "Accept": "application/json, text/plain, */*", "Accept-Language": "en-US,en;q=0.5", "Cache-Control": "max-age=0", "Cookie": `${document.cookie}` }, "referrer": "https://bc.game", "method": "GET", "mode": "cors" }).then(response => response.json()) .then((data) => { let total = 0, i = 0; const res = data.data; res.map((coin)=>{ fetch(`https://api.cryptonator.com/api/ticker/${coin.currencyName.toLowerCase()}-usd`) .then(response => response.json()) .then((data) => { total = data.ticker.price * coin.amount; console.log(total, coin.currencyName); var header = document.getElementById('header'); var coinIcon = header.getElementsByClassName('coin-icon')[i]; coinIcon.src=`https://bc.game/coin/${coin.currencyName}.black.png`; var coinAmount = header.getElementsByClassName('coin-amount')[i]; coinAmount.innerHTML = total; var coinName = header.getElementsByClassName('coin-name')[i]; coinName.innerHTML = 'USD'; i++; }) .catch(err=>{}) }) }) .catch(err => console.log(err)) } getWallet(); })(); I like it but there is no need for an outside API. Take a look at document.querySelector("#header > div.header-pc > div.right > div.user-balance > button > svg").__vue__.$store.state.system.currency It has all the coins USD values. Link to comment Share on other sites More sharing options...
][NT3L][G3NC][ Posted September 24, 2020 Share Posted September 24, 2020 oOo and also the fetch to get the wallet balance can also be done via document.querySelector("#header > div.header-pc > div.right > div.user-balance > button > svg").__vue__.$store.state.account.currencys The querySelector is selecting the wallet button next to your balance, so it should always be there whenever you are on bcGame's website. Just food for thought Link to comment Share on other sites More sharing options...
BlackDragon Posted September 25, 2020 Author Share Posted September 25, 2020 9 hours ago, ][NT3L][G3NC][ said: oOo and also the fetch to get the wallet balance can also be done via document.querySelector("#header > div.header-pc > div.right > div.user-balance > button > svg").__vue__.$store.state.account.currencys The querySelector is selecting the wallet button next to your balance, so it should always be there whenever you are on bcGame's website. Just food for thought Sure, will use this. Thanks man. Link to comment Share on other sites More sharing options...
Juragan Posted September 25, 2020 Share Posted September 25, 2020 20 hours ago, BlackDragon said: // ==UserScript== // @name Wallet Balance // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author Devilla // @match https://bc.game/home // @grant none // ==/UserScript== (function() { 'use strict'; function getWallet(){ fetch("https://bc.game/api/user/amount/?source=", { "credentials": "include", "headers": { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0", "Accept": "application/json, text/plain, */*", "Accept-Language": "en-US,en;q=0.5", "Cache-Control": "max-age=0", "Cookie": `${document.cookie}` }, "referrer": "https://bc.game", "method": "GET", "mode": "cors" }).then(response => response.json()) .then((data) => { let total = 0, i = 0; const res = data.data; res.map((coin)=>{ fetch(`https://api.cryptonator.com/api/ticker/${coin.currencyName.toLowerCase()}-usd`) .then(response => response.json()) .then((data) => { total = data.ticker.price * coin.amount; console.log(total, coin.currencyName); var header = document.getElementById('header'); var coinIcon = header.getElementsByClassName('coin-icon')[i]; coinIcon.src=`https://bc.game/coin/${coin.currencyName}.black.png`; var coinAmount = header.getElementsByClassName('coin-amount')[i]; coinAmount.innerHTML = total; var coinName = header.getElementsByClassName('coin-name')[i]; coinName.innerHTML = 'USD'; i++; }) .catch(err=>{}) }) }) .catch(err => console.log(err)) } getWallet(); })(); Script for?? Link to comment Share on other sites More sharing options...
BlackDragon Posted September 25, 2020 Author Share Posted September 25, 2020 It's a script that changes your wallet crypto coin balances into USD to have a better understanding of your balances in fiat/native currency. Link to comment Share on other sites More sharing options...
][NT3L][G3NC][ Posted October 8, 2020 Share Posted October 8, 2020 maybe consider adding a button to toggle/switch from USD to the actual coin! havent tried/used it but i love the concept. Link to comment Share on other sites More sharing options...
BlackDragon Posted November 2, 2020 Author Share Posted November 2, 2020 There are a few production bugs in the wallet : 1. USD Balance doesn't update after each bet (without refreshing the page manually). 2. Scrollbar doesn't work for Firefox browser to scroll different coins (FIX : ```overflow-y : scroll``` should be added). Link to comment Share on other sites More sharing options...
BlackDragon Posted January 31, 2021 Author Share Posted January 31, 2021 Use this in console : var currencies = document.querySelector("#header > div.header-pc > div.right > div.user-balance > button > svg").__vue__.$store.state.account.currencys; var symbol= document.querySelector("#header > div.header-pc > div.right > div.user-balance > button > svg").__vue__.$store.state.system.currency; currencies.map((coin)=>{ console.log( coin.currencyName, coin.amount*symbol[`${coin.currencyName}`].usdPrice + ' USD' ) }) Link to comment Share on other sites More sharing options...
Skomarion Posted February 2, 2021 Share Posted February 2, 2021 On 9/24/2020 at 4:15 PM, BlackDragon said: // ==UserScript== // @name Wallet Balance // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author Devilla // @match https://bc.game/home // @grant none // ==/UserScript== (function() { 'use strict'; function getWallet(){ fetch("https://bc.game/api/user/amount/?source=", { "credentials": "include", "headers": { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0", "Accept": "application/json, text/plain, */*", "Accept-Language": "en-US,en;q=0.5", "Cache-Control": "max-age=0", "Cookie": `${document.cookie}` }, "referrer": "https://bc.game", "method": "GET", "mode": "cors" }).then(response => response.json()) .then((data) => { let total = 0, i = 0; const res = data.data; res.map((coin)=>{ fetch(`https://api.cryptonator.com/api/ticker/${coin.currencyName.toLowerCase()}-usd`) .then(response => response.json()) .then((data) => { total = data.ticker.price * coin.amount; console.log(total, coin.currencyName); var header = document.getElementById('header'); var coinIcon = header.getElementsByClassName('coin-icon')[i]; coinIcon.src=`https://bc.game/coin/${coin.currencyName}.black.png`; var coinAmount = header.getElementsByClassName('coin-amount')[i]; coinAmount.innerHTML = total; var coinName = header.getElementsByClassName('coin-name')[i]; coinName.innerHTML = 'USD'; i++; }) .catch(err=>{}) }) }) .catch(err => console.log(err)) } getWallet(); })(); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.