diff --git a/Kukai Mobile.xcodeproj/project.pbxproj b/Kukai Mobile.xcodeproj/project.pbxproj index a7922072..55e04d8f 100644 --- a/Kukai Mobile.xcodeproj/project.pbxproj +++ b/Kukai Mobile.xcodeproj/project.pbxproj @@ -2792,7 +2792,7 @@ repositoryURL = "https://github.com/WalletConnect/WalletConnectSwiftV2"; requirement = { kind = exactVersion; - version = 1.18.8; + version = 1.19.4; }; }; C07A2DEE2AEA76BF00550E32 /* XCRemoteSwiftPackageReference "Starscream" */ = { diff --git a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index cd2f1ae2..e65bc26d 100644 --- a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -70,7 +70,7 @@ "location" : "https://github.com/kukai-wallet/kukai-core-swift", "state" : { "branch" : "develop", - "revision" : "b5f65d9e8f9a4041f74a7265be3e2e3a07212148" + "revision" : "f1b5a0cbac1b55fa78813f697f13b3f2f700cfae" } }, { @@ -177,8 +177,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/WalletConnect/WalletConnectSwiftV2", "state" : { - "revision" : "d819f76df8664a7550e31c03e9c4e68e990d7e91", - "version" : "1.18.8" + "revision" : "4736c2be84dcb136aeccf7111e67ab7cff513a7e", + "version" : "1.19.4" } } ], diff --git a/Kukai Mobile/AppDelegate.swift b/Kukai Mobile/AppDelegate.swift index 4772dcd0..813ad097 100644 --- a/Kukai Mobile/AppDelegate.swift +++ b/Kukai Mobile/AppDelegate.swift @@ -56,7 +56,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { if DependencyManager.shared.currentNetworkType == .mainnet { DependencyManager.shared.setDefaultMainnetURLs() } else { - DependencyManager.shared.setDefaultTestnetURLs() + DependencyManager.shared.setDefaultGhostnetURLs() } return true diff --git a/Kukai Mobile/Modules/Account/AccountViewController.swift b/Kukai Mobile/Modules/Account/AccountViewController.swift index 88878806..c1bcc924 100644 --- a/Kukai Mobile/Modules/Account/AccountViewController.swift +++ b/Kukai Mobile/Modules/Account/AccountViewController.swift @@ -135,7 +135,7 @@ extension AccountViewController: UITableViewCellButtonDelegate { func tableViewCellButtonTapped(sender: UIButton) { switch sender.accessibilityIdentifier { case AccountViewModel.accessibilityIdentifiers.onramp: - if DependencyManager.shared.currentNetworkType == .testnet { + if DependencyManager.shared.currentNetworkType == .ghostnet { UIApplication.shared.open(DependencyManager.ghostnetFaucetLink) } else { diff --git a/Kukai Mobile/Modules/Account/AccountViewModel.swift b/Kukai Mobile/Modules/Account/AccountViewModel.swift index c8cf4a5b..d7e3bff4 100644 --- a/Kukai Mobile/Modules/Account/AccountViewModel.swift +++ b/Kukai Mobile/Modules/Account/AccountViewModel.swift @@ -208,7 +208,7 @@ class AccountViewModel: ViewModel, UITableViewDiffableDataSourceHandler { let metadata = DependencyManager.shared.selectedWalletMetadata let parentMetadata = metadata?.isChild == true ? DependencyManager.shared.walletList.parentMetadata(forChildAddress: metadata?.address ?? "") : nil - let isTestnet = DependencyManager.shared.currentNetworkType == .testnet + let isTestnet = DependencyManager.shared.currentNetworkType == .ghostnet var snapshot = NSDiffableDataSourceSnapshot() var data: [AnyHashable] = [] diff --git a/Kukai Mobile/Modules/Account/TokenDetailsViewModel.swift b/Kukai Mobile/Modules/Account/TokenDetailsViewModel.swift index 33c9246e..490413db 100644 --- a/Kukai Mobile/Modules/Account/TokenDetailsViewModel.swift +++ b/Kukai Mobile/Modules/Account/TokenDetailsViewModel.swift @@ -227,7 +227,7 @@ public class TokenDetailsViewModel: ViewModel, TokenDetailsChartCellDelegate { ] // TODO: remove testnet check in future when remote serivce supports ghostnet - if balanceAndBakerData?.isDelegationPossible == true && balanceAndBakerData?.isDelegated == true && DependencyManager.shared.currentNetworkType != .testnet { + if balanceAndBakerData?.isDelegationPossible == true && balanceAndBakerData?.isDelegated == true && DependencyManager.shared.currentNetworkType != .ghostnet { data.append(stakingRewardLoadingData) } @@ -285,7 +285,7 @@ public class TokenDetailsViewModel: ViewModel, TokenDetailsChartCellDelegate { } // TODO: remove testnet check in future when remote serivce supports ghostnet - if balanceAndBakerData?.isDelegationPossible == true && balanceAndBakerData?.isDelegated == true && DependencyManager.shared.currentNetworkType != .testnet { + if balanceAndBakerData?.isDelegationPossible == true && balanceAndBakerData?.isDelegated == true && DependencyManager.shared.currentNetworkType != .ghostnet { loadBakerData { [weak self] result in guard let self = self else { return } diff --git a/Kukai Mobile/Modules/Activity/ActivityViewModel.swift b/Kukai Mobile/Modules/Activity/ActivityViewModel.swift index 91b70a7f..566139e4 100644 --- a/Kukai Mobile/Modules/Activity/ActivityViewModel.swift +++ b/Kukai Mobile/Modules/Activity/ActivityViewModel.swift @@ -171,7 +171,7 @@ class ActivityViewModel: ViewModel, UITableViewDiffableDataSourceHandler { } // Build snapshot - let isTestnet = DependencyManager.shared.currentNetworkType == .testnet + let isTestnet = DependencyManager.shared.currentNetworkType == .ghostnet currentSnapshot = NSDiffableDataSourceSnapshot() var data: [[AnyHashable]] = [[]] diff --git a/Kukai Mobile/Modules/Activity/Cells/ActivityToolbarCell.swift b/Kukai Mobile/Modules/Activity/Cells/ActivityToolbarCell.swift index 36438986..260f340b 100644 --- a/Kukai Mobile/Modules/Activity/Cells/ActivityToolbarCell.swift +++ b/Kukai Mobile/Modules/Activity/Cells/ActivityToolbarCell.swift @@ -10,11 +10,7 @@ import UIKit class ActivityToolbarCell: UITableViewCell { @IBAction func viewInExplorerTapped(_ sender: CustomisableButton) { - let tzktAPIURLString = DependencyManager.shared.tezosClientConfig.tzktURL.absoluteString - let stripAPI = tzktAPIURLString.replacingOccurrences(of: "api.", with: "") - - if let websiteURL = URL(string: stripAPI)?.appending(path: DependencyManager.shared.selectedWalletAddress ?? "").appending(path: "operations") { - UIApplication.shared.open(websiteURL) - } + let tzktAPIURLString = DependencyManager.shared.currentExplorerURL + UIApplication.shared.open(tzktAPIURLString.appending(path: DependencyManager.shared.selectedWalletAddress ?? "").appending(path: "operations")) } } diff --git a/Kukai Mobile/Modules/Collectibles/CollectiblesViewController.swift b/Kukai Mobile/Modules/Collectibles/CollectiblesViewController.swift index fcc4f2da..3a5f9748 100644 --- a/Kukai Mobile/Modules/Collectibles/CollectiblesViewController.swift +++ b/Kukai Mobile/Modules/Collectibles/CollectiblesViewController.swift @@ -77,7 +77,7 @@ class CollectiblesViewController: UIViewController { } private func displayGhostnet() { - if DependencyManager.shared.currentNetworkType != .testnet { + if DependencyManager.shared.currentNetworkType != .ghostnet { ghostnetStackview.isHidden = true } else { diff --git a/Kukai Mobile/Modules/Discover/DiscoverViewModel.swift b/Kukai Mobile/Modules/Discover/DiscoverViewModel.swift index 4e06aa5b..3d4973dc 100644 --- a/Kukai Mobile/Modules/Discover/DiscoverViewModel.swift +++ b/Kukai Mobile/Modules/Discover/DiscoverViewModel.swift @@ -132,7 +132,7 @@ class DiscoverViewModel: ViewModel, UITableViewDiffableDataSourceHandler { if groups.count == 0 { return } - if DependencyManager.shared.currentNetworkType == .testnet { + if DependencyManager.shared.currentNetworkType == .ghostnet { currentSnapshot.appendSections(Array(0.. String { - if DependencyManager.shared.currentNetworkType == .testnet { + if DependencyManager.shared.currentNetworkType == .ghostnet { return address + "-ghostnet" } diff --git a/Kukai Mobile/Services/DependencyManager.swift b/Kukai Mobile/Services/DependencyManager.swift index dbe283db..56cb92c1 100644 --- a/Kukai Mobile/Services/DependencyManager.swift +++ b/Kukai Mobile/Services/DependencyManager.swift @@ -22,15 +22,17 @@ class DependencyManager { static let defaultNodeURLs_mainnet = [URL(string: "https://mainnet.kukai.network")!, URL(string: "https://rpc.tzbeta.net")!, URL(string: "https://mainnet.smartpy.io")!] static let defaultTzktURL_mainnet = URL(string: "https://kukai.api.tzkt.io")! + static let defaultExplorerURL_mainnet = URL(string: "https://tzkt.io")! static let defaultBcdURL_mainnet = URL(string: "https://api.better-call.dev")! static let defaultTezosDomainsURL_mainnet = URL(string: "https://api.tezos.domains/graphql")! static let defaultObjktURL_mainnet = URL(string: "https://data.objkt.com/v3/graphql")! - static let defaultNodeURLs_testnet = [URL(string: "https://ghostnet.ecadinfra.com")!, URL(string: "https://rpc.ghostnet.tzboot.net")!, URL(string: "https://ghostnet.smartpy.io")!] - static let defaultTzktURL_testnet = URL(string: "https://api.ghostnet.tzkt.io")! - static let defaultBcdURL_testnet = URL(string: "https://api.better-call.dev")! - static let defaultTezosDomainsURL_testnet = URL(string: "https://ghostnet-api.tezos.domains/graphql")! - static let defaultObjktURL_testnet = URL(string: "https://data.ghostnet.objkt.com/v3/graphql")! + static let defaultNodeURLs_ghostnet = [URL(string: "https://ghostnet.ecadinfra.com")!, URL(string: "https://rpc.ghostnet.tzboot.net")!, URL(string: "https://ghostnet.smartpy.io")!] + static let defaultTzktURL_ghostnet = URL(string: "https://api.ghostnet.tzkt.io")! + static let defaultExplorerURL_ghostnet = URL(string: "https://ghostnet.tzkt.io")! + static let defaultBcdURL_ghostnet = URL(string: "https://api.better-call.dev")! + static let defaultTezosDomainsURL_ghostnet = URL(string: "https://ghostnet-api.tezos.domains/graphql")! + static let defaultObjktURL_ghostnet = URL(string: "https://data.ghostnet.objkt.com/v3/graphql")! static let ghostnetFaucetLink = URL(string: "https://faucet.ghostnet.teztnets.com/")! @@ -89,6 +91,11 @@ class DependencyManager { get { return URL(string: UserDefaults.standard.string(forKey: "app.kukai.mobile.tzkt.url") ?? "") ?? DependencyManager.defaultTzktURL_mainnet } } + var currentExplorerURL: URL { + set { UserDefaults.standard.setValue(newValue.absoluteString, forKey: "app.kukai.mobile.explorer.url") } + get { return URL(string: UserDefaults.standard.string(forKey: "app.kukai.mobile.explorer.url") ?? "") ?? DependencyManager.defaultExplorerURL_mainnet } + } + var currentBcdURL: URL { set { UserDefaults.standard.setValue(newValue.absoluteString, forKey: "app.kukai.mobile.bcd.url") } get { return URL(string: UserDefaults.standard.string(forKey: "app.kukai.mobile.bcd.url") ?? "") ?? DependencyManager.defaultBcdURL_mainnet } @@ -239,6 +246,7 @@ class DependencyManager { func setDefaultMainnetURLs(supressUpdateNotification: Bool = false) { currentNodeURLs = DependencyManager.defaultNodeURLs_mainnet currentTzktURL = DependencyManager.defaultTzktURL_mainnet + currentExplorerURL = DependencyManager.defaultExplorerURL_mainnet currentBcdURL = DependencyManager.defaultBcdURL_mainnet currentTezosDomainsURL = DependencyManager.defaultTezosDomainsURL_mainnet currentObjktURL = DependencyManager.defaultObjktURL_mainnet @@ -247,13 +255,14 @@ class DependencyManager { updateKukaiCoreClients(supressUpdateNotification: supressUpdateNotification) } - func setDefaultTestnetURLs(supressUpdateNotification: Bool = false) { - currentNodeURLs = DependencyManager.defaultNodeURLs_testnet - currentTzktURL = DependencyManager.defaultTzktURL_testnet - currentBcdURL = DependencyManager.defaultBcdURL_testnet - currentTezosDomainsURL = DependencyManager.defaultTezosDomainsURL_testnet - currentObjktURL = DependencyManager.defaultObjktURL_testnet - currentNetworkType = .testnet + func setDefaultGhostnetURLs(supressUpdateNotification: Bool = false) { + currentNodeURLs = DependencyManager.defaultNodeURLs_ghostnet + currentTzktURL = DependencyManager.defaultTzktURL_ghostnet + currentExplorerURL = DependencyManager.defaultExplorerURL_ghostnet + currentBcdURL = DependencyManager.defaultBcdURL_ghostnet + currentTezosDomainsURL = DependencyManager.defaultTezosDomainsURL_ghostnet + currentObjktURL = DependencyManager.defaultObjktURL_ghostnet + currentNetworkType = .ghostnet updateKukaiCoreClients(supressUpdateNotification: supressUpdateNotification) } diff --git a/Kukai Mobile/Services/WalletConnectService.swift b/Kukai Mobile/Services/WalletConnectService.swift index 6982c64e..f8887221 100644 --- a/Kukai Mobile/Services/WalletConnectService.swift +++ b/Kukai Mobile/Services/WalletConnectService.swift @@ -82,7 +82,7 @@ public class WalletConnectService { description: "Kukai iOS", url: "https://wallet.kukai.app", icons: ["https://wallet.kukai.app/assets/img/header-logo.svg"], - redirect: AppMetadata.Redirect(native: "kukai://", universal: nil)) + redirect: (try! AppMetadata.Redirect(native: "kukai://", universal: nil)) ) private var pairingTimer: Timer? = nil private var requestOrProposalInProgress = false