|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include "ApplicationConfig.generated.h" |
| 4 | + |
| 5 | +/** |
| 6 | + * @class UApplicationConfig |
| 7 | + * @brief Configuration settings for Passport and various APIs. |
| 8 | + * @details This class stores configuration settings such as URLs, chain names, contract addresses, |
| 9 | + * client IDs, and environment settings for the zkEVM API, Orderbook API, and Passport. |
| 10 | + */ |
| 11 | +UCLASS(Abstract, Blueprintable, ClassGroup = Immutable) |
| 12 | +class UApplicationConfig : public UObject |
| 13 | +{ |
| 14 | + GENERATED_BODY() |
| 15 | + |
| 16 | +public: |
| 17 | + /** |
| 18 | + * Retrieves URL for the zkEVM API. |
| 19 | + * |
| 20 | + * @return A constant reference to an FString containing the name of the chain. |
| 21 | + */ |
| 22 | + const FString& GetzkEVMAPIURL() |
| 23 | + { |
| 24 | + return zkEVMAPIURL; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Retrieves the name of the chain used to pass to the zkEVM API. |
| 29 | + * |
| 30 | + * @return A constant reference to an FString containing the name of the chain. |
| 31 | + */ |
| 32 | + const FString& GetzkEVMAPIChainName() |
| 33 | + { |
| 34 | + return zkEVMAPIChainName; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Retrieves URL for the Orderbook API. |
| 39 | + * |
| 40 | + * @return A constant reference to an FString containing the name of the chain. |
| 41 | + */ |
| 42 | + const FString& GetOrderbookAPIURL() |
| 43 | + { |
| 44 | + return OrederbookAPIURL; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Retrieves the name of the chain used to pass to the Orderbook API. |
| 49 | + * |
| 50 | + * @return A constant reference to an FString containing the name of the chain. |
| 51 | + */ |
| 52 | + const FString& GetOrderbookAPIChainName() |
| 53 | + { |
| 54 | + return OrderbookAPIChainName; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * @brief Retrieves the cryptocurrency contract address associated with the user's wallet balance. |
| 59 | + * |
| 60 | + * @return A string representing the contract address. |
| 61 | + */ |
| 62 | + const FString& GetTokenBalanceContractAddress() |
| 63 | + { |
| 64 | + return TokenBalanceContractAddress; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Retrieves the list of NFT contracts used in the APIs' queries. |
| 69 | + * |
| 70 | + * @return A constant reference to an array of strings representing the contracts. |
| 71 | + */ |
| 72 | + const TArray<FString>& GetNFTContractAddresses() |
| 73 | + { |
| 74 | + return NFTContractAddress; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Retrieves the Client ID used for Passport initialization. |
| 79 | + * |
| 80 | + * @return A constant reference to an FString containing the Client ID. |
| 81 | + */ |
| 82 | + const FString& GetClientID() |
| 83 | + { |
| 84 | + return ClientID; |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Retrieves the environment configuration used for Passport initialization. |
| 89 | + * |
| 90 | + * @return A constant reference to an FString representing the environment. |
| 91 | + */ |
| 92 | + const FString& GetEnvironment() |
| 93 | + { |
| 94 | + return Environment; |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * Retrieves the URL where the browser will redirect after successful authentication. |
| 99 | + * @note This is only used for Android, iOS, and macOS. |
| 100 | + * |
| 101 | + * @return A constant reference to an FString containing the redirect URL. |
| 102 | + */ |
| 103 | + const FString& GetRedirectURL() |
| 104 | + { |
| 105 | + return RedirectURL; |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * Retrieves the URL used for logging out. |
| 110 | + * |
| 111 | + * @return A constant reference to an FString containing the logout URL. |
| 112 | + */ |
| 113 | + const FString& GetLogoutURL() |
| 114 | + { |
| 115 | + return LogoutURL; |
| 116 | + } |
| 117 | + |
| 118 | +protected: |
| 119 | + /** The URL for the zkEVM API. */ |
| 120 | + UPROPERTY(EditDefaultsOnly, Category = "zkEVM API") |
| 121 | + FString zkEVMAPIURL; |
| 122 | + |
| 123 | + /** The name of the API chain used by the zkEVM API. */ |
| 124 | + UPROPERTY(EditDefaultsOnly, Category = "zkEVM API") |
| 125 | + FString zkEVMAPIChainName; |
| 126 | + |
| 127 | + /** The URL for the Orderbook API. */ |
| 128 | + UPROPERTY(EditDefaultsOnly, Category = "Orderbook API") |
| 129 | + FString OrederbookAPIURL; |
| 130 | + |
| 131 | + /** The name of the API chain used by Orderbook API. */ |
| 132 | + UPROPERTY(EditDefaultsOnly, Category = "Orderbook API") |
| 133 | + FString OrderbookAPIChainName; |
| 134 | + |
| 135 | + /** The address of the cryptocurrency contract in the blockchain. */ |
| 136 | + UPROPERTY(EditDefaultsOnly, Category = "Contracts") |
| 137 | + FString TokenBalanceContractAddress; |
| 138 | + |
| 139 | + /** An array of NFT contract addresses used for searching NFTs in the marketplace or displaying them in the player's inventory. */ |
| 140 | + UPROPERTY(EditDefaultsOnly, Category = "Contracts") |
| 141 | + TArray<FString> NFTContractAddress; |
| 142 | + |
| 143 | + /** Passport Client ID. */ |
| 144 | + UPROPERTY(EditDefaultsOnly, Category = "Passport") |
| 145 | + FString ClientID; |
| 146 | + |
| 147 | + /** Environment used to initialize passport. Ex. sandbox or production */ |
| 148 | + UPROPERTY(EditDefaultsOnly, Category = "Passport") |
| 149 | + FString Environment; |
| 150 | + |
| 151 | + /** |
| 152 | + * (Android, iOS, and macOS only) |
| 153 | + * The URL where the browser will redirect after successful authentication. |
| 154 | + */ |
| 155 | + UPROPERTY(EditDefaultsOnly, Category = "Passport") |
| 156 | + FString RedirectURL; |
| 157 | + |
| 158 | + /** The URL where the browser will redirect after logout is complete. */ |
| 159 | + UPROPERTY(EditDefaultsOnly, Category = "Passport") |
| 160 | + FString LogoutURL; |
| 161 | + |
| 162 | +}; |
0 commit comments