public static string TokenPairsContent(TokenActionType tokenAction, ListServiceResponse <PairData> pairResponse) { var formPair = string.Empty; if (tokenAction == TokenActionType.ADDED) { formPair = $"🥉 *Pairs*\n"; if (pairResponse.Success) { foreach (var item in pairResponse.ListResponse) { formPair += $"`{item.Token0.Symbol}/{item.Token1.Symbol}`\n" + $"Total value: _${item.TotalLiquidityUSD} USD_\n" + $"Created at: _{item.CreatedAt:dd.MM.yyyy}_\n" + $"[Uniswap](https://info.uniswap.org/pair/{item.Id}) |" + $" [DEXT](https://www.dextools.io/app/uniswap/pair-explorer/{item.Id}) |" + $" [Astro](https://app.astrotools.io/pair-explorer/{item.Id}) |" + $" [MoonTools](https://app.moontools.io/pairs/{item.Id}) |" + $" [UniCrypt](https://v2.unicrypt.network/pair/{item.Id})" + $"\n\n"; } } else { formPair += $"`Data unavailable` \n\n"; } } return(formPair); }
ServerReflectionResponse ListServices() { var serviceResponses = new ListServiceResponse(); foreach (string serviceName in services) { serviceResponses.Service.Add(new ServiceResponse { Name = serviceName }); } return(new ServerReflectionResponse { ListServicesResponse = serviceResponses }); }
public async Task <ListServiceResponse <Token> > FetchAllAsync() { var result = new ListServiceResponse <Token>(); var response = await _uniswapService.FetchAllAsync(); if (response.Success) { result.ListResponse = response.ListResponse; } else { result.Message = response.Message; } return(result); }
public async Task <ListServiceResponse <KyberToken> > FetchAllAsync() { var result = new ListServiceResponse <KyberToken>(); try { using var client = new WebClient(); string httpApiResult = await client.DownloadStringTaskAsync($"{_baseUrl}currencies?include_delisted=true"); if (!string.IsNullOrWhiteSpace(httpApiResult)) { var response = JsonSerializer.Deserialize <KyberTokenList>(httpApiResult); if ((response is null) && !response.Error) { result.ListResponse = response.Data; } else { result.Message = $"Response error"; } } }
private async Task ListServices(IClientStreamWriter <ServerReflectionRequest> req, ListServiceResponse resp) { var services = resp.Service.Where(p => !p.Name.StartsWith("grpc.")); foreach (var service in services) { await req.WriteAsync(new ServerReflectionRequest() { FileContainingSymbol = service.Name }); } await req.CompleteAsync(); }
ServerReflectionResponse ListServices() { var serviceResponses = new ListServiceResponse(); foreach (string serviceName in services) { serviceResponses.Service.Add(new ServiceResponse { Name = serviceName }); } return new ServerReflectionResponse { ListServicesResponse = serviceResponses }; }
public static Tuple <IReplyMarkup, string> ForPremiumTelegram( Gem gem, SingleServiceResponse <TokenData> uniResponse, SingleServiceResponse <TokenInfo> ethPlorerTokenInfoResponse, SingleServiceResponse <SmartContract> etherScanResponse, ListServiceResponse <PairData> pairResponse, SingleServiceResponse <TopHolderList> ethPlorerTopHoldersResponse ) { string tokenInfo = string.Empty; if (gem.Recently == TokenActionType.ADDED) { tokenInfo = $"🥇 *Token - ${gem.Symbol}*\n"; if (uniResponse.Success) { tokenInfo += $"Initial Price: _${uniResponse.ObjectResponse.Price} USD_\n" + $"Txns: _{uniResponse.ObjectResponse.DailyTxns}_\n\n"; } else { tokenInfo += $"`Data unavailable` \n\n"; } } string tokenInfoDetails = string.Empty; if (gem.Recently == TokenActionType.ADDED) { tokenInfoDetails += $"🥇 *Token Details*\n"; if (ethPlorerTokenInfoResponse.Success) { var dec = Convert.ToInt32(ethPlorerTokenInfoResponse.ObjectResponse.Decimals); var val = BigInteger.Parse(ethPlorerTokenInfoResponse.ObjectResponse.TotalSupply); var owner = string.IsNullOrWhiteSpace(ethPlorerTokenInfoResponse.ObjectResponse.Owner) ? $"Owner: [0x](https://etherscan.io/)\n" : $"Owner: [{ethPlorerTokenInfoResponse.ObjectResponse.Owner}](https://etherscan.io/address/{ethPlorerTokenInfoResponse.ObjectResponse.Owner})\n"; tokenInfoDetails += $"Transfers: _{ethPlorerTokenInfoResponse.ObjectResponse.TransfersCount}_\n" + owner + $"Total supply: _{UnitConversion.Convert.FromWei(val, dec)}_ {gem.Symbol} \n\n"; } else { tokenInfoDetails += $"`Data unavailable` \n\n"; } } string liquidityInfo = string.Empty; if (gem.Recently == TokenActionType.ADDED) { liquidityInfo = $"🥈 *Liquidity*\n"; if (uniResponse.Success) { liquidityInfo += $"USD: _${uniResponse.ObjectResponse.LiquidityUSD}_\n" + $"ETH: _{uniResponse.ObjectResponse.LiquidityETH}_\n" + $"{gem.Symbol}: _{uniResponse.ObjectResponse.LiquidityToken}_\n\n"; } else { liquidityInfo += $"`Data unavailable` \n\n"; } } string contractInfo = string.Empty; if (gem.Recently == TokenActionType.ADDED) { if (etherScanResponse.Success) { contractInfo = etherScanResponse.ObjectResponse.IsVerified ? $"✅ [Contract](https://etherscan.io/address/{gem.Id}#code) is verified \n\n" : $"❌ [Contract](https://etherscan.io/address/{gem.Id}#code) is NOT verified \n\n"; } else { contractInfo += $"`Data unavailable` \n\n"; } } var formPair = string.Empty; if (gem.Recently == TokenActionType.ADDED) { formPair = $"🥉 *Pairs*\n"; if (pairResponse.Success) { foreach (var item in pairResponse.ListResponse) { formPair += $"`{item.Token0.Symbol}/{item.Token1.Symbol}`\n" + $"Total value: _${item.TotalLiquidityUSD} USD_\n" + $"Created at: _{item.CreatedAt:dd.MM.yyyy}_\n" + $"[Uniswap](https://info.uniswap.org/pair/{item.Id}) |" + $" [DEXT](https://www.dextools.io/app/uniswap/pair-explorer/{item.Id}) |" + $" [Astro](https://app.astrotools.io/pair-explorer/{item.Id}) |" + $" [MoonTools](https://app.moontools.io/pairs/{item.Id}) |" + $" [UniCrypt](https://v2.unicrypt.network/pair/{item.Id})" + $"\n\n"; } } else { formPair += $"`Data unavailable` \n\n"; } } string topHoldersInfo = string.Empty; if (gem.Recently == TokenActionType.ADDED) { if (ethPlorerTokenInfoResponse.Success) { topHoldersInfo += $"🌐 *Current hodlers*: {ethPlorerTokenInfoResponse.ObjectResponse.HoldersCount}.\n"; } else { topHoldersInfo += $"🌐 *Current hodlers*\n"; } if (ethPlorerTopHoldersResponse.Success) { topHoldersInfo += $"Top 5 below:\n"; var counter = 1; foreach (var item in ethPlorerTopHoldersResponse.ObjectResponse.Holders) { topHoldersInfo += $"[Hodler - {counter++}](https://etherscan.io/token/{gem.Id}?a={item.Address}) - `{item.Share}%` \n"; } topHoldersInfo += $"\n\n"; } else { topHoldersInfo += $"`Data unavailable` \n\n"; } } var banner = Content(gem) + tokenInfo + tokenInfoDetails + liquidityInfo + contractInfo + formPair + topHoldersInfo; var buttons = new InlineKeyboardMarkup(new[] { UniswapButtons(gem), SharedMessageContent.EtherscanButtons(gem.Id), new [] { InlineKeyboardButton.WithUrl("📧 Support", $"https://t.me/GemTrackerCommunity") } }); return(new Tuple <IReplyMarkup, string>(buttons, banner)); }
public async Task <ListServiceResponse <Token> > FetchAllAsync() { var result = new ListServiceResponse <Token>(); try { GraphQLResponse <TokenList> graphQLResponse = null; var list = new List <Token>(); var last = "0x0"; do { var initialRequest = new GraphQLRequest { Query = @" query GetTokens( $first: Int, $orderBy: ID, $orderDirection: String) { tokens( first: $first, where: { id_gt: " + $"\"{last}\"" + @" }, orderBy: $orderBy, orderDirection: $orderDirection) { id symbol name } }", OperationName = "GetTokens", Variables = new { first = 500 } }; graphQLResponse = await _graphQLClient.SendQueryAsync <TokenList>(initialRequest); if (!(graphQLResponse.Data is null)) { if (graphQLResponse.Data.Tokens.AnyAndNotNull()) { list.AddRange(graphQLResponse.Data.Tokens); var lastOne = graphQLResponse.Data.Tokens.Last(); last = lastOne.Id; } } if (!(graphQLResponse.Errors is null)) { result.ListResponse = null; result.Message = graphQLResponse.Errors?.FirstOrDefault().Message; break; } Thread.Sleep(500); } while (!(graphQLResponse.Data is null) && (graphQLResponse.Errors is null) && graphQLResponse.Data.Tokens.AnyAndNotNull()); result.ListResponse = list; } catch (Exception ex) { result.Message = ex.GetFullMessage(); } return(result); }
public async Task <ListServiceResponse <PairData> > FetchPairsAsync(string tokenId) { var result = new ListServiceResponse <PairData>(); try { var pairDataRequest = new GraphQLRequest { Query = @" query GetPairData ($id: String, $first: Int){ pairs ( first: $first, orderBy: reserveUSD, orderDirection: desc where: { token0: $id }) { id reserveUSD createdAtTimestamp token0{ id symbol name } token1{ id symbol name } } }", OperationName = "GetPairData", Variables = new { id = tokenId, first = 5 } }; var pairData = new List <PairData>(); GraphQLResponse <PairList> pairDataResponse = null; pairDataResponse = await _graphQLClient.SendQueryAsync <PairList>(pairDataRequest); if (!(pairDataResponse.Data is null)) { if (pairDataResponse.Data.Pairs.AnyAndNotNull()) { pairData.AddRange(pairDataResponse.Data.Pairs); } } result.ListResponse = pairData; } catch (Exception ex) { result.Message = ex.GetFullMessage(); } return(result); }