diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 55221cead..0f6d11f2c 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -87,7 +87,6 @@ - diff --git a/src/avalonia/AngorApp.Model/Wallet/Simple/SimpleWallet.cs b/src/avalonia/AngorApp.Model/Wallet/Simple/SimpleWallet.cs index 55ae32ada..82dc34ffb 100644 --- a/src/avalonia/AngorApp.Model/Wallet/Simple/SimpleWallet.cs +++ b/src/avalonia/AngorApp.Model/Wallet/Simple/SimpleWallet.cs @@ -7,7 +7,7 @@ using Angor.Shared.Models; using AngorApp.Model.Amounts; using AngorApp.Model.Common; -using Blockcore.Networks; +using Angor.Shared.Networks; using CSharpFunctionalExtensions; using ReactiveUI; using ReactiveUI.SourceGenerators; @@ -82,7 +82,7 @@ public SimpleWallet(WalletId id, IWalletAppService walletAppService, ISendMoneyF GetTestCoins.HandleErrorsWith(notificationService, "Cannot get test coins"); - CanGetTestCoins = networkConfiguration.GetNetwork().NetworkType == NetworkType.Testnet; + CanGetTestCoins = !networkConfiguration.GetNetwork().IsMainnet; Name = CanGetTestCoins ? "Test Wallet" : "Bitcoin Wallet"; } diff --git a/src/avalonia/AngorApp/UI/Flows/AddWallet/Import/SeedwordsEntryViewModel.cs b/src/avalonia/AngorApp/UI/Flows/AddWallet/Import/SeedwordsEntryViewModel.cs index ff8e72de2..fa1fb3dc4 100644 --- a/src/avalonia/AngorApp/UI/Flows/AddWallet/Import/SeedwordsEntryViewModel.cs +++ b/src/avalonia/AngorApp/UI/Flows/AddWallet/Import/SeedwordsEntryViewModel.cs @@ -1,6 +1,6 @@ using ReactiveUI.Validation.Extensions; using ReactiveUI.Validation.Helpers; -using Blockcore.NBitcoin.BIP39; +using NBitcoin; namespace AngorApp.UI.Flows.AddWallet.Import { diff --git a/src/avalonia/AngorApp/UI/Sections/Funds/Accounts/AccountsViewModel.cs b/src/avalonia/AngorApp/UI/Sections/Funds/Accounts/AccountsViewModel.cs index 7e817d125..b235b4fff 100644 --- a/src/avalonia/AngorApp/UI/Sections/Funds/Accounts/AccountsViewModel.cs +++ b/src/avalonia/AngorApp/UI/Sections/Funds/Accounts/AccountsViewModel.cs @@ -3,7 +3,7 @@ using Angor.Sdk.Wallet.Application; using Angor.Shared; using AngorApp.UI.Flows.AddWallet; -using Blockcore.Networks; +using Angor.Shared.Networks; using DynamicData; using ReactiveUI; using Zafiro.CSharpFunctionalExtensions; @@ -39,13 +39,13 @@ public AccountsViewModel(IWalletContext walletContext, IAddWalletFlow addWalletF Balances = accountBalances; - CanGetTestCoins = networkConfiguration.GetNetwork().NetworkType == NetworkType.Testnet; + CanGetTestCoins = !networkConfiguration.GetNetwork().IsMainnet; // Update CanGetTestCoins when wallets are reloaded (e.g. after network change) walletContext.WalletChanges .QueryWhenChanged() .Select(wallets => wallets.Items.Any(w => w.CanGetTestCoins)) - .StartWith(networkConfiguration.GetNetwork().NetworkType == NetworkType.Testnet) + .StartWith(!networkConfiguration.GetNetwork().IsMainnet) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(value => CanGetTestCoins = value) .DisposeWith(disposable); diff --git a/src/avalonia/AngorApp/UI/Sections/Settings/SettingsSectionViewModel.cs b/src/avalonia/AngorApp/UI/Sections/Settings/SettingsSectionViewModel.cs index a8852320a..332304c3d 100644 --- a/src/avalonia/AngorApp/UI/Sections/Settings/SettingsSectionViewModel.cs +++ b/src/avalonia/AngorApp/UI/Sections/Settings/SettingsSectionViewModel.cs @@ -82,9 +82,9 @@ public SettingsSectionViewModel(INetworkStorage networkStorage, IWalletStore wal currentNetwork = networkStorage.GetNetwork(); networkConfiguration.SetNetwork(currentNetwork switch { - "Mainnet" => new BitcoinMain(), - "Liquid" => new LiquidMain(), - _ => new Angornet() + "Mainnet" => AngorNetwork.Main(), + "Liquid" => AngorNetwork.Liquid(), + _ => AngorNetwork.Angornet() }); Network = currentNetwork; SelectedNetwork = currentNetwork; @@ -272,9 +272,9 @@ private async Task ChangeNetworkAsync() networkStorage.SetSettings(new SettingsInfo()); networkConfiguration.SetNetwork(newNetwork switch { - "Mainnet" => new BitcoinMain(), - "Liquid" => new LiquidMain(), - _ => new Angornet() + "Mainnet" => AngorNetwork.Main(), + "Liquid" => AngorNetwork.Liquid(), + _ => AngorNetwork.Angornet() }); AmountUI.DefaultSymbol = networkConfiguration.GetNetwork().CoinTicker; networkService.AddSettingsIfNotExist(); diff --git a/src/avalonia/AngorApp/UI/Shared/Services/UIServices.cs b/src/avalonia/AngorApp/UI/Shared/Services/UIServices.cs index b1dfee94d..1c2369d4c 100644 --- a/src/avalonia/AngorApp/UI/Shared/Services/UIServices.cs +++ b/src/avalonia/AngorApp/UI/Shared/Services/UIServices.cs @@ -8,7 +8,7 @@ using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Styling; -using Blockcore.Networks; +using Angor.Shared.Networks; using Serilog; using Zafiro.Avalonia.Dialogs; using Zafiro.Settings; @@ -129,7 +129,7 @@ public virtual bool EnableProductionValidations() { var isDebugMode = IsDebugModeEnabled; var network = networkConfiguration.GetNetwork(); - var isTestnet = network.NetworkType == NetworkType.Testnet; + var isTestnet = !network.IsMainnet; return !(isDebugMode && isTestnet); } diff --git a/src/design/App.Test.Integration/LogExportRoundtripTest.cs b/src/design/App.Test.Integration/LogExportRoundtripTest.cs index 5a739396c..684f7ab3d 100644 --- a/src/design/App.Test.Integration/LogExportRoundtripTest.cs +++ b/src/design/App.Test.Integration/LogExportRoundtripTest.cs @@ -4,8 +4,8 @@ using Angor.Sdk.Funding.Projects; using Angor.Shared; using Angor.Shared.Services; -using Blockcore.NBitcoin; -using Blockcore.NBitcoin.DataEncoders; +using NBitcoin; +using NBitcoin.DataEncoders; using FluentAssertions; using Xunit; diff --git a/src/design/App.Test.Integration/Nip44InteropTest.cs b/src/design/App.Test.Integration/Nip44InteropTest.cs index 0e6660a42..9f074dc73 100644 --- a/src/design/App.Test.Integration/Nip44InteropTest.cs +++ b/src/design/App.Test.Integration/Nip44InteropTest.cs @@ -1,8 +1,8 @@ using System.Diagnostics; using Angor.Sdk.Funding.Projects; using Angor.Shared.Services; -using Blockcore.NBitcoin; -using Blockcore.NBitcoin.DataEncoders; +using NBitcoin; +using NBitcoin.DataEncoders; using FluentAssertions; using Xunit; diff --git a/src/design/App/Automation/AutomationFlows.cs b/src/design/App/Automation/AutomationFlows.cs index 6226102b6..93f963123 100644 --- a/src/design/App/Automation/AutomationFlows.cs +++ b/src/design/App/Automation/AutomationFlows.cs @@ -1159,22 +1159,37 @@ private static async Task DeployProjectAsync( // deploy modal is a PaymentFlowView (DeployFlowViewModel.CurrentScreen is not set // in the wallet-pay path) var deployDeadline = DateTime.UtcNow + TxTimeout; + bool deploySucceeded = false; while (DateTime.UtcNow < deployDeadline) { - var success = await Dispatcher.UIThread.InvokeAsync(() => + var (success, errorMsg) = await Dispatcher.UIThread.InvokeAsync(() => { Dispatcher.UIThread.RunJobs(); var paymentFlow = myProjectsVm.CreateProjectVm?.DeployFlow?.PaymentFlow; - return paymentFlow?.IsSuccess == true; + var deployFlow = myProjectsVm.CreateProjectVm?.DeployFlow; + var err = paymentFlow?.ErrorMessage ?? deployFlow?.DeployErrorMessage; + return (paymentFlow?.IsSuccess == true, err); }); if (success) { + deploySucceeded = true; break; } + // If the deploy flow reported an error, don't wait the full timeout + if (!string.IsNullOrEmpty(errorMsg)) + { + return new ProjectCreatedResponse { Success = false, Error = $"Deploy failed: {errorMsg}" }; + } + await Task.Delay(PollInterval); } + if (!deploySucceeded) + { + return new ProjectCreatedResponse { Success = false, Error = "Deploy timed out waiting for IsSuccess" }; + } + // Click SuccessActionButton in the PaymentFlowView success screen await ClickByNameAsync(window, "SuccessActionButton"); await Task.Delay(500); diff --git a/src/design/App/UI/Sections/MyProjects/EditProfile/EditProfileView.axaml.cs b/src/design/App/UI/Sections/MyProjects/EditProfile/EditProfileView.axaml.cs index 28c910c97..b957ec489 100644 --- a/src/design/App/UI/Sections/MyProjects/EditProfile/EditProfileView.axaml.cs +++ b/src/design/App/UI/Sections/MyProjects/EditProfile/EditProfileView.axaml.cs @@ -12,7 +12,7 @@ using App.UI.Shared; using App.UI.Shell; using App.UI.Shared.Services; -using Blockcore.NBitcoin; +using NBitcoin; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using ReactiveUI; diff --git a/src/design/App/UI/Sections/MyProjects/Steps/CreateProjectStep3View.axaml.cs b/src/design/App/UI/Sections/MyProjects/Steps/CreateProjectStep3View.axaml.cs index f4a956ab9..f6c32f832 100644 --- a/src/design/App/UI/Sections/MyProjects/Steps/CreateProjectStep3View.axaml.cs +++ b/src/design/App/UI/Sections/MyProjects/Steps/CreateProjectStep3View.axaml.cs @@ -9,7 +9,7 @@ using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Platform.Storage; -using Blockcore.NBitcoin; +using NBitcoin; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using ReactiveUI; diff --git a/src/design/App/UI/Sections/Settings/SettingsViewModel.cs b/src/design/App/UI/Sections/Settings/SettingsViewModel.cs index 5ddb6e228..ae416d1cd 100644 --- a/src/design/App/UI/Sections/Settings/SettingsViewModel.cs +++ b/src/design/App/UI/Sections/Settings/SettingsViewModel.cs @@ -325,9 +325,9 @@ private async Task SwitchNetworkStorageAsync(string newNetwork) // Switch the runtime network object so Bitcoin operations use the correct parameters. _networkConfig.SetNetwork(newNetwork switch { - "Mainnet" => new BitcoinMain(), - "Liquid" => new LiquidMain(), - _ => new Angornet() + "Mainnet" => AngorNetwork.Main(), + "Liquid" => AngorNetwork.Liquid(), + _ => AngorNetwork.Angornet() }); // Re-initialize defaults for the new network. diff --git a/src/design/App/UI/Shared/Helpers/BlossomAuthKeyHelper.cs b/src/design/App/UI/Shared/Helpers/BlossomAuthKeyHelper.cs index 767cd30cf..771411b76 100644 --- a/src/design/App/UI/Shared/Helpers/BlossomAuthKeyHelper.cs +++ b/src/design/App/UI/Shared/Helpers/BlossomAuthKeyHelper.cs @@ -1,4 +1,4 @@ -using Blockcore.NBitcoin; +using NBitcoin; namespace App.UI.Shared.Helpers; diff --git a/src/design/App/UI/Shared/Services/LogExportService.cs b/src/design/App/UI/Shared/Services/LogExportService.cs index f8876f300..c7197c03c 100644 --- a/src/design/App/UI/Shared/Services/LogExportService.cs +++ b/src/design/App/UI/Shared/Services/LogExportService.cs @@ -7,8 +7,8 @@ using Angor.Shared; using Angor.Shared.Models; using Angor.Shared.Services; -using Blockcore.NBitcoin; -using Blockcore.NBitcoin.DataEncoders; +using NBitcoin; +using NBitcoin.DataEncoders; using CSharpFunctionalExtensions; using Nostr.Client.Utils; using Microsoft.Extensions.Logging; diff --git a/src/sdk/Angor.Sdk.Tests/Funding/Founder/ApproveInvestmentTests.cs b/src/sdk/Angor.Sdk.Tests/Funding/Founder/ApproveInvestmentTests.cs index 346db11b9..7624f3133 100644 --- a/src/sdk/Angor.Sdk.Tests/Funding/Founder/ApproveInvestmentTests.cs +++ b/src/sdk/Angor.Sdk.Tests/Funding/Founder/ApproveInvestmentTests.cs @@ -7,7 +7,7 @@ using Angor.Shared.Models; using Angor.Shared.Protocol; using Angor.Shared.Services; -using Blockcore.NBitcoin; +using NBitcoin; using CSharpFunctionalExtensions; using FluentAssertions; using Moq; @@ -119,16 +119,16 @@ public async Task Handle_WhenSignatureVerificationFails_ReturnsFailure() .Returns(network); _mockInvestorTransactionActions - .Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny(), It.IsAny())) + .Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny(), It.IsAny())) .Returns(tx); _mockFounderTransactionActions - .Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new SignatureInfo()); // CheckInvestorRecoverySignatures returns false -> throws InvalidOperationException _mockInvestorTransactionActions - .Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); // Act @@ -165,15 +165,15 @@ public async Task Handle_WhenSuccessful_SendsSignaturesToInvestor() .Returns(network); _mockInvestorTransactionActions - .Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny(), It.IsAny())) + .Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny(), It.IsAny())) .Returns(tx); _mockFounderTransactionActions - .Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new SignatureInfo()); _mockInvestorTransactionActions - .Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); _mockSerializer @@ -268,15 +268,15 @@ private void SetupSuccessfulApprovalFlow() .Returns(network); _mockInvestorTransactionActions - .Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny(), It.IsAny())) + .Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny(), It.IsAny())) .Returns(tx); _mockFounderTransactionActions - .Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .Returns(new SignatureInfo()); _mockInvestorTransactionActions - .Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); } diff --git a/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectProfileTests.cs b/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectProfileTests.cs index 6e26e406a..7186eca62 100644 --- a/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectProfileTests.cs +++ b/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectProfileTests.cs @@ -8,7 +8,7 @@ using Angor.Shared; using Angor.Shared.Models; using Angor.Shared.Services; -using Blockcore.NBitcoin; +using NBitcoin; using CSharpFunctionalExtensions; using FluentAssertions; using Microsoft.Extensions.Logging; diff --git a/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectTests.cs b/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectTests.cs index 4971ffc45..bc0496447 100644 --- a/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectTests.cs +++ b/src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectTests.cs @@ -7,10 +7,8 @@ using Angor.Shared; using Angor.Shared.Models; using Angor.Shared.Protocol; -using Blockcore.Consensus.ScriptInfo; -using Blockcore.Consensus.TransactionInfo; -using Blockcore.NBitcoin; -using Blockcore.Networks; +using Angor.Shared.Networks; +using NBitcoin; using CSharpFunctionalExtensions; using FluentAssertions; using Microsoft.Extensions.Logging; diff --git a/src/sdk/Angor.Sdk.Tests/Funding/Founder/FounderAppServiceTests.cs b/src/sdk/Angor.Sdk.Tests/Funding/Founder/FounderAppServiceTests.cs index fb912ef9d..0bc8d6d4e 100644 --- a/src/sdk/Angor.Sdk.Tests/Funding/Founder/FounderAppServiceTests.cs +++ b/src/sdk/Angor.Sdk.Tests/Funding/Founder/FounderAppServiceTests.cs @@ -10,7 +10,7 @@ using Angor.Shared; using Angor.Shared.Models; using Angor.Shared.Services; -using Blockcore.NBitcoin; +using NBitcoin; using CSharpFunctionalExtensions; using FluentAssertions; using Microsoft.Extensions.Logging.Abstractions; diff --git a/src/sdk/Angor.Sdk.Tests/Funding/Founder/ReleaseFundsTests.cs b/src/sdk/Angor.Sdk.Tests/Funding/Founder/ReleaseFundsTests.cs index 7b3d895c2..4677f331a 100644 --- a/src/sdk/Angor.Sdk.Tests/Funding/Founder/ReleaseFundsTests.cs +++ b/src/sdk/Angor.Sdk.Tests/Funding/Founder/ReleaseFundsTests.cs @@ -8,7 +8,7 @@ using Angor.Shared.Models; using Angor.Shared.Protocol; using Angor.Shared.Services; -using Blockcore.NBitcoin; +using NBitcoin; using CSharpFunctionalExtensions; using FluentAssertions; using Moq; @@ -163,7 +163,7 @@ public async Task Handle_WhenSignatureCheckFails_ReturnsFailure() _mockInvestorTransactionActions .Setup(x => x.CheckInvestorUnfundedReleaseSignatures( It.IsAny(), - It.IsAny(), + It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); @@ -171,13 +171,13 @@ public async Task Handle_WhenSignatureCheckFails_ReturnsFailure() _mockFounderTransactionActions .Setup(x => x.SignInvestorRecoveryTransactions( It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + It.IsAny(), It.IsAny())) .Returns(new SignatureInfo()); _mockInvestorTransactionActions .Setup(x => x.BuildUnfundedReleaseInvestorFundsTransaction( It.IsAny(), - It.IsAny(), + It.IsAny(), It.IsAny())) .Returns(network.CreateTransaction()); diff --git a/src/sdk/Angor.Sdk.Tests/Funding/Founder/SpendStageFundsTests.cs b/src/sdk/Angor.Sdk.Tests/Funding/Founder/SpendStageFundsTests.cs index 930903994..24c335b4d 100644 --- a/src/sdk/Angor.Sdk.Tests/Funding/Founder/SpendStageFundsTests.cs +++ b/src/sdk/Angor.Sdk.Tests/Funding/Founder/SpendStageFundsTests.cs @@ -9,7 +9,8 @@ using Angor.Shared.Models; using Angor.Shared.Protocol; using Angor.Shared.Services; -using Blockcore.NBitcoin; +using NBitcoin; +using Angor.Shared.Networks; using CSharpFunctionalExtensions; using FluentAssertions; using Microsoft.Extensions.Logging; @@ -230,7 +231,7 @@ public async Task Handle_WhenSuccessful_ReturnsTransactionDraft() It.IsAny(), It.IsAny>(), It.IsAny(), - It.IsAny(), + It.IsAny