diff --git a/.github/workflows/deploy_appstore.yml b/.github/workflows/deploy_appstore.yml index f48cb026ce..815fa3d215 100644 --- a/.github/workflows/deploy_appstore.yml +++ b/.github/workflows/deploy_appstore.yml @@ -72,3 +72,4 @@ jobs: XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY: ${{ secrets.XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY }} XCCONFIG_PROD_SHARED_CLOUD_CONTAINER_ID: ${{ secrets.XCCONFIG_PROD_SHARED_CLOUD_CONTAINER_ID }} XCCONFIG_PROD_PRIVATE_CLOUD_CONTAINER_ID: ${{ secrets.XCCONFIG_PROD_PRIVATE_CLOUD_CONTAINER_ID }} + XCCONFIG_PROD_OPEN_SEA_API_KEY: ${{ secrets.XCCONFIG_PROD_OPEN_SEA_API_KEY }} diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index 53a0746e4f..88ae70f1da 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -73,3 +73,4 @@ jobs: XCCONFIG_DEV_WALLET_CONNECT_V2_PROJECT_KEY: ${{ secrets.XCCONFIG_DEV_WALLET_CONNECT_V2_PROJECT_KEY }} XCCONFIG_DEV_SHARED_CLOUD_CONTAINER_ID: ${{ secrets.XCCONFIG_DEV_SHARED_CLOUD_CONTAINER_ID }} XCCONFIG_DEV_PRIVATE_CLOUD_CONTAINER_ID: ${{ secrets.XCCONFIG_DEV_PRIVATE_CLOUD_CONTAINER_ID }} + XCCONFIG_DEV_OPEN_SEA_API_KEY: ${{ secrets.XCCONFIG_DEV_OPEN_SEA_API_KEY }} diff --git a/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig b/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig index 319709a58e..0bf3ba7953 100644 --- a/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig +++ b/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig @@ -17,3 +17,4 @@ wallet_connect_v2_project_key = default_words = shared_cloud_container_id = private_cloud_container_id = +open_sea_api_key = diff --git a/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig b/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig index 19c31d93a6..51e68f0928 100644 --- a/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig +++ b/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig @@ -16,3 +16,4 @@ trongrid_api_key = wallet_connect_v2_project_key = shared_cloud_container_id = private_cloud_container_id = +open_sea_api_key = diff --git a/UnstoppableWallet/UnstoppableWallet/Core/App.swift b/UnstoppableWallet/UnstoppableWallet/Core/App.swift index 9ba4bc9e39..b6bbd07255 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/App.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/App.swift @@ -221,7 +221,7 @@ class App { let nftDatabaseStorage = try NftDatabaseStorage(dbPool: dbPool) let nftStorage = NftStorage(marketKit: marketKit, storage: nftDatabaseStorage) - nftMetadataManager = NftMetadataManager(networkManager: networkManager, marketKit: marketKit, storage: nftStorage) + nftMetadataManager = NftMetadataManager(networkManager: networkManager, marketKit: marketKit, storage: nftStorage, appConfigProvider: appConfigProvider) nftAdapterManager = NftAdapterManager( walletManager: walletManager, evmBlockchainManager: evmBlockchainManager diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Managers/NftMetadataManager.swift b/UnstoppableWallet/UnstoppableWallet/Core/Managers/NftMetadataManager.swift index e688c9b1d5..a749de288c 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Managers/NftMetadataManager.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Managers/NftMetadataManager.swift @@ -11,11 +11,11 @@ class NftMetadataManager { private let addressMetadataRelay = PublishRelay<(NftKey, NftAddressMetadata)>() - init(networkManager: NetworkManager, marketKit: MarketKit.Kit, storage: NftStorage) { + init(networkManager: NetworkManager, marketKit: MarketKit.Kit, storage: NftStorage, appConfigProvider: AppConfigProvider) { self.storage = storage providerMap = [ - .ethereum: OpenSeaNftProvider(networkManager: networkManager, marketKit: marketKit) + .ethereum: OpenSeaNftProvider(networkManager: networkManager, marketKit: marketKit, appConfigProvider: appConfigProvider) ] eventProviderMap = [ diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfigProvider.swift b/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfigProvider.swift index 5d2b541743..1b70e76b7e 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfigProvider.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfigProvider.swift @@ -99,6 +99,10 @@ class AppConfigProvider { Bundle.main.object(forInfoDictionaryKey: "PrivateCloudContainerId") as? String } + var openSeaApiKey: String { + (Bundle.main.object(forInfoDictionaryKey: "OpenSeaApiKey") as? String) ?? "" + } + } diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Providers/Nft/OpenSeaNftProvider.swift b/UnstoppableWallet/UnstoppableWallet/Core/Providers/Nft/OpenSeaNftProvider.swift index 03c6abec80..f3823cc6ce 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Providers/Nft/OpenSeaNftProvider.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Providers/Nft/OpenSeaNftProvider.swift @@ -16,12 +16,13 @@ class OpenSeaNftProvider { private let headers: HTTPHeaders private let encoding: ParameterEncoding = URLEncoding(arrayEncoding: .noBrackets, boolEncoding: .literal) - init(networkManager: NetworkManager, marketKit: MarketKit.Kit) { + init(networkManager: NetworkManager, marketKit: MarketKit.Kit, appConfigProvider: AppConfigProvider) { self.networkManager = networkManager self.marketKit = marketKit headers = HTTPHeaders([ - HTTPHeader.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36") + HTTPHeader.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"), + HTTPHeader(name: "X-API-KEY", value: appConfigProvider.openSeaApiKey) ]) } diff --git a/UnstoppableWallet/UnstoppableWallet/Info.plist b/UnstoppableWallet/UnstoppableWallet/Info.plist index 52b4859e19..ad633d5f1a 100644 --- a/UnstoppableWallet/UnstoppableWallet/Info.plist +++ b/UnstoppableWallet/UnstoppableWallet/Info.plist @@ -139,5 +139,7 @@ ${private_cloud_container_id} WallectConnectV2ProjectKey ${wallet_connect_v2_project_key} + OpenSeaApiKey + ${open_sea_api_key} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f5c72ce263..848e087c9e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -27,6 +27,7 @@ XCCONFIG_DEV_DEFIYIELD_API_KEY = ENV["XCCONFIG_DEV_DEFIYIELD_API_KEY"] XCCONFIG_DEV_TWITTER_BEARER_TOKEN = ENV["XCCONFIG_DEV_TWITTER_BEARER_TOKEN"] XCCONFIG_DEV_HS_PROVIDER_API_KEY = ENV["XCCONFIG_DEV_HS_PROVIDER_API_KEY"] XCCONFIG_DEV_WALLET_CONNECT_V2_PROJECT_KEY = ENV["XCCONFIG_DEV_WALLET_CONNECT_V2_PROJECT_KEY"] +XCCONFIG_DEV_OPEN_SEA_API_KEY = ENV["XCCONFIG_DEV_OPEN_SEA_API_KEY"] XCCONFIG_DEV_SHARED_CLOUD_CONTAINER_ID = ENV["XCCONFIG_DEV_SHARED_CLOUD_CONTAINER_ID"] XCCONFIG_DEV_PRIVATE_CLOUD_CONTAINER_ID = ENV["XCCONFIG_DEV_PRIVATE_CLOUD_CONTAINER_ID"] @@ -45,6 +46,7 @@ XCCONFIG_PROD_DEFIYIELD_API_KEY = ENV["XCCONFIG_PROD_DEFIYIELD_API_KEY"] XCCONFIG_PROD_TWITTER_BEARER_TOKEN = ENV["XCCONFIG_PROD_TWITTER_BEARER_TOKEN"] XCCONFIG_PROD_HS_PROVIDER_API_KEY = ENV["XCCONFIG_PROD_HS_PROVIDER_API_KEY"] XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY = ENV["XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY"] +XCCONFIG_PROD_OPEN_SEA_API_KEY = ENV["XCCONFIG_PROD_OPEN_SEA_API_KEY"] XCCONFIG_PROD_SHARED_CLOUD_CONTAINER_ID = ENV["XCCONFIG_PROD_SHARED_CLOUD_CONTAINER_ID"] XCCONFIG_PROD_PRIVATE_CLOUD_CONTAINER_ID = ENV["XCCONFIG_PROD_PRIVATE_CLOUD_CONTAINER_ID"] @@ -122,6 +124,7 @@ def apply_dev_xcconfig update_dev_xcconfig('wallet_connect_v2_project_key', XCCONFIG_DEV_WALLET_CONNECT_V2_PROJECT_KEY) update_dev_xcconfig('shared_cloud_container_id', XCCONFIG_DEV_SHARED_CLOUD_CONTAINER_ID) update_dev_xcconfig('private_cloud_container_id', XCCONFIG_DEV_PRIVATE_CLOUD_CONTAINER_ID) + update_dev_xcconfig('open_sea_api_key', XCCONFIG_DEV_OPEN_SEA_API_KEY) end def apply_prod_xcconfig @@ -141,6 +144,7 @@ def apply_prod_xcconfig update_prod_xcconfig('wallet_connect_v2_project_key', XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY) update_prod_xcconfig('shared_cloud_container_id', XCCONFIG_PROD_SHARED_CLOUD_CONTAINER_ID) update_prod_xcconfig('private_cloud_container_id', XCCONFIG_PROD_PRIVATE_CLOUD_CONTAINER_ID) + update_prod_xcconfig('open_sea_api_key', XCCONFIG_PROD_OPEN_SEA_API_KEY) end def force_update_devices(type, username)