Skip to content

Commit 8c720cd

Browse files
committed
Update CryptoExchange.Net version to 8.5.0, added SetOptions on clients, added setting of DefaultProxyCredentials to CredentialCache.DefaultCredentials on the DI http client, updated dotnet versions to 9.0
1 parent 5c18ce9 commit 8c720cd

File tree

10 files changed

+58
-4
lines changed

10 files changed

+58
-4
lines changed

.github/workflows/dotnet.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup .NET
1717
uses: actions/setup-dotnet@v1
1818
with:
19-
dotnet-version: 8.0.x
19+
dotnet-version: 9.0.x
2020
- name: Set GitHub package source
2121
run: dotnet nuget add source --username JKorf --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/JKorf/index.json"
2222
- name: Restore dependencies

Binance.Net.UnitTests/Binance.Net.UnitTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

Binance.Net.UnitTests/TestImplementations/TestSocket.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Binance.Net.UnitTests.TestImplementations
1212
{
13-
public class TestSocket: IWebsocket
13+
public class TestSocket : IWebsocket
1414
{
1515
public bool CanConnect { get; set; } = true;
1616
public bool Connected { get; set; }
@@ -120,5 +120,7 @@ public Task ReconnectAsync()
120120
{
121121
throw new NotImplementedException();
122122
}
123+
124+
public void UpdateProxy(ApiProxy proxy) => throw new NotImplementedException();
123125
}
124126
}

Binance.Net/Binance.Net.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<PrivateAssets>all</PrivateAssets>
4949
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5050
</PackageReference>
51-
<PackageReference Include="CryptoExchange.Net" Version="8.4.4" />
51+
<PackageReference Include="CryptoExchange.Net" Version="8.5.0" />
5252
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
5353
<PrivateAssets>all</PrivateAssets>
5454
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Binance.Net/Binance.Net.xml

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Binance.Net/Clients/BinanceRestClient.cs

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using CryptoExchange.Net.Clients;
1212
using Microsoft.Extensions.Options;
1313
using Microsoft.Extensions.DependencyInjection;
14+
using CryptoExchange.Net.Objects.Options;
1415

1516
namespace Binance.Net.Clients
1617
{
@@ -59,6 +60,15 @@ public BinanceRestClient(HttpClient? httpClient, ILoggerFactory? loggerFactory,
5960

6061
#endregion
6162

63+
/// <inheritdoc />
64+
public void SetOptions(UpdateOptions options)
65+
{
66+
GeneralApi.SetOptions(options);
67+
SpotApi.SetOptions(options);
68+
UsdFuturesApi.SetOptions(options);
69+
CoinFuturesApi.SetOptions(options);
70+
}
71+
6272
/// <summary>
6373
/// Set the default options to be used when creating new clients
6474
/// </summary>

Binance.Net/Clients/BinanceSocketClient.cs

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Binance.Net.Interfaces.Clients.UsdFuturesApi;
88
using Binance.Net.Objects.Options;
99
using CryptoExchange.Net.Clients;
10+
using CryptoExchange.Net.Objects.Options;
1011
using Microsoft.Extensions.DependencyInjection;
1112
using Microsoft.Extensions.Options;
1213

@@ -57,6 +58,14 @@ public BinanceSocketClient(IOptions<BinanceSocketOptions> options, ILoggerFactor
5758
}
5859
#endregion
5960

61+
/// <inheritdoc />
62+
public void SetOptions(UpdateOptions options)
63+
{
64+
SpotApi.SetOptions(options);
65+
UsdFuturesApi.SetOptions(options);
66+
CoinFuturesApi.SetOptions(options);
67+
}
68+
6069
/// <summary>
6170
/// Set the default options to be used when creating new clients
6271
/// </summary>

Binance.Net/ExtensionMethods/ServiceCollectionExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ private static IServiceCollection AddBinanceCore(
113113
try
114114
{
115115
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
116+
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
116117
}
117118
catch (PlatformNotSupportedException)
118119
{ }

Binance.Net/Interfaces/Clients/IBinanceRestClient.cs

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Binance.Net.Interfaces.Clients.GeneralApi;
33
using Binance.Net.Interfaces.Clients.SpotApi;
44
using Binance.Net.Interfaces.Clients.UsdFuturesApi;
5+
using CryptoExchange.Net.Objects.Options;
56

67
namespace Binance.Net.Interfaces.Clients
78
{
@@ -27,6 +28,12 @@ public interface IBinanceRestClient: IRestClient
2728
/// </summary>
2829
IBinanceRestClientUsdFuturesApi UsdFuturesApi { get; }
2930

31+
/// <summary>
32+
/// Update specific options
33+
/// </summary>
34+
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
35+
void SetOptions(UpdateOptions options);
36+
3037
/// <summary>
3138
/// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.
3239
/// </summary>

Binance.Net/Interfaces/Clients/IBinanceSocketClient.cs

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Binance.Net.Interfaces.Clients.CoinFuturesApi;
22
using Binance.Net.Interfaces.Clients.SpotApi;
33
using Binance.Net.Interfaces.Clients.UsdFuturesApi;
4+
using CryptoExchange.Net.Objects.Options;
45

56
namespace Binance.Net.Interfaces.Clients
67
{
@@ -22,6 +23,12 @@ public interface IBinanceSocketClient: ISocketClient
2223
/// </summary>
2324
IBinanceSocketClientUsdFuturesApi UsdFuturesApi { get; }
2425

26+
/// <summary>
27+
/// Update specific options
28+
/// </summary>
29+
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
30+
void SetOptions(UpdateOptions options);
31+
2532
/// <summary>
2633
/// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.
2734
/// </summary>

0 commit comments

Comments
 (0)