Skip to content

Commit 3b2bb0d

Browse files
authored
Next ver 063 (#79)
* added integration * updated to include draft for boilerplate * fix
1 parent 5ef2075 commit 3b2bb0d

File tree

14 files changed

+1195
-37
lines changed

14 files changed

+1195
-37
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Using a terminal of your choice, create a new directory for your project and exe
5656
```sh
5757
dotnet new sln
5858
dotnet new substrate \
59-
--sdk_version 0.6.2 \
59+
--sdk_version 0.6.3 \
6060
--rest_service PROJECTNAME.RestService \
6161
--net_api PROJECTNAME.NetApiExt \
6262
--net_integration PROJECTNAME.Integration \
@@ -127,7 +127,7 @@ You can also watch our short step-by-step tutorial that guides you through the e
127127
- AstarNET
128128
```sh
129129
dotnet new substrate \
130-
--sdk_version 0.6.2 \
130+
--sdk_version 0.6.3 \
131131
--rest_service AstarNET.RestService \
132132
--net_api AstarNET.NetApiExt \
133133
--net_api AstarNET.Integration \

Tools/Substrate.DotNet.Template/templates/Substrate/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"symbols": {
1313
"sdk_version": {
1414
"datatype": "string",
15-
"defaultValue": "0.6.2",
15+
"defaultValue": "0.6.3",
1616
"description": "Uses the given Substrate .NET Toolchain version.",
1717
"replaces": "SUBSTRATE_TOOLCHAIN_VERSION",
1818
"type": "parameter"

Tools/Substrate.DotNet/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ private static async Task<bool> UpgradeOrUpdateSubstrateEnvironmentAsync(bool fe
174174
// Client
175175
GenerateRestClientClasses(configuration);
176176

177+
// Integration
178+
GenerateIntegrationClasses(metadata, configuration);
179+
177180
return true;
178181
}
179182

@@ -319,7 +322,7 @@ private static void GenerateNetApiClasses(MetaData metadata, SubstrateConfigurat
319322
/// <param name="configuration"></param>
320323
private static void GenerateIntegrationClasses(MetaData metadata, SubstrateConfiguration configuration)
321324
{
322-
var generator = new IntegrationGenerator(Log.Logger, configuration.Metadata.Runtime, new ProjectSettings(configuration.Projects.NetApi));
325+
var generator = new IntegrationGenerator(Log.Logger, configuration.Metadata.Runtime, new ProjectSettings(configuration.Projects.Integration));
323326
generator.Generate(metadata);
324327
}
325328

Tools/Substrate.DotNet/Service/Generators/IntegrationGenerator.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,44 @@ namespace Substrate.DotNet.Service.Generators
1111
/// </summary>
1212
public class IntegrationGenerator : SolutionGeneratorBase
1313
{
14+
private readonly string _nodeRuntime;
1415
private readonly ProjectSettings _projectSettings;
1516

1617
public IntegrationGenerator(ILogger logger, string nodeRuntime, ProjectSettings projectSettings) : base(logger, nodeRuntime, projectSettings.ProjectName)
1718
{
19+
_nodeRuntime = nodeRuntime;
1820
_projectSettings = projectSettings;
1921
}
2022

2123
protected override void GenerateClasses(MetaData metadata)
2224
{
23-
GetGenericStructs(metadata.NodeMetadata.Types);
25+
GenerateIntegration(metadata.NodeMetadata.Modules, metadata);
2426
}
2527

26-
}
28+
private void GenerateIntegration(Dictionary<uint, PalletModule> modules, MetaData metadata)
29+
{
30+
List<string> modulesResolved = new();
31+
foreach (PalletModule module in modules.Values) { }
32+
33+
BaseClientBuilder
34+
.Init(_projectSettings.ProjectName, 0, modulesResolved, null, metadata).Create()
35+
.Build(write: true, out bool _, _projectSettings.ProjectDirectory);
36+
37+
ExtrinsicManagerBuilder
38+
.Init(_projectSettings.ProjectName, 0, modulesResolved, null).Create()
39+
.Build(write: true, out bool _, _projectSettings.ProjectDirectory);
40+
41+
ExtrinsicInfoBuilder
42+
.Init(_projectSettings.ProjectName, 0, modulesResolved, null, metadata, _nodeRuntime).Create()
43+
.Build(write: true, out bool _, _projectSettings.ProjectDirectory);
44+
45+
SubscriptionManagerBuilder
46+
.Init(_projectSettings.ProjectName, 0, modulesResolved, null).Create()
47+
.Build(write: true, out bool _, _projectSettings.ProjectDirectory);
48+
49+
GenericHelperBuilder
50+
.Init(_projectSettings.ProjectName, 0, modulesResolved, null).Create()
51+
.Build(write: true, out bool _, _projectSettings.ProjectDirectory);
52+
}
53+
}
2754
}

Tools/Substrate.DotNet/Service/Generators/NetApiGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Substrate.NetApi.Model.Meta;
44
using Serilog;
55
using System.Collections.Generic;
6+
using System;
67

78
namespace Substrate.DotNet.Service.Generators
89
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.CodeDom;
2+
using System.Collections.Generic;
3+
4+
namespace Substrate.DotNet.Service.Node.Base
5+
{
6+
public abstract class IntegrationBuilderBase : BuilderBase
7+
{
8+
public List<string> ModuleNames { get; }
9+
public string NetApiExtProject { get; private set; }
10+
11+
public IntegrationBuilderBase(string projectName, uint id, List<string> moduleNames, NodeTypeResolver typeDict)
12+
: base(projectName, id, typeDict)
13+
{
14+
ModuleNames = moduleNames;
15+
NetApiExtProject = ProjectName.Replace("Integration", "NetApiExt");
16+
ImportsNamespace.Imports.Add(new CodeNamespaceImport($"{NetApiExtProject}.Generated"));
17+
}
18+
19+
}
20+
}

0 commit comments

Comments
 (0)