private void BindClients(ContainerBuilder builder)
        {
            builder.RegisterAssetsClient(
                AssetServiceSettings.Create(new Uri(_settings.Assets.ServiceUrl),
                                            _jobSettings.AssetsCache.ExpirationPeriod));

            builder.RegisterType <PersonalDataService>()
            .As <IPersonalDataService>()
            .WithParameter(TypedParameter.From(_settings.PersonalDataServiceSettings));

            builder.RegisterLykkeServiceClient(_settings.ClientAccountClient.ServiceUrl);
            builder.RegisterOperationsClient(_settings.TransactionHandlerJob.Services.OperationsUrl);
            builder.RegisterExchangeOperationsClient(_jobSettings.ExchangeOperationsServiceUrl);

            builder.Register <IEthereumCoreAPI>(x =>
            {
                var api = new EthereumCoreAPI(new Uri(_settings.Ethereum.EthereumCoreUrl));
                api.SetRetryPolicy(null);
                return(api);
            }).SingleInstance();

            builder.RegisterOperationsRepositoryClients(_settings.OperationsRepositoryServiceClient);
            builder.RegisterBitcoinApiClient(_settings.BitCoinCore.BitcoinCoreApiUrl);

            builder.RegisterMeClient(_settings.MatchingEngineClient.IpEndpoint.GetClientIpEndPoint());
        }
Esempio n. 2
0
        public static IBalanceReader Create(ToolSettings toolSettings, IAssetsService assetsService)
        {
            if (toolSettings.Ethereum?.EthereumCoreUrl == null)
            {
                throw new ArgumentNullException(nameof(toolSettings.Ethereum.EthereumCoreUrl));
            }

            var client = new EthereumCoreAPI(new Uri(toolSettings.Ethereum.EthereumCoreUrl));

            return(new EthereumBalanceReader(client, assetsService));
        }
Esempio n. 3
0
        private EthereumBalanceReader(EthereumCoreAPI client, IAssetsService assetsService)
        {
            _lazyErc20AssetsCache = new Lazy <Task <IEnumerable <Asset> > >(async() =>
            {
                var result = await GetApprovedTokenAssets(null);

                return(result);
            });
            _assetsService = assetsService ?? throw new ArgumentNullException(nameof(assetsService));
            _addressUtil   = new AddressUtil();
            _client        = client;
        }