Commit f24e1da0 authored by Pieterjan Vanhoof's avatar Pieterjan Vanhoof Committed by GitHub

Add Wallet Manager (#33)

Add Wallet Manager
parents 1563efa9 c5350c48
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 15
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{807563C4-7259-434D-B604-A14C3DCF8E30}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{807563C4-7259-434D-B604-A14C3DCF8E30}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2FF3130A-E8F3-4E0B-8733-B34C4A19910C}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{2FF3130A-E8F3-4E0B-8733-B34C4A19910C}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
global.json = global.json global.json = global.json
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Breeze.Api", "src\Breeze.Api\Breeze.Api.xproj", "{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Api", "src\Breeze.Api\Breeze.Api.csproj", "{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Breeze.Api.Tests", "src\Breeze.Api.Tests\Breeze.Api.Tests.xproj", "{BD5174B4-DCE8-4594-9A16-B83E56767770}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Api.Tests", "src\Breeze.Api.Tests\Breeze.Api.Tests.csproj", "{BD5174B4-DCE8-4594-9A16-B83E56767770}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Breeze.Wallet", "src\Breeze.Wallet\Breeze.Wallet.xproj", "{D16CD478-9D1E-4C69-91AD-43539E94A215}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Wallet", "src\Breeze.Wallet\Breeze.Wallet.csproj", "{D16CD478-9D1E-4C69-91AD-43539E94A215}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Breeze.Deamon", "src\Breeze.Deamon\Breeze.Deamon.xproj", "{1B598E33-667F-496D-BC0D-88276E8E7632}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Deamon", "src\Breeze.Deamon\Breeze.Deamon.csproj", "{1B598E33-667F-496D-BC0D-88276E8E7632}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{807563C4-7259-434D-B604-A14C3DCF8E30}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{2FF3130A-E8F3-4E0B-8733-B34C4A19910C}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
global.json = global.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Api", "src\Breeze.Api\Breeze.Api.csproj", "{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Api.Tests", "src\Breeze.Api.Tests\Breeze.Api.Tests.csproj", "{BD5174B4-DCE8-4594-9A16-B83E56767770}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Wallet", "src\Breeze.Wallet\Breeze.Wallet.csproj", "{D16CD478-9D1E-4C69-91AD-43539E94A215}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Breeze.Deamon", "src\Breeze.Deamon\Breeze.Deamon.csproj", "{1B598E33-667F-496D-BC0D-88276E8E7632}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7B3E9EB-34E8-4B10-B296-4D5270E314A4}.Release|Any CPU.Build.0 = Release|Any CPU
{BD5174B4-DCE8-4594-9A16-B83E56767770}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD5174B4-DCE8-4594-9A16-B83E56767770}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD5174B4-DCE8-4594-9A16-B83E56767770}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD5174B4-DCE8-4594-9A16-B83E56767770}.Release|Any CPU.Build.0 = Release|Any CPU
{D16CD478-9D1E-4C69-91AD-43539E94A215}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D16CD478-9D1E-4C69-91AD-43539E94A215}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D16CD478-9D1E-4C69-91AD-43539E94A215}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D16CD478-9D1E-4C69-91AD-43539E94A215}.Release|Any CPU.Build.0 = Release|Any CPU
{1B598E33-667F-496D-BC0D-88276E8E7632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B598E33-667F-496D-BC0D-88276E8E7632}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B598E33-667F-496D-BC0D-88276E8E7632}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B598E33-667F-496D-BC0D-88276E8E7632}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E7B3E9EB-34E8-4B10-B296-4D5270E314A4} = {807563C4-7259-434D-B604-A14C3DCF8E30}
{BD5174B4-DCE8-4594-9A16-B83E56767770} = {807563C4-7259-434D-B604-A14C3DCF8E30}
{D16CD478-9D1E-4C69-91AD-43539E94A215} = {807563C4-7259-434D-B604-A14C3DCF8E30}
{1B598E33-667F-496D-BC0D-88276E8E7632} = {807563C4-7259-434D-B604-A14C3DCF8E30}
EndGlobalSection
EndGlobal
{ {
"projects": [ "src" ], "projects": [ "src" ]
"sdk": { }
"version": "1.0.0-preview2-003131"
}
}
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
<PackageReference Include="NStratis" Version="3.0.2.17" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta5-build1225" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta5-build1225" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" /> <PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.2.0-beta5-build3474" /> <PackageReference Include="xunit" Version="2.2.0-beta5-build3474" />
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>bd5174b4-dce8-4594-9a16-b83e56767770</ProjectGuid>
<RootNamespace>Breeze.Api.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
\ No newline at end of file
{
"version": "1.0.0-*",
"dependencies": {
"System.Runtime.Serialization.Primitives": "4.3.0",
"xunit": "2.2.0",
"dotnet-test-xunit": "1.0.0-rc2-build10025",
"Breeze.Api": "1.0.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Moq": "4.7.8",
"Breeze.Wallet": "1.0.0-*"
},
"testRunner": "xunit",
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": [ "netcore50" ]
}
}
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<AssemblyName>Breeze.Api</AssemblyName> <AssemblyName>Breeze.Api</AssemblyName>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<PackageId>Breeze.Api</PackageId> <PackageId>Breeze.Api</PackageId>
<RuntimeIdentifiers>win10-x64;win7-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win10-x64;win7-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion> <RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback> <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup> </PropertyGroup>
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="NBitcoin" Version="3.0.2.15" /> <PackageReference Include="Stratis.Bitcoin" Version="1.0.1.5-alpha" />
<PackageReference Include="Stratis.Bitcoin" Version="1.0.1.3-alpha" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0-rc3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0-rc3" />
<PackageReference Include="System.Reactive" Version="3.1.1" /> <PackageReference Include="System.Reactive" Version="3.1.1" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" /> <PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>e7b3e9eb-34e8-4b10-b296-4d5270e314a4</ProjectGuid>
<RootNamespace>Breeze.Api</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.1.2",
"Microsoft.AspNetCore.Mvc.Versioning": "1.0.3",
"Microsoft.AspNetCore.Routing": "1.1.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.1",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.1",
"Microsoft.Extensions.Configuration.Json": "1.1.1",
"Microsoft.Extensions.DependencyModel": "1.1.1",
"Microsoft.Extensions.Logging": "1.1.1",
"Microsoft.Extensions.Logging.Console": "1.1.1",
"Microsoft.Extensions.Logging.Debug": "1.1.1",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.1",
"Microsoft.NETCore.App": "1.1.0",
"NBitcoin": "3.0.2.15",
"Stratis.Bitcoin": "1.0.1.3-alpha",
"Swashbuckle.AspNetCore": "1.0.0-rc3",
"System.Reactive": "3.1.1",
"System.Runtime.Loader": "4.3.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"runtimes": {
"win10-x64": {},
"win7-x64": {},
"ubuntu.16.04-x64": {}
}
}
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Stratis.Bitcoin" Version="1.0.1.3-alpha" /> <PackageReference Include="Stratis.Bitcoin" Version="1.0.1.5-alpha" />
</ItemGroup> </ItemGroup>
</Project> </Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>1b598e33-667f-496d-bc0d-88276e8e7632</ProjectGuid>
<RootNamespace>Breeze.Deamon</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
...@@ -18,11 +18,12 @@ namespace Breeze.Deamon ...@@ -18,11 +18,12 @@ namespace Breeze.Deamon
// configure Full Node // configure Full Node
Logs.Configure(new LoggerFactory().AddConsole(LogLevel.Trace, false)); Logs.Configure(new LoggerFactory().AddConsole(LogLevel.Trace, false));
NodeSettings nodeSettings = NodeSettings.FromArguments(args); NodeSettings nodeSettings = NodeSettings.FromArguments(args);
var node = (FullNode)new FullNodeBuilder() var node = (FullNode)new FullNodeBuilder()
.UseNodeSettings(nodeSettings) .UseNodeSettings(nodeSettings)
.UseWallet() .UseWallet()
.UseBlockNotification() .UseBlockNotification()
.UseTransactionNotification()
.UseApi() .UseApi()
.Build(); .Build();
......
{
"title": "",
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
// TODO uncomment the line below when we move to VS2017 (https://github.com/aspnet/Tooling/issues/842)
//"outputName": "breezed"
},
"dependencies": {
"Breeze.Api": "1.0.0-*",
"Breeze.Wallet": "1.0.0-*",
"Microsoft.Extensions.Logging.Abstractions": "1.1.1",
"Microsoft.Extensions.Logging.Console": "1.1.1",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"Stratis.Bitcoin": "1.0.1.3-alpha"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
...@@ -16,10 +16,8 @@ ...@@ -16,10 +16,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="HBitcoin" Version="0.1.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="1.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="1.0.3" />
<PackageReference Include="NBitcoin" Version="3.0.2.15" /> <PackageReference Include="Stratis.Bitcoin" Version="1.0.1.5-alpha" />
<PackageReference Include="Stratis.Bitcoin" Version="1.0.1.3-alpha" />
</ItemGroup> </ItemGroup>
</Project> </Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>d16cd478-9d1e-4c69-91ad-43539e94a215</ProjectGuid>
<RootNamespace>Breeze.Wallet</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
using NBitcoin;
using Stratis.Bitcoin;
using Breeze.Wallet.Wrappers;
namespace Breeze.Wallet.Notifications
{
/// <summary>
/// Observer that receives notifications about the arrival of new <see cref="Transaction"/>s.
/// </summary>
public class TransactionObserver : SignalObserver<Transaction>
{
private readonly ITrackerWrapper trackerWrapper;
public TransactionObserver(ITrackerWrapper trackerWrapper)
{
this.trackerWrapper = trackerWrapper;
}
/// <summary>
/// Manages what happens when a new transaction is received.
/// </summary>
/// <param name="transaction">The new transaction</param>
protected override void OnNextCore(Transaction transaction)
{
this.trackerWrapper.NotifyAboutTransaction(transaction);
}
}
}
using Stratis.Bitcoin;
using System;
using NBitcoin;
namespace Breeze.Wallet.Notifications
{
/// <summary>
/// Manages the subscription of the transaction observer to the transaction signaler.
/// </summary>
public class TransactionSubscriber
{
private readonly ISignaler<Transaction> signaler;
private readonly TransactionObserver observer;
public TransactionSubscriber(ISignaler<Transaction> signaler, TransactionObserver observer)
{
this.signaler = signaler;
this.observer = observer;
}
/// <summary>
/// Subscribes the transaction observer to the transaction signaler.
/// </summary>
/// <returns>An <see cref="IDisposable"/></returns>
public IDisposable Subscribe()
{
return this.signaler.Subscribe(this.observer);
}
}
}
...@@ -26,6 +26,8 @@ namespace Breeze.Wallet ...@@ -26,6 +26,8 @@ namespace Breeze.Wallet
{ {
BlockSubscriber sub = new BlockSubscriber(signals.Blocks, new BlockObserver(chain, trackerWrapper)); BlockSubscriber sub = new BlockSubscriber(signals.Blocks, new BlockObserver(chain, trackerWrapper));
sub.Subscribe(); sub.Subscribe();
TransactionSubscriber txSub = new TransactionSubscriber(signals.Transactions, new TransactionObserver(trackerWrapper));
txSub.Subscribe();
} }
} }
......
...@@ -6,6 +6,8 @@ namespace Breeze.Wallet.Wrappers ...@@ -6,6 +6,8 @@ namespace Breeze.Wallet.Wrappers
{ {
void NotifyAboutBlock(int height, Block block); void NotifyAboutBlock(int height, Block block);
uint256 GetLastProcessedBlock(); void NotifyAboutTransaction(Transaction transaction);
uint256 GetLastProcessedBlock();
} }
} }
 using Breeze.Wallet.Models;
using Breeze.Wallet.Models;
using HBitcoin.Models;
using NBitcoin; using NBitcoin;
namespace Breeze.Wallet.Wrappers namespace Breeze.Wallet.Wrappers
......
using NBitcoin; using NBitcoin;
using HBitcoin.FullBlockSpv;
using HBitcoin.Models;
using System; using System;
namespace Breeze.Wallet.Wrappers namespace Breeze.Wallet.Wrappers
{ {
public class TrackerWrapper : ITrackerWrapper public class TrackerWrapper : ITrackerWrapper
{ {
private readonly Tracker tracker; // private readonly Tracker tracker;
public TrackerWrapper(Network network) public TrackerWrapper(Network network)
{ {
this.tracker = new Tracker(network); //this.tracker = new Tracker(network);
} }
/// <summary> /// <summary>
/// Get the hash of the last block that has been succesfully processed. /// Get the hash of the last block that has been succesfully processed.
/// </summary> /// </summary>
/// <returns>The hash of the block</returns> /// <returns>The hash of the block</returns>
public uint256 GetLastProcessedBlock() public uint256 GetLastProcessedBlock()
{ {
// TODO use Tracker.BestHeight. Genesis hash for now. // TODO use Tracker.BestHeight. Genesis hash for now.
return uint256.Parse("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); return uint256.Parse("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
} }
public void NotifyAboutBlock(int height, Block block)
{
// this.tracker.AddOrReplaceBlock(new Height(height), block);
Console.WriteLine($"block notification: height: {height}, block hash: {block.Header.GetHash()}");
}
public void NotifyAboutBlock(int height, Block block) public void NotifyAboutTransaction(Transaction transaction)
{ {
this.tracker.AddOrReplaceBlock(new Height(height), block); // TODO what should the height be? is it necessary?
Console.WriteLine($"height: {height}, block hash: {block.Header.GetHash()}"); // this.tracker.ProcessTransaction(new SmartTransaction(transaction, new Height(0)));
Console.WriteLine($"transaction notification: tx hash {transaction.GetHash()}");
} }
} }
} }
...@@ -3,7 +3,6 @@ using System.IO; ...@@ -3,7 +3,6 @@ using System.IO;
using System.Linq; using System.Linq;
using Breeze.Wallet.Helpers; using Breeze.Wallet.Helpers;
using Breeze.Wallet.Models; using Breeze.Wallet.Models;
using HBitcoin.KeyManagement;
using NBitcoin; using NBitcoin;
namespace Breeze.Wallet.Wrappers namespace Breeze.Wallet.Wrappers
......
{
"version": "1.0.0-*",
"dependencies": {
"HBitcoin": "0.1.6",
"Microsoft.AspNetCore.Mvc.Versioning": "1.0.3",
"NBitcoin": "3.0.2.15",
"NETStandard.Library": "1.6.1",
"Stratis.Bitcoin": "1.0.1.3-alpha"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment