コード例 #1
0
        public AssetAdapter()
        {
            var settings = new CoinprismApiSettings()
            {
                Network = AppSettings.Network,
                UrlMain = AppSettings.CoinprismUrlMain,
                UrlTest = AppSettings.CoinprismUrlTest
            };

            _client = new CoinprismClient(settings);
        }
コード例 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddApplicationInsightsTelemetry(Configuration);

            services.AddMvc();

            var storageConnectionString = Configuration.Get <string>("ConnectionString");

            if (string.IsNullOrWhiteSpace(storageConnectionString))
            {
                storageConnectionString = "UseDevelopmentStorage=true";
            }

            var bitcoinRpcSettings = new BitcoinRpcSettings
            {
                Url      = new Uri(Configuration.Get <string>("RpcHostPort")),
                Password = Configuration.Get <string>("RpcPassword"),
                User     = Configuration.Get <string>("RpcUser")
            };

            services.AddInstance(new BitcoinRpcClient(bitcoinRpcSettings));

            var bitcoinNinjaSettings = new BitcoinNinjaSettings
            {
                //UrlMain = new Uri(Configuration.Get<string>("UrlMainNinja")),
                UrlTest = new Uri(Configuration.Get <string>("UrlTestNetNinja")),
                Network = (Network)Enum.Parse(typeof(Network), Configuration.Get <string>("Network"))
            };

            services.AddInstance <IBitcoinNinjaClient>(new BitcoinNinjaClient(bitcoinNinjaSettings));

            var coniprismApiSettings = new CoinprismApiSettings
            {
                UrlMain = new Uri(Configuration.Get <string>("UrlCoinprismApi")),
                UrlTest = new Uri(Configuration.Get <string>("UrlCoinprismApiTestnet")),
                Network = (Network)Enum.Parse(typeof(Network), Configuration.Get <string>("Network"))
            };

            services.AddInstance <ICoinprismClient>(new CoinprismClient(coniprismApiSettings));

            var log = new LogToConsole();

            services.AddInstance <ILog>(log);

            AppInfo.Version = Configuration.Get <string>("version");

            services.BindAzureRepositories(storageConnectionString, log);
        }