@using System.Globalization @using BTCPayServer.Payments @using BTCPayServer.Payments.Bitcoin @model IEnumerable @{ PayjoinInformation payjoinIformation = null; var onchainPayments = 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(); int 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) { payjoinIformation = pj; m.AdditionalInformation = "Original transaction"; } if (payjoinIformation is PayjoinInformation && payjoinIformation.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; return m; }).Where(model => model != null); } @if (onchainPayments.Any()) { var hasNetworkFee = onchainPayments.Sum(a => a.NetworkFee) > 0;

On-Chain payments

@if (hasNetworkFee) { } @foreach (var payment in onchainPayments) { @if (hasNetworkFee) { } }
Crypto Index Deposit address Amount Network Fee Transaction Id Confirmations
@payment.Crypto @(payment.CryptoPaymentData.KeyPath?.ToString()?? "Unknown") @payment.DepositAddress @payment.CryptoPaymentData.GetValue() @Safe.Raw(payment.AdditionalInformation is string i ? $"
({i})" : string.Empty)
@payment.NetworkFee @payment.Confirmations
}