Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
136bc94a
Commit
136bc94a
authored
Mar 28, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Api and Wallet features
Moved Wallet Controller and types out of the Api
parent
fc9814a6
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
157 additions
and
71 deletions
+157
-71
ControllersTests.cs
Breeze/src/Breeze.Api.Tests/ControllersTests.cs
+2
-2
project.json
Breeze/src/Breeze.Api.Tests/project.json
+2
-1
ApiFeature.cs
Breeze/src/Breeze.Api/ApiFeature.cs
+15
-6
MvcBuilderExtensions.cs
Breeze/src/Breeze.Api/MvcBuilderExtensions.cs
+28
-0
Program.cs
Breeze/src/Breeze.Api/Program.cs
+25
-11
Startup.cs
Breeze/src/Breeze.Api/Startup.cs
+29
-33
project.json
Breeze/src/Breeze.Api/project.json
+3
-3
Program.cs
Breeze/src/Breeze.Deamon/Program.cs
+5
-4
SafeController.cs
Breeze/src/Breeze.Wallet/Controllers/SafeController.cs
+10
-9
SafeCreation.cs
Breeze/src/Breeze.Wallet/Models/SafeCreation.cs
+1
-1
WalletFeature.cs
Breeze/src/Breeze.Wallet/WalletFeature.cs
+35
-0
project.json
Breeze/src/Breeze.Wallet/project.json
+2
-1
No files found.
Breeze/src/Breeze.Api.Tests/ControllersTests.cs
View file @
136bc94a
...
@@ -3,10 +3,10 @@ using System.IO;
...
@@ -3,10 +3,10 @@ using System.IO;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
Xunit
;
using
Xunit
;
using
Moq
;
using
Moq
;
using
Breeze.Api.Controllers
;
using
Breeze.Api.Models
;
using
Breeze.Wallet.Wrappers
;
using
Breeze.Wallet.Wrappers
;
using
Breeze.Wallet
;
using
Breeze.Wallet
;
using
Breeze.Wallet.Controllers
;
using
Breeze.Wallet.Models
;
namespace
Breeze.Api.Tests
namespace
Breeze.Api.Tests
{
{
...
...
Breeze/src/Breeze.Api.Tests/project.json
View file @
136bc94a
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
"dotnet-test-xunit"
:
"1.0.0-rc2-build10025"
,
"dotnet-test-xunit"
:
"1.0.0-rc2-build10025"
,
"Breeze.Api"
:
"1.0.0-*"
,
"Breeze.Api"
:
"1.0.0-*"
,
"Microsoft.DotNet.InternalAbstractions"
:
"1.0.0"
,
"Microsoft.DotNet.InternalAbstractions"
:
"1.0.0"
,
"Moq"
:
"4.7.1"
"Moq"
:
"4.7.1"
,
"Breeze.Wallet"
:
"1.0.0-*"
},
},
"testRunner"
:
"xunit"
,
"testRunner"
:
"xunit"
,
"frameworks"
:
{
"frameworks"
:
{
...
...
Breeze/src/Breeze.Api/ApiFeature.cs
View file @
136bc94a
using
Stratis.Bitcoin.Builder
;
using
Microsoft.Extensions.DependencyInjection
;
using
Stratis.Bitcoin.Builder
;
using
Stratis.Bitcoin.Builder.Feature
;
using
Stratis.Bitcoin.Builder.Feature
;
namespace
Breeze.Api
namespace
Breeze.Api
{
{
public
class
ApiFeature
:
FullNodeFeature
public
class
ApiFeature
:
FullNodeFeature
{
{
private
readonly
IFullNodeBuilder
fullNodeBuilder
;
public
ApiFeature
(
IFullNodeBuilder
fullNodeBuilder
)
{
this
.
fullNodeBuilder
=
fullNodeBuilder
;
}
public
override
void
Start
()
public
override
void
Start
()
{
{
Program
.
Main
(
null
);
Program
.
Initialize
(
this
.
fullNodeBuilder
.
Services
);
}
}
}
}
...
@@ -21,6 +29,7 @@ namespace Breeze.Api
...
@@ -21,6 +29,7 @@ namespace Breeze.Api
.
AddFeature
<
ApiFeature
>()
.
AddFeature
<
ApiFeature
>()
.
FeatureServices
(
services
=>
.
FeatureServices
(
services
=>
{
{
services
.
AddSingleton
(
fullNodeBuilder
);
});
});
});
});
...
...
Breeze/src/Breeze.Api/MvcBuilderExtensions.cs
0 → 100644
View file @
136bc94a
using
System.Linq
;
using
System.Reflection
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.DependencyInjection
;
namespace
Breeze.Api
{
public
static
class
MvcBuilderExtensions
{
/// <summary>
/// Finds all the types that are <see cref="Controller"/> and add them to the Api as services.
/// </summary>
/// <param name="builder">The builder</param>
/// <param name="services">The services to look into</param>
/// <returns>The Mvc builder</returns>
public
static
IMvcBuilder
AddControllers
(
this
IMvcBuilder
builder
,
IServiceCollection
services
)
{
var
controllerTypes
=
services
.
Where
(
s
=>
s
.
ServiceType
.
GetTypeInfo
().
BaseType
==
typeof
(
Controller
));
foreach
(
var
controllerType
in
controllerTypes
)
{
builder
.
AddApplicationPart
(
controllerType
.
ServiceType
.
GetTypeInfo
().
Assembly
);
}
builder
.
AddControllersAsServices
();
return
builder
;
}
}
}
Breeze/src/Breeze.Api/Program.cs
View file @
136bc94a
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.
AspNetCore.Builder
;
using
Microsoft.
Extensions.DependencyInjection
;
namespace
Breeze.Api
namespace
Breeze.Api
{
{
public
class
Program
public
class
Program
{
{
public
static
void
Main
(
string
[]
args
)
public
static
void
Main
(
string
[]
args
)
{
Initialize
();
}
public
static
void
Initialize
(
IEnumerable
<
ServiceDescriptor
>
services
=
null
)
{
{
var
host
=
new
WebHostBuilder
()
var
host
=
new
WebHostBuilder
()
.
UseKestrel
()
.
UseKestrel
()
.
UseContentRoot
(
Directory
.
GetCurrentDirectory
())
.
UseContentRoot
(
Directory
.
GetCurrentDirectory
())
.
UseIISIntegration
()
.
UseIISIntegration
()
.
ConfigureServices
(
collection
=>
{
if
(
services
==
null
)
{
return
;
}
foreach
(
var
service
in
services
)
{
collection
.
Add
(
service
);
}
})
.
UseStartup
<
Startup
>()
.
UseStartup
<
Startup
>()
.
Build
();
.
Build
();
...
...
Breeze/src/Breeze.Api/Startup.cs
View file @
136bc94a
...
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Hosting;
...
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Hosting;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Breeze.Wallet.Wrappers
;
namespace
Breeze.Api
namespace
Breeze.Api
{
{
...
@@ -27,11 +26,8 @@ namespace Breeze.Api
...
@@ -27,11 +26,8 @@ namespace Breeze.Api
// Add framework services.
// Add framework services.
services
.
AddMvc
()
services
.
AddMvc
()
// add serializers for NBitcoin objects
// add serializers for NBitcoin objects
.
AddJsonOptions
(
options
=>
NBitcoin
.
JsonConverters
.
Serializer
.
RegisterFrontConverters
(
options
.
SerializerSettings
));
.
AddJsonOptions
(
options
=>
NBitcoin
.
JsonConverters
.
Serializer
.
RegisterFrontConverters
(
options
.
SerializerSettings
))
.
AddControllers
(
services
);
// add DI classes for controllers.
services
.
AddTransient
<
ISafeWrapper
,
SafeWrapper
>();
services
.
AddTransient
<
ITrackerWrapper
,
TrackerWrapper
>();
}
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...
...
Breeze/src/Breeze.Api/project.json
View file @
136bc94a
{
{
"dependencies"
:
{
"dependencies"
:
{
"Breeze.Wallet"
:
"1.0.0-*"
,
"Microsoft.AspNetCore.Mvc"
:
"1.1.2"
,
"Microsoft.AspNetCore.Mvc"
:
"1.1.2"
,
"Microsoft.AspNetCore.Routing"
:
"1.1.1"
,
"Microsoft.AspNetCore.Routing"
:
"1.1.1"
,
"Microsoft.AspNetCore.Server.IISIntegration"
:
"1.1.1"
,
"Microsoft.AspNetCore.Server.IISIntegration"
:
"1.1.1"
,
...
@@ -8,6 +7,7 @@
...
@@ -8,6 +7,7 @@
"Microsoft.Extensions.Configuration.EnvironmentVariables"
:
"1.1.1"
,
"Microsoft.Extensions.Configuration.EnvironmentVariables"
:
"1.1.1"
,
"Microsoft.Extensions.Configuration.FileExtensions"
:
"1.1.1"
,
"Microsoft.Extensions.Configuration.FileExtensions"
:
"1.1.1"
,
"Microsoft.Extensions.Configuration.Json"
:
"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"
:
"1.1.1"
,
"Microsoft.Extensions.Logging.Console"
:
"1.1.1"
,
"Microsoft.Extensions.Logging.Console"
:
"1.1.1"
,
"Microsoft.Extensions.Logging.Debug"
:
"1.1.1"
,
"Microsoft.Extensions.Logging.Debug"
:
"1.1.1"
,
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
"Microsoft.NETCore.App"
:
"1.1.0"
,
"Microsoft.NETCore.App"
:
"1.1.0"
,
"NBitcoin"
:
"3.0.2.10"
,
"NBitcoin"
:
"3.0.2.10"
,
"Stratis.Bitcoin"
:
"1.0.1.2-alpha"
,
"Stratis.Bitcoin"
:
"1.0.1.2-alpha"
,
"System.Reactive"
:
"3.1.1"
"System.Reactive"
:
"3.1.1"
,
"System.Runtime.Loader"
:
"4.3.0"
},
},
"tools"
:
{
"tools"
:
{
...
@@ -34,7 +35,6 @@
...
@@ -34,7 +35,6 @@
"buildOptions"
:
{
"buildOptions"
:
{
"emitEntryPoint"
:
true
,
"emitEntryPoint"
:
true
,
"preserveCompilationContext"
:
true
"preserveCompilationContext"
:
true
},
},
"runtimeOptions"
:
{
"runtimeOptions"
:
{
...
...
Breeze/src/Breeze.Deamon/Program.cs
View file @
136bc94a
...
@@ -5,6 +5,7 @@ using Stratis.Bitcoin;
...
@@ -5,6 +5,7 @@ using Stratis.Bitcoin;
using
Stratis.Bitcoin.Builder
;
using
Stratis.Bitcoin.Builder
;
using
Stratis.Bitcoin.Configuration
;
using
Stratis.Bitcoin.Configuration
;
using
Stratis.Bitcoin.Logging
;
using
Stratis.Bitcoin.Logging
;
using
Breeze.Wallet
;
namespace
Breeze.Deamon
namespace
Breeze.Deamon
{
{
...
@@ -18,7 +19,7 @@ namespace Breeze.Deamon
...
@@ -18,7 +19,7 @@ namespace Breeze.Deamon
var
node
=
(
FullNode
)
new
FullNodeBuilder
()
var
node
=
(
FullNode
)
new
FullNodeBuilder
()
.
UseNodeSettings
(
nodeSettings
)
.
UseNodeSettings
(
nodeSettings
)
//
.UseWallet()
.
UseWallet
()
.
UseApi
()
.
UseApi
()
//.UseBlockNotification()
//.UseBlockNotification()
.
Build
();
.
Build
();
...
...
Breeze/src/Breeze.
Api
/Controllers/SafeController.cs
→
Breeze/src/Breeze.
Wallet
/Controllers/SafeController.cs
View file @
136bc94a
...
@@ -4,11 +4,12 @@ using System.Linq;
...
@@ -4,11 +4,12 @@ using System.Linq;
using
System.Net
;
using
System.Net
;
using
System.Security
;
using
System.Security
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
Breeze.
Api
.Models
;
using
Breeze.
Wallet
.Models
;
using
Breeze.Wallet.Wrappers
;
using
Breeze.Wallet.Wrappers
;
using
Stratis.Bitcoin
;
namespace
Breeze.
Api
.Controllers
namespace
Breeze.
Wallet
.Controllers
{
{
[
Route
(
"api/[controller]"
)]
[
Route
(
"api/[controller]"
)]
public
class
SafeController
:
Controller
public
class
SafeController
:
Controller
...
...
Breeze/src/Breeze.
Api
/Models/SafeCreation.cs
→
Breeze/src/Breeze.
Wallet
/Models/SafeCreation.cs
View file @
136bc94a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations
;
namespace
Breeze.
Api
.Models
namespace
Breeze.
Wallet
.Models
{
{
/// <summary>
/// <summary>
/// Object used to create a new wallet
/// Object used to create a new wallet
...
...
Breeze/src/Breeze.Wallet/WalletFeature.cs
0 → 100644
View file @
136bc94a
using
Stratis.Bitcoin.Builder.Feature
;
using
Breeze.Wallet.Controllers
;
using
Breeze.Wallet.Wrappers
;
using
Microsoft.Extensions.DependencyInjection
;
using
Stratis.Bitcoin.Builder
;
namespace
Breeze.Wallet
{
public
class
WalletFeature
:
FullNodeFeature
{
public
override
void
Start
()
{
}
}
public
static
class
WalletFeatureExtension
{
public
static
IFullNodeBuilder
UseWallet
(
this
IFullNodeBuilder
fullNodeBuilder
)
{
fullNodeBuilder
.
ConfigureFeature
(
features
=>
{
features
.
AddFeature
<
WalletFeature
>()
.
FeatureServices
(
services
=>
{
services
.
AddTransient
<
ISafeWrapper
,
SafeWrapper
>();
services
.
AddTransient
<
ITrackerWrapper
,
TrackerWrapper
>();
services
.
AddSingleton
<
SafeController
>();
});
});
return
fullNodeBuilder
;
}
}
}
Breeze/src/Breeze.Wallet/project.json
View file @
136bc94a
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
"dependencies"
:
{
"dependencies"
:
{
"HBitcoin"
:
"0.1.5"
,
"HBitcoin"
:
"0.1.5"
,
"NBitcoin"
:
"3.0.2.10"
,
"NBitcoin"
:
"3.0.2.10"
,
"NETStandard.Library"
:
"1.6.1"
"NETStandard.Library"
:
"1.6.1"
,
"Stratis.Bitcoin"
:
"1.0.1.2-alpha"
},
},
"frameworks"
:
{
"frameworks"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment