Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
<PackageVersion Include="ModelContextProtocol" Version="1.3.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
<!-- Shared / legacy packages -->
<PackageVersion Include="Blockcore.Core" Version="1.1.41" />
<PackageVersion Include="Blockcore.Nostr.Client" Version="2.0.2" />
<PackageVersion Include="NBitcoin.Altcoins" Version="3.0.21" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
Expand Down
4 changes: 2 additions & 2 deletions src/avalonia/AngorApp.Model/Wallet/Simple/SimpleWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ReactiveUI.Validation.Extensions;
using ReactiveUI.Validation.Helpers;
using Blockcore.NBitcoin.BIP39;
using NBitcoin;

namespace AngorApp.UI.Flows.AddWallet.Import
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/avalonia/AngorApp/UI/Shared/Services/UIServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/design/App.Test.Integration/LogExportRoundtripTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/design/App.Test.Integration/Nip44InteropTest.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
19 changes: 17 additions & 2 deletions src/design/App/Automation/AutomationFlows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,22 +1121,37 @@ private static async Task<ProjectCreatedResponse> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/design/App/UI/Sections/Settings/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ private async Task<Result> 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.
Expand Down
2 changes: 1 addition & 1 deletion src/design/App/UI/Shared/Helpers/BlossomAuthKeyHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Blockcore.NBitcoin;
using NBitcoin;

namespace App.UI.Shared.Helpers;

Expand Down
4 changes: 2 additions & 2 deletions src/design/App/UI/Shared/Services/LogExportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 10 additions & 10 deletions src/sdk/Angor.Sdk.Tests/Funding/Founder/ApproveInvestmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -119,16 +119,16 @@ public async Task Handle_WhenSignatureVerificationFails_ReturnsFailure()
.Returns(network);

_mockInvestorTransactionActions
.Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny<ProjectInfo>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>()))
.Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny<ProjectInfo>(), It.IsAny<Transaction>()))
.Returns(tx);

_mockFounderTransactionActions
.Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny<ProjectInfo>(), It.IsAny<string>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<AngorKey>()))
.Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny<ProjectInfo>(), It.IsAny<string>(), It.IsAny<Transaction>(), It.IsAny<AngorKey>()))
.Returns(new SignatureInfo());

// CheckInvestorRecoverySignatures returns false -> throws InvalidOperationException
_mockInvestorTransactionActions
.Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny<ProjectInfo>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<SignatureInfo>()))
.Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny<ProjectInfo>(), It.IsAny<Transaction>(), It.IsAny<SignatureInfo>()))
.Returns(false);

// Act
Expand Down Expand Up @@ -165,15 +165,15 @@ public async Task Handle_WhenSuccessful_SendsSignaturesToInvestor()
.Returns(network);

_mockInvestorTransactionActions
.Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny<ProjectInfo>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>()))
.Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny<ProjectInfo>(), It.IsAny<Transaction>()))
.Returns(tx);

_mockFounderTransactionActions
.Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny<ProjectInfo>(), It.IsAny<string>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<AngorKey>()))
.Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny<ProjectInfo>(), It.IsAny<string>(), It.IsAny<Transaction>(), It.IsAny<AngorKey>()))
.Returns(new SignatureInfo());

_mockInvestorTransactionActions
.Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny<ProjectInfo>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<SignatureInfo>()))
.Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny<ProjectInfo>(), It.IsAny<Transaction>(), It.IsAny<SignatureInfo>()))
.Returns(true);

_mockSerializer
Expand Down Expand Up @@ -268,15 +268,15 @@ private void SetupSuccessfulApprovalFlow()
.Returns(network);

_mockInvestorTransactionActions
.Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny<ProjectInfo>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>()))
.Setup(x => x.BuildRecoverInvestorFundsTransaction(It.IsAny<ProjectInfo>(), It.IsAny<Transaction>()))
.Returns(tx);

_mockFounderTransactionActions
.Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny<ProjectInfo>(), It.IsAny<string>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<AngorKey>()))
.Setup(x => x.SignInvestorRecoveryTransactions(It.IsAny<ProjectInfo>(), It.IsAny<string>(), It.IsAny<Transaction>(), It.IsAny<AngorKey>()))
.Returns(new SignatureInfo());

_mockInvestorTransactionActions
.Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny<ProjectInfo>(), It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<SignatureInfo>()))
.Setup(x => x.CheckInvestorRecoverySignatures(It.IsAny<ProjectInfo>(), It.IsAny<Transaction>(), It.IsAny<SignatureInfo>()))
.Returns(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions src/sdk/Angor.Sdk.Tests/Funding/Founder/CreateProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/sdk/Angor.Sdk.Tests/Funding/Founder/ReleaseFundsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -163,21 +163,21 @@ public async Task Handle_WhenSignatureCheckFails_ReturnsFailure()
_mockInvestorTransactionActions
.Setup(x => x.CheckInvestorUnfundedReleaseSignatures(
It.IsAny<ProjectInfo>(),
It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(),
It.IsAny<Transaction>(),
It.IsAny<SignatureInfo>(),
It.IsAny<string>()))
.Returns(false);

_mockFounderTransactionActions
.Setup(x => x.SignInvestorRecoveryTransactions(
It.IsAny<ProjectInfo>(), It.IsAny<string>(),
It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(), It.IsAny<AngorKey>()))
It.IsAny<Transaction>(), It.IsAny<AngorKey>()))
.Returns(new SignatureInfo());

_mockInvestorTransactionActions
.Setup(x => x.BuildUnfundedReleaseInvestorFundsTransaction(
It.IsAny<ProjectInfo>(),
It.IsAny<Blockcore.Consensus.TransactionInfo.Transaction>(),
It.IsAny<Transaction>(),
It.IsAny<string>()))
.Returns(network.CreateTransaction());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -230,7 +231,7 @@ public async Task Handle_WhenSuccessful_ReturnsTransactionDraft()
It.IsAny<ProjectInfo>(),
It.IsAny<IEnumerable<string>>(),
It.IsAny<int>(),
It.IsAny<Blockcore.Consensus.ScriptInfo.Script>(),
It.IsAny<Script>(),
It.IsAny<AngorKey>(),
It.IsAny<FeeEstimation>()))
.Returns(new Angor.Shared.Models.TransactionInfo
Expand Down Expand Up @@ -262,7 +263,7 @@ private static SpendStageFunds.SpendStageFundsRequest CreateRequest()
toSpend);
}

private Blockcore.Networks.Network SetupNetwork()
private AngorNetwork SetupNetwork()
{
var network = Angor.Shared.Networks.Networks.Bitcoin.Testnet();
_mockNetworkConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading