diff --git a/BTCPayApp.Core/BTCPayConnection.cs b/BTCPayApp.Core/BTCPayConnection.cs index 9af1791..f9feffd 100644 --- a/BTCPayApp.Core/BTCPayConnection.cs +++ b/BTCPayApp.Core/BTCPayConnection.cs @@ -60,7 +60,7 @@ public class BTCPayConnection : IHostedService, IBTCPayAppServerClient, IHubConn } else { - + InvokeConnectionChange(); await Task.Delay(5000); } @@ -117,7 +117,6 @@ public class BTCPayConnection : IHostedService, IBTCPayAppServerClient, IHubConn InvokeConnectionChange(); _subscription = Connection.Register(this); _hubProxy = Connection.CreateHubProxy(); - } @@ -130,7 +129,7 @@ public class BTCPayConnection : IHostedService, IBTCPayAppServerClient, IHubConn public Task ClientMethod1(string user, string message) { - _logger.LogInformation($"ClientMethod1: {user}, {message}"); + _logger.LogInformation("ClientMethod1: {User}, {Message}", user, message); return Task.FromResult($"[Success] Call ClientMethod1 : {user}, {message}"); } @@ -142,7 +141,7 @@ public class BTCPayConnection : IHostedService, IBTCPayAppServerClient, IHubConn public Task ClientMethod3(string user, string message, CancellationToken cancellationToken) { - _logger.LogInformation($"ClientMethod3: {user}, {message}"); + _logger.LogInformation("ClientMethod3: {User}, {Message}", user, message); return Task.FromResult($"[Success] Call ClientMethod3 : {user}, {message}"); } @@ -156,7 +155,7 @@ public class BTCPayConnection : IHostedService, IBTCPayAppServerClient, IHubConn public Task OnReconnected(string? connectionId) { InvokeConnectionChange(); - _logger.LogInformation($"OnReconnected: {connectionId}"); + _logger.LogInformation("OnReconnected: {ConnectionId}", connectionId); return Task.CompletedTask; } @@ -166,4 +165,16 @@ public class BTCPayConnection : IHostedService, IBTCPayAppServerClient, IHubConn _logger.LogError(exception, "OnReconnecting"); return Task.CompletedTask; } -} \ No newline at end of file + + public Task OnTransactionDetected(string txid) + { + _logger.LogInformation("OnTransactionDetected: {Txid}", txid); + return Task.CompletedTask; + } + + public Task NewBlock(string block) + { + _logger.LogInformation("NewBlock: {Block}", block); + return Task.CompletedTask; + } +} diff --git a/BTCPayApp.UI/Pages/Dashboard.razor b/BTCPayApp.UI/Pages/Dashboard.razor index 6951da8..16658c5 100644 --- a/BTCPayApp.UI/Pages/Dashboard.razor +++ b/BTCPayApp.UI/Pages/Dashboard.razor @@ -12,7 +12,15 @@ } else { - Your wallet is not configured — set up a wallet. + + Your wallet is not configured. + + Set up a wallet + + } @if (State.Value.PairConfig is not null) { diff --git a/BTCPayApp.UI/Pages/WalletSetup.razor b/BTCPayApp.UI/Pages/WalletSetup.razor index ee8e2af..d2aaf03 100644 --- a/BTCPayApp.UI/Pages/WalletSetup.razor +++ b/BTCPayApp.UI/Pages/WalletSetup.razor @@ -18,20 +18,23 @@ @code { private async Task Callback(BTCPayServerOnchainWalletConfigure.ChosenConfiguration obj) { + var config = State.Value.PairConfig; + if (config is null) return; + var kp = new KeyPath("m/84'/0'/0'"); - var seed = new Mnemonic(obj.Mnemonic ?? State.Value.PairConfig.PairingResult.ExistingWalletSeed); + var seed = new Mnemonic(obj.Mnemonic ?? config.PairingResult.ExistingWalletSeed); var mKey = seed.DeriveExtKey(); var xpub = mKey.Derive(kp).Neuter().ToString(Network.Main); - if (obj is {UseExisting: false,SetStore: true}) + if (obj is { UseExisting: false, SetStore: true }) { - await BTCPayConnection.Client.UpdateStoreOnChainPaymentMethod(State.Value.PairConfig.PairingResult.StoreId, "BTC", new UpdateOnChainPaymentMethodRequest() + await BTCPayConnection.Client.UpdateStoreOnChainPaymentMethod(config.PairingResult.StoreId, "BTC", new UpdateOnChainPaymentMethodRequest { Enabled = true, DerivationScheme = xpub, AccountKeyPath = new RootedKeyPath(mKey, kp) }); } - Dispatcher.Dispatch(new RootState.WalletConfigLoadedAction(new WalletConfig() + Dispatcher.Dispatch(new RootState.WalletConfigLoadedAction(new WalletConfig { Mnemonic = seed.ToString(), DerivationPath = kp.ToString(),