Add exchangeRate providers
MODIFY
MagicalCryptoWallet.Backend/Controllers/BlockchainController.cs
MagicalCryptoWallet.Backend/Controllers/BlockchainController.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using MagicalCryptoWallet.Backend.Models;
using MagicalCryptoWallet.Helpers;
using MagicalCryptoWallet.Logging;
+using MagicalCryptoWallet.WebClients;
using MagicalCryptoWallet.WebClients.SmartBit;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -161,8 +162,9 @@ namespace MagicalCryptoWallet.Backend.Controllers
if (!_cache.TryGetValue(nameof(GetExchangeRatesAsync), out exchangeRates))
{
var exchangeRateProviders = new IExchangeRateProvider[]{
- new SmartBitExchangeRateProvider(new SmartBitClient(Network, disposeHandler: true)),
+ new SmartBitExchangeRateProvider(new SmartBitClient(Network.Main, disposeHandler: true)),
new BlockchainInfoExchangeRateProvider()
+ // TODO: More Providers. Which ones?
};
foreach(var provider in exchangeRateProviders)

RENAME
MagicalCryptoWallet.Backend/Controllers/ExchangeRateProviders.cs
MagicalCryptoWallet/WebClients/ExchangeRateProviders.cs
@@ -9,15 +9,15 @@ using MagicalCryptoWallet.Backend.Models;
using MagicalCryptoWallet.WebClients.SmartBit;
using Newtonsoft.Json;
-namespace MagicalCryptoWallet.Backend
+namespace MagicalCryptoWallet.WebClients
{
- interface IExchangeRateProvider
+ public interface IExchangeRateProvider
{
Task<List<ExchangeRate>> GetExchangeRateAsync();
}
- class SmartBitExchangeRateProvider : IExchangeRateProvider
+ public class SmartBitExchangeRateProvider : IExchangeRateProvider
{
private SmartBitClient _client;
@@ -40,7 +40,7 @@ namespace MagicalCryptoWallet.Backend
}
}
- class BlockchainInfoExchangeRateProvider : IExchangeRateProvider
+ public class BlockchainInfoExchangeRateProvider : IExchangeRateProvider
{
class BlockchainInfoExchangeRate{
public decimal Last { get; set; }

Add exchangeRate providers