public string GetNanoPoolInfo(string address, SocketUser user) { NanoPool.Account account = NanoPool.GetAccount(address, user); string msg = ""; if (account == null) { msg = "Account **" + address + "**\nNot Found!"; return(msg); } msg += "**Account:** " + account.account; msg += "\n**Unconfirmed Balance:** " + account.unconfirmed_balance; msg += "\n**Balance:** " + account.balance; double balance = double.Parse(account.balance); NanoPool.Prices prices = NanoPool.GetPrices(); double usdBal = prices.price_usd * balance; double btcBal = prices.price_btc * balance; double gbpBal = prices.price_gbp * balance; double eurBal = prices.price_eur * balance; msg += "\n**USD Value:** " + string.Format("${0:N2}", usdBal); msg += "\n**BTC Value:** " + string.Format("{0:N8} BTC", btcBal); msg += "\n**Hashrate:** " + account.hashrate + " Mh/s"; msg += "\n\n__Average Hashrate__"; msg += "\n**1 Hour:** " + account.avgHashrate["h1"] + " Mh/s"; msg += "\n**3 Hours:** " + account.avgHashrate["h3"] + " Mh/s"; msg += "\n**6 Hours:** " + account.avgHashrate["h6"] + " Mh/s"; msg += "\n**12 Hours:** " + account.avgHashrate["h12"] + " Mh/s"; msg += "\n**24 Hours:** " + account.avgHashrate["h24"] + " Mh/s"; msg += "\n\n__Workers__"; for (int i = 0; i < account.workers.Count; i++) { if (i > 0) { msg += "\n"; } msg += "\n**ID:** " + account.workers[i].id; msg += "\n**UID:** " + account.workers[i].uid; msg += "\n**Hashrate:** " + account.workers[i].hashrate + " Mh/s"; msg += "\n**Last Share:** " + SteamAccounts.UnixTimeStampToDateTime(account.workers[i].lastshare); msg += "\n**Rating:** " + account.workers[i].rating; /* * msg += "\n**1hr Avg Hashrate:** " + account.workers[i].h1 + " Mh/s"; * msg += "\n**3hr Avg Hashrate:** " + account.workers[i].h3 + " Mh/s"; * msg += "\n**6hr Avg Hashrate:** " + account.workers[i].h6 + " Mh/s"; * msg += "\n**12hr Avg Hashrate:** " + account.workers[i].h12 + " Mh/s"; * msg += "\n**24hr Avg Hashrate:** " + account.workers[i].h24 + " Mh/s"; */ } return(msg); }
public async Task EthTokens([Remainder] string address = null) { NanoPool.UserAccount account = NanoPool.GetUser(Context.User, address); string msg = ""; if (account == null) { msg = "Account **" + address + "**\nNot Found! Please use linketh cmd or enter an address to link!"; await PrintEmbedMessage("Account Retrieval Failed", msg); return; } if (address == null) { address = account.address; } List <EtherScan.Token> tokens = EtherScan.GetTokens(address); string symbols = ""; int count = 0; foreach (EtherScan.Token token in tokens) { if (token.tokenSymbol != "" && !token.tokenName.ToLower().Contains("promo")) { if (count == 1) { symbols += ","; count = 0; } symbols += token.tokenSymbol; count++; } } Dictionary <string, CoinMarketCap.Currency> currencies = CoinMarketCap.GetTokens(symbols); count = 0; int num = 0; msg += "**Account:** " + address; double totalValue = 0; foreach (EtherScan.Token token in tokens) { int decPlace = 0; if (token.tokenDecimal != "0" && token.tokenDecimal != "") { decPlace = int.Parse(token.tokenDecimal); } double div = 1; for (int i = 0; i < decPlace; i++) { div *= 10d; } double balance = double.Parse(token.value) / div; if (currencies.ContainsKey(token.tokenSymbol)) { totalValue += currencies[token.tokenSymbol].quote.USD.price * balance; } } msg += string.Format("\n**Total Value:** ${0:N5}", totalValue); foreach (EtherScan.Token token in tokens) { int decPlace = 0; if (token.tokenDecimal != "0" && token.tokenDecimal != "") { decPlace = int.Parse(token.tokenDecimal); } double div = 1; for (int i = 0; i < decPlace; i++) { div *= 10d; } msg += "\n\n**Name:** " + token.tokenName; msg += "\n**Symbol:** " + token.tokenSymbol; double balance = double.Parse(token.value) / div; if (decPlace == 0) { msg += "\n**Balance:** " + string.Format("{0:N0} " + token.tokenSymbol, balance); } if (decPlace == 8) { msg += "\n**Balance:** " + string.Format("{0:N8} " + token.tokenSymbol, balance); } if (decPlace == 18) { msg += "\n**Balance:** " + string.Format("{0:N15} " + token.tokenSymbol, balance); } if (currencies.ContainsKey(token.tokenSymbol)) { msg += string.Format("\n**USD Value:** ${0:N15}", currencies[token.tokenSymbol].quote.USD.price * balance); } msg += "\n**Date:** " + SteamAccounts.UnixTimeStampToDateTime(double.Parse(token.timeStamp)); msg += "\n**Confirmations:** " + string.Format("{0:N0}", ulong.Parse(token.confirmations)); if (count > 8) { msg += "|"; count = 0; } count++; num++; } string[] split = msg.Split('|'); for (int i = 0; i < split.Length; i++) { await PrintEmbedMessage("ETH Tokens", split[i]); } //await Context.Channel.SendMessageAsync(msg); }