Skip to content

Commit

Permalink
Unity3d API feature (#569)
Browse files Browse the repository at this point in the history
* Added unity3d api feature

* disable other controllers on unity api

* add methods to unity api controller

* cleanup

* Cleanup and added api method

* more cleanup

* provide UTXOs for address

* added sat value to utxos output

* add sendtx endpoint

* changed api return types for nswagger

* upd controller

* cleanup

* added api method

* fix per review

* Update src/Stratis.Features.Unity3dApi/Controllers/Unity3dController.cs

Co-authored-by: zeptin <zeptin@gmail.com>

* fixes per review

Co-authored-by: zeptin <zeptin@gmail.com>
  • Loading branch information
2 people authored and fassadlr committed Aug 9, 2021
1 parent 5707133 commit 45e9a3e
Show file tree
Hide file tree
Showing 17 changed files with 1,108 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static OpenApiInfo CreateInfoForApiVersion(ApiVersionDescription description)
{
Title = "Stratis Node API",
Version = description.ApiVersion.ToString(),
Description = "Access to the Stratis Node's core features."
Description = "Access to the Stratis Node's api."
};

if (info.Version.Contains("dev"))
Expand Down
17 changes: 14 additions & 3 deletions src/Stratis.Bitcoin.Features.Api/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Builder;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -83,7 +85,17 @@ public void ConfigureServices(IServiceCollection services)
.AddNewtonsoftJson(options => {
Utilities.JsonConverters.Serializer.RegisterFrontConverters(options.SerializerSettings);
})
.AddControllers(this.fullNode.Services.Features, services);
.AddControllers(this.fullNode.Services.Features, services)
.ConfigureApplicationPartManager(a =>
{
foreach (ApplicationPart appPart in a.ApplicationParts.ToList())
{
if (appPart.Name != "Stratis.Features.Unity3dApi")
continue;
a.ApplicationParts.Remove(appPart);
}
});

// Enable API versioning.
// Note much of this is borrowed from https://github.com/microsoft/aspnet-api-versioning/blob/master/samples/aspnetcore/SwaggerSample/Startup.cs
Expand Down Expand Up @@ -114,7 +126,6 @@ public void ConfigureServices(IServiceCollection services)
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("contracts", new OpenApiInfo { Title = "Contract API", Version = "1" });
});
services.AddSwaggerGenNewtonsoftSupport(); // Use Newtonsoft JSON serializer with swagger. Needs to be placed after AddSwaggerGen()

Expand Down
2 changes: 2 additions & 0 deletions src/Stratis.CirrusD/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Stratis.Features.Collateral.CounterChain;
using Stratis.Features.Diagnostic;
using Stratis.Features.SQLiteWalletRepository;
using Stratis.Features.Unity3dApi;
using Stratis.Sidechains.Networks;

namespace Stratis.CirrusD
Expand Down Expand Up @@ -77,6 +78,7 @@ private static IFullNode GetSideChainFullNode(NodeSettings nodeSettings)
.UseSmartContractWallet()
.AddSQLiteWalletRepository()
.UseApi()
.UseUnity3dApi()
.AddRPC()
.AddSignalR(options =>
{
Expand Down
1 change: 1 addition & 0 deletions src/Stratis.CirrusD/Stratis.CirrusD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ProjectReference Include="..\Stratis.Features.Diagnostic\Stratis.Features.Diagnostic.csproj" />
<ProjectReference Include="..\Stratis.Features.FederatedPeg\Stratis.Features.FederatedPeg.csproj" />
<ProjectReference Include="..\Stratis.Features.SQLiteWalletRepository\Stratis.Features.SQLiteWalletRepository.csproj" />
<ProjectReference Include="..\Stratis.Features.Unity3dApi\Stratis.Features.Unity3dApi.csproj" />
<ProjectReference Include="..\Stratis.Sidechains.Networks\Stratis.Sidechains.Networks.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 45e9a3e

Please sign in to comment.