-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added application configuration utilities (#151)
* feat: added utilities to simplify managing immutable configurations * chore: added missing commets
- Loading branch information
1 parent
1d589a8
commit 0812272
Showing
7 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
#pragma once | ||
|
||
#include "ApplicationConfig.generated.h" | ||
|
||
/** | ||
* @class UApplicationConfig | ||
* @brief Configuration settings for Passport and various APIs. | ||
* @details This class stores configuration settings such as URLs, chain names, contract addresses, | ||
* client IDs, and environment settings for the zkEVM API, Orderbook API, and Passport. | ||
*/ | ||
UCLASS(Abstract, Blueprintable, ClassGroup = Immutable) | ||
class UApplicationConfig : public UObject | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
/** | ||
* Retrieves URL for the zkEVM API. | ||
* | ||
* @return A constant reference to an FString containing the name of the chain. | ||
*/ | ||
const FString& GetzkEVMAPIURL() | ||
{ | ||
return zkEVMAPIURL; | ||
} | ||
|
||
/** | ||
* Retrieves the name of the chain used to pass to the zkEVM API. | ||
* | ||
* @return A constant reference to an FString containing the name of the chain. | ||
*/ | ||
const FString& GetzkEVMAPIChainName() | ||
{ | ||
return zkEVMAPIChainName; | ||
} | ||
|
||
/** | ||
* Retrieves URL for the Orderbook API. | ||
* | ||
* @return A constant reference to an FString containing the name of the chain. | ||
*/ | ||
const FString& GetOrderbookAPIURL() | ||
{ | ||
return OrederbookAPIURL; | ||
} | ||
|
||
/** | ||
* Retrieves the name of the chain used to pass to the Orderbook API. | ||
* | ||
* @return A constant reference to an FString containing the name of the chain. | ||
*/ | ||
const FString& GetOrderbookAPIChainName() | ||
{ | ||
return OrderbookAPIChainName; | ||
} | ||
|
||
/** | ||
* @brief Retrieves the cryptocurrency contract address associated with the user's wallet balance. | ||
* | ||
* @return A string representing the contract address. | ||
*/ | ||
const FString& GetTokenBalanceContractAddress() | ||
{ | ||
return TokenBalanceContractAddress; | ||
} | ||
|
||
/** | ||
* Retrieves the list of NFT contracts used in the APIs' queries. | ||
* | ||
* @return A constant reference to an array of strings representing the contracts. | ||
*/ | ||
const TArray<FString>& GetNFTContractAddresses() | ||
{ | ||
return NFTContractAddress; | ||
} | ||
|
||
/** | ||
* Retrieves the Client ID used for Passport initialization. | ||
* | ||
* @return A constant reference to an FString containing the Client ID. | ||
*/ | ||
const FString& GetClientID() | ||
{ | ||
return ClientID; | ||
} | ||
|
||
/** | ||
* Retrieves the environment configuration used for Passport initialization. | ||
* | ||
* @return A constant reference to an FString representing the environment. | ||
*/ | ||
const FString& GetEnvironment() | ||
{ | ||
return Environment; | ||
} | ||
|
||
/** | ||
* Retrieves the URL where the browser will redirect after successful authentication. | ||
* @note This is only used for Android, iOS, and macOS. | ||
* | ||
* @return A constant reference to an FString containing the redirect URL. | ||
*/ | ||
const FString& GetRedirectURL() | ||
{ | ||
return RedirectURL; | ||
} | ||
|
||
/** | ||
* Retrieves the URL used for logging out. | ||
* | ||
* @return A constant reference to an FString containing the logout URL. | ||
*/ | ||
const FString& GetLogoutURL() | ||
{ | ||
return LogoutURL; | ||
} | ||
|
||
protected: | ||
/** The URL for the zkEVM API. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "zkEVM API") | ||
FString zkEVMAPIURL; | ||
|
||
/** The name of the API chain used by the zkEVM API. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "zkEVM API") | ||
FString zkEVMAPIChainName; | ||
|
||
/** The URL for the Orderbook API. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Orderbook API") | ||
FString OrederbookAPIURL; | ||
|
||
/** The name of the API chain used by Orderbook API. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Orderbook API") | ||
FString OrderbookAPIChainName; | ||
|
||
/** The address of the cryptocurrency contract in the blockchain. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Contracts") | ||
FString TokenBalanceContractAddress; | ||
|
||
/** An array of NFT contract addresses used for searching NFTs in the marketplace or displaying them in the player's inventory. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Contracts") | ||
TArray<FString> NFTContractAddress; | ||
|
||
/** Passport Client ID. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Passport") | ||
FString ClientID; | ||
|
||
/** Environment used to initialize passport. Ex. sandbox or production */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Passport") | ||
FString Environment; | ||
|
||
/** | ||
* (Android, iOS, and macOS only) | ||
* The URL where the browser will redirect after successful authentication. | ||
*/ | ||
UPROPERTY(EditDefaultsOnly, Category = "Passport") | ||
FString RedirectURL; | ||
|
||
/** The URL where the browser will redirect after logout is complete. */ | ||
UPROPERTY(EditDefaultsOnly, Category = "Passport") | ||
FString LogoutURL; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Source/Immutable/Public/Immutable/ImmutablePluginSettings.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include "Engine/DeveloperSettings.h" | ||
#include "ApplicationConfig.h" | ||
|
||
#include "ImmutablePluginSettings.generated.h" | ||
|
||
|
||
/** | ||
* ImmutablePluginSettings is a configuration class for the Immutable plugin. | ||
* This class contains settings that can be adjusted to control the behavior | ||
* of the Immutable plugin within the Unreal Engine environment. | ||
*/ | ||
UCLASS(config = Game, defaultconfig, meta = (DisplayName = "Immutable Plugin Settings")) | ||
class IMMUTABLE_API UImmutablePluginSettings : public UDeveloperSettings | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
/// The default application configuration class. | ||
/// This property holds a reference to a subclass of UApplicationConfig, | ||
/// which will be used as the default configuration for the application. | ||
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "General") | ||
TSubclassOf<UApplicationConfig> DefaultApplicationConfig; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters