Skip to content

Commit f4b6c87

Browse files
committed
cleanup code and fix tests
1 parent 09b674f commit f4b6c87

26 files changed

Lines changed: 77 additions & 67 deletions

File tree

samples/BlazorApp/Pages/Index.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
@page "/"
2+
@using System.ComponentModel.DataAnnotations
3+
@using Blazored.LocalStorage
24
@using EverscaleNet.Abstract
35
@using EverscaleNet.Client.Models
46
@using EverscaleNet.Models
5-
@using Blazored.LocalStorage
6-
@using System.ComponentModel.DataAnnotations
77

88
<PageTitle>Index</PageTitle>
99

@@ -59,7 +59,7 @@ Welcome to your new everscale app.
5959
ResultOfGetEndpoints result = await EverClient.Net.GetEndpoints();
6060
Endpoints = result.Endpoints;
6161
} catch (EverClientException e) when (e.Code == 14) {
62-
Endpoints = new[] { e.Message };
62+
Endpoints = [e.Message];
6363
}
6464
}
6565

samples/MessageReceiverService/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
builder.ConfigureServices((_, services) => {
66
services.AddHostedService<Worker>();
77
services.AddEverClient(config => {
8-
config.Network.Endpoints = new[] { "http://localhost" };
8+
config.Network.Endpoints = ["http://localhost"];
99
config.Network.WaitForTimeout = 5000;
1010
});
1111
});

samples/MessageSenderService/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
builder.ConfigureServices((_, services) => {
66
services.AddHostedService<Worker>();
77
services.AddEverClient(config => {
8-
config.Network.Endpoints = new[] { "http://localhost" };
8+
config.Network.Endpoints = ["http://localhost"];
99
config.Network.WaitForTimeout = 5000;
1010
});
1111
});

samples/TestingExample/CalculatorInternalTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private async Task<IMultisigAccount> CreateMultisig(decimal coins = 20m) {
3535
KeyPair keyPair = await _everClient.Crypto.GenerateRandomSignKeys();
3636
await multisig.Init(keyPair);
3737
await _giver.SendTransaction(multisig.Address, coins);
38-
await multisig.Deploy(new[] { keyPair.Public }, 1, TimeSpan.FromHours(1));
38+
await multisig.Deploy([keyPair.Public], 1, TimeSpan.FromHours(1));
3939
return multisig;
4040
}
4141

samples/TestingExample/Startup.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,19 @@ public void ConfigureHost(IHostBuilder hostBuilder) {
3232

3333
private static void AddEverClientWithSerilog(IServiceCollection services) {
3434
services.AddOptions();
35-
services.AddSingleton<IConfigureOptions<EverClientOptions>>(
36-
provider => new ConfigureOptions<EverClientOptions>(options => {
37-
string endpoint = provider.GetRequiredService<NodeSeDockerContainer>().Endpoint;
38-
options.Network.Endpoints = new[] { endpoint };
39-
}))
35+
services.AddSingleton<IConfigureOptions<EverClientOptions>>(provider => new ConfigureOptions<EverClientOptions>(options => {
36+
string endpoint = provider.GetRequiredService<NodeSeDockerContainer>().Endpoint;
37+
options.Network.Endpoints = [endpoint];
38+
}))
4039
.AddSingleton<IEverClientAdapter>(provider => {
4140
var optionsAccessor = provider.GetRequiredService<IOptions<EverClientOptions>>();
4241
var output = provider.GetRequiredService<ITestOutputHelperAccessor>();
43-
var loggerFactory = new LoggerFactory(new[] {
42+
var loggerFactory = new LoggerFactory([
4443
new SerilogLoggerProvider(new LoggerConfiguration()
4544
.MinimumLevel.Verbose()
4645
.WriteTo.TestOutput(output.Output)
4746
.CreateLogger(), true)
48-
});
47+
]);
4948
return new EverClientRustAdapter(optionsAccessor, loggerFactory.CreateLogger<EverClientRustAdapter>());
5049
})
5150
.AddTransient<IEverClient, EverClient>()

src/EverscaleNet.Client/ServiceCollectionExtensions.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ public static IServiceCollection AddEverClient(this IServiceCollection services,
5252
Action<IServiceProvider, FilePackageManagerOptions>? configurePackageManagerOptions = null) {
5353
if (configureEverClientOptions != null) {
5454
services.AddOptions();
55-
services.AddSingleton<IConfigureOptions<EverClientOptions>>(
56-
provider => new ConfigureOptions<EverClientOptions>(options => configureEverClientOptions(provider, options)));
55+
services.AddSingleton<IConfigureOptions<EverClientOptions>>(provider => new ConfigureOptions<EverClientOptions>(options => configureEverClientOptions(provider, options)));
5756
}
5857
if (configurePackageManagerOptions != null) {
5958
services.AddOptions();
60-
services.AddSingleton<IConfigureOptions<FilePackageManagerOptions>>(
61-
provider => new ConfigureOptions<FilePackageManagerOptions>(options => configurePackageManagerOptions(provider, options)));
59+
services.AddSingleton<IConfigureOptions<FilePackageManagerOptions>>(provider =>
60+
new ConfigureOptions<FilePackageManagerOptions>(options => configurePackageManagerOptions(provider, options)));
6261
}
6362

6463
return services

src/EverscaleNet.TestSuite/Services/InitMultisigAccountService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public InitMultisigAccountService(IMultisigAccount multisig, KeyPair keyPair, IE
2424
public async Task StartAsync(CancellationToken cancellationToken) {
2525
await _multisig.Init(_keyPair.Public, cancellationToken: cancellationToken);
2626
await _giver.SendTransaction(_multisig.Address, 20m, false, cancellationToken);
27-
await _multisig.Deploy(new[] { _keyPair.Public }, 1, TimeSpan.FromHours(1), cancellationToken);
27+
await _multisig.Deploy([_keyPair.Public], 1, TimeSpan.FromHours(1), cancellationToken);
2828
}
2929

3030
/// <summary>

src/EverscaleNet.TestSuite/Services/NodeSeDockerContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<bool> UntilAsync(IContainer container) {
6565
try {
6666
await using var adapter = new EverClientRustAdapter(new OptionsWrapper<EverClientOptions>(new EverClientOptions {
6767
Network = new NetworkConfig {
68-
Endpoints = new[] { $"http://localhost:{container.GetMappedPublicPort(80)}" }
68+
Endpoints = [$"http://localhost:{container.GetMappedPublicPort(80)}"]
6969
}
7070
}), _loggerFactory.CreateLogger<EverClientRustAdapter>());
7171
var everClient = new EverClient(adapter);

src/EverscaleNet.Utils/EverOS.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,30 @@ public static class Endpoints {
3535
/// <summary>
3636
/// Main network endpoints
3737
/// </summary>
38-
public static string[] Everscale => new[] {
38+
public static string[] Everscale => [
3939
"https://eri01.main.everos.dev",
4040
"https://gra01.main.everos.dev",
4141
"https://gra02.main.everos.dev",
4242
"https://lim01.main.everos.dev",
4343
"https://rbx01.main.everos.dev"
44-
};
44+
];
4545

4646
/// <summary>
4747
/// Dev network endpoints
4848
/// </summary>
49-
public static string[] Development => new[] {
49+
public static string[] Development => [
5050
"https://eri01.net.everos.dev/",
5151
"https://rbx01.net.everos.dev/",
5252
"https://gra01.net.everos.dev/"
53-
};
53+
];
5454

5555
/// <summary>
5656
/// Node SE network endpoints
5757
/// </summary>
58-
public static string[] NodeSE => new[] {
58+
public static string[] NodeSE => [
5959
"http://localhost",
6060
"http://127.0.0.1",
6161
"http://0.0.0.0"
62-
};
62+
];
6363
}
6464
}

src/EverscaleNet.WebClient/ServiceCollectionExtensions.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,16 @@ public static IServiceCollection AddEverWebClient(this IServiceCollection servic
7070
Action<IServiceProvider, LibWebOptions>? configureLibWebOptions = null) {
7171
if (configureEverClientOptions != null) {
7272
services.AddOptions();
73-
services.AddSingleton<IConfigureOptions<EverClientOptions>>(
74-
provider => new ConfigureOptions<EverClientOptions>(options => configureEverClientOptions(provider, options)));
73+
services.AddSingleton<IConfigureOptions<EverClientOptions>>(provider => new ConfigureOptions<EverClientOptions>(options => configureEverClientOptions(provider, options)));
7574
}
7675
if (configureLibWebOptions != null) {
7776
services.AddOptions();
78-
services.AddSingleton<IConfigureOptions<LibWebOptions>>(
79-
provider => new ConfigureOptions<LibWebOptions>(options => configureLibWebOptions(provider, options)));
77+
services.AddSingleton<IConfigureOptions<LibWebOptions>>(provider => new ConfigureOptions<LibWebOptions>(options => configureLibWebOptions(provider, options)));
8078
}
8179
if (configurePackageManagerOptions != null) {
8280
services.AddOptions();
83-
services.AddSingleton<IConfigureOptions<WebPackageManagerOptions>>(
84-
provider => new ConfigureOptions<WebPackageManagerOptions>(options => configurePackageManagerOptions(provider, options)));
81+
services.AddSingleton<IConfigureOptions<WebPackageManagerOptions>>(provider =>
82+
new ConfigureOptions<WebPackageManagerOptions>(options => configurePackageManagerOptions(provider, options)));
8583
}
8684

8785
services

0 commit comments

Comments
 (0)