using System.Collections.Generic; using System.Threading.Tasks; using BTCPayServer.Client.Models; using BTCPayServer.Lightning; namespace BTCPayApp.CommonServer; public class TransactionDetectedRequest { public string Identifier { get; set; } public string TxId { get; set; } public string[] SpentScripts { get; set; } public string[] ReceivedScripts { get; set; } public bool Confirmed { get; set; } } //methods available on the hub in the client public interface IBTCPayAppHubClient { Task NotifyNetwork(string network); Task TransactionDetected(TransactionDetectedRequest request); Task NewBlock(string block); Task CreateInvoice(CreateLightningInvoiceRequest createLightningInvoiceRequest); Task GetLightningInvoice(string paymentHash); Task GetLightningPayment(string paymentHash); Task> GetLightningPayments(ListPaymentsParams request); Task> GetLightningInvoices(ListInvoicesParams request); } //methods available on the hub in the server public interface IBTCPayAppHubServer { Task MasterNodePong(string group, bool active); Task> Pair(PairRequest request); Task Handshake(AppHandshake request); Task BroadcastTransaction(string tx); Task GetFeeRate(int blockTarget); Task GetBestBlock(); Task GetBlockHeader(string hash); Task FetchTxsAndTheirBlockHeads(string[] txIds); Task DeriveScript(string identifier); Task TrackScripts(string identifier, string[] scripts); Task UpdatePsbt(string[] identifiers, string psbt); Task GetUTXOs(string[] identifiers); Task SendPaymentUpdate(string identifier, LightningPayment lightningPayment); } public class CoinResponse { public string Identifier{ get; set; } public bool Confirmed { get; set; } public string Script { get; set; } public string Outpoint { get; set; } public decimal Value { get; set; } public string Path { get; set; } } public class TxInfoResponse { public Dictionary Txs { get; set; } public Dictionary Blocks { get; set; } public Dictionary BlockHeghts { get; set; } } public class TransactionResponse { public string? BlockHash { get; set; } public int? BlockHeight { get; set; } public string Transaction { get; set; } } public class BestBlockResponse { public required string BlockHash { get; set; } public required int BlockHeight { get; set; } public string BlockHeader { get; set; } } public class AppHandshake { public string[] Identifiers { get; set; } } public class AppHandshakeResponse { //response about identifiers being tracked successfully public string[] IdentifiersAcknowledged { get; set; } } public class PairRequest { public Dictionary Derivations { get; set; } = new(); }