Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[W3M] Find and Replace Web3Modal name #924

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Web3Modal"
BuildableName = "Web3Modal"
BlueprintName = "Web3Modal"
BlueprintIdentifier = "WalletConnectModal"
BuildableName = "WalletConnectModal"
BlueprintName = "WalletConnectModal"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -28,6 +28,18 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectModalTests"
BuildableName = "WalletConnectModalTests"
BlueprintName = "WalletConnectModalTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -49,9 +61,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Web3Modal"
BuildableName = "Web3Modal"
BlueprintName = "Web3Modal"
BlueprintIdentifier = "WalletConnectModal"
BuildableName = "WalletConnectModal"
BlueprintName = "WalletConnectModal"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
Expand Down
4 changes: 2 additions & 2 deletions Example/DApp/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit
import Auth
import WalletConnectRelay
import WalletConnectNetworking
import Web3Modal
import WalletConnectModal

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion Example/DApp/Sign/Connect/ConnectViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import UIKit
import Web3Modal
import WalletConnectModal

class ConnectViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let uri: WalletConnectURI
Expand Down
8 changes: 4 additions & 4 deletions Example/DApp/Sign/SelectChain/SelectChainViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import Web3Modal
import WalletConnectModal
import UIKit
import Combine

Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions Example/ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,17 @@
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 */; };
CF1A594929E5876600AAC16B /* WalletEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1A594029E5876600AAC16B /* WalletEngine.swift */; };
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 */
Expand Down Expand Up @@ -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 */,
Expand All @@ -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 */,
Expand Down Expand Up @@ -1778,8 +1778,8 @@
A5BB7FA228B6A50400707FC6 /* WalletConnectAuth */,
A54195A42934E83F0035AD19 /* Web3 */,
84E6B8642981720400428BAF /* WalletConnectPush */,
CF140F2C2A2A288D00BEB791 /* Web3Modal */,
A573C53829EC365000E3CBFD /* HDWalletKit */,
CF25F28A2A432488009C7E49 /* WalletConnectModal */,
);
productName = DApp;
productReference = 84CE641C27981DED00142511 /* DApp.app */;
Expand Down Expand Up @@ -1825,8 +1825,8 @@
A59FAEC828B7B93A002BB66F /* Web3 */,
A58EC610299D57B800F3452A /* AsyncButton */,
A58EC617299D665A00F3452A /* Web3Inbox */,
CF9C7E492A01802F0037C006 /* Web3Modal */,
A561C7FF29DF32CE00DF540D /* HDWalletKit */,
CF25F2882A432476009C7E49 /* WalletConnectModal */,
);
productName = Showcase;
productReference = A58E7CE828729F550082D443 /* Showcase.app */;
Expand Down Expand Up @@ -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 */
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import WalletConnectNetworking
import WalletConnectPairing
import Auth
import Web3Modal
import WalletConnectModal

struct ThirdPartyConfigurator: Configurator {

Expand All @@ -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)
}
}
4 changes: 2 additions & 2 deletions Example/Showcase/Classes/DomainLayer/Chat/ChatService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit
import Combine
import Web3Modal
import WalletConnectModal

final class ImportPresenter: ObservableObject {

Expand All @@ -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))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIKit
import Web3Modal
import WalletConnectModal
import WalletConnectPairing

final class ImportRouter {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SwiftUI
import Web3Modal
import WalletConnectModal

struct ImportView: View {

Expand All @@ -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" ) {
Expand Down
10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ let package = Package(
name: "Web3Inbox",
targets: ["Web3Inbox"]),
.library(
name: "Web3Modal",
targets: ["Web3Modal"]),
name: "WalletConnectModal",
targets: ["WalletConnectModal"]),

],
dependencies: [
Expand Down Expand Up @@ -131,7 +131,7 @@ let package = Package(
name: "WalletConnectVerify",
dependencies: ["WalletConnectUtils", "WalletConnectNetworking"]),
.target(
name: "Web3Modal",
name: "WalletConnectModal",
dependencies: ["QRCode", "WalletConnectSign"]),
.target(
name: "WalletConnectSync",
Expand Down Expand Up @@ -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]
)
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ protocol ModalSheetInteractor {

final class DefaultModalSheetInteractor: ModalSheetInteractor {

lazy var sessionSettlePublisher: AnyPublisher<Session, Never> = Web3Modal.instance.sessionSettlePublisher
lazy var sessionRejectionPublisher: AnyPublisher<(Session.Proposal, Reason), Never> = Web3Modal.instance.sessionRejectionPublisher
lazy var sessionSettlePublisher: AnyPublisher<Session, Never> = WalletConnectModal.instance.sessionSettlePublisher
lazy var sessionRejectionPublisher: AnyPublisher<(Session.Proposal, Reason), Never> = WalletConnectModal.instance.sessionRejectionPublisher

func getListings() async throws -> [Listing] {

let httpClient = HTTPNetworkClient(host: "explorer-api.walletconnect.com")
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
)
)

return response.listings.values.compactMap { $0 }
}

func createPairingAndConnect() async throws -> WalletConnectURI? {
try await Web3Modal.instance.connect(topic: nil)
try await WalletConnectModal.instance.connect(topic: nil)
}
}
Loading