Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for showing BTC and USD (or local) currency prices. #27

Open
wants to merge 33 commits into
base: feature/multichain
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d340595
Add support for showing BTC and USD (or local) currency prices.
sondreb Jan 18, 2019
9d566cc
- Add the API documentation, even though it should had been generated…
sondreb Jan 18, 2019
2273c38
Upgrade to v5 of Font Awesome to get BTC icon
sondreb Jan 19, 2019
3f4342c
Update the documentation
sondreb Jan 27, 2019
b8ff6e9
Temporary enable Documentation to not be in gitignore.
sondreb Jan 27, 2019
4073a91
Remove site - configure gitbook
sondreb Jan 27, 2019
3ef1c25
Update URL for API documentation
sondreb Jan 27, 2019
27e614a
Add null check for handling when APIs are returning server errors.
sondreb Mar 31, 2019
33f3d3b
Remove unused usings
sondreb Mar 31, 2019
72438f0
Update a package that returns restore error
sondreb Mar 31, 2019
72adbd3
Update README.md
sondreb Apr 1, 2019
f08d5c1
Minor fix for Azure deploy
sondreb May 26, 2019
00da693
Upgrade the default OS disk size
sondreb Oct 1, 2019
5c27f00
New requirements in ARM
sondreb Oct 2, 2019
4e25620
Changed to dynamic IP assignment
sondreb Oct 2, 2019
b48048f
Update OS version
sondreb Oct 2, 2019
0ad0f88
Fix the path for one-click deploy buttons
sondreb Oct 2, 2019
0c1ce4e
Add version query parameter to Nako Indexer API
sondreb Oct 3, 2019
21d7416
- Fix issue with decimal points after recent Nako indexer upgrades.
sondreb Oct 19, 2019
43509be
- Fixes queries against Nako by including the version query parameter.
sondreb Oct 19, 2019
bc2b17a
Fix parse bug for block height
sondreb Oct 31, 2019
46b401d
Add transaction details
sondreb Oct 31, 2019
b4528cb
Change the hero graphics image type
sondreb Oct 31, 2019
fa59ca6
- Fix link to hero
sondreb Oct 31, 2019
0e21df7
Update _Layout.cshtml
sondreb Oct 31, 2019
0035ac6
Add a try/catch around GetTicker
sondreb Oct 31, 2019
312e61b
Update CoinTagHelper.cs
sondreb Nov 1, 2019
0d8d5e9
Fix routing issue that caused 404 errors (invalid links)
sondreb Nov 1, 2019
d118848
Fix 404 generated link issues
sondreb Nov 1, 2019
8eb7cc5
Improve API and API documentation
sondreb Nov 1, 2019
3a13a4f
Update CITY.json
sondreb Dec 14, 2019
dee5271
Improve the decimal separator for different cultures
sondreb Jan 7, 2020
eba03ed
Add support for XDS
sondreb Jan 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions Stratis.Guru/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,26 @@ public ApiController(

[HttpGet]
[Route("price")]
public ActionResult<object> Price(bool notApi = false, double amount = 1)
public ActionResult<object> Price(bool notApi = false, decimal amount = 1)
{
try
{
var ticker = _tickerService.GetCachedTicker();
var rqf = Request.HttpContext.Features.Get<IRequestCultureFeature>();
var regionInfo = _currencyService.GetRegionaInfo(rqf);
var ticker = _tickerService.GetTicker(regionInfo.ISOCurrencySymbol);

if (notApi)
{
var rqf = Request.HttpContext.Features.Get<IRequestCultureFeature>();
var regionInfo = _currencyService.GetRegionaInfo(rqf);
var displayPrice = _currencyService.GetExchangePrice(ticker.DisplayPrice, regionInfo.ISOCurrencySymbol);

return new TickerApi
{
UsdPrice = (displayPrice * amount).ToString("C"),
Symbol = ticker.Symbol,
PriceBtc = ticker.PriceBtc.ToString(),
Price = ticker.Price.ToString("C2"),
Last24Change = (ticker.Last24Change).ToString("P2")
};
}
return new Ticker
{
DisplayPrice = ticker.DisplayPrice * amount,
Last24Change = ticker.Last24Change
};

return ticker;
}
catch
{
Expand Down
13 changes: 4 additions & 9 deletions Stratis.Guru/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,10 @@ public IActionResult Index()
if (_featuresSettings.Ticker)
{
var rqf = Request.HttpContext.Features.Get<IRequestCultureFeature>();
var ticker = _tickerService.GetCachedTicker();
var regionInfo = _currencyService.GetRegionaInfo(rqf);
var displayPrice = _currencyService.GetExchangePrice(ticker.DisplayPrice, regionInfo.ISOCurrencySymbol);
var ticker = _tickerService.GetTicker(regionInfo.ISOCurrencySymbol);

return View(new Ticker
{
DisplayPrice = displayPrice,
Last24Change = ticker.Last24Change
});
return View(ticker);
}
else
{
Expand Down Expand Up @@ -167,7 +162,7 @@ public IActionResult CheckPayment()
if(stratisAdressRequest.unconfirmedBalance + stratisAdressRequest.balance > 0)
{
HttpContext.Session.SetString("Deposited", depositAddress);
HttpContext.Session.SetString("DepositedAmount", ((double)(stratisAdressRequest.unconfirmedBalance + stratisAdressRequest.balance)).ToString());
HttpContext.Session.SetString("DepositedAmount", ((decimal)(stratisAdressRequest.unconfirmedBalance + stratisAdressRequest.balance)).ToString());
return Json(true);
}
return BadRequest();
Expand All @@ -189,7 +184,7 @@ public IActionResult NewParticipation()
public IActionResult SaveParticipation(string nickname, string address)
{
_settings.IncrementIterator();
_participation.StoreParticipation(HttpContext.Session.GetString("Ticket"), nickname, address, double.Parse(HttpContext.Session.GetString("DepositedAmount")));
_participation.StoreParticipation(HttpContext.Session.GetString("Ticket"), nickname, address, decimal.Parse(HttpContext.Session.GetString("DepositedAmount")));

return RedirectToAction("Participated");
}
Expand Down
6 changes: 3 additions & 3 deletions Stratis.Guru/Documentation/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Stratis.Guru Documentation
# City Chain Explorer Documentation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it multichain or citychain Oo


This documentation describes how to use the Stratis.Guru API.
This documentation describes how to use the City Chain Explorer API.

## Create Stratis Key Pair
This endpoint generate a new Stratis Address and returns a public and private key pair.
This endpoint generate a new City Chain Address and returns a public and private key pair.
```
GET https://stratis.guru/api/create-address
```
Expand Down
7 changes: 3 additions & 4 deletions Stratis.Guru/Documentation/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
site_name: Stratis.Guru
site_description: Strati.Guru API Documentation
site_name: City.Chain.Explorer
site_description: City Chain Explorer API Documentation
site_author: Clint Mourlevat
repo_url: https://github.com/clintnetwork/stratis-guru-v2.git
google_analytics: ["UA-111742056-1", "stratis.guru"]
repo_url: https://github.com/CityChainFoundation/city-explorer.git
theme: readthedocs
121 changes: 121 additions & 0 deletions Stratis.Guru/Documentation/site/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta name="author" content="Clint Mourlevat">
<link rel="shortcut icon" href="/img/favicon.ico">
<title>City.Chain.Explorer</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>

<link rel="stylesheet" href="/css/theme.css" type="text/css" />
<link rel="stylesheet" href="/css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">

<script src="/js/jquery-2.1.1.min.js" defer></script>
<script src="/js/modernizr-2.8.3.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

</head>

<body class="wy-body-for-nav" role="document">

<div class="wy-grid-for-nav">


<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href="/." class="icon icon-home"> City.Chain.Explorer</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="//search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>
</div>

<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">


<li class="toctree-l1">

<a class="" href="/.">City Chain Explorer Documentation</a>
</li>

</ul>
</div>
&nbsp;
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">


<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="/.">City.Chain.Explorer</a>
</nav>


<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="/.">Docs</a> &raquo;</li>


<li class="wy-breadcrumbs-aside">

</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">


<h1 id="404-page-not-found">404</h1>

<p><strong>Page not found</strong></p>


</div>
</div>
<footer>


<hr/>

<div role="contentinfo">
<!-- Copyright etc -->

</div>

Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>

</div>
</div>

</section>

</div>

<div class="rst-versions" role="note" style="cursor: pointer">
<span class="rst-current-version" data-toggle="rst-current-version">

<a href="https://github.com/CityChainFoundation/city-explorer.git/" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>



</span>
</div>
<script>var base_url = '/';</script>
<script src="/js/theme.js" defer></script>
<script src="/search/main.js" defer></script>

</body>
</html>
12 changes: 12 additions & 0 deletions Stratis.Guru/Documentation/site/css/theme.css

Large diffs are not rendered by default.

Loading