diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIChainWithDetails.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIChainWithDetails.cpp index 0b7da6a..86a0124 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Private/APIChainWithDetails.cpp +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIChainWithDetails.cpp @@ -29,6 +29,14 @@ void APIChainWithDetails::WriteJson(JsonWriter& Writer) const { Writer->WriteIdentifierPrefix(TEXT("rpc_url")); WriteJsonValue(Writer, RpcUrl.GetValue()); } + if (OperatorAllowlistAddress.IsSet()) + { + Writer->WriteIdentifierPrefix(TEXT("operator_allowlist_address")); WriteJsonValue(Writer, OperatorAllowlistAddress.GetValue()); + } + if (MinterAddress.IsSet()) + { + Writer->WriteIdentifierPrefix(TEXT("minter_address")); WriteJsonValue(Writer, MinterAddress.GetValue()); + } Writer->WriteObjectEnd(); } @@ -43,6 +51,8 @@ bool APIChainWithDetails::FromJson(const TSharedPtr& JsonValue) ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id); ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name); ParseSuccess &= TryGetJsonValue(*Object, TEXT("rpc_url"), RpcUrl); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("operator_allowlist_address"), OperatorAllowlistAddress); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("minter_address"), MinterAddress); return ParseSuccess; } diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilter.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilter.cpp new file mode 100644 index 0000000..6f412ac --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilter.cpp @@ -0,0 +1,47 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#include "APIFilter.h" + +#include "ImmutablezkEVMAPIModule.h" +#include "APIHelpers.h" + +#include "Templates/SharedPointer.h" + +namespace ImmutablezkEVMAPI +{ + +void APIFilter::WriteJson(JsonWriter& Writer) const +{ + Writer->WriteObjectStart(); + Writer->WriteIdentifierPrefix(TEXT("name")); WriteJsonValue(Writer, Name); + Writer->WriteIdentifierPrefix(TEXT("values")); WriteJsonValue(Writer, Values); + Writer->WriteIdentifierPrefix(TEXT("omitted_values_count")); WriteJsonValue(Writer, OmittedValuesCount); + Writer->WriteObjectEnd(); +} + +bool APIFilter::FromJson(const TSharedPtr& JsonValue) +{ + const TSharedPtr* Object; + if (!JsonValue->TryGetObject(Object)) + return false; + + bool ParseSuccess = true; + + ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("values"), Values); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("omitted_values_count"), OmittedValuesCount); + + return ParseSuccess; +} + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilterResult.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilterResult.cpp new file mode 100644 index 0000000..be34a85 --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilterResult.cpp @@ -0,0 +1,47 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#include "APIFilterResult.h" + +#include "ImmutablezkEVMAPIModule.h" +#include "APIHelpers.h" + +#include "Templates/SharedPointer.h" + +namespace ImmutablezkEVMAPI +{ + +void APIFilterResult::WriteJson(JsonWriter& Writer) const +{ + Writer->WriteObjectStart(); + Writer->WriteIdentifierPrefix(TEXT("chain")); WriteJsonValue(Writer, Chain); + Writer->WriteIdentifierPrefix(TEXT("contract_address")); WriteJsonValue(Writer, ContractAddress); + Writer->WriteIdentifierPrefix(TEXT("filters")); WriteJsonValue(Writer, Filters); + Writer->WriteObjectEnd(); +} + +bool APIFilterResult::FromJson(const TSharedPtr& JsonValue) +{ + const TSharedPtr* Object; + if (!JsonValue->TryGetObject(Object)) + return false; + + bool ParseSuccess = true; + + ParseSuccess &= TryGetJsonValue(*Object, TEXT("chain"), Chain); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("contract_address"), ContractAddress); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("filters"), Filters); + + return ParseSuccess; +} + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilterValue.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilterValue.cpp new file mode 100644 index 0000000..6da31b7 --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIFilterValue.cpp @@ -0,0 +1,45 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#include "APIFilterValue.h" + +#include "ImmutablezkEVMAPIModule.h" +#include "APIHelpers.h" + +#include "Templates/SharedPointer.h" + +namespace ImmutablezkEVMAPI +{ + +void APIFilterValue::WriteJson(JsonWriter& Writer) const +{ + Writer->WriteObjectStart(); + Writer->WriteIdentifierPrefix(TEXT("value")); WriteJsonValue(Writer, Value); + Writer->WriteIdentifierPrefix(TEXT("nft_count")); WriteJsonValue(Writer, NftCount); + Writer->WriteObjectEnd(); +} + +bool APIFilterValue::FromJson(const TSharedPtr& JsonValue) +{ + const TSharedPtr* Object; + if (!JsonValue->TryGetObject(Object)) + return false; + + bool ParseSuccess = true; + + ParseSuccess &= TryGetJsonValue(*Object, TEXT("value"), Value); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("nft_count"), NftCount); + + return ParseSuccess; +} + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIListFiltersResult.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIListFiltersResult.cpp new file mode 100644 index 0000000..fb32744 --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIListFiltersResult.cpp @@ -0,0 +1,45 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#include "APIListFiltersResult.h" + +#include "ImmutablezkEVMAPIModule.h" +#include "APIHelpers.h" + +#include "Templates/SharedPointer.h" + +namespace ImmutablezkEVMAPI +{ + +void APIListFiltersResult::WriteJson(JsonWriter& Writer) const +{ + Writer->WriteObjectStart(); + Writer->WriteIdentifierPrefix(TEXT("result")); WriteJsonValue(Writer, Result); + Writer->WriteIdentifierPrefix(TEXT("page")); WriteJsonValue(Writer, Page); + Writer->WriteObjectEnd(); +} + +bool APIListFiltersResult::FromJson(const TSharedPtr& JsonValue) +{ + const TSharedPtr* Object; + if (!JsonValue->TryGetObject(Object)) + return false; + + bool ParseSuccess = true; + + ParseSuccess &= TryGetJsonValue(*Object, TEXT("result"), Result); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("page"), Page); + + return ParseSuccess; +} + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIListing.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIListing.cpp index c54f236..16d76c7 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Private/APIListing.cpp +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIListing.cpp @@ -25,7 +25,6 @@ void APIListing::WriteJson(JsonWriter& Writer) const Writer->WriteObjectStart(); Writer->WriteIdentifierPrefix(TEXT("listing_id")); WriteJsonValue(Writer, ListingId); Writer->WriteIdentifierPrefix(TEXT("price_details")); WriteJsonValue(Writer, PriceDetails); - Writer->WriteIdentifierPrefix(TEXT("converted_prices")); WriteJsonValue(Writer, ConvertedPrices); Writer->WriteIdentifierPrefix(TEXT("token_id")); WriteJsonValue(Writer, TokenId); Writer->WriteIdentifierPrefix(TEXT("contract_address")); WriteJsonValue(Writer, ContractAddress); Writer->WriteIdentifierPrefix(TEXT("creator")); WriteJsonValue(Writer, Creator); @@ -43,7 +42,6 @@ bool APIListing::FromJson(const TSharedPtr& JsonValue) ParseSuccess &= TryGetJsonValue(*Object, TEXT("listing_id"), ListingId); ParseSuccess &= TryGetJsonValue(*Object, TEXT("price_details"), PriceDetails); - ParseSuccess &= TryGetJsonValue(*Object, TEXT("converted_prices"), ConvertedPrices); ParseSuccess &= TryGetJsonValue(*Object, TEXT("token_id"), TokenId); ParseSuccess &= TryGetJsonValue(*Object, TEXT("contract_address"), ContractAddress); ParseSuccess &= TryGetJsonValue(*Object, TEXT("creator"), Creator); diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIMarketPriceDetails.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIMarketPriceDetails.cpp index a5794ce..f66b59e 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Private/APIMarketPriceDetails.cpp +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIMarketPriceDetails.cpp @@ -27,6 +27,10 @@ void APIMarketPriceDetails::WriteJson(JsonWriter& Writer) const Writer->WriteIdentifierPrefix(TEXT("amount")); WriteJsonValue(Writer, Amount); Writer->WriteIdentifierPrefix(TEXT("fee_inclusive_amount")); WriteJsonValue(Writer, FeeInclusiveAmount); Writer->WriteIdentifierPrefix(TEXT("fees")); WriteJsonValue(Writer, Fees); + if (ConvertedPrices.IsSet()) + { + Writer->WriteIdentifierPrefix(TEXT("converted_prices")); WriteJsonValue(Writer, ConvertedPrices.GetValue()); + } Writer->WriteObjectEnd(); } @@ -42,6 +46,7 @@ bool APIMarketPriceDetails::FromJson(const TSharedPtr& JsonValue) ParseSuccess &= TryGetJsonValue(*Object, TEXT("amount"), Amount); ParseSuccess &= TryGetJsonValue(*Object, TEXT("fee_inclusive_amount"), FeeInclusiveAmount); ParseSuccess &= TryGetJsonValue(*Object, TEXT("fees"), Fees); + ParseSuccess &= TryGetJsonValue(*Object, TEXT("converted_prices"), ConvertedPrices); return ParseSuccess; } diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApi.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApi.cpp index 87eb741..9d13ce4 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApi.cpp +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApi.cpp @@ -133,6 +133,33 @@ void APIStacksApi::HandleResponse(FHttpResponsePtr HttpResponse, bool bSucceeded InOutResponse.SetHttpResponseCode(EHttpResponseCodes::RequestTimeout); } +FHttpRequestPtr APIStacksApi::ListFilters(const ListFiltersRequest& Request, const FListFiltersDelegate& Delegate /*= FListFiltersDelegate()*/) const +{ + if (!IsValid()) + return nullptr; + + FHttpRequestRef HttpRequest = CreateHttpRequest(Request); + HttpRequest->SetURL(*(Url + Request.ComputePath())); + + for(const auto& It : AdditionalHeaderParams) + { + HttpRequest->SetHeader(It.Key, It.Value); + } + + Request.SetupHttpRequest(HttpRequest); + + HttpRequest->OnProcessRequestComplete().BindRaw(this, &APIStacksApi::OnListFiltersResponse, Delegate); + HttpRequest->ProcessRequest(); + return HttpRequest; +} + +void APIStacksApi::OnListFiltersResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FListFiltersDelegate Delegate) const +{ + ListFiltersResponse Response; + HandleResponse(HttpResponse, bSucceeded, Response); + Delegate.ExecuteIfBound(Response); +} + FHttpRequestPtr APIStacksApi::ListStacks(const ListStacksRequest& Request, const FListStacksDelegate& Delegate /*= FListStacksDelegate()*/) const { if (!IsValid()) diff --git a/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApiOperations.cpp b/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApiOperations.cpp index d435ff3..59a688a 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApiOperations.cpp +++ b/Source/Experimental/ImmutablezkEVMAPI/Private/APIStacksApiOperations.cpp @@ -23,6 +23,60 @@ namespace ImmutablezkEVMAPI { +FString APIStacksApi::ListFiltersRequest::ComputePath() const +{ + TMap PathParams = { + { TEXT("chain_name"), FStringFormatArg(ToUrlString(ChainName)) }, + { TEXT("contract_address"), FStringFormatArg(ToUrlString(ContractAddress)) } }; + + FString Path = FString::Format(TEXT("/experimental/chains/{chain_name}/search/filters/{contract_address}"), PathParams); + + return Path; +} + +void APIStacksApi::ListFiltersRequest::SetupHttpRequest(const FHttpRequestRef& HttpRequest) const +{ + static const TArray Consumes = { }; + //static const TArray Produces = { TEXT("application/json") }; + + HttpRequest->SetVerb(TEXT("GET")); + +} + +void APIStacksApi::ListFiltersResponse::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) +{ + Response::SetHttpResponseCode(InHttpResponseCode); + switch ((int)InHttpResponseCode) + { + case 200: + SetResponseString(TEXT("200 response")); + break; + case 400: + SetResponseString(TEXT("Bad Request (400)")); + break; + case 401: + SetResponseString(TEXT("Unauthorised Request (401)")); + break; + case 403: + SetResponseString(TEXT("Forbidden Request (403)")); + break; + case 404: + SetResponseString(TEXT("The specified resource was not found (404)")); + break; + case 429: + SetResponseString(TEXT("Too Many Requests (429)")); + break; + case 500: + SetResponseString(TEXT("Internal Server Error (500)")); + break; + } +} + +bool APIStacksApi::ListFiltersResponse::FromJson(const TSharedPtr& JsonValue) +{ + return TryGetJsonValue(JsonValue, Content); +} + FString APIStacksApi::ListStacksRequest::ComputePath() const { TMap PathParams = { @@ -230,9 +284,9 @@ FString APIStacksApi::SearchStacksRequest::ComputePath() const { QueryParams.Add(FString(TEXT("only_if_has_active_listings=")) + ToUrlString(OnlyIfHasActiveListings.GetValue())); } - if(Trait.IsSet()) + if(Traits.IsSet()) { - QueryParams.Add(FString(TEXT("trait=")) + ToUrlString(Trait.GetValue())); + QueryParams.Add(FString(TEXT("traits=")) + ToUrlString(Traits.GetValue())); } if(Keyword.IsSet()) { diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIChainWithDetails.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIChainWithDetails.h index 74f7656..90e40a5 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Public/APIChainWithDetails.h +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIChainWithDetails.h @@ -35,6 +35,10 @@ class IMMUTABLEZKEVMAPI_API APIChainWithDetails : public Model FString Name; /* URL for RPC node */ TOptional RpcUrl; + /* The address of the Operator Allowlist - https://docs.immutable.com/products/zkevm/minting/royalties/allowlist-spec/ */ + TOptional OperatorAllowlistAddress; + /* The address of the minter used in the Minting API - https://docs.immutable.com/products/zkEVM/minting/minting-api#minting-api-prerequisites */ + TOptional MinterAddress; }; } diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilter.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilter.h new file mode 100644 index 0000000..b86b29d --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilter.h @@ -0,0 +1,41 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#pragma once + +#include "APIBaseModel.h" +#include "APIFilterValue.h" + +namespace ImmutablezkEVMAPI +{ + +/* + * APIFilter + * + * + */ +class IMMUTABLEZKEVMAPI_API APIFilter : public Model +{ +public: + virtual ~APIFilter() {} + bool FromJson(const TSharedPtr& JsonValue) final; + void WriteJson(JsonWriter& Writer) const final; + + /* Name of trait */ + FString Name; + /* List of 100 most common values for this trait sorted by number of associated NFTs */ + TArray Values; + /* Indicated how many more distinct values exist */ + int32 OmittedValuesCount = 0; +}; + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilterResult.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilterResult.h new file mode 100644 index 0000000..cc47b05 --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilterResult.h @@ -0,0 +1,41 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#pragma once + +#include "APIBaseModel.h" +#include "APIChain.h" +#include "APIFilter.h" + +namespace ImmutablezkEVMAPI +{ + +/* + * APIFilterResult + * + * + */ +class IMMUTABLEZKEVMAPI_API APIFilterResult : public Model +{ +public: + virtual ~APIFilterResult() {} + bool FromJson(const TSharedPtr& JsonValue) final; + void WriteJson(JsonWriter& Writer) const final; + + APIChain Chain; + /* ETH Address of collection that the asset belongs to */ + FString ContractAddress; + /* List of all filters and the most common values */ + TArray Filters; +}; + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilterValue.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilterValue.h new file mode 100644 index 0000000..98564f0 --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIFilterValue.h @@ -0,0 +1,37 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#pragma once + +#include "APIBaseModel.h" + +namespace ImmutablezkEVMAPI +{ + +/* + * APIFilterValue + * + * + */ +class IMMUTABLEZKEVMAPI_API APIFilterValue : public Model +{ +public: + virtual ~APIFilterValue() {} + bool FromJson(const TSharedPtr& JsonValue) final; + void WriteJson(JsonWriter& Writer) const final; + + FString Value; + /* Number of NFTs that have this trait. Uint256 as string */ + FString NftCount; +}; + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIListFiltersResult.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIListFiltersResult.h new file mode 100644 index 0000000..e6e2894 --- /dev/null +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIListFiltersResult.h @@ -0,0 +1,38 @@ +/** + * Immutable zkEVM API + * Immutable Multi Rollup API + * + * OpenAPI spec version: 1.0.0 + * Contact: support@immutable.com + * + * NOTE: This class is auto generated by OpenAPI Generator + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +#pragma once + +#include "APIBaseModel.h" +#include "APIFilterResult.h" +#include "APIPage.h" + +namespace ImmutablezkEVMAPI +{ + +/* + * APIListFiltersResult + * + * List filters result + */ +class IMMUTABLEZKEVMAPI_API APIListFiltersResult : public Model +{ +public: + virtual ~APIListFiltersResult() {} + bool FromJson(const TSharedPtr& JsonValue) final; + void WriteJson(JsonWriter& Writer) const final; + + APIFilterResult Result; + APIPage Page; +}; + +} diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIListing.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIListing.h index 4c395fa..8d80805 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Public/APIListing.h +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIListing.h @@ -33,8 +33,6 @@ class IMMUTABLEZKEVMAPI_API APIListing : public Model /* Global Order identifier */ FString ListingId; APIMarketPriceDetails PriceDetails; - /* A mapping of converted prices for major currencies such as ETH, USD. All converted prices are fee-inclusive. */ - TMap ConvertedPrices; /* Token ID */ FString TokenId; /* ETH Address of collection that the asset belongs to */ diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIMarketPriceDetails.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIMarketPriceDetails.h index 10c0e9e..bbff192 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Public/APIMarketPriceDetails.h +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIMarketPriceDetails.h @@ -37,6 +37,8 @@ class IMMUTABLEZKEVMAPI_API APIMarketPriceDetails : public Model /* The token amount value. This value is provided in the smallest unit of the token (e.g. wei for ETH) */ FString FeeInclusiveAmount; TArray Fees; + /* A mapping of converted prices for major currencies such as ETH, USD. All converted prices are fee-inclusive. */ + TOptional> ConvertedPrices; }; } diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApi.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApi.h index 6f1f71f..d2b4513 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApi.h +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApi.h @@ -38,6 +38,8 @@ class IMMUTABLEZKEVMAPI_API APIStacksApi void SetHttpRetryManager(FHttpRetrySystem::FManager& RetryManager); FHttpRetrySystem::FManager& GetHttpRetryManager(); + class ListFiltersRequest; + class ListFiltersResponse; class ListStacksRequest; class ListStacksResponse; class SearchNFTsRequest; @@ -45,15 +47,18 @@ class IMMUTABLEZKEVMAPI_API APIStacksApi class SearchStacksRequest; class SearchStacksResponse; + DECLARE_DELEGATE_OneParam(FListFiltersDelegate, const ListFiltersResponse&); DECLARE_DELEGATE_OneParam(FListStacksDelegate, const ListStacksResponse&); DECLARE_DELEGATE_OneParam(FSearchNFTsDelegate, const SearchNFTsResponse&); DECLARE_DELEGATE_OneParam(FSearchStacksDelegate, const SearchStacksResponse&); + FHttpRequestPtr ListFilters(const ListFiltersRequest& Request, const FListFiltersDelegate& Delegate = FListFiltersDelegate()) const; FHttpRequestPtr ListStacks(const ListStacksRequest& Request, const FListStacksDelegate& Delegate = FListStacksDelegate()) const; FHttpRequestPtr SearchNFTs(const SearchNFTsRequest& Request, const FSearchNFTsDelegate& Delegate = FSearchNFTsDelegate()) const; FHttpRequestPtr SearchStacks(const SearchStacksRequest& Request, const FSearchStacksDelegate& Delegate = FSearchStacksDelegate()) const; private: + void OnListFiltersResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FListFiltersDelegate Delegate) const; void OnListStacksResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FListStacksDelegate Delegate) const; void OnSearchNFTsResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FSearchNFTsDelegate Delegate) const; void OnSearchStacksResponse(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, FSearchStacksDelegate Delegate) const; diff --git a/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApiOperations.h b/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApiOperations.h index 6749189..e66277f 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApiOperations.h +++ b/Source/Experimental/ImmutablezkEVMAPI/Public/APIStacksApiOperations.h @@ -21,6 +21,7 @@ #include "APIAPIError404.h" #include "APIAPIError429.h" #include "APIAPIError500.h" +#include "APIListFiltersResult.h" #include "APISearchNFTsResult.h" #include "APISearchStacksResult.h" #include "APIStackBundle.h" @@ -28,6 +29,33 @@ namespace ImmutablezkEVMAPI { +/* Experimental: Get list of metadata attribute filters + * + * ![Experimental](https://img.shields.io/badge/status-experimental-yellow) Get list of metadata filters +*/ +class IMMUTABLEZKEVMAPI_API APIStacksApi::ListFiltersRequest : public Request +{ +public: + virtual ~ListFiltersRequest() {} + void SetupHttpRequest(const FHttpRequestRef& HttpRequest) const final; + FString ComputePath() const final; + + /* The name of chain */ + FString ChainName; + /* Contract addresses for collection */ + FString ContractAddress; +}; + +class IMMUTABLEZKEVMAPI_API APIStacksApi::ListFiltersResponse : public Response +{ +public: + virtual ~ListFiltersResponse() {} + void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final; + bool FromJson(const TSharedPtr& JsonValue) final; + + APIListFiltersResult Content; +}; + /* Experimental: List NFT stacks by stack_id * * ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks @@ -114,7 +142,7 @@ class IMMUTABLEZKEVMAPI_API APIStacksApi::SearchStacksRequest : public Request /* Filters results to include only stacks that have a current active listing. False and 'null' return all unfiltered stacks. */ TOptional OnlyIfHasActiveListings; /* JSON encoded traits to filter by. e.g. encodeURIComponent(JSON.stringify({\"rarity\": {\"values\": [\"common\", \"rare\"], \"condition\": \"eq\"}})) */ - TOptional Trait; + TOptional Traits; /* Keyword to search NFT name and description. Alphanumeric characters only. */ TOptional Keyword; enum class SortByEnum diff --git a/Source/Experimental/ImmutablezkEVMAPI/README.md b/Source/Experimental/ImmutablezkEVMAPI/README.md index 5879fec..4bdaf2b 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/README.md +++ b/Source/Experimental/ImmutablezkEVMAPI/README.md @@ -3,6 +3,6 @@ TO generate OpenAPI locally: ``` - openapi-generator-cli generate -i openapi.json -g cpp-ue4 -o . --additional-properties=modelNamePrefix="API",cppNamespace=ImmutableOrderbook,unrealModuleName=ImmutableOrderbook + openapi-generator-cli generate -i openapi.json -g cpp-ue4 -o . --additional-properties=modelNamePrefix="API",cppNamespace=ImmutablezkEVMAPI,unrealModuleName=ImmutablezkEVMAPI ``` \ No newline at end of file diff --git a/Source/Experimental/ImmutablezkEVMAPI/openapi.json b/Source/Experimental/ImmutablezkEVMAPI/openapi.json index 00be343..9745fce 100644 --- a/Source/Experimental/ImmutablezkEVMAPI/openapi.json +++ b/Source/Experimental/ImmutablezkEVMAPI/openapi.json @@ -3624,6 +3624,75 @@ } } }, + "/experimental/chains/{chain_name}/search/filters/{contract_address}": { + "get": { + "x-hide-from-sdk": true, + "tags": [ + "stacks" + ], + "operationId": "ListFilters", + "summary": "Experimental: Get list of metadata attribute filters", + "description": "![Experimental](https://img.shields.io/badge/status-experimental-yellow) Get list of metadata filters", + "parameters": [ + { + "name": "chain_name", + "description": "The name of chain", + "schema": { + "$ref": "#/components/schemas/ChainName" + }, + "in": "path", + "required": true, + "examples": { + "testnet": { + "value": "imtbl-zkevm-testnet", + "summary": "Immutable zkEVM Public Testnet" + } + } + }, + { + "name": "contract_address", + "in": "path", + "required": true, + "description": "Contract addresses for collection", + "schema": { + "type": "string", + "pattern": "^0x[a-fA-F0-9]{40}$", + "example": "0xe9b00a87700f660e46b6f5deaa1232836bcc07d3" + } + } + ], + "responses": { + "200": { + "description": "200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFiltersResult" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/UnauthorisedRequest" + }, + "403": { + "$ref": "#/components/responses/ForbiddenRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "429": { + "$ref": "#/components/responses/TooManyRequests" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + } + } + }, "/experimental/chains/{chain_name}/search/nfts": { "get": { "x-hide-from-sdk": true, @@ -3826,7 +3895,7 @@ } }, { - "name": "trait", + "name": "traits", "in": "query", "required": false, "description": "JSON encoded traits to filter by. e.g. encodeURIComponent(JSON.stringify({\"rarity\": {\"values\": [\"common\", \"rare\"], \"condition\": \"eq\"}}))", @@ -5695,10 +5764,22 @@ "type": "string", "nullable": true, "description": "URL for RPC node" + }, + "operator_allowlist_address": { + "type": "string", + "nullable": true, + "description": "The address of the Operator Allowlist - https://docs.immutable.com/products/zkevm/minting/royalties/allowlist-spec/" + }, + "minter_address": { + "type": "string", + "nullable": true, + "description": "The address of the minter used in the Minting API - https://docs.immutable.com/products/zkEVM/minting/minting-api#minting-api-prerequisites" } }, "required": [ - "rpc_url" + "rpc_url", + "operator_allowlist_address", + "minter_address" ] } ] @@ -9082,6 +9163,100 @@ } } }, + "FilterValue": { + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "nft_count": { + "type": "string", + "description": "Number of NFTs that have this trait. Uint256 as string" + } + }, + "example": [ + { + "value": "Common", + "nft_count": "42" + }, + { + "value": "Rare", + "nft_count": "17" + } + ], + "required": [ + "value", + "nft_count" + ] + }, + "Filter": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of trait", + "example": "Rarity" + }, + "values": { + "description": "List of 100 most common values for this trait sorted by number of associated NFTs", + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterValue" + } + }, + "omitted_values_count": { + "type": "integer", + "description": "Indicated how many more distinct values exist", + "example": 0 + } + }, + "required": [ + "name", + "values", + "omitted_values_count" + ] + }, + "FilterResult": { + "type": "object", + "properties": { + "chain": { + "$ref": "#/components/schemas/Chain" + }, + "contract_address": { + "type": "string", + "description": "ETH Address of collection that the asset belongs to", + "example": "0xe9b00a87700f660e46b6f5deaa1232836bcc07d3" + }, + "filters": { + "description": "List of all filters and the most common values", + "type": "array", + "items": { + "$ref": "#/components/schemas/Filter" + } + } + }, + "required": [ + "chain", + "contract_address", + "filters" + ] + }, + "ListFiltersResult": { + "type": "object", + "description": "List filters result", + "properties": { + "result": { + "$ref": "#/components/schemas/FilterResult" + }, + "page": { + "$ref": "#/components/schemas/Page" + } + }, + "required": [ + "result", + "page" + ] + }, "MarketplaceContractType": { "description": "The contract type for a collection", "type": "string", @@ -9297,6 +9472,18 @@ "recipient_address" ] }, + "ConvertedPrices": { + "type": "object", + "description": "A mapping of converted prices for major currencies such as ETH, USD. All converted prices are fee-inclusive.", + "nullable": true, + "additionalProperties": { + "type": "string" + }, + "example": { + "ETH": "0.0058079775", + "USD": "15.89" + } + }, "MarketPriceDetails": { "type": "object", "description": "Market Price details", @@ -9337,26 +9524,19 @@ "amount": "1000000000000000000" } ] + }, + "converted_prices": { + "$ref": "#/components/schemas/ConvertedPrices" } }, "required": [ "token", "amount", "fee_inclusive_amount", - "fees" + "fees", + "converted_prices" ] }, - "ConvertedPrices": { - "type": "object", - "description": "A mapping of converted prices for major currencies such as ETH, USD. All converted prices are fee-inclusive.", - "additionalProperties": { - "type": "string" - }, - "example": { - "ETH": "0.0058079775", - "USD": "15.89" - } - }, "Listing": { "type": "object", "properties": { @@ -9368,9 +9548,6 @@ "price_details": { "$ref": "#/components/schemas/MarketPriceDetails" }, - "converted_prices": { - "$ref": "#/components/schemas/ConvertedPrices" - }, "token_id": { "type": "string", "description": "Token ID", @@ -9395,7 +9572,6 @@ "required": [ "listing_id", "price_details", - "converted_prices", "creator", "token_id", "contract_address",