diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Web3Modal.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/WalletConnectModal.xcscheme similarity index 71% rename from .swiftpm/xcode/xcshareddata/xcschemes/Web3Modal.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/WalletConnectModal.xcscheme index 8096d2466..fee4df7b0 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Web3Modal.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/WalletConnectModal.xcscheme @@ -1,6 +1,6 @@ @@ -28,6 +28,18 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" shouldAutocreateTestPlan = "YES"> + + + + + + diff --git a/Example/DApp/SceneDelegate.swift b/Example/DApp/SceneDelegate.swift index fc931226d..cee7938cc 100644 --- a/Example/DApp/SceneDelegate.swift +++ b/Example/DApp/SceneDelegate.swift @@ -2,7 +2,7 @@ import UIKit import Auth import WalletConnectRelay import WalletConnectNetworking -import Web3Modal +import WalletConnectModal class SceneDelegate: UIResponder, UIWindowSceneDelegate { @@ -22,7 +22,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { icons: ["https://avatars.githubusercontent.com/u/37784886"] ) - Web3Modal.configure(projectId: InputConfig.projectId, metadata: metadata) + WalletConnectModal.configure(projectId: InputConfig.projectId, metadata: metadata) setupWindow(scene: scene) } diff --git a/Example/DApp/Sign/Connect/ConnectViewController.swift b/Example/DApp/Sign/Connect/ConnectViewController.swift index 094b82b6e..d69bc4739 100644 --- a/Example/DApp/Sign/Connect/ConnectViewController.swift +++ b/Example/DApp/Sign/Connect/ConnectViewController.swift @@ -1,6 +1,6 @@ import Foundation import UIKit -import Web3Modal +import WalletConnectModal class ConnectViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { let uri: WalletConnectURI diff --git a/Example/DApp/Sign/SelectChain/SelectChainViewController.swift b/Example/DApp/Sign/SelectChain/SelectChainViewController.swift index 4bbf7a67e..5d9051757 100644 --- a/Example/DApp/Sign/SelectChain/SelectChainViewController.swift +++ b/Example/DApp/Sign/SelectChain/SelectChainViewController.swift @@ -1,5 +1,5 @@ import Foundation -import Web3Modal +import WalletConnectModal import UIKit import Combine @@ -71,16 +71,16 @@ class SelectChainViewController: UIViewController, UITableViewDataSource { ] Task { - Web3Modal.set(sessionParams: .init( + WalletConnectModal.set(sessionParams: .init( requiredNamespaces: namespaces, optionalNamespaces: optionalNamespaces, sessionProperties: sessionProperties )) - let uri = try await Web3Modal.instance.connect(topic: nil) + let uri = try await WalletConnectModal.instance.connect(topic: nil) } - Web3Modal.present(from: self) + WalletConnectModal.present(from: self) } @objc diff --git a/Example/ExampleApp.xcodeproj/project.pbxproj b/Example/ExampleApp.xcodeproj/project.pbxproj index de86fdb74..148a68698 100644 --- a/Example/ExampleApp.xcodeproj/project.pbxproj +++ b/Example/ExampleApp.xcodeproj/project.pbxproj @@ -282,7 +282,6 @@ C5F32A322954816C00A6476E /* ConnectionDetailsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5F32A312954816C00A6476E /* ConnectionDetailsPresenter.swift */; }; C5F32A342954817600A6476E /* ConnectionDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5F32A332954817600A6476E /* ConnectionDetailsView.swift */; }; C5F32A362954FE3C00A6476E /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5F32A352954FE3C00A6476E /* Colors.xcassets */; }; - CF140F2D2A2A288D00BEB791 /* Web3Modal in Frameworks */ = {isa = PBXBuildFile; productRef = CF140F2C2A2A288D00BEB791 /* Web3Modal */; }; CF1A594529E5876600AAC16B /* XCUIElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A593A29E5876600AAC16B /* XCUIElement.swift */; }; CF1A594629E5876600AAC16B /* PushNotificationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A593C29E5876600AAC16B /* PushNotificationTests.swift */; }; CF1A594829E5876600AAC16B /* Engine.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A593F29E5876600AAC16B /* Engine.swift */; }; @@ -290,9 +289,10 @@ CF1A594B29E5876600AAC16B /* DAppEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A594229E5876600AAC16B /* DAppEngine.swift */; }; CF1A594C29E5876600AAC16B /* RoutingEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A594329E5876600AAC16B /* RoutingEngine.swift */; }; CF1A594D29E5876600AAC16B /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A594429E5876600AAC16B /* App.swift */; }; + CF25F2892A432476009C7E49 /* WalletConnectModal in Frameworks */ = {isa = PBXBuildFile; productRef = CF25F2882A432476009C7E49 /* WalletConnectModal */; }; + CF25F28B2A432488009C7E49 /* WalletConnectModal in Frameworks */ = {isa = PBXBuildFile; productRef = CF25F28A2A432488009C7E49 /* WalletConnectModal */; }; CF6704DF29E59DDC003326A4 /* XCUIElementQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF6704DE29E59DDC003326A4 /* XCUIElementQuery.swift */; }; CF6704E129E5A014003326A4 /* XCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF6704E029E5A014003326A4 /* XCTestCase.swift */; }; - CF9C7E4A2A01802F0037C006 /* Web3Modal in Frameworks */ = {isa = PBXBuildFile; productRef = CF9C7E492A01802F0037C006 /* Web3Modal */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -622,9 +622,9 @@ buildActionMask = 2147483647; files = ( 8448F1D427E4726F0000B866 /* WalletConnect in Frameworks */, + CF25F28B2A432488009C7E49 /* WalletConnectModal in Frameworks */, A54195A52934E83F0035AD19 /* Web3 in Frameworks */, 84E6B8652981720400428BAF /* WalletConnectPush in Frameworks */, - CF140F2D2A2A288D00BEB791 /* Web3Modal in Frameworks */, A5D85228286333E300DAF5C3 /* Starscream in Frameworks */, A573C53929EC365000E3CBFD /* HDWalletKit in Frameworks */, A5BB7FA328B6A50400707FC6 /* WalletConnectAuth in Frameworks */, @@ -643,9 +643,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CF9C7E4A2A01802F0037C006 /* Web3Modal in Frameworks */, A58EC618299D665A00F3452A /* Web3Inbox in Frameworks */, A5629AEA2877F2D600094373 /* WalletConnectChat in Frameworks */, + CF25F2892A432476009C7E49 /* WalletConnectModal in Frameworks */, A561C80029DF32CE00DF540D /* HDWalletKit in Frameworks */, A59FAEC928B7B93A002BB66F /* Web3 in Frameworks */, A5629AF22877F75100094373 /* Starscream in Frameworks */, @@ -1778,8 +1778,8 @@ A5BB7FA228B6A50400707FC6 /* WalletConnectAuth */, A54195A42934E83F0035AD19 /* Web3 */, 84E6B8642981720400428BAF /* WalletConnectPush */, - CF140F2C2A2A288D00BEB791 /* Web3Modal */, A573C53829EC365000E3CBFD /* HDWalletKit */, + CF25F28A2A432488009C7E49 /* WalletConnectModal */, ); productName = DApp; productReference = 84CE641C27981DED00142511 /* DApp.app */; @@ -1825,8 +1825,8 @@ A59FAEC828B7B93A002BB66F /* Web3 */, A58EC610299D57B800F3452A /* AsyncButton */, A58EC617299D665A00F3452A /* Web3Inbox */, - CF9C7E492A01802F0037C006 /* Web3Modal */, A561C7FF29DF32CE00DF540D /* HDWalletKit */, + CF25F2882A432476009C7E49 /* WalletConnectModal */, ); productName = Showcase; productReference = A58E7CE828729F550082D443 /* Showcase.app */; @@ -3243,13 +3243,13 @@ isa = XCSwiftPackageProductDependency; productName = Web3Wallet; }; - CF140F2C2A2A288D00BEB791 /* Web3Modal */ = { + CF25F2882A432476009C7E49 /* WalletConnectModal */ = { isa = XCSwiftPackageProductDependency; - productName = Web3Modal; + productName = WalletConnectModal; }; - CF9C7E492A01802F0037C006 /* Web3Modal */ = { + CF25F28A2A432488009C7E49 /* WalletConnectModal */ = { isa = XCSwiftPackageProductDependency; - productName = Web3Modal; + productName = WalletConnectModal; }; /* End XCSwiftPackageProductDependency section */ }; diff --git a/Example/Showcase/Classes/ApplicationLayer/Configurator/ThirdPartyConfigurator.swift b/Example/Showcase/Classes/ApplicationLayer/Configurator/ThirdPartyConfigurator.swift index c7734a2f1..bdd34c7e1 100644 --- a/Example/Showcase/Classes/ApplicationLayer/Configurator/ThirdPartyConfigurator.swift +++ b/Example/Showcase/Classes/ApplicationLayer/Configurator/ThirdPartyConfigurator.swift @@ -1,7 +1,7 @@ import WalletConnectNetworking import WalletConnectPairing import Auth -import Web3Modal +import WalletConnectModal struct ThirdPartyConfigurator: Configurator { @@ -16,6 +16,6 @@ struct ThirdPartyConfigurator: Configurator { Networking.configure(projectId: InputConfig.projectId, socketFactory: DefaultSocketFactory()) Auth.configure(crypto: DefaultCryptoProvider()) - Web3Modal.configure(projectId: InputConfig.projectId, metadata: metadata) + WalletConnectModal.configure(projectId: InputConfig.projectId, metadata: metadata) } } diff --git a/Example/Showcase/Classes/DomainLayer/Chat/ChatService.swift b/Example/Showcase/Classes/DomainLayer/Chat/ChatService.swift index 799726841..265ac3a56 100644 --- a/Example/Showcase/Classes/DomainLayer/Chat/ChatService.swift +++ b/Example/Showcase/Classes/DomainLayer/Chat/ChatService.swift @@ -120,7 +120,7 @@ private extension ChatService { case .swift, .kotlin, .js, .custom: return .signed(onSign(message: message, privateKey: importAccount.privateKey)) case .web3Modal(let account, let topic): - return await onWeb3ModalSign(message: message, account: account, topic: topic) + return await onWalletConnectModalSign(message: message, account: account, topic: topic) } } @@ -130,7 +130,7 @@ private extension ChatService { return try! signer.sign(message: message, privateKey: privateKey, type: .eip191) } - func onWeb3ModalSign(message: String, account: Account, topic: String) async -> SigningResult { + func onWalletConnectModalSign(message: String, account: Account, topic: String) async -> SigningResult { guard let session = Sign.instance.getSessions().first(where: { $0.topic == topic }) else { return .rejected } do { diff --git a/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportPresenter.swift b/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportPresenter.swift index 060775904..cecd2569f 100644 --- a/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportPresenter.swift +++ b/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportPresenter.swift @@ -1,6 +1,6 @@ import UIKit import Combine -import Web3Modal +import WalletConnectModal final class ImportPresenter: ObservableObject { @@ -17,19 +17,19 @@ final class ImportPresenter: ObservableObject { } @MainActor - func didPressWeb3Modal() async throws { - router.presentWeb3Modal() + func didPressWalletConnectModal() async throws { + router.presentWalletConnectModal() let session: Session = try await withCheckedThrowingContinuation { continuation in var cancellable: AnyCancellable? - cancellable = Web3Modal.instance.sessionSettlePublisher.sink { session in + cancellable = WalletConnectModal.instance.sessionSettlePublisher.sink { session in defer { cancellable?.cancel() } return continuation.resume(returning: session) } } guard let account = session.accounts.first(where: { $0.blockchain.absoluteString == "eip155:1" }) else { - throw AlertError(message: "Тo matching accounts found in namespaces") + throw AlertError(message: "No matching accounts found in namespaces") } try await importAccount(.web3Modal(account: account, topic: session.topic)) diff --git a/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportRouter.swift b/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportRouter.swift index ce6ba13e8..db0aec97f 100644 --- a/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportRouter.swift +++ b/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportRouter.swift @@ -1,5 +1,5 @@ import UIKit -import Web3Modal +import WalletConnectModal import WalletConnectPairing final class ImportRouter { @@ -12,8 +12,8 @@ final class ImportRouter { self.app = app } - func presentWeb3Modal() { - Web3Modal.present(from: viewController) + func presentWalletConnectModal() { + WalletConnectModal.present(from: viewController) } func presentChat(importAccount: ImportAccount) { diff --git a/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportView.swift b/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportView.swift index 72f5b20bb..e7aac0269 100644 --- a/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportView.swift +++ b/Example/Showcase/Classes/PresentationLayer/Chat/Import/ImportView.swift @@ -1,5 +1,5 @@ import SwiftUI -import Web3Modal +import WalletConnectModal struct ImportView: View { @@ -18,8 +18,8 @@ struct ImportView: View { VStack { - BrandButton(title: "Web3Modal WIP") { - try await presenter.didPressWeb3Modal() + BrandButton(title: "WalletConnectModal WIP") { + try await presenter.didPressWalletConnectModal() } BrandButton(title: "Ok, done" ) { diff --git a/Package.swift b/Package.swift index 9a61e0040..23d31ae0f 100644 --- a/Package.swift +++ b/Package.swift @@ -50,8 +50,8 @@ let package = Package( name: "Web3Inbox", targets: ["Web3Inbox"]), .library( - name: "Web3Modal", - targets: ["Web3Modal"]), + name: "WalletConnectModal", + targets: ["WalletConnectModal"]), ], dependencies: [ @@ -131,7 +131,7 @@ let package = Package( name: "WalletConnectVerify", dependencies: ["WalletConnectUtils", "WalletConnectNetworking"]), .target( - name: "Web3Modal", + name: "WalletConnectModal", dependencies: ["QRCode", "WalletConnectSign"]), .target( name: "WalletConnectSync", @@ -174,8 +174,8 @@ let package = Package( name: "CommonsTests", dependencies: ["Commons", "TestingUtils"]), .testTarget( - name: "Web3ModalTests", - dependencies: ["Web3Modal", "TestingUtils"]) + name: "WalletConnectModalTests", + dependencies: ["WalletConnectModal", "TestingUtils"]) ], swiftLanguageVersions: [.v5] ) diff --git a/Sources/Web3Modal/Environment+ProjectId.swift b/Sources/WalletConnectModal/Environment+ProjectId.swift similarity index 100% rename from Sources/Web3Modal/Environment+ProjectId.swift rename to Sources/WalletConnectModal/Environment+ProjectId.swift diff --git a/Sources/Web3Modal/Extensions/Collection.swift b/Sources/WalletConnectModal/Extensions/Collection.swift similarity index 100% rename from Sources/Web3Modal/Extensions/Collection.swift rename to Sources/WalletConnectModal/Extensions/Collection.swift diff --git a/Sources/Web3Modal/Extensions/View+Backport.swift b/Sources/WalletConnectModal/Extensions/View+Backport.swift similarity index 100% rename from Sources/Web3Modal/Extensions/View+Backport.swift rename to Sources/WalletConnectModal/Extensions/View+Backport.swift diff --git a/Sources/Web3Modal/Extensions/View+RoundedCorners.swift b/Sources/WalletConnectModal/Extensions/View+RoundedCorners.swift similarity index 100% rename from Sources/Web3Modal/Extensions/View+RoundedCorners.swift rename to Sources/WalletConnectModal/Extensions/View+RoundedCorners.swift diff --git a/Sources/Web3Modal/Helpers/UIApplicationWrapper.swift b/Sources/WalletConnectModal/Helpers/UIApplicationWrapper.swift similarity index 60% rename from Sources/Web3Modal/Helpers/UIApplicationWrapper.swift rename to Sources/WalletConnectModal/Helpers/UIApplicationWrapper.swift index f27b12de0..bdf486246 100644 --- a/Sources/Web3Modal/Helpers/UIApplicationWrapper.swift +++ b/Sources/WalletConnectModal/Helpers/UIApplicationWrapper.swift @@ -1,16 +1,14 @@ import UIKit struct UIApplicationWrapper { - let openURL: (URL) -> Void + let openURL: (URL, ((Bool) -> Void)?) -> Void let canOpenURL: (URL) -> Bool } extension UIApplicationWrapper { static let live = Self( - openURL: { url in - Task { @MainActor in - await UIApplication.shared.open(url) - } + openURL: { url, completion in + UIApplication.shared.open(url, completionHandler: completion) }, canOpenURL: { url in UIApplication.shared.canOpenURL(url) diff --git a/Sources/Web3Modal/Modal/Modal+Previews.swift b/Sources/WalletConnectModal/Modal/Modal+Previews.swift similarity index 94% rename from Sources/Web3Modal/Modal/Modal+Previews.swift rename to Sources/WalletConnectModal/Modal/Modal+Previews.swift index 748a4a8f1..eef03c066 100644 --- a/Sources/Web3Modal/Modal/Modal+Previews.swift +++ b/Sources/WalletConnectModal/Modal/Modal+Previews.swift @@ -43,7 +43,7 @@ struct ModalContainerView_Previews: PreviewProvider { ) Networking.configure(projectId: projectId, socketFactory: WebSocketFactoryMock()) - Web3Modal.configure(projectId: projectId, metadata: metadata) + WalletConnectModal.configure(projectId: projectId, metadata: metadata) } var body: some View { diff --git a/Sources/Web3Modal/Modal/ModalContainerView.swift b/Sources/WalletConnectModal/Modal/ModalContainerView.swift similarity index 94% rename from Sources/Web3Modal/Modal/ModalContainerView.swift rename to Sources/WalletConnectModal/Modal/ModalContainerView.swift index 4a4a43d5b..5b5aa3b26 100644 --- a/Sources/Web3Modal/Modal/ModalContainerView.swift +++ b/Sources/WalletConnectModal/Modal/ModalContainerView.swift @@ -26,7 +26,7 @@ struct ModalContainerView: View { interactor: DefaultModalSheetInteractor() ) ) - .environment(\.projectId, Web3Modal.config.projectId) + .environment(\.projectId, WalletConnectModal.config.projectId) .transition(.move(edge: .bottom)) .animation(.spring(), value: showModal) } diff --git a/Sources/Web3Modal/Modal/ModalInteractor.swift b/Sources/WalletConnectModal/Modal/ModalInteractor.swift similarity index 75% rename from Sources/Web3Modal/Modal/ModalInteractor.swift rename to Sources/WalletConnectModal/Modal/ModalInteractor.swift index a321d0d2e..3d0eb8d9a 100644 --- a/Sources/Web3Modal/Modal/ModalInteractor.swift +++ b/Sources/WalletConnectModal/Modal/ModalInteractor.swift @@ -12,8 +12,8 @@ protocol ModalSheetInteractor { final class DefaultModalSheetInteractor: ModalSheetInteractor { - lazy var sessionSettlePublisher: AnyPublisher = Web3Modal.instance.sessionSettlePublisher - lazy var sessionRejectionPublisher: AnyPublisher<(Session.Proposal, Reason), Never> = Web3Modal.instance.sessionRejectionPublisher + lazy var sessionSettlePublisher: AnyPublisher = WalletConnectModal.instance.sessionSettlePublisher + lazy var sessionRejectionPublisher: AnyPublisher<(Session.Proposal, Reason), Never> = WalletConnectModal.instance.sessionRejectionPublisher func getListings() async throws -> [Listing] { @@ -21,8 +21,8 @@ final class DefaultModalSheetInteractor: ModalSheetInteractor { let response = try await httpClient.request( ListingsResponse.self, at: ExplorerAPI.getListings( - projectId: Web3Modal.config.projectId, - metadata: Web3Modal.config.metadata + projectId: WalletConnectModal.config.projectId, + metadata: WalletConnectModal.config.metadata ) ) @@ -30,6 +30,6 @@ final class DefaultModalSheetInteractor: ModalSheetInteractor { } func createPairingAndConnect() async throws -> WalletConnectURI? { - try await Web3Modal.instance.connect(topic: nil) + try await WalletConnectModal.instance.connect(topic: nil) } } diff --git a/Sources/Web3Modal/Modal/ModalSheet.swift b/Sources/WalletConnectModal/Modal/ModalSheet.swift similarity index 100% rename from Sources/Web3Modal/Modal/ModalSheet.swift rename to Sources/WalletConnectModal/Modal/ModalSheet.swift diff --git a/Sources/Web3Modal/Modal/ModalViewModel.swift b/Sources/WalletConnectModal/Modal/ModalViewModel.swift similarity index 77% rename from Sources/Web3Modal/Modal/ModalViewModel.swift rename to Sources/WalletConnectModal/Modal/ModalViewModel.swift index 4949cd44a..ccefa20c2 100644 --- a/Sources/Web3Modal/Modal/ModalViewModel.swift +++ b/Sources/WalletConnectModal/Modal/ModalViewModel.swift @@ -128,7 +128,7 @@ final class ModalViewModel: ObservableObject { let storeLink = URL(string: storeLinkString) else { return } - uiApplicationWrapper.openURL(storeLink) + uiApplicationWrapper.openURL(storeLink, nil) } func onBackButton() { @@ -172,21 +172,42 @@ final class ModalViewModel: ObservableObject { } private extension ModalViewModel { - enum Errors: Error { + enum DeeplinkErrors: LocalizedError { case noWalletLinkFound + case uriNotCreated + case failedToOpen + + var errorDescription: String? { + switch self { + case .noWalletLinkFound: + return NSLocalizedString("No valid link for opening given wallet found", comment: "") + case .uriNotCreated: + return NSLocalizedString("Couldn't generate link due to missing connection URI", comment: "") + case .failedToOpen: + return NSLocalizedString("Given link couldn't be opened", comment: "") + } + } } func navigateToDeepLink(universalLink: String, nativeLink: String) { do { - let nativeUrlString = formatNativeUrlString(nativeLink) - let universalUrlString = formatUniversalUrlString(universalLink) + let nativeUrlString = try formatNativeUrlString(nativeLink) + let universalUrlString = try formatUniversalUrlString(universalLink) if let nativeUrl = nativeUrlString?.toURL() { - uiApplicationWrapper.openURL(nativeUrl) + uiApplicationWrapper.openURL(nativeUrl) { success in + if !success { + self.toast = Toast(style: .error, message: DeeplinkErrors.failedToOpen.localizedDescription) + } + } } else if let universalUrl = universalUrlString?.toURL() { - uiApplicationWrapper.openURL(universalUrl) + uiApplicationWrapper.openURL(universalUrl) { success in + if !success { + self.toast = Toast(style: .error, message: DeeplinkErrors.failedToOpen.localizedDescription) + } + } } else { - throw Errors.noWalletLinkFound + throw DeeplinkErrors.noWalletLinkFound } } catch { toast = Toast(style: .error, message: error.localizedDescription) @@ -197,11 +218,11 @@ private extension ModalViewModel { return url.hasPrefix("http://") || url.hasPrefix("https://") } - func formatNativeUrlString(_ string: String) -> String? { + func formatNativeUrlString(_ string: String) throws -> String? { if string.isEmpty { return nil } if isHttpUrl(url: string) { - return formatUniversalUrlString(string) + return try formatUniversalUrlString(string) } var safeAppUrl = string @@ -210,16 +231,18 @@ private extension ModalViewModel { safeAppUrl = "\(safeAppUrl)://" } - guard let deeplinkUri else { return nil } + guard let deeplinkUri else { + throw DeeplinkErrors.uriNotCreated + } return "\(safeAppUrl)wc?uri=\(deeplinkUri)" } - func formatUniversalUrlString(_ string: String) -> String? { + func formatUniversalUrlString(_ string: String) throws -> String? { if string.isEmpty { return nil } if !isHttpUrl(url: string) { - return formatNativeUrlString(string) + return try formatNativeUrlString(string) } var plainAppUrl = string @@ -227,7 +250,9 @@ private extension ModalViewModel { plainAppUrl = String(plainAppUrl.dropLast()) } - guard let deeplinkUri else { return nil } + guard let deeplinkUri else { + throw DeeplinkErrors.uriNotCreated + } return "\(plainAppUrl)/wc?uri=\(deeplinkUri)" } diff --git a/Sources/Web3Modal/Modal/Screens/GetAWalletView.swift b/Sources/WalletConnectModal/Modal/Screens/GetAWalletView.swift similarity index 100% rename from Sources/Web3Modal/Modal/Screens/GetAWalletView.swift rename to Sources/WalletConnectModal/Modal/Screens/GetAWalletView.swift diff --git a/Sources/Web3Modal/Modal/Screens/QRCodeView.swift b/Sources/WalletConnectModal/Modal/Screens/QRCodeView.swift similarity index 100% rename from Sources/Web3Modal/Modal/Screens/QRCodeView.swift rename to Sources/WalletConnectModal/Modal/Screens/QRCodeView.swift diff --git a/Sources/Web3Modal/Modal/Screens/WalletList.swift b/Sources/WalletConnectModal/Modal/Screens/WalletList.swift similarity index 100% rename from Sources/Web3Modal/Modal/Screens/WalletList.swift rename to Sources/WalletConnectModal/Modal/Screens/WalletList.swift diff --git a/Sources/Web3Modal/Modal/Screens/WhatIsWalletView.swift b/Sources/WalletConnectModal/Modal/Screens/WhatIsWalletView.swift similarity index 100% rename from Sources/Web3Modal/Modal/Screens/WhatIsWalletView.swift rename to Sources/WalletConnectModal/Modal/Screens/WhatIsWalletView.swift diff --git a/Sources/Web3Modal/Networking/Explorer/ExplorerAPI.swift b/Sources/WalletConnectModal/Networking/Explorer/ExplorerAPI.swift similarity index 100% rename from Sources/Web3Modal/Networking/Explorer/ExplorerAPI.swift rename to Sources/WalletConnectModal/Networking/Explorer/ExplorerAPI.swift diff --git a/Sources/Web3Modal/Networking/Explorer/ListingsResponse.swift b/Sources/WalletConnectModal/Networking/Explorer/ListingsResponse.swift similarity index 100% rename from Sources/Web3Modal/Networking/Explorer/ListingsResponse.swift rename to Sources/WalletConnectModal/Networking/Explorer/ListingsResponse.swift diff --git a/Sources/Web3Modal/Resources/Asset.swift b/Sources/WalletConnectModal/Resources/Asset.swift similarity index 100% rename from Sources/Web3Modal/Resources/Asset.swift rename to Sources/WalletConnectModal/Resources/Asset.swift diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/accent.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/accent.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/accent.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/accent.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/background1.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/background1.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/background1.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/background1.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/background2.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/background2.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/background2.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/background2.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/background3.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/background3.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/background3.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/background3.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/foreground1.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foreground1.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/foreground1.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foreground1.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/foreground2.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foreground2.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/foreground2.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foreground2.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/foreground3.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foreground3.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/foreground3.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foreground3.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/foregroundInverse.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foregroundInverse.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/foregroundInverse.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/foregroundInverse.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/negative.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/negative.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/negative.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/negative.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/thickOverlay.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/thickOverlay.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/thickOverlay.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/thickOverlay.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/colors/thinOverlay.colorset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/colors/thinOverlay.colorset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/colors/thinOverlay.colorset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/colors/thinOverlay.colorset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Browser.imageset/Browser.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Browser.imageset/Browser.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Browser.imageset/Browser.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Browser.imageset/Browser.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Browser.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Browser.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Browser.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Browser.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/DAO.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/DAO.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/DAO.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/DAO.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/DAO.imageset/DAO.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/DAO.imageset/DAO.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/DAO.imageset/DAO.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/DAO.imageset/DAO.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/DeFi.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/DeFi.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/DeFi.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/DeFi.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/DeFi.imageset/DeFi.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/DeFi.imageset/DeFi.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/DeFi.imageset/DeFi.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/DeFi.imageset/DeFi.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/ETH.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/ETH.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/ETH.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/ETH.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/ETH.imageset/ETH.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/ETH.imageset/ETH.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/ETH.imageset/ETH.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/ETH.imageset/ETH.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Layers.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Layers.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Layers.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Layers.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Layers.imageset/Layers.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Layers.imageset/Layers.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Layers.imageset/Layers.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Layers.imageset/Layers.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Lock.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Lock.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Lock.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Lock.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Lock.imageset/Lock.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Lock.imageset/Lock.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Lock.imageset/Lock.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Lock.imageset/Lock.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Login.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Login.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Login.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Login.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Login.imageset/Login.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Login.imageset/Login.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Login.imageset/Login.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Login.imageset/Login.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/NFT.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/NFT.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/NFT.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/NFT.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/NFT.imageset/NFT.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/NFT.imageset/NFT.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/NFT.imageset/NFT.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/NFT.imageset/NFT.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Network.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Network.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Network.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Network.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Network.imageset/Network.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Network.imageset/Network.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Network.imageset/Network.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Network.imageset/Network.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Noun.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Noun.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Noun.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Noun.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Noun.imageset/Noun.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Noun.imageset/Noun.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Noun.imageset/Noun.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Noun.imageset/Noun.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Profile.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Profile.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Profile.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Profile.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/Profile.imageset/Profile.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/Profile.imageset/Profile.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/Profile.imageset/Profile.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/Profile.imageset/Profile.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/System.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/System.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/System.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/System.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/help/System.imageset/System.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/help/System.imageset/System.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/help/System.imageset/System.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/help/System.imageset/System.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/close.imageset/Close.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/close.imageset/Close.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/close.imageset/Close.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/close.imageset/Close.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/close.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/close.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/close.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/close.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/external_link.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/external_link.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/external_link.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/external_link.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/external_link.imageset/External Link.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/external_link.imageset/External Link.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/external_link.imageset/External Link.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/external_link.imageset/External Link.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/help.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/help.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/help.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/help.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/help.imageset/Help.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/help.imageset/Help.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/help.imageset/Help.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/help.imageset/Help.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/large/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/large/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Copy.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Copy.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Copy.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/copy_large.imageset/Copy.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/large/qr_large.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/qr_large.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/large/qr_large.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/qr_large.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/large/qr_large.imageset/QRCode.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/qr_large.imageset/QRCode.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/large/qr_large.imageset/QRCode.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/large/qr_large.imageset/QRCode.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/wallet.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/wallet.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/wallet.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/wallet.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/icons/wallet.imageset/Wallet.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/icons/wallet.imageset/Wallet.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/icons/wallet.imageset/Wallet.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/icons/wallet.imageset/Wallet.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/walletconnect_logo.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/walletconnect_logo.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/walletconnect_logo.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/walletconnect_logo.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/walletconnect_logo.imageset/LogoLockup.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/walletconnect_logo.imageset/LogoLockup.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/walletconnect_logo.imageset/LogoLockup.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/walletconnect_logo.imageset/LogoLockup.pdf diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/wc_logo.imageset/Contents.json b/Sources/WalletConnectModal/Resources/Assets.xcassets/wc_logo.imageset/Contents.json similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/wc_logo.imageset/Contents.json rename to Sources/WalletConnectModal/Resources/Assets.xcassets/wc_logo.imageset/Contents.json diff --git a/Sources/Web3Modal/Resources/Assets.xcassets/wc_logo.imageset/WCLOGO.pdf b/Sources/WalletConnectModal/Resources/Assets.xcassets/wc_logo.imageset/WCLOGO.pdf similarity index 100% rename from Sources/Web3Modal/Resources/Assets.xcassets/wc_logo.imageset/WCLOGO.pdf rename to Sources/WalletConnectModal/Resources/Assets.xcassets/wc_logo.imageset/WCLOGO.pdf diff --git a/Sources/Web3Modal/Resources/Color.swift b/Sources/WalletConnectModal/Resources/Color.swift similarity index 100% rename from Sources/Web3Modal/Resources/Color.swift rename to Sources/WalletConnectModal/Resources/Color.swift diff --git a/Sources/Web3Modal/Styles/Button.swift b/Sources/WalletConnectModal/Styles/Button.swift similarity index 100% rename from Sources/Web3Modal/Styles/Button.swift rename to Sources/WalletConnectModal/Styles/Button.swift diff --git a/Sources/Web3Modal/UI/Common/ActivityIndicator.swift b/Sources/WalletConnectModal/UI/Common/ActivityIndicator.swift similarity index 100% rename from Sources/Web3Modal/UI/Common/ActivityIndicator.swift rename to Sources/WalletConnectModal/UI/Common/ActivityIndicator.swift diff --git a/Sources/Web3Modal/UI/Common/AsyncImage.swift b/Sources/WalletConnectModal/UI/Common/AsyncImage.swift similarity index 95% rename from Sources/Web3Modal/UI/Common/AsyncImage.swift rename to Sources/WalletConnectModal/UI/Common/AsyncImage.swift index a7d733b25..d0f4e44a5 100644 --- a/Sources/Web3Modal/UI/Common/AsyncImage.swift +++ b/Sources/WalletConnectModal/UI/Common/AsyncImage.swift @@ -12,7 +12,7 @@ struct AsyncImage: View where Content: View { var request = URLRequest(url: url) request.setValue(ExplorerAPI.userAgent, forHTTPHeaderField: "User-Agent") - request.setValue(Web3Modal.config.metadata.name, forHTTPHeaderField: "Referer") + request.setValue(WalletConnectModal.config.metadata.name, forHTTPHeaderField: "Referer") URLSession.shared.dataTaskPublisher(for: request) .map(\.data) diff --git a/Sources/Web3Modal/UI/Common/Toast.swift b/Sources/WalletConnectModal/UI/Common/Toast.swift similarity index 100% rename from Sources/Web3Modal/UI/Common/Toast.swift rename to Sources/WalletConnectModal/UI/Common/Toast.swift diff --git a/Sources/Web3Modal/UI/WalletImage.swift b/Sources/WalletConnectModal/UI/WalletImage.swift similarity index 100% rename from Sources/Web3Modal/UI/WalletImage.swift rename to Sources/WalletConnectModal/UI/WalletImage.swift diff --git a/Sources/Web3Modal/UIKitSupport/Web3ModalSheetController.swift b/Sources/WalletConnectModal/UIKitSupport/WalletConnectModalSheetController.swift similarity index 85% rename from Sources/Web3Modal/UIKitSupport/Web3ModalSheetController.swift rename to Sources/WalletConnectModal/UIKitSupport/WalletConnectModalSheetController.swift index e64b42bf5..176afe51a 100644 --- a/Sources/Web3Modal/UIKitSupport/Web3ModalSheetController.swift +++ b/Sources/WalletConnectModal/UIKitSupport/WalletConnectModalSheetController.swift @@ -1,7 +1,7 @@ import SwiftUI @available(iOS 14.0, *) -class Web3ModalSheetController: UIHostingController { +class WalletConnectModalSheetController: UIHostingController { @MainActor dynamic required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") diff --git a/Sources/Web3Modal/Web3Modal.swift b/Sources/WalletConnectModal/WalletConnectModal.swift similarity index 83% rename from Sources/Web3Modal/Web3Modal.swift rename to Sources/WalletConnectModal/WalletConnectModal.swift index d8becaee5..6c3a22772 100644 --- a/Sources/Web3Modal/Web3Modal.swift +++ b/Sources/WalletConnectModal/WalletConnectModal.swift @@ -6,7 +6,7 @@ import UIKit public typealias VerifyContext = WalletConnectVerify.VerifyContext #endif -/// Web3Modal instance wrapper +/// WalletConnectModal instance wrapper /// /// ```Swift /// let metadata = AppMetadata( @@ -15,16 +15,16 @@ public typealias VerifyContext = WalletConnectVerify.VerifyContext /// url: "dapp.wallet.connect", /// icons: ["https://my_icon.com/1"] /// ) -/// Web3Modal.configure(projectId: PROJECT_ID, metadata: metadata) -/// Web3Modal.instance.getSessions() +/// WalletConnectModal.configure(projectId: PROJECT_ID, metadata: metadata) +/// WalletConnectModal.instance.getSessions() /// ``` -public class Web3Modal { - /// Web3Modalt client instance - public static var instance: Web3ModalClient = { - guard let config = Web3Modal.config else { - fatalError("Error - you must call Web3Modal.configure(_:) before accessing the shared instance.") +public class WalletConnectModal { + /// WalletConnectModalt client instance + public static var instance: WalletConnectModalClient = { + guard let config = WalletConnectModal.config else { + fatalError("Error - you must call WalletConnectModal.configure(_:) before accessing the shared instance.") } - return Web3ModalClient( + return WalletConnectModalClient( signClient: Sign.instance, pairingClient: Pair.instance as! (PairingClientProtocol & PairingInteracting & PairingRegisterer) ) @@ -49,7 +49,7 @@ public class Web3Modal { sessionParams: SessionParams = .default ) { Pair.configure(metadata: metadata) - Web3Modal.config = Web3Modal.Config( + WalletConnectModal.config = WalletConnectModal.Config( projectId: projectId, metadata: metadata, sessionParams: sessionParams @@ -57,7 +57,7 @@ public class Web3Modal { } public static func set(sessionParams: SessionParams) { - Web3Modal.config.sessionParams = sessionParams + WalletConnectModal.config.sessionParams = sessionParams } public static func present(from presentingViewController: UIViewController? = nil) { @@ -67,7 +67,7 @@ public class Web3Modal { } if #available(iOS 14.0, *) { - let modal = Web3ModalSheetController() + let modal = WalletConnectModalSheetController() vc.present(modal, animated: true) } } diff --git a/Sources/Web3Modal/Web3ModalClient.swift b/Sources/WalletConnectModal/WalletConnectModalClient.swift similarity index 87% rename from Sources/Web3Modal/Web3ModalClient.swift rename to Sources/WalletConnectModal/WalletConnectModalClient.swift index ac33d4a46..b6a8f41be 100644 --- a/Sources/Web3Modal/Web3ModalClient.swift +++ b/Sources/WalletConnectModal/WalletConnectModalClient.swift @@ -4,8 +4,8 @@ import Combine /// /// Cannot be instantiated outside of the SDK /// -/// Access via `Web3Modal.instance` -public class Web3ModalClient { +/// Access via `WalletConnectModal.instance` +public class WalletConnectModalClient { // MARK: - Public Properties /// Publisher that sends sessions on every sessions update @@ -68,7 +68,7 @@ public class Web3ModalClient { /// For proposing a session to a wallet. /// Function will propose a session on existing pairing or create new one if not specified - /// Namespaces from Web3Modal.config will be used + /// Namespaces from WalletConnectModal.config will be used /// - Parameters: /// - topic: pairing topic public func connect( @@ -77,18 +77,18 @@ public class Web3ModalClient { if let topic = topic { try pairingClient.validatePairingExistance(topic) try await signClient.connect( - requiredNamespaces: Web3Modal.config.sessionParams.requiredNamespaces, - optionalNamespaces: Web3Modal.config.sessionParams.optionalNamespaces, - sessionProperties: Web3Modal.config.sessionParams.sessionProperties, + requiredNamespaces: WalletConnectModal.config.sessionParams.requiredNamespaces, + optionalNamespaces: WalletConnectModal.config.sessionParams.optionalNamespaces, + sessionProperties: WalletConnectModal.config.sessionParams.sessionProperties, topic: topic ) return nil } else { let pairingURI = try await pairingClient.create() try await signClient.connect( - requiredNamespaces: Web3Modal.config.sessionParams.requiredNamespaces, - optionalNamespaces: Web3Modal.config.sessionParams.optionalNamespaces, - sessionProperties: Web3Modal.config.sessionParams.sessionProperties, + requiredNamespaces: WalletConnectModal.config.sessionParams.requiredNamespaces, + optionalNamespaces: WalletConnectModal.config.sessionParams.optionalNamespaces, + sessionProperties: WalletConnectModal.config.sessionParams.sessionProperties, topic: pairingURI.topic ) return pairingURI diff --git a/Sources/Web3Modal/Web3ModalImports.swift b/Sources/WalletConnectModal/WalletConnectModalImports.swift similarity index 100% rename from Sources/Web3Modal/Web3ModalImports.swift rename to Sources/WalletConnectModal/WalletConnectModalImports.swift diff --git a/Tests/Web3ModalTests/ExplorerAPITests.swift b/Tests/WalletConnectModalTests/ExplorerAPITests.swift similarity index 94% rename from Tests/Web3ModalTests/ExplorerAPITests.swift rename to Tests/WalletConnectModalTests/ExplorerAPITests.swift index f4db68e44..4ced8dfee 100644 --- a/Tests/Web3ModalTests/ExplorerAPITests.swift +++ b/Tests/WalletConnectModalTests/ExplorerAPITests.swift @@ -1,5 +1,5 @@ import TestingUtils -@testable import Web3Modal +@testable import WalletConnectModal import XCTest final class ExplorerAPITests: XCTestCase { diff --git a/Tests/Web3ModalTests/Helpers/FuncTests.swift b/Tests/WalletConnectModalTests/Helpers/FuncTests.swift similarity index 100% rename from Tests/Web3ModalTests/Helpers/FuncTests.swift rename to Tests/WalletConnectModalTests/Helpers/FuncTests.swift diff --git a/Tests/Web3ModalTests/Mocks/ModalSheetInteractorMock.swift b/Tests/WalletConnectModalTests/Mocks/ModalSheetInteractorMock.swift similarity index 98% rename from Tests/Web3ModalTests/Mocks/ModalSheetInteractorMock.swift rename to Tests/WalletConnectModalTests/Mocks/ModalSheetInteractorMock.swift index 2197afbaa..738eb9d35 100644 --- a/Tests/Web3ModalTests/Mocks/ModalSheetInteractorMock.swift +++ b/Tests/WalletConnectModalTests/Mocks/ModalSheetInteractorMock.swift @@ -2,7 +2,7 @@ import Combine import Foundation import WalletConnectSign import WalletConnectUtils -@testable import Web3Modal +@testable import WalletConnectModal @testable import WalletConnectSign final class ModalSheetInteractorMock: ModalSheetInteractor { diff --git a/Tests/Web3ModalTests/ModalViewModelTests.swift b/Tests/WalletConnectModalTests/ModalViewModelTests.swift similarity index 98% rename from Tests/Web3ModalTests/ModalViewModelTests.swift rename to Tests/WalletConnectModalTests/ModalViewModelTests.swift index fb01ebc23..73922b94e 100644 --- a/Tests/Web3ModalTests/ModalViewModelTests.swift +++ b/Tests/WalletConnectModalTests/ModalViewModelTests.swift @@ -1,5 +1,5 @@ import TestingUtils -@testable import Web3Modal +@testable import WalletConnectModal import XCTest final class ModalViewModelTests: XCTestCase { @@ -22,7 +22,7 @@ final class ModalViewModelTests: XCTestCase { Listing(id: "2", name: "Awesome App", homepage: "https://example.com/awesome", order: 2, imageId: "2", app: Listing.App(ios: "https://example.com/download-ios", mac: "https://example.com/download-mac", safari: "https://example.com/download-safari"), mobile: Listing.Mobile(native: "awesomeapp://deeplink", universal: "https://awesome.com/awesome/universal")), ]), uiApplicationWrapper: .init( - openURL: { url in + openURL: { url, _ in self.openURLFuncTest.call(url) self.expectation.fulfill() },