Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata + Events / Extrinsics / Blocks database integration #37

Merged
merged 34 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fb8a014
Add block search + light event handler refacto
Apolixit Jul 7, 2024
7e10109
Add Cache + EraStakers unit tests
Apolixit Jul 8, 2024
20fa831
Bump Polkadot version to v1002006
Apolixit Jul 9, 2024
8701e6d
WIP block detail page
Apolixit Jul 9, 2024
7feba2c
Save extrinsics into database + move save events into domain
Apolixit Jul 17, 2024
3d497ab
Add search extrinsics module + use case
Apolixit Jul 18, 2024
d563bad
WIP Extrinsics decode. Need a hard metadata refactoring. Let's go
Apolixit Jul 20, 2024
3588762
WIP Metadata < v14
Apolixit Aug 3, 2024
e2c6fa0
WIP MetadataService + Update nuget packages
Apolixit Sep 15, 2024
20df3c2
Adapt some storage mapping (BabeStorage)
Apolixit Sep 16, 2024
1ef4c48
Metadata refacto + fox unit test
Apolixit Sep 27, 2024
62fcb0b
Add PeopleChain to the project.
Apolixit Sep 28, 2024
beb4cb3
Refacto Polkadot & PeopleChain to avoid duplicated code
Apolixit Sep 29, 2024
6bfbfb9
Start to fetch PeopleChain events
Apolixit Oct 2, 2024
a80ee0c
Remove IBlockchainMapping and keep mapper project by project
Apolixit Oct 5, 2024
812249a
Update namespaces + fix FindNode with DomainMapping attribute
Apolixit Oct 6, 2024
7ee478a
Move Substrate decode service into Infrastructure to handle unmapped …
Apolixit Oct 8, 2024
2ca68e3
Make all decode function asyncrhonous
Apolixit Oct 10, 2024
4d11ca6
Fix decode node + start convert node to json
Apolixit Oct 12, 2024
84c316b
Adapt code for CheckMetadataHash (old and new version)
Apolixit Oct 16, 2024
c373154
Update create method on NET.API.Ext + fix most of the unit tests
Apolixit Oct 22, 2024
e29edca
Fix unit test. Now need to fix events
Apolixit Oct 23, 2024
91d76cb
Add forked NET.API
Apolixit Oct 23, 2024
74f764e
Save failed events in database (if not correctly decoded by NetApiExt…
Apolixit Oct 23, 2024
ebaa6e6
Cleanup and fix Sonar issues
Apolixit Oct 24, 2024
7bfe24f
Fix GetValidators + ToJsonCompact from node + cleaning
Apolixit Oct 24, 2024
1caa180
Refined Events / Extrinsics / Block use case. Add some metrics.
Apolixit Oct 24, 2024
7b2e8c9
Improve SavedEventsHandler performance + add Id generated key for dat…
Apolixit Oct 25, 2024
81ebded
Light refacto ValidationPipelineBehaviour + Staking & Version worker
Apolixit Oct 26, 2024
368923f
Update licence to MIT for each project
Apolixit Oct 27, 2024
46cc551
Fix existing data when re-run worker + add unit tests + fix sonar lint
Apolixit Oct 29, 2024
f61bb48
Handle connection & deconnection for blockchain dependencies automati…
Apolixit Oct 31, 2024
5a89794
Remove uncessary pallets and add unit test
Apolixit Oct 31, 2024
b9f5306
Update maintenance page
Apolixit Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ jobs:

- name: Publish Test Results
uses: dorny/test-reporter@v1
if: success()
if: always()
with:
name: Polkanalysis Tests
name: Test results
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
28 changes: 21 additions & 7 deletions Polkanalysis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Architecture.T
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Infrastructure.Blockchain.Contracts", "src\Infrastructure\Polkanalysis.Infrastructure.Blockchain.Contracts\Polkanalysis.Infrastructure.Blockchain.Contracts.csproj", "{7331F10F-D1E9-4F9D-BBCB-358BCB32F839}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Infrastructure.Blockchain.Internal", "src\Infrastructure\Polkanalysis.Infrastructure.Blockchain.Internal\Polkanalysis.Infrastructure.Blockchain.Internal.csproj", "{F1C68243-94C5-40BC-AA17-9315E751E7FF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.App", "src\Applications\Polkanalysis.App\Polkanalysis.App.csproj", "{A35CD5A4-9FA6-4268-98C7-8B903A8FD6D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Common", "src\Core\Polkanalysis.Common\Polkanalysis.Common.csproj", "{5E9ABA92-90D8-4E6D-BEBB-195B9AACF267}"
Expand All @@ -103,6 +101,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Abstract.Tests
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Api.Service", "src\Applications\Polkanalysis.Api.Service\Polkanalysis.Api.Service.csproj", "{4C9408BE-8B70-4E51-A777-0D1A4D934902}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Infrastructure.Blockchain.PeopleChain", "src\Infrastructure\Polkanalysis.Infrastructure.Blockchain.PeopleChain\Polkanalysis.Infrastructure.Blockchain.PeopleChain.csproj", "{900C47DE-07A5-4225-8963-A8E70EE3778E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polkanalysis.Infrastructure.Blockchain.Polkadot", "src\Infrastructure\Polkanalysis.Infrastructure.Blockchain.Polkadot\Polkanalysis.Infrastructure.Blockchain.Polkadot.csproj", "{6F562625-8390-47DF-81C3-FF8092A950C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Substrate.NetApi", "src\Infrastructure\Substrate.NetApi\Substrate.NetApi.csproj", "{EA9B046C-23EB-42AF-8E99-2BD8FED9CA07}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -205,10 +209,6 @@ Global
{7331F10F-D1E9-4F9D-BBCB-358BCB32F839}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7331F10F-D1E9-4F9D-BBCB-358BCB32F839}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7331F10F-D1E9-4F9D-BBCB-358BCB32F839}.Release|Any CPU.Build.0 = Release|Any CPU
{F1C68243-94C5-40BC-AA17-9315E751E7FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1C68243-94C5-40BC-AA17-9315E751E7FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1C68243-94C5-40BC-AA17-9315E751E7FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1C68243-94C5-40BC-AA17-9315E751E7FF}.Release|Any CPU.Build.0 = Release|Any CPU
{A35CD5A4-9FA6-4268-98C7-8B903A8FD6D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A35CD5A4-9FA6-4268-98C7-8B903A8FD6D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A35CD5A4-9FA6-4268-98C7-8B903A8FD6D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -233,6 +233,18 @@ Global
{4C9408BE-8B70-4E51-A777-0D1A4D934902}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C9408BE-8B70-4E51-A777-0D1A4D934902}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C9408BE-8B70-4E51-A777-0D1A4D934902}.Release|Any CPU.Build.0 = Release|Any CPU
{900C47DE-07A5-4225-8963-A8E70EE3778E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{900C47DE-07A5-4225-8963-A8E70EE3778E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{900C47DE-07A5-4225-8963-A8E70EE3778E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{900C47DE-07A5-4225-8963-A8E70EE3778E}.Release|Any CPU.Build.0 = Release|Any CPU
{6F562625-8390-47DF-81C3-FF8092A950C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F562625-8390-47DF-81C3-FF8092A950C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F562625-8390-47DF-81C3-FF8092A950C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F562625-8390-47DF-81C3-FF8092A950C2}.Release|Any CPU.Build.0 = Release|Any CPU
{EA9B046C-23EB-42AF-8E99-2BD8FED9CA07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA9B046C-23EB-42AF-8E99-2BD8FED9CA07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA9B046C-23EB-42AF-8E99-2BD8FED9CA07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA9B046C-23EB-42AF-8E99-2BD8FED9CA07}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -267,12 +279,14 @@ Global
{3643934D-6D4A-498E-811E-FCA72BA3D2DF} = {95DEEDB4-3C7D-4D06-9A97-CC16D7721152}
{4BDA2D65-B730-407E-A6ED-12B3F8A840C5} = {F54F8885-056B-4991-8E99-518851FC9CCF}
{7331F10F-D1E9-4F9D-BBCB-358BCB32F839} = {06CE1338-7D1F-4CA5-9936-65C31CED0F95}
{F1C68243-94C5-40BC-AA17-9315E751E7FF} = {06CE1338-7D1F-4CA5-9936-65C31CED0F95}
{A35CD5A4-9FA6-4268-98C7-8B903A8FD6D6} = {CB427406-E3C9-402D-9C25-F35C450D7D2C}
{5E9ABA92-90D8-4E6D-BEBB-195B9AACF267} = {F8743F78-109F-4E69-BA71-02047B4BB2D6}
{81F9AC86-D103-4A5B-BCA6-8C4759A4B1E7} = {F54F8885-056B-4991-8E99-518851FC9CCF}
{667DD5A6-9F0C-4049-9C6E-BAABDB7C3941} = {F54F8885-056B-4991-8E99-518851FC9CCF}
{4C9408BE-8B70-4E51-A777-0D1A4D934902} = {CB427406-E3C9-402D-9C25-F35C450D7D2C}
{900C47DE-07A5-4225-8963-A8E70EE3778E} = {06CE1338-7D1F-4CA5-9936-65C31CED0F95}
{6F562625-8390-47DF-81C3-FF8092A950C2} = {06CE1338-7D1F-4CA5-9936-65C31CED0F95}
{EA9B046C-23EB-42AF-8E99-2BD8FED9CA07} = {F8743F78-109F-4E69-BA71-02047B4BB2D6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {31C4F337-85EF-42F2-9358-F402619BBAE7}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.5.0" />
<None Include="..\..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.6.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
Expand Down
15 changes: 12 additions & 3 deletions src/Applications/Polkanalysis.Api/Polkanalysis.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<DockerfileContext>..\..\..</DockerfileContext>
<SonarQubeExclude>true</SonarQubeExclude>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.9.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
Expand All @@ -23,10 +31,10 @@
<PackageReference Include="prometheus-net" Version="8.2.1" />
<PackageReference Include="prometheus-net.AspNetCore" Version="8.2.1" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="10.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.1" />
</ItemGroup>

Expand All @@ -35,6 +43,7 @@
<ProjectReference Include="..\..\Core\Polkanalysis.Configuration.Extensions\Polkanalysis.Configuration.Extensions.csproj" />
<ProjectReference Include="..\..\Domain\Polkanalysis.Domain.Contracts\Polkanalysis.Domain.Contracts.csproj" />
<ProjectReference Include="..\..\Domain\Polkanalysis.Domain\Polkanalysis.Domain.csproj" />
<ProjectReference Include="..\..\Infrastructure\Polkanalysis.Infrastructure.Blockchain.Polkadot\Polkanalysis.Infrastructure.Blockchain.Polkadot.csproj" />
<ProjectReference Include="..\..\Infrastructure\Polkanalysis.Infrastructure.Blockchain\Polkanalysis.Infrastructure.Blockchain.csproj" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/Applications/Polkanalysis.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

using Microsoft.EntityFrameworkCore;
using Polkanalysis.Domain.Contracts.Secondary;
using Polkanalysis.Domain.Runtime;
using Serilog;
using Polkanalysis.Configuration.Extensions;
using Polkanalysis.Infrastructure.Blockchain.Polkadot.Repository;
using Polkanalysis.Api.Services;
using Polkanalysis.Domain.Service;
using Polkanalysis.Infrastructure.Database;
using Microsoft.AspNetCore.RateLimiting;
using System.Text.Json.Serialization;
using Polkanalysis.Infrastructure.Blockchain.Contracts;
using Serilog.Extensions.Logging;
using Polkanalysis.Infrastructure.Database.Extensions;
using Polkanalysis.Common.Monitoring.Opentelemetry;
using Polkanalysis.Infrastructure.Blockchain.Polkadot;
using Polkanalysis.Infrastructure.Blockchain.Runtime;

namespace Polkanalysis.Api
{
Expand Down Expand Up @@ -54,12 +53,13 @@ public async static Task Main(string[] args)
});

// For the API, we register Polkadot as singleton
builder.Services.AddPolkadotBlockchain("polkadot", registerAsSingleton: true);
builder.Services.AddSubstrateBlockchain("polkadot", registerAsSingleton: true);
builder.Services.AddHttpClient();
builder.Services.AddEndpoint(builder.Configuration, registerAsSingleton: true);
builder.Services.AddSubstrateService();
builder.Services.AddDatabase();
builder.Services.AddSubstrateLogic();
builder.Services.AddSubstrateNodeBuilder();
builder.Services.AddMediatRAndPipelineBehaviors();

builder.Services.AddCors(options =>
Expand Down Expand Up @@ -144,7 +144,7 @@ public async static Task Main(string[] args)
await app.ApplyMigrationAsync(microsftLogger);

var substrateService = app.Services.GetRequiredService<ISubstrateService>();
await substrateService.ConnectAsync();
await substrateService.ConnectAsync(CancellationToken.None);
if (substrateService.IsConnected())
{
microsftLogger.LogInformation($"Polkanalysis.API is now connected to {substrateService.BlockchainName} and ready to serve.");
Expand Down
2 changes: 1 addition & 1 deletion src/Applications/Polkanalysis.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"SubstrateDb": ""
},
"SubstrateEndpoint": {
"Endpoint": "wss://polkadot-rpc.dwellir.com",
"Endpoint": "wss://dot-rpc.stakeworld.io",
"Name": "Polkadot"
},
"Monitoring": {
Expand Down
16 changes: 13 additions & 3 deletions src/Applications/Polkanalysis.App/Polkanalysis.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.9.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
Expand All @@ -16,19 +24,21 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.7.2" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter" Version="4.7.2" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.7.2" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="10.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Core\Polkanalysis.Common\Polkanalysis.Common.csproj" />
<ProjectReference Include="..\..\Core\Polkanalysis.Configuration.Extensions\Polkanalysis.Configuration.Extensions.csproj" />
<ProjectReference Include="..\..\Domain\Polkanalysis.Domain.Contracts\Polkanalysis.Domain.Contracts.csproj" />
<ProjectReference Include="..\..\Domain\Polkanalysis.Domain\Polkanalysis.Domain.csproj" />
<ProjectReference Include="..\..\Infrastructure\Polkanalysis.Infrastructure.Blockchain.Polkadot\Polkanalysis.Infrastructure.Blockchain.Polkadot.csproj" />
<ProjectReference Include="..\..\Infrastructure\Polkanalysis.Infrastructure.Blockchain\Polkanalysis.Infrastructure.Blockchain.csproj" />
<ProjectReference Include="..\Polkanalysis.Components\Polkanalysis.Components.csproj" />
</ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/Applications/Polkanalysis.App/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Polkanalysis.Components.Services.Http;
using Polkanalysis.Configuration.Extensions;
using Polkanalysis.Infrastructure.Blockchain.Polkadot.Repository;
using Polkanalysis.Infrastructure.Blockchain.Polkadot;
using Polkanalysis.Domain.Runtime;
using Polkanalysis.WebApp.Services;
using Microsoft.EntityFrameworkCore;
Expand All @@ -14,7 +14,7 @@
using ApexCharts;
using Polkanalysis.Common.Monitoring.Opentelemetry;
using Microsoft.FluentUI.AspNetCore.Components.Components.Tooltip;
using static Azure.Core.HttpHeader;
using Polkanalysis.Infrastructure.Blockchain.Runtime;

var builder = WebApplication.CreateBuilder(args);

Expand All @@ -37,13 +37,16 @@
builder.Services.AddScoped<IApiService, ApiService>();
builder.Services.AddScoped<ITooltipService, TooltipService>();

builder.Services.AddPolkadotBlockchain("polkadot");
builder.Services.AddSubstrateBlockchain("polkadot");
builder.Services.AddEndpoint(builder.Configuration);
builder.Services.AddSubstrateService();
builder.Services.AddSubstrateLogic();
builder.Services.AddSubstrateNodeBuilder();
builder.Services.AddMediatRAndPipelineBehaviors();
builder.Services.AddDatabase();

builder.Services.AddDataGridEntityFrameworkAdapter();

builder.Services.AddOpentelemetry(microsoftLogger, "Polkanalysis.App");

// Add services to the container.
Expand Down
2 changes: 1 addition & 1 deletion src/Applications/Polkanalysis.App/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"SubstrateDb": ""
},
"SubstrateEndpoint": {
"Endpoint": "wss://polkadot-rpc.dwellir.com",
"Endpoint": "wss://dot-rpc.stakeworld.io",
"Name": "Polkadot"
},
"Api": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<Using Include="Bunit" />
<Using Include="Bunit.TestDoubles" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
protected override void OnInitialized()
{
SelectedOperator = optionsSelector.First(x => x.Value == Operator.Equal);

if (Value is null)
{
Value = new NumberCriteria<TFilter> { Operator = SelectedOperator.Value };
}
}

public void OnInputChanged(ChangeEventArgs e, Action<TFilter?> action)
Expand Down Expand Up @@ -62,6 +67,18 @@
}
}

protected virtual void ResetFilters()
{
SelectedOperator = optionsSelector.First(x => x.Value == Operator.Equal);

Value!.Value = default!;
Value!.Value2 = default!;
Value.Operator = SelectedOperator.Value;

displaySecondField = false;
ValueChanged.InvokeAsync(Value);
}

protected virtual void OnInternalValueChanged(TFilter? value)
{
if (value is null) Value = null;
Expand All @@ -78,6 +95,22 @@
ValueChanged.InvokeAsync(Value);
}

protected virtual void HandleClear()
{
if (Value is null || string.IsNullOrEmpty(Value.Value.ToString()))
{
Value!.Value = default!;
}
}

protected virtual void HandleClear2()
{
if (Value is null || string.IsNullOrEmpty(Value.Value2!.ToString()))
{
Value!.Value2 = default;
}
}

protected static List<Option<Operator>> optionsSelector = new()
{
{ new Option<Operator> { Value = Operator.LowerStrict, Text = "<" } },
Expand Down
Loading
Loading