Skip to content

Commit

Permalink
Merge branch 'fix/endpoint' into release/2.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bigearsenal committed Jan 2, 2024
2 parents 8f8eb17 + a34a0c6 commit c4e6e73
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 14 deletions.
23 changes: 13 additions & 10 deletions p2p_wallet/Common/Extensions/SolanaSDK+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
2 changes: 2 additions & 0 deletions p2p_wallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
<string>$(TRANSAK_PRODUCTION_API_KEY)</string>
<key>TRANSAK_STAGING_API_KEY</key>
<string>$(TRANSAK_STAGING_API_KEY)</string>
<key>KEYAPP_ORG_API_KEY</key>
<string>$(KEYAPP_ORG_API_KEY)</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
Expand Down
1 change: 1 addition & 0 deletions p2p_wallet/Injection/Resolver+registerAllServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ extension Resolver: ResolverRegistering {
WarmupManager(processes: [
RemoteConfigWarmupProcess(),
TokenServiceWarmupProcess(),
MigrationWarmupProcess(),
])
}.scope(.application)

Expand Down
26 changes: 22 additions & 4 deletions p2p_wallet/Scenes/DebugMenu/ViewModel/DebugMenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit c4e6e73

Please sign in to comment.