diff --git a/src/Angor/Client/Pages/Invest.razor b/src/Angor/Client/Pages/Invest.razor index 2e0ac748..5f918d6e 100644 --- a/src/Angor/Client/Pages/Invest.razor +++ b/src/Angor/Client/Pages/Invest.razor @@ -269,26 +269,11 @@ await CheckIfSeederTimeHasPassed(); UpdateStagesBreakdown(new ChangeEventArgs { Value = Investment.InvestmentAmount }); - - - if (project != null && recoverySigs?.Signatures.Any() == false) - { - var accountInfo = storage.GetAccountInfo(_networkConfiguration.GetNetwork().Name); - - var nostrPrivateKey = _derivationOperations.DeriveProjectNostrPrivateKey(_walletStorage.GetWallet(), accountInfo.InvestmentsCount + 1); - - var nostrPrivateKeyHex = Encoders.Hex.EncodeData(nostrPrivateKey.ToBytes()); - - _SignService.LookupSignatureForInvestmentRequest( - NostrPrivateKey.FromHex(nostrPrivateKeyHex).DerivePublicKey().Hex - , project.NostrPubKey, recoverySigs.TimeOfRequestForSigning.Value, - async _ => await HandleSignatureReceivedAsync(nostrPrivateKeyHex, _)); - } } protected override async Task OnAfterRenderAsync(bool firstRender) { - if (firstRender) + if (javascriptNostrToolsModule == null) { try { @@ -297,10 +282,24 @@ } catch (JSException e) { - Console.WriteLine(e); + _Logger.LogError(e,"Failed to load the nostr tools module"); notificationComponent.ShowErrorMessage(e.Message); } } + + if (project != null && recoverySigs?.Signatures.Any() == false) + { + var accountInfo = storage.GetAccountInfo(_networkConfiguration.GetNetwork().Name); + + var nostrPrivateKey = _derivationOperations.DeriveProjectNostrPrivateKey(_walletStorage.GetWallet(), accountInfo.InvestmentsCount + 1); + + var nostrPrivateKeyHex = Encoders.Hex.EncodeData(nostrPrivateKey.ToBytes()); + + _SignService.LookupSignatureForInvestmentRequest( + NostrPrivateKey.FromHex(nostrPrivateKeyHex).DerivePublicKey().Hex + , project.NostrPubKey, recoverySigs.TimeOfRequestForSigning.Value, + async _ => await HandleSignatureReceivedAsync(nostrPrivateKeyHex, _)); + } } private Task CheckIfSeederTimeHasPassed()