From 842e1dd9c88df796e07d7243a329b88899fce864 Mon Sep 17 00:00:00 2001 From: Stanislav Vysotskyi <66203238+ArdenHide@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:50:34 +0300 Subject: [PATCH] Remove TLY // Update to .NET 8 (#280) * - remove tly logic * - migrate to .net8 --- src/MetaDataAPI/DefaultServiceProvider.cs | 5 +---- src/MetaDataAPI/Environments.cs | 4 +--- src/MetaDataAPI/MetaDataAPI.csproj | 3 +-- .../Properties/launchSettings.json | 4 ++-- src/MetaDataAPI/Providers/AbstractProvider.cs | 21 +------------------ .../MetaDataAPI.Tests.csproj | 2 +- 6 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/MetaDataAPI/DefaultServiceProvider.cs b/src/MetaDataAPI/DefaultServiceProvider.cs index 4bbb4afb..25b4f7f8 100644 --- a/src/MetaDataAPI/DefaultServiceProvider.cs +++ b/src/MetaDataAPI/DefaultServiceProvider.cs @@ -1,6 +1,4 @@ -using TLY.ShortUrl; -using MetaDataAPI.Services.Erc20; -using EnvironmentManager.Extensions; +using MetaDataAPI.Services.Erc20; using MetaDataAPI.Services.ChainsInfo; using Microsoft.Extensions.DependencyInjection; using poolz.finance.csharp.contracts.LockDealNFT; @@ -15,7 +13,6 @@ public static class DefaultServiceProvider serviceCollection.AddSingleton(_ => new DbChainManager()); serviceCollection.AddSingleton(_ => new Erc20Provider()); - serviceCollection.AddSingleton(_ => new TlyContext(Environments.TLY_API_KEY.Get())); serviceCollection.AddSingleton(_ => new LockDealNFTService()); return serviceCollection.BuildServiceProvider(); diff --git a/src/MetaDataAPI/Environments.cs b/src/MetaDataAPI/Environments.cs index daac4a46..d5bf987c 100644 --- a/src/MetaDataAPI/Environments.cs +++ b/src/MetaDataAPI/Environments.cs @@ -7,7 +7,5 @@ public enum Environments [EnvironmentVariable(isRequired: true)] NFT_HTML_ENDPOINT, [EnvironmentVariable(isRequired: true)] - HTML_TO_IMAGE_ENDPOINT, - [EnvironmentVariable(isRequired: true)] - TLY_API_KEY + HTML_TO_IMAGE_ENDPOINT } \ No newline at end of file diff --git a/src/MetaDataAPI/MetaDataAPI.csproj b/src/MetaDataAPI/MetaDataAPI.csproj index f5f5a6a8..3495868d 100644 --- a/src/MetaDataAPI/MetaDataAPI.csproj +++ b/src/MetaDataAPI/MetaDataAPI.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 enable enable true @@ -20,7 +20,6 @@ - diff --git a/src/MetaDataAPI/Properties/launchSettings.json b/src/MetaDataAPI/Properties/launchSettings.json index a82d4042..c1fabf8f 100644 --- a/src/MetaDataAPI/Properties/launchSettings.json +++ b/src/MetaDataAPI/Properties/launchSettings.json @@ -3,8 +3,8 @@ "Mock Lambda Test Tool": { "commandName": "Executable", "commandLineArgs": "--port 5050", - "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", - "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + "workingDirectory": ".\\bin\\$(Configuration)\\net8.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-8.0.exe" } } } \ No newline at end of file diff --git a/src/MetaDataAPI/Providers/AbstractProvider.cs b/src/MetaDataAPI/Providers/AbstractProvider.cs index 3059e673..e9c7d157 100644 --- a/src/MetaDataAPI/Providers/AbstractProvider.cs +++ b/src/MetaDataAPI/Providers/AbstractProvider.cs @@ -1,11 +1,9 @@ using Net.Urlify; -using TLY.ShortUrl; using Nethereum.Web3; using System.Numerics; using HandlebarsDotNet; using System.Reflection; using Net.Urlify.Attributes; -using Net.Cryptography.SHA256; using MetaDataAPI.Services.Erc20; using MetaDataAPI.Providers.Image; using EnvironmentManager.Extensions; @@ -21,7 +19,6 @@ public abstract class AbstractProvider : Urlify { protected readonly ILockDealNFTService LockDealNft; protected readonly IErc20Provider Erc20Provider; - protected readonly ITlyContext TlyContext; public IEnumerable FullData { get; } public BasePoolInfo PoolInfo { get; } @@ -52,7 +49,6 @@ protected AbstractProvider(BasePoolInfo[] poolsInfo, ChainInfo chainInfo, IServi : base((string)Environments.NFT_HTML_ENDPOINT.Get()) { Erc20Provider = serviceProvider.GetRequiredService(); - TlyContext = serviceProvider.GetRequiredService(); LockDealNft = serviceProvider.GetRequiredService(); FullData = poolsInfo; @@ -84,22 +80,7 @@ private string GetDescription() private string GetImage() { - var url = new UrlifyProvider(this).BuildUrl(); - - var hash = $"{ChainInfo.ChainId}-{PoolId}-{VaultId}-{PoolInfo.Params}".ToSha256(); - var description = $"ChainId: {ChainInfo.ChainId}, PoolId: {PoolId}, Hash: {hash}"; - - var shortUrl = TlyContext.SearchShortUrlAsync(description) - .GetAwaiter() - .GetResult() - .Data - .FirstOrDefault() - ?.ShortUrl; - - return shortUrl ?? TlyContext.CreateShortUrlAsync(url, description) - .GetAwaiter() - .GetResult() - .ShortUrl; + return new UrlifyProvider(this).BuildUrl(); } private IEnumerable GetAttributes() diff --git a/tests/MetaDataAPI.Tests/MetaDataAPI.Tests.csproj b/tests/MetaDataAPI.Tests/MetaDataAPI.Tests.csproj index f47cdf14..5ce72681 100644 --- a/tests/MetaDataAPI.Tests/MetaDataAPI.Tests.csproj +++ b/tests/MetaDataAPI.Tests/MetaDataAPI.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 enable enable MetaDataAPI.Tests