diff --git a/p2p_wallet/Common/Extensions/SolanaSDK+Extensions.swift b/p2p_wallet/Common/Extensions/SolanaSDK+Extensions.swift index d92c09fea7..1a2481dc1d 100644 --- a/p2p_wallet/Common/Extensions/SolanaSDK+Extensions.swift +++ b/p2p_wallet/Common/Extensions/SolanaSDK+Extensions.swift @@ -13,16 +13,19 @@ extension APIEndPoint { ) } var endpoints = remoteEndpoints.isEmpty ? defaultEndpoints : remoteEndpoints - if remoteEndpoints.isEmpty { - endpoints.insert( - .init(address: "https://p2p.rpcpool.com", network: .mainnetBeta, - additionalQuery: .secretConfig("RPCPOOL_API_KEY")), - at: 0 - ) - #if !DEBUG - endpoints.removeAll { $0.network == .testnet || $0.network == .devnet } - #endif - } +// if remoteEndpoints.isEmpty { + endpoints.insert( + .init( + address: "https://solana.keyapp.org", + network: .mainnetBeta, + additionalQuery: .secretConfig("KEYAPP_ORG_API_KEY") + ), + at: 0 + ) + #if !DEBUG + endpoints.removeAll { $0.network == .testnet || $0.network == .devnet } + #endif +// } return endpoints } } diff --git a/p2p_wallet/Common/Services/WarmupService/MigrationWarmupProcess.swift b/p2p_wallet/Common/Services/WarmupService/MigrationWarmupProcess.swift new file mode 100644 index 0000000000..fb8946a2ea --- /dev/null +++ b/p2p_wallet/Common/Services/WarmupService/MigrationWarmupProcess.swift @@ -0,0 +1,20 @@ +import Foundation +import Resolver + +class MigrationWarmupProcess: WarmupProcess { + func start() async { + // Migrate to endpoint solana.keyapp.org + let migration1Key = "APIEndpoint.migrationKey1" + if !UserDefaults.standard.bool(forKey: migration1Key) { + Resolver.resolve(ChangeNetworkResponder.self) + .changeAPIEndpoint( + to: .init( + address: "https://solana.keyapp.org", + network: .mainnetBeta, + additionalQuery: .secretConfig("KEYAPP_ORG_API_KEY") + ) + ) + UserDefaults.standard.set(true, forKey: migration1Key) + } + } +} diff --git a/p2p_wallet/Info.plist b/p2p_wallet/Info.plist index 322de822a5..17d104cedb 100644 --- a/p2p_wallet/Info.plist +++ b/p2p_wallet/Info.plist @@ -177,6 +177,8 @@ $(TRANSAK_PRODUCTION_API_KEY) TRANSAK_STAGING_API_KEY $(TRANSAK_STAGING_API_KEY) + KEYAPP_ORG_API_KEY + $(KEYAPP_ORG_API_KEY) UIApplicationSupportsIndirectInputEvents UIBackgroundModes diff --git a/p2p_wallet/Injection/Resolver+registerAllServices.swift b/p2p_wallet/Injection/Resolver+registerAllServices.swift index 6fa91daea7..6658cb39f2 100644 --- a/p2p_wallet/Injection/Resolver+registerAllServices.swift +++ b/p2p_wallet/Injection/Resolver+registerAllServices.swift @@ -42,6 +42,7 @@ extension Resolver: ResolverRegistering { WarmupManager(processes: [ RemoteConfigWarmupProcess(), TokenServiceWarmupProcess(), + MigrationWarmupProcess(), ]) }.scope(.application) diff --git a/p2p_wallet/Scenes/DebugMenu/ViewModel/DebugMenuViewModel.swift b/p2p_wallet/Scenes/DebugMenu/ViewModel/DebugMenuViewModel.swift index 396524ac32..e7916acdf7 100644 --- a/p2p_wallet/Scenes/DebugMenu/ViewModel/DebugMenuViewModel.swift +++ b/p2p_wallet/Scenes/DebugMenu/ViewModel/DebugMenuViewModel.swift @@ -25,10 +25,28 @@ final class DebugMenuViewModel: BaseViewModel, ObservableObject { } let solanaEndpoints: [APIEndPoint] = [ - .init(address: "https://api.mainnet-beta.solana.com", network: .mainnetBeta), - .init(address: "https://solana-api.projectserum.com", network: .mainnetBeta), - .init(address: "https://p2p.rpcpool.com", network: .mainnetBeta), - .init(address: "https://api.devnet.solana.com", network: .devnet), + .init( + address: "https://api.mainnet-beta.solana.com", + network: .mainnetBeta + ), + .init( + address: "https://solana-api.projectserum.com", + network: .mainnetBeta + ), + .init( + address: "https://p2p.rpcpool.com", + network: .mainnetBeta, + additionalQuery: .secretConfig("RPCPOOL_API_KEY") + ), + .init( + address: "https://solana.keyapp.org", + network: .mainnetBeta, + additionalQuery: .secretConfig("KEYAPP_ORG_API_KEY") + ), + .init( + address: "https://api.devnet.solana.com", + network: .devnet + ), ] self.solanaEndpoints = solanaEndpoints selectedEndpoint = solanaEndpoints.first(where: { $0 == Defaults.apiEndPoint })