public async Task <IActionResult> WalletTransactions(
            [ModelBinder(typeof(WalletIdModelBinder))]
            WalletId walletId)
        {
            var store = await _Repo.FindStore(walletId.StoreId, GetUserId());

            DerivationStrategy paymentMethod = GetPaymentMethod(walletId, store);

            if (paymentMethod == null)
            {
                return(NotFound());
            }

            var wallet       = _walletProvider.GetWallet(paymentMethod.Network);
            var transactions = await wallet.FetchTransactions(paymentMethod.DerivationStrategyBase);

            var model = new ListTransactionsViewModel();

            foreach (var tx in transactions.UnconfirmedTransactions.Transactions.Concat(transactions.ConfirmedTransactions.Transactions))
            {
                var vm = new ListTransactionsViewModel.TransactionViewModel();
                model.Transactions.Add(vm);
                vm.Id        = tx.TransactionId.ToString();
                vm.Link      = string.Format(CultureInfo.InvariantCulture, paymentMethod.Network.BlockExplorerLink, vm.Id);
                vm.Timestamp = tx.Timestamp;
                vm.Positive  = tx.BalanceChange >= Money.Zero;
                vm.Balance   = tx.BalanceChange.ToString();
            }
            model.Transactions = model.Transactions.OrderByDescending(t => t.Timestamp).ToList();
            return(View(model));
        }
        public async Task <IActionResult> WalletTransactions(
            [ModelBinder(typeof(WalletIdModelBinder))]
            WalletId walletId, string labelFilter = null)
        {
            DerivationSchemeSettings paymentMethod = GetDerivationSchemeSettings(walletId);

            if (paymentMethod == null)
            {
                return(NotFound());
            }

            var wallet                      = _walletProvider.GetWallet(paymentMethod.Network);
            var walletBlobAsync             = WalletRepository.GetWalletInfo(walletId);
            var walletTransactionsInfoAsync = WalletRepository.GetWalletTransactionsInfo(walletId);
            var transactions                = await wallet.FetchTransactions(paymentMethod.AccountDerivation);

            var walletBlob             = await walletBlobAsync;
            var walletTransactionsInfo = await walletTransactionsInfoAsync;
            var model = new ListTransactionsViewModel();

            foreach (var tx in transactions.UnconfirmedTransactions.Transactions.Concat(transactions.ConfirmedTransactions.Transactions).ToArray())
            {
                var vm = new ListTransactionsViewModel.TransactionViewModel();
                vm.Id          = tx.TransactionId.ToString();
                vm.Link        = string.Format(CultureInfo.InvariantCulture, paymentMethod.Network.BlockExplorerLink, vm.Id);
                vm.Timestamp   = tx.Timestamp;
                vm.Positive    = tx.BalanceChange >= Money.Zero;
                vm.Balance     = tx.BalanceChange.ToString();
                vm.IsConfirmed = tx.Confirmations != 0;

                if (walletTransactionsInfo.TryGetValue(tx.TransactionId.ToString(), out var transactionInfo))
                {
                    var labels = walletBlob.GetLabels(transactionInfo);
                    vm.Labels.AddRange(labels);
                    model.Labels.AddRange(labels);
                    vm.Comment = transactionInfo.Comment;
                }

                if (labelFilter == null || vm.Labels.Any(l => l.Value.Equals(labelFilter, StringComparison.OrdinalIgnoreCase)))
                {
                    model.Transactions.Add(vm);
                }
            }
            model.Transactions = model.Transactions.OrderByDescending(t => t.Timestamp).ToList();
            return(View(model));
        }