@using System.Numerics @using BTCPayServer.Lightning @using BTCPayServer.Models.StoreViewModels @using BTCPayServer.Plugins.BreezSpark @using BTCPayServer.Security @inject BreezSparkService BreezService @{ ViewData.SetActivePage("Breez", "Send", "Send"); var storeId = Model switch { string s => s, StoreDashboardViewModel dashboardModel => dashboardModel.StoreId, _ => Context.GetImplicitStoreId() }; var sdk = BreezService.GetClient(storeId)?.Sdk; if (sdk is null) return; var nodeInfo = new Breez.Sdk.Spark.GetInfoRequest(ensureSynced: false); Breez.Sdk.Spark.GetInfoResponse? infoResponse = null; try { infoResponse = await sdk.GetInfo(nodeInfo); } catch (Exception ex) { return; } var max = LightMoney.Satoshis((long)(infoResponse?.balanceSats ?? 0)).ToUnit(LightMoneyUnit.Satoshi); } @if (ViewData["PaymentDetails"] is PaymentDetailsViewModel paymentDetails) {

Payment Details

Destination: @paymentDetails.Destination

Amount: @paymentDetails.Amount sats

Fee: @paymentDetails.Fee sats

Total: @(paymentDetails.Amount + paymentDetails.Fee) sats

Cancel
} else {

@ViewData["Title"]

Enter a Lightning bolt11 invoice or a Bitcoin address
Maximum payable: @max sats
} @functions { public class PaymentDetailsViewModel { public string Destination { get; set; } public long Amount { get; set; } public long Fee { get; set; } public string PrepareResponseJson { get; set; } } }