Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetaDataAPI V2 #266

Merged
merged 38 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
291904d
- save
ArdenHide Jun 14, 2024
2791787
- remove old saved requests
ArdenHide Jun 14, 2024
096d351
- code cleanup
ArdenHide Jun 17, 2024
6ba209e
- code refactor
ArdenHide Jun 17, 2024
8fcf2e1
- update code
ArdenHide Jun 17, 2024
096f8c9
- use latest version of `Net.Cache.DynamoDb.ERC20` package
ArdenHide Jun 17, 2024
5b114b8
- setting properties in `PoolInfo`
ArdenHide Jun 17, 2024
bce3412
- refactor code
ArdenHide Jun 18, 2024
81b641d
- refactor code
ArdenHide Jun 18, 2024
697a037
- write a comment
ArdenHide Jun 18, 2024
7fdd9ab
- update `CollateralProvider`
ArdenHide Jun 18, 2024
72ad667
- remove `OnDescriptionCreating()`
ArdenHide Jun 18, 2024
0ed090d
- update `GetDescription`
ArdenHide Jun 19, 2024
85c4664
- save
ArdenHide Jun 19, 2024
8f60f5f
- fix bug in Refund Provider
ArdenHide Jun 20, 2024
2160c1b
- bugfix in `CollateralProvider`
ArdenHide Jun 20, 2024
8402d14
- reorganize
ArdenHide Jun 21, 2024
a4e05da
- build fix
ArdenHide Jun 21, 2024
347bcfc
- save
ArdenHide Jun 21, 2024
d1c3c4d
- move `CollateralType` to `CollateralProvider`
ArdenHide Jun 21, 2024
55b9a2c
- rename `Erc721Attribute` to `Erc721MetadataItem`
ArdenHide Jun 21, 2024
e7f7cab
- draw MainCoin for `RefundProvider`
ArdenHide Jun 21, 2024
b9e6dc7
- update response logic
ArdenHide Jun 21, 2024
61db4cc
- update `IChainmanager` and implementation.
ArdenHide Jun 21, 2024
481349a
Merge branch 'master' into meta-data-api-v2
ArdenHide Jun 21, 2024
dea6201
- fix auto-validation for LambdaRequest
ArdenHide Jun 26, 2024
9e12262
- returns `provider name` in metadata response
ArdenHide Jun 26, 2024
b031026
- rename `protected` members in `AbstractProvider`
ArdenHide Jun 26, 2024
4ccd275
- register `ILockDealNFTService` in `DefaultServiceProvider`
ArdenHide Jun 26, 2024
02b52e1
- check if pool id less then total supply
ArdenHide Jun 26, 2024
a8f97b7
- remove old saved requests
ArdenHide Jun 26, 2024
484a02c
- remove all exist tests
ArdenHide Jun 28, 2024
a897aee
Merge branch 'master' into meta-data-api-v2
ArdenHide Jul 1, 2024
8ec1b47
MetaDataAPI V2 - Tests (#270)
ArdenHide Jul 1, 2024
7bb0589
Merge branch 'master' into meta-data-api-v2
ArdenHide Jul 1, 2024
7c63a13
Merge branch 'master' into meta-data-api-v2
ArdenHide Jul 1, 2024
e123ddb
Update `IChainManager` (#272)
ArdenHide Jul 1, 2024
abbfd68
Meta data api v2 description (#276)
ArdenHide Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*.userosscache
*.sln.docstates
*aws-lambda-tools-defaults.json
*appsettings.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "fully withdrawn DealProvider",
"queryStringParameters": {
"poolId": 0,
"chainId": 97
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "simple LockDealProvider",
"queryStringParameters": {
"poolId": 1,
"chainId": 97
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "simple TimedDealProvider",
"queryStringParameters": {
"poolId": 2,
"chainId": 97
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "simple RefundProvider",
"queryStringParameters": {
"poolId": 3,
"chainId": 97
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "simple CollateralProvider",
"queryStringParameters": {
"poolId": 5,
"chainId": 97
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "fully refunded DealProvider",
"queryStringParameters": {
"poolId": 6,
"chainId": 97
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Description": "simple DealProvider",
"queryStringParameters": {
"poolId": 8,
"chainId": 97
}
}
5 changes: 0 additions & 5 deletions src/MetaDataAPI/.lambda-test-tool/SavedRequests/id 2.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions src/MetaDataAPI/Attributes/ErrorMessageAttribute.cs

This file was deleted.

25 changes: 25 additions & 0 deletions src/MetaDataAPI/DefaultServiceProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using TLY.ShortUrl;
using MetaDataAPI.Services.Erc20;
using EnvironmentManager.Extensions;
using MetaDataAPI.Services.ChainsInfo;
using Microsoft.Extensions.DependencyInjection;
using poolz.finance.csharp.contracts.LockDealNFT;

namespace MetaDataAPI;

public static class DefaultServiceProvider
{
private static readonly Lazy<IServiceProvider> LazyInstance = new(() =>
{
var serviceCollection = new ServiceCollection();

serviceCollection.AddSingleton<IChainManager, DbChainManager>(_ => new DbChainManager());
serviceCollection.AddSingleton<IErc20Provider, Erc20Provider>(_ => new Erc20Provider());
serviceCollection.AddSingleton<ITlyContext, TlyContext>(_ => new TlyContext(Environments.TLY_API_KEY.Get()));
serviceCollection.AddSingleton<ILockDealNFTService, LockDealNFTService>(_ => new LockDealNFTService());

return serviceCollection.BuildServiceProvider();
});

public static IServiceProvider Instance => LazyInstance.Value;
}
6 changes: 1 addition & 5 deletions src/MetaDataAPI/Environments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ namespace MetaDataAPI;

public enum Environments
{
[EnvironmentVariable(isRequired: true)]
LOCK_DEAL_NFT_ADDRESS,
[EnvironmentVariable(isRequired: true)]
RPC_URL,
[EnvironmentVariable(isRequired: true)]
NFT_HTML_ENDPOINT,
[EnvironmentVariable(isRequired: true)]
HTML_TO_IMAGE_ENDPOINT_TEMPLATE,
HTML_TO_IMAGE_ENDPOINT,
[EnvironmentVariable(isRequired: true)]
TLY_API_KEY
}
9 changes: 0 additions & 9 deletions src/MetaDataAPI/Extensions/BigIntegerExtensions.cs

This file was deleted.

10 changes: 10 additions & 0 deletions src/MetaDataAPI/Extensions/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Numerics;

namespace MetaDataAPI.Extensions;

public static class DateTimeExtensions
{
public static string DateTimeStringFormat(this DateTime dateTime) => $"{dateTime:MM/dd/yyyy} {dateTime:HH:mm:ss}";
public static string DateTimeStringFormat(this BigInteger timestamp) =>
DateTimeStringFormat(DateTimeOffset.FromUnixTimeSeconds((long)timestamp).UtcDateTime);
}
35 changes: 35 additions & 0 deletions src/MetaDataAPI/Extensions/LockDealNftServiceExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Numerics;
using Microsoft.Extensions.DependencyInjection;
using poolz.finance.csharp.contracts.LockDealNFT;
using poolz.finance.csharp.contracts.LockDealNFT.ContractDefinition;

namespace MetaDataAPI.Extensions;

public static class LockDealNftServiceExtensions
{
public static bool IsPoolIdInSupplyRange(this ILockDealNFTService lockDealNft, BigInteger poolId)
{
return lockDealNft.TotalSupplyQueryAsync()
.GetAwaiter()
.GetResult() > poolId;
}

public static BasePoolInfo[] FetchPoolInfo(this ILockDealNFTService lockDealNft, BigInteger poolId)
{
return lockDealNft.GetFullDataQueryAsync(poolId)
.GetAwaiter()
.GetResult()
.PoolInfo
.ToArray();
}

public static BasePoolInfo[] FetchPoolInfo(this IServiceProvider serviceProvider, BigInteger poolId)
{
return serviceProvider.GetRequiredService<ILockDealNFTService>()
.GetFullDataQueryAsync(poolId)
.GetAwaiter()
.GetResult()
.PoolInfo
.ToArray();
}
}
8 changes: 0 additions & 8 deletions src/MetaDataAPI/ImageGeneration/IImageGenerator.cs

This file was deleted.

28 changes: 0 additions & 28 deletions src/MetaDataAPI/ImageGeneration/ImageGenerator.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/MetaDataAPI/ImageGeneration/Services/IImageRenderer.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/MetaDataAPI/ImageGeneration/Services/IUrlShortener.cs

This file was deleted.

15 changes: 0 additions & 15 deletions src/MetaDataAPI/ImageGeneration/Services/ImageRenderer.cs

This file was deleted.

27 changes: 0 additions & 27 deletions src/MetaDataAPI/ImageGeneration/Services/UrlShortener.cs

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions src/MetaDataAPI/ImageGeneration/UrlifyModels/BaseUrlifyModel.cs

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading