Skip to content

Commit

Permalink
Integrate api key rotation for EVM block explorers
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Oct 22, 2024
1 parent 645767d commit 6e789c6
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 120 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/deploy_appstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ jobs:
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

XCCONFIG_PROD_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_ETHERSCAN_API_KEY }}
XCCONFIG_PROD_ARBISCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_ARBISCAN_API_KEY }}
XCCONFIG_PROD_OPTIMISM_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_OPTIMISM_ETHERSCAN_API_KEY }}
XCCONFIG_PROD_BASESCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_BASESCAN_API_KEY }}
XCCONFIG_PROD_BSCSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_BSCSCAN_API_KEY }}
XCCONFIG_PROD_POLYGONSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_POLYGONSCAN_API_KEY }}
XCCONFIG_PROD_SNOWTRACE_API_KEY: ${{ secrets.XCCONFIG_PROD_SNOWTRACE_API_KEY }}
XCCONFIG_PROD_GNOSISSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_GNOSISSCAN_API_KEY }}
XCCONFIG_PROD_FTMSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_FTMSCAN_API_KEY }}
XCCONFIG_PROD_ETHERSCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_ETHERSCAN_API_KEYS }}
XCCONFIG_PROD_ARBISCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_ARBISCAN_API_KEYS }}
XCCONFIG_PROD_OPTIMISM_ETHERSCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_OPTIMISM_ETHERSCAN_API_KEYS }}
XCCONFIG_PROD_BASESCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_BASESCAN_API_KEYS }}
XCCONFIG_PROD_BSCSCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_BSCSCAN_API_KEYS }}
XCCONFIG_PROD_POLYGONSCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_POLYGONSCAN_API_KEYS }}
XCCONFIG_PROD_SNOWTRACE_API_KEYS: ${{ secrets.XCCONFIG_PROD_SNOWTRACE_API_KEYS }}
XCCONFIG_PROD_GNOSISSCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_GNOSISSCAN_API_KEYS }}
XCCONFIG_PROD_FTMSCAN_API_KEYS: ${{ secrets.XCCONFIG_PROD_FTMSCAN_API_KEYS }}
XCCONFIG_PROD_DEFIYIELD_API_KEY: ${{ secrets.XCCONFIG_PROD_DEFIYIELD_API_KEY }}
XCCONFIG_PROD_TWITTER_BEARER_TOKEN: ${{ secrets.XCCONFIG_PROD_TWITTER_BEARER_TOKEN }}
XCCONFIG_PROD_HS_PROVIDER_API_KEY: ${{ secrets.XCCONFIG_PROD_HS_PROVIDER_API_KEY }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ jobs:
APP_CENTER_API_TOKEN: ${{ secrets.APP_CENTER_API_TOKEN }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

XCCONFIG_DEV_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_ETHERSCAN_API_KEY }}
XCCONFIG_DEV_ARBISCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_ARBISCAN_API_KEY }}
XCCONFIG_DEV_OPTIMISM_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_OPTIMISM_ETHERSCAN_API_KEY }}
XCCONFIG_DEV_BASESCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_BASESCAN_API_KEY }}
XCCONFIG_DEV_BSCSCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_BSCSCAN_API_KEY }}
XCCONFIG_DEV_POLYGONSCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_POLYGONSCAN_API_KEY }}
XCCONFIG_DEV_SNOWTRACE_API_KEY: ${{ secrets.XCCONFIG_DEV_SNOWTRACE_API_KEY }}
XCCONFIG_DEV_GNOSISSCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_GNOSISSCAN_API_KEY }}
XCCONFIG_DEV_FTMSCAN_API_KEY: ${{ secrets.XCCONFIG_DEV_FTMSCAN_API_KEY }}
XCCONFIG_DEV_ETHERSCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_ETHERSCAN_API_KEYS }}
XCCONFIG_DEV_ARBISCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_ARBISCAN_API_KEYS }}
XCCONFIG_DEV_OPTIMISM_ETHERSCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_OPTIMISM_ETHERSCAN_API_KEYS }}
XCCONFIG_DEV_BASESCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_BASESCAN_API_KEYS }}
XCCONFIG_DEV_BSCSCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_BSCSCAN_API_KEYS }}
XCCONFIG_DEV_POLYGONSCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_POLYGONSCAN_API_KEYS }}
XCCONFIG_DEV_SNOWTRACE_API_KEYS: ${{ secrets.XCCONFIG_DEV_SNOWTRACE_API_KEYS }}
XCCONFIG_DEV_GNOSISSCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_GNOSISSCAN_API_KEYS }}
XCCONFIG_DEV_FTMSCAN_API_KEYS: ${{ secrets.XCCONFIG_DEV_FTMSCAN_API_KEYS }}
XCCONFIG_DEV_DEFIYIELD_API_KEY: ${{ secrets.XCCONFIG_DEV_DEFIYIELD_API_KEY }}
XCCONFIG_DEV_TWITTER_BEARER_TOKEN: ${{ secrets.XCCONFIG_DEV_TWITTER_BEARER_TOKEN }}
XCCONFIG_DEV_HS_PROVIDER_API_KEY: ${{ secrets.XCCONFIG_DEV_HS_PROVIDER_API_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13011,7 +13011,7 @@
repositoryURL = "https://github.com/horizontalsystems/EvmKit.Swift";
requirement = {
kind = exactVersion;
version = 2.0.21;
version = 2.1.0;
};
};
D3604E4828F02A8B0066C366 /* XCRemoteSwiftPackageReference "Eip20Kit" */ = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
etherscan_api_key =
arbiscan_api_key =
optimism_etherscan_api_key =
basescan_api_key =
bscscan_api_key =
polygonscan_api_key =
gnosisscan_api_key =
ftmscan_api_key =
snowtrace_api_key =
etherscan_api_keys =
arbiscan_api_keys =
optimism_etherscan_api_keys =
basescan_api_keys =
bscscan_api_keys =
polygonscan_api_keys =
gnosisscan_api_keys =
ftmscan_api_keys =
snowtrace_api_keys =
defiyield_api_key =
twitter_bearer_token =
market_api_url = https:/$()/api-dev.blocksdecoded.com
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
etherscan_api_key =
arbiscan_api_key =
optimism_etherscan_api_key =
basescan_api_key =
bscscan_api_key =
polygonscan_api_key =
gnosisscan_api_key =
ftmscan_api_key =
snowtrace_api_key =
etherscan_api_keys =
arbiscan_api_keys =
optimism_etherscan_api_keys =
basescan_api_keys =
bscscan_api_keys =
polygonscan_api_keys =
gnosisscan_api_keys =
ftmscan_api_keys =
snowtrace_api_keys =
defiyield_api_key =
twitter_bearer_token =
market_api_url = https:/$()/api.blocksdecoded.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class EvmSyncSourceManager {

private func defaultTransactionSource(blockchainType: BlockchainType) -> EvmKit.TransactionSource {
switch blockchainType {
case .ethereum: return .ethereumEtherscan(apiKey: AppConfig.etherscanKey)
case .binanceSmartChain: return .bscscan(apiKey: AppConfig.bscscanKey)
case .polygon: return .polygonscan(apiKey: AppConfig.polygonscanKey)
case .avalanche: return .snowtrace(apiKey: AppConfig.snowtraceKey)
case .optimism: return .optimisticEtherscan(apiKey: AppConfig.optimismEtherscanKey)
case .arbitrumOne: return .arbiscan(apiKey: AppConfig.arbiscanKey)
case .gnosis: return .gnosis(apiKey: AppConfig.gnosisscanKey)
case .fantom: return .fantom(apiKey: AppConfig.ftmscanKey)
case .base: return .basescan(apiKey: AppConfig.basescanKey)
case .ethereum: return .ethereumEtherscan(apiKeys: AppConfig.etherscanKeys)
case .binanceSmartChain: return .bscscan(apiKeys: AppConfig.bscscanKeys)
case .polygon: return .polygonscan(apiKeys: AppConfig.polygonscanKeys)
case .avalanche: return .snowtrace(apiKeys: AppConfig.snowtraceKeys)
case .optimism: return .optimisticEtherscan(apiKeys: AppConfig.optimismEtherscanKeys)
case .arbitrumOne: return .arbiscan(apiKeys: AppConfig.arbiscanKeys)
case .gnosis: return .gnosis(apiKeys: AppConfig.gnosisscanKeys)
case .fantom: return .fantom(apiKeys: AppConfig.ftmscanKeys)
case .base: return .basescan(apiKeys: AppConfig.basescanKeys)
default: fatalError("Non-supported EVM blockchain")
}
}
Expand All @@ -53,7 +53,7 @@ extension EvmSyncSourceManager {
rpcSource: .http(urls: [URL(string: "\(AppConfig.marketApiUrl)/v1/ethereum-rpc/sepolia")!], auth: nil),
transactionSource: EvmKit.TransactionSource(
name: "sepolia.etherscan.io",
type: .etherscan(apiBaseUrl: "https://api-sepolia.etherscan.io", txBaseUrl: "https://sepiloa.etherscan.io", apiKey: AppConfig.etherscanKey)
type: .etherscan(apiBaseUrl: "https://api-sepolia.etherscan.io", txBaseUrl: "https://sepiloa.etherscan.io", apiKeys: AppConfig.etherscanKeys)
)
),
]
Expand All @@ -79,7 +79,7 @@ extension EvmSyncSourceManager {
rpcSource: .http(urls: [URL(string: "https://data-seed-prebsc-1-s1.binance.org:8545")!], auth: nil),
transactionSource: EvmKit.TransactionSource(
name: "testnet.bscscan.com",
type: .etherscan(apiBaseUrl: "https://api-testnet.bscscan.com", txBaseUrl: "https://testnet.bscscan.com", apiKey: AppConfig.bscscanKey)
type: .etherscan(apiBaseUrl: "https://api-testnet.bscscan.com", txBaseUrl: "https://testnet.bscscan.com", apiKeys: AppConfig.bscscanKeys)
)
),
]
Expand Down
36 changes: 18 additions & 18 deletions UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,40 +65,40 @@ enum AppConfig {
Bundle.main.object(forInfoDictionaryKey: "OfficeMode") as? String == "true"
}

static var etherscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "EtherscanApiKey") as? String) ?? ""
static var etherscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "EtherscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var arbiscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "ArbiscanApiKey") as? String) ?? ""
static var arbiscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "ArbiscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var gnosisscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "GnosisscanApiKey") as? String) ?? ""
static var gnosisscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "GnosisscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var ftmscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "FtmscanApiKey") as? String) ?? ""
static var ftmscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "FtmscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var optimismEtherscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "OptimismEtherscanApiKey") as? String) ?? ""
static var optimismEtherscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "OptimismEtherscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var basescanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "BasescanApiKey") as? String) ?? ""
static var basescanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "BasescanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var bscscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "BscscanApiKey") as? String) ?? ""
static var bscscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "BscscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var polygonscanKey: String {
(Bundle.main.object(forInfoDictionaryKey: "PolygonscanApiKey") as? String) ?? ""
static var polygonscanKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "PolygonscanApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var snowtraceKey: String {
(Bundle.main.object(forInfoDictionaryKey: "SnowtraceApiKey") as? String) ?? ""
static var snowtraceKeys: [String] {
((Bundle.main.object(forInfoDictionaryKey: "SnowtraceApiKeys") as? String) ?? "").components(separatedBy: ",")
}

static var twitterBearerToken: String? {
Expand Down
36 changes: 18 additions & 18 deletions UnstoppableWallet/UnstoppableWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ArbiscanApiKey</key>
<string>${arbiscan_api_key}</string>
<key>BasescanApiKey</key>
<string>${basescan_api_key}</string>
<key>BscscanApiKey</key>
<string>${bscscan_api_key}</string>
<key>ArbiscanApiKeys</key>
<string>${arbiscan_api_keys}</string>
<key>BasescanApiKeys</key>
<string>${basescan_api_keys}</string>
<key>BscscanApiKeys</key>
<string>${bscscan_api_keys}</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down Expand Up @@ -57,12 +57,12 @@
<string>$(defiyield_api_key)</string>
<key>DonateEnabled</key>
<string>${donate_enabled}</string>
<key>EtherscanApiKey</key>
<string>${etherscan_api_key}</string>
<key>FtmscanApiKey</key>
<string>${ftmscan_api_key}</string>
<key>GnosisscanApiKey</key>
<string>${gnosisscan_api_key}</string>
<key>EtherscanApiKeys</key>
<string>${etherscan_api_keys}</string>
<key>FtmscanApiKeys</key>
<string>${ftmscan_api_keys}</string>
<key>GnosisscanApiKeys</key>
<string>${gnosisscan_api_keys}</string>
<key>HsProviderApiKey</key>
<string>$(hs_provider_api_key)</string>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down Expand Up @@ -121,10 +121,10 @@
<string>${one_inch_commission_address}</string>
<key>OpenSeaApiKey</key>
<string>${open_sea_api_key}</string>
<key>OptimismEtherscanApiKey</key>
<string>${optimism_etherscan_api_key}</string>
<key>PolygonscanApiKey</key>
<string>${polygonscan_api_key}</string>
<key>OptimismEtherscanApiKeys</key>
<string>${optimism_etherscan_api_keys}</string>
<key>PolygonscanApiKeys</key>
<string>${polygonscan_api_keys}</string>
<key>PrivateCloudContainerId</key>
<string>${private_cloud_container_id}</string>
<key>SharedCloudContainerId</key>
Expand All @@ -133,8 +133,8 @@
<string>${ShowBuildNumber}</string>
<key>ShowTestNetSwitcher</key>
<string>${ShowTestNetSwitcher}</string>
<key>SnowtraceApiKey</key>
<string>${snowtrace_api_key}</string>
<key>SnowtraceApiKeys</key>
<string>${snowtrace_api_keys}</string>
<key>SwapEnabled</key>
<string>${swap_enabled}</string>
<key>TronGridApiKey</key>
Expand Down
Loading

0 comments on commit 6e789c6

Please sign in to comment.