From 7f0bba98c2252d8a31138792793823d805015171 Mon Sep 17 00:00:00 2001 From: Stanislav Vysotskyi Date: Wed, 6 Nov 2024 13:33:53 +0300 Subject: [PATCH] - remove tly logic --- src/MetaDataAPI/DefaultServiceProvider.cs | 5 +---- src/MetaDataAPI/Environments.cs | 4 +--- src/MetaDataAPI/MetaDataAPI.csproj | 1 - src/MetaDataAPI/Providers/AbstractProvider.cs | 21 +------------------ 4 files changed, 3 insertions(+), 28 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..134d176e 100644 --- a/src/MetaDataAPI/MetaDataAPI.csproj +++ b/src/MetaDataAPI/MetaDataAPI.csproj @@ -20,7 +20,6 @@ - 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()