Skip to content

Commit

Permalink
Update CryptoExchange.Net version to 8.5.0, added SetOptions on clien…
Browse files Browse the repository at this point in the history
…ts, added setting of DefaultProxyCredentials to CredentialCache.DefaultCredentials on the DI http client, updated dotnet versions to 9.0
  • Loading branch information
JKorf committed Dec 23, 2024
1 parent 58c32fe commit b5167d2
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Set GitHub package source
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"
- name: Restore dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Set GitHub package source
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"
- name: Restore dependencies
Expand Down
2 changes: 1 addition & 1 deletion Bitfinex.Net.UnitTests/Bitfinex.Net.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion Bitfinex.Net.UnitTests/TestImplementations/TestSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Binance.Net.UnitTests.TestImplementations
{
public class TestSocket: IWebsocket
public class TestSocket : IWebsocket
{
public bool CanConnect { get; set; } = true;
public bool Connected { get; set; }
Expand Down Expand Up @@ -130,5 +130,7 @@ public async Task ReconnectAsync()
await Task.Delay(10);
await OnReconnected();
}

public void UpdateProxy(ApiProxy proxy) => throw new NotImplementedException();
}
}
2 changes: 1 addition & 1 deletion Bitfinex.Net/Bitfinex.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CryptoExchange.Net" Version="8.4.3" />
<PackageReference Include="CryptoExchange.Net" Version="8.5.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
18 changes: 18 additions & 0 deletions Bitfinex.Net/Bitfinex.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Bitfinex.Net/Clients/BitfinexRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.Extensions.DependencyInjection;
using CryptoExchange.Net.Clients;
using Microsoft.Extensions.Options;
using CryptoExchange.Net.Objects.Options;

namespace Bitfinex.Net.Clients
{
Expand Down Expand Up @@ -52,6 +53,12 @@ public BitfinexRestClient(HttpClient? httpClient, ILoggerFactory? loggerFactory,
#endregion

#region methods
/// <inheritdoc />
public void SetOptions(UpdateOptions options)
{
GeneralApi.SetOptions(options);
SpotApi.SetOptions(options);
}

/// <summary>
/// Set the default options to be used when creating new clients
Expand Down
6 changes: 6 additions & 0 deletions Bitfinex.Net/Clients/BitfinexSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Bitfinex.Net.Objects.Options;
using CryptoExchange.Net.Clients;
using Microsoft.Extensions.Options;
using CryptoExchange.Net.Objects.Options;

namespace Bitfinex.Net.Clients
{
Expand Down Expand Up @@ -44,6 +45,11 @@ public BitfinexSocketClient(IOptions<BitfinexSocketOptions> options, ILoggerFact
}

#endregion
/// <inheritdoc />
public void SetOptions(UpdateOptions options)
{
SpotApi.SetOptions(options);
}

/// <summary>
/// Set the default options to be used when creating new clients
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ private static IServiceCollection AddBitfinexCore(
try
{
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
}
catch (PlatformNotSupportedException)
{ }
Expand Down
7 changes: 7 additions & 0 deletions Bitfinex.Net/Interfaces/Clients/IBitfinexRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Bitfinex.Net.Interfaces.Clients.SpotApi;
using CryptoExchange.Net.Authentication;
using CryptoExchange.Net.Interfaces;
using CryptoExchange.Net.Objects.Options;

namespace Bitfinex.Net.Interfaces.Clients
{
Expand All @@ -20,6 +21,12 @@ public interface IBitfinexRestClient : IRestClient
/// </summary>
IBitfinexRestClientSpotApi SpotApi { get; }

/// <summary>
/// Update specific options
/// </summary>
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
void SetOptions(UpdateOptions options);

/// <summary>
/// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Bitfinex.Net/Interfaces/Clients/IBitfinexSocketClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Bitfinex.Net.Interfaces.Clients.SpotApi;
using CryptoExchange.Net.Authentication;
using CryptoExchange.Net.Interfaces;
using CryptoExchange.Net.Objects.Options;

namespace Bitfinex.Net.Interfaces.Clients
{
Expand All @@ -14,6 +15,12 @@ public interface IBitfinexSocketClient : ISocketClient
/// </summary>
IBitfinexSocketClientSpotApi SpotApi { get; }

/// <summary>
/// Update specific options
/// </summary>
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
void SetOptions(UpdateOptions options);

/// <summary>
/// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.
/// </summary>
Expand Down

0 comments on commit b5167d2

Please sign in to comment.