Skip to content

Commit

Permalink
add pair to sample apps
Browse files Browse the repository at this point in the history
  • Loading branch information
llbartekll committed Sep 30, 2022
1 parent c6c0093 commit 1cd9459
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Example/DApp/Auth/AuthViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import UIKit
import Combine
import Auth
import WalletConnectPairing

final class AuthViewModel: ObservableObject {

Expand All @@ -27,7 +28,8 @@ final class AuthViewModel: ObservableObject {
func setupInitialState() async throws {
state = .none
uri = nil
uri = try await Auth.instance.request(.stub()).absoluteString
let uri = try! await Pair.instance.create()
try await Auth.instance.request(.stub(), topic: uri.topic)
}

func copyDidPressed() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UIKit
import Auth
import WalletConnectPairing

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand Down Expand Up @@ -30,7 +31,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

let uri = context.url.absoluteString.replacingOccurrences(of: "showcase://wc?uri=", with: "")
Task {
try await Auth.instance.pair(uri: WalletConnectURI(string: uri)!)
try await Pair.instance.pair(uri: WalletConnectURI(string: uri)!)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Combine
import Auth
import WalletConnectPairing

final class WalletInteractor {

func pair(uri: WalletConnectURI) async throws {
try await Auth.instance.pair(uri: uri)
try await Pair.instance.pair(uri: uri)
}

var requestPublisher: AnyPublisher<AuthRequest, Never> {
Expand Down

0 comments on commit 1cd9459

Please sign in to comment.