示例#1
0
 public BtcAddressNormalizer(
     IBlockchainsProvider blockchainsProvider,
     BtcSettings settings)
 {
     _bitcoin = blockchainsProvider.GetBitcoin();
     _network = Network.GetNetwork(settings.Network);
 }
示例#2
0
 public BtcDepositsHistoryProvider(
     IBlockchainsProvider blockchainsProvider,
     BtcSettings settings)
 {
     _bitcoin = blockchainsProvider.GetBitcoin();
     _client  = new CustomQBitNinjaClient(new Uri(settings.NinjaUrl), Network.GetNetwork(settings.Network));
 }
        public async Task <PaginatedList <DepositWallet> > GetWalletsAsync(string continuation)
        {
            var continuationToken = continuation != null
                ? JsonConvert.DeserializeObject <TableContinuationToken>(continuation)
                : null;

            var query = new TableQuery <WalletCredentialsEntity>
            {
                TakeCount = 1000
            };
            var response = await _table.ExecuteQuerySegmentedAsync(query, continuationToken);

            var transactions = response.Results
                               .SelectMany(wallet =>
            {
                var userId  = Guid.Parse(wallet.ClientId);
                var wallets = new List <DepositWallet>();
                var bitcoin = _blockchainsProvider.GetBitcoin();

                if (!string.IsNullOrEmpty(wallet.MultiSig))
                {
                    wallets.Add(new DepositWallet
                                (
                                    userId,
                                    wallet.MultiSig,
                                    bitcoin.CryptoCurrency
                                ));
                }

                if (!string.IsNullOrEmpty(wallet.ColoredMultiSig))
                {
                    wallets.Add(new DepositWallet
                                (
                                    userId,
                                    wallet.ColoredMultiSig,
                                    bitcoin.CryptoCurrency
                                ));
                }

                return(wallets);
            })
                               .ToArray();

            return(PaginatedList.From(response.ContinuationToken, transactions));
        }