Skip to content

Commit

Permalink
revert options
Browse files Browse the repository at this point in the history
  • Loading branch information
vobradovich committed Nov 27, 2024
1 parent 5a66889 commit c003c76
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
1 change: 0 additions & 1 deletion net/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<PackageVersion Include="Ensure.That" Version="10.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.11.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
<PackageVersion Include="Substrate.NET.API" Version="0.9.23" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
Expand Down
1 change: 0 additions & 1 deletion net/src/Sails.Net/Sails.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
<!-- Sails.Remoting.Abstractions -->
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Options" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 3 additions & 4 deletions net/src/Sails.Remoting/Core/NodeClientProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Threading;
using System.Threading.Tasks;
using EnsureThat;
using Microsoft.Extensions.Options;
using Sails.Remoting.Options;
using Substrate.Gear.Api.Generated;
using Substrate.NetApi.Model.Extrinsics;
Expand All @@ -11,12 +10,12 @@ namespace Sails.Remoting.Core;

internal sealed class NodeClientProvider : IDisposable, INodeClientProvider
{
public NodeClientProvider(IOptions<NodeClientOptions> options)
public NodeClientProvider(NodeClientOptions options)
{
EnsureArg.IsNotNull(options, nameof(options));
EnsureArg.IsNotNull(options.Value.GearNodeUri, nameof(options.Value.GearNodeUri));
EnsureArg.IsNotNull(options.GearNodeUri, nameof(options.GearNodeUri));

this.nodeClient = new SubstrateClientExt(options.Value.GearNodeUri, ChargeTransactionPayment.Default());
this.nodeClient = new SubstrateClientExt(options.GearNodeUri, ChargeTransactionPayment.Default());
}

private readonly SubstrateClientExt nodeClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using EnsureThat;
using EnsureThat;
using Microsoft.Extensions.DependencyInjection;
using Sails.Remoting.Abstractions.Core;
using Sails.Remoting.Core;
Expand All @@ -11,13 +10,12 @@ public static class ServiceCollectionExtensions
{
public static IServiceCollection AddRemotingViaNodeClient(
this IServiceCollection services,
Action<NodeClientOptions> configure)
NodeClientOptions options)
{
EnsureArg.IsNotNull(services, nameof(services));
EnsureArg.IsNotNull(configure, nameof(configure));
EnsureArg.IsNotNull(options, nameof(options));

var serviceCollection = services.Configure(configure);
services.AddSingleton<INodeClientProvider, NodeClientProvider>();
services.AddSingleton<INodeClientProvider>(_ => new NodeClientProvider(options));

services.AddTransient<IRemotingProvider>(
serviceProvicer => new RemotingProvider(
Expand Down
2 changes: 1 addition & 1 deletion net/src/Sails.Remoting/Options/NodeClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ namespace Sails.Remoting.Options;

public sealed record NodeClientOptions
{
public Uri? GearNodeUri { get; set; }
public Uri? GearNodeUri { get; init; }
}
1 change: 0 additions & 1 deletion net/src/Sails.Remoting/Sails.Remoting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="PolySharp">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down

0 comments on commit c003c76

Please sign in to comment.