Skip to content

Commit

Permalink
Add api key for OpenSea provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Jun 22, 2023
1 parent 3555df7 commit f11265d
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy_appstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ wallet_connect_v2_project_key =
default_words =
shared_cloud_container_id =
private_cloud_container_id =
open_sea_api_key =
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ trongrid_api_key =
wallet_connect_v2_project_key =
shared_cloud_container_id =
private_cloud_container_id =
open_sea_api_key =
2 changes: 1 addition & 1 deletion UnstoppableWallet/UnstoppableWallet/Core/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class AppConfigProvider {
Bundle.main.object(forInfoDictionaryKey: "PrivateCloudContainerId") as? String
}

var openSeaApiKey: String {
(Bundle.main.object(forInfoDictionaryKey: "OpenSeaApiKey") as? String) ?? ""
}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])
}

Expand Down
2 changes: 2 additions & 0 deletions UnstoppableWallet/UnstoppableWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,7 @@
<string>${private_cloud_container_id}</string>
<key>WallectConnectV2ProjectKey</key>
<string>${wallet_connect_v2_project_key}</string>
<key>OpenSeaApiKey</key>
<string>${open_sea_api_key}</string>
</dict>
</plist>
4 changes: 4 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"]
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit f11265d

Please sign in to comment.