@using System.Globalization @using BTCPayServer.Payments @using BTCPayServer.Payments.Bitcoin @using BTCPayServer.Services @inject DisplayFormatter DisplayFormatter @model IEnumerable @{ PayjoinInformation payjoinInformation = null; var payments = Model .Where(entity => entity.GetPaymentMethodId()?.PaymentType == BitcoinPaymentType.Instance) .Select(payment => { var m = new OnchainPaymentViewModel(); var onChainPaymentData = payment.GetCryptoPaymentData() as BitcoinLikePaymentData; if (onChainPaymentData is null) { return null; } m.Crypto = payment.GetPaymentMethodId().CryptoCode; m.DepositAddress = onChainPaymentData.GetDestination(); var confirmationCount = onChainPaymentData.ConfirmationCount; var network = payment.Network as BTCPayNetwork; if (confirmationCount >= network.MaxTrackedConfirmation) { m.Confirmations = "At least " + (network.MaxTrackedConfirmation); } else { m.Confirmations = confirmationCount.ToString(CultureInfo.InvariantCulture); } if (onChainPaymentData.PayjoinInformation is PayjoinInformation pj) { payjoinInformation = pj; m.AdditionalInformation = "Original transaction"; } if (payjoinInformation is PayjoinInformation && payjoinInformation.CoinjoinTransactionHash == onChainPaymentData?.Outpoint.Hash) { m.AdditionalInformation = "Payjoin transaction"; } m.TransactionId = onChainPaymentData.Outpoint.Hash.ToString(); m.ReceivedTime = payment.ReceivedTime; m.TransactionLink = string.Format(CultureInfo.InvariantCulture, payment.Network.BlockExplorerLink, m.TransactionId); m.Replaced = !payment.Accounted; m.CryptoPaymentData = onChainPaymentData; m.NetworkFee = payment.NetworkFee; m.PaymentProof = onChainPaymentData.Outpoint.ToString(); return m; }) .Where(model => model != null) .ToList(); } @if (payments.Any()) { var hasNetworkFee = payments.Sum(a => a.NetworkFee) > 0;
On-Chain Payments
@if (hasNetworkFee) { } @foreach (var payment in payments) { @if (hasNetworkFee) { } }
Crypto Index Destination Payment Proof Network Fee Confirmations Paid
@payment.Crypto @(payment.CryptoPaymentData.KeyPath?.ToString()?? "Unknown") @payment.NetworkFee@payment.Confirmations @DisplayFormatter.Currency(payment.CryptoPaymentData.GetValue(), payment.Crypto) @if (!string.IsNullOrEmpty(payment.AdditionalInformation)) {
(@payment.AdditionalInformation)
}
}