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

[Sign] Release v1.0.0 #550

Merged
merged 207 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
f4d9f4f
savepoint
llbartekll Sep 12, 2022
f59f7bf
savepoint
llbartekll Sep 12, 2022
f9f87f2
savepoint
llbartekll Sep 12, 2022
3959625
SessionEngine
flypaper0 Sep 6, 2022
a67e09d
ApproveEngine
flypaper0 Sep 6, 2022
bfcd3af
Sign: Networking package imported
flypaper0 Sep 8, 2022
41a54d5
Sign new ping
flypaper0 Sep 8, 2022
3a734ea
Cleanup
flypaper0 Sep 8, 2022
e19148d
Unit tests fixed
flypaper0 Sep 8, 2022
12587e4
Sample apps build errors fixed
flypaper0 Sep 9, 2022
fb9805b
Sample apps and UI tests repaired
flypaper0 Sep 12, 2022
f2dc91e
testSessionPing duplicate removed
flypaper0 Sep 12, 2022
dc469c2
Wallet sample app fixed
flypaper0 Sep 12, 2022
be2641e
UI Tests improvements
flypaper0 Sep 13, 2022
48d3adc
Approve Engine RPCResult replaced
flypaper0 Sep 14, 2022
707d335
Prompt
flypaper0 Sep 14, 2022
f794605
Unit test fixed
flypaper0 Sep 14, 2022
51a0bcd
RelayClient Retry
flypaper0 Sep 14, 2022
e8a2762
PR suggetsions
flypaper0 Sep 15, 2022
355e63b
CurrentValueSubject replaced
flypaper0 Sep 19, 2022
c4fa054
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
llbartekll Sep 19, 2022
ffbfc0d
pass pairing api integration test
llbartekll Sep 19, 2022
e583fea
Merge pull request #506 from WalletConnect/feature/relay-retry
flypaper0 Sep 19, 2022
c2ba26c
refactor pairing
llbartekll Sep 20, 2022
73b824f
Merge branch 'flypaper0/sign-network-interactor' of github.com:Wallet…
llbartekll Sep 20, 2022
f50a816
update pairingable protocol
llbartekll Sep 20, 2022
70b7cda
add requestSubscription on requests to networking
llbartekll Sep 20, 2022
b8ca28b
savepoint
llbartekll Sep 20, 2022
2901a00
savepoint
llbartekll Sep 20, 2022
36f52c5
RPCHistory factory
flypaper0 Sep 20, 2022
b18789f
Merge pull request #510 from WalletConnect/feature/rpc-factory-#509
llbartekll Sep 20, 2022
1bc9ce3
savepoint
llbartekll Sep 20, 2022
84770b8
SessionEngine
flypaper0 Sep 6, 2022
498c6b1
ApproveEngine
flypaper0 Sep 6, 2022
17fbd90
Sign: Networking package imported
flypaper0 Sep 8, 2022
e6cde54
Sign new ping
flypaper0 Sep 8, 2022
1b25f06
Cleanup
flypaper0 Sep 8, 2022
c1d9ef5
Unit tests fixed
flypaper0 Sep 8, 2022
3a72916
Sample apps build errors fixed
flypaper0 Sep 9, 2022
68afd51
Sample apps and UI tests repaired
flypaper0 Sep 12, 2022
774b0fc
testSessionPing duplicate removed
flypaper0 Sep 12, 2022
5f1bd7d
Wallet sample app fixed
flypaper0 Sep 12, 2022
f91bcca
UI Tests improvements
flypaper0 Sep 13, 2022
0031114
Approve Engine RPCResult replaced
flypaper0 Sep 14, 2022
c4cca76
Prompt
flypaper0 Sep 14, 2022
13c0e5f
Unit test fixed
flypaper0 Sep 14, 2022
41f491b
Sign RPCHistoryFactory
flypaper0 Sep 20, 2022
99ef0f1
requestNetworkAck removed
flypaper0 Sep 20, 2022
82eafa7
Removed old WCRelay tests
flypaper0 Sep 20, 2022
8f210ef
Revert "requestNetworkAck removed"
flypaper0 Sep 21, 2022
4538ea3
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
llbartekll Sep 21, 2022
1e1646e
remove socket connection observing from integration tests
llbartekll Sep 21, 2022
67e3b15
restore on connection publisher
llbartekll Sep 21, 2022
bc68317
Merge branch 'flypaper0/sign-network-interactor' of github.com:Wallet…
llbartekll Sep 21, 2022
1395b23
remove duplicated file
llbartekll Sep 21, 2022
227ac54
self review changes
llbartekll Sep 21, 2022
c63004b
Merge pull request #498 from WalletConnect/flypaper0/sign-network-int…
flypaper0 Sep 21, 2022
6aab69c
savepoint
llbartekll Sep 22, 2022
132dbc6
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
flypaper0 Sep 22, 2022
be56aab
Pairingable removed
flypaper0 Sep 22, 2022
1a3af64
PairingRegisterer
flypaper0 Sep 22, 2022
87006a7
Push propose error publisher
flypaper0 Sep 23, 2022
eb1ce87
Build errors
flypaper0 Sep 23, 2022
d6df9c0
refactor request method
llbartekll Sep 26, 2022
3128d09
refactor respond method
llbartekll Sep 26, 2022
8a04461
refactor protocol methods in auth and chat
llbartekll Sep 26, 2022
5f0601f
refactor sign protocol methods
llbartekll Sep 26, 2022
4a91d0c
refactor sign protocol methods
llbartekll Sep 26, 2022
a466d29
rename properties
llbartekll Sep 26, 2022
9ab2979
savepoint
llbartekll Sep 26, 2022
5a23be7
restructure files
llbartekll Sep 26, 2022
80e050f
fix unit tests
llbartekll Sep 26, 2022
34728a2
Cache key updated
flypaper0 Sep 27, 2022
cc80680
Resolve Dependencies after cache restore
flypaper0 Sep 27, 2022
272e005
Update chache id
flypaper0 Sep 27, 2022
f58a867
testHandleSessionProposeResponse stability
flypaper0 Sep 27, 2022
ba90193
Update cache id
flypaper0 Sep 27, 2022
79e7adc
Default cache id
flypaper0 Sep 27, 2022
85cb411
Combine timeout for dispatcher logic
flypaper0 Sep 27, 2022
ac90e6f
change vars for lets in protocol methods
llbartekll Sep 27, 2022
245d100
Merge pull request #514 from WalletConnect/#502-add-tll-prompt-to-req…
llbartekll Sep 27, 2022
5307b48
Merge pull request #516 from WalletConnect/bugfix/dispatcher-retry
llbartekll Sep 27, 2022
3938dfc
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
llbartekll Sep 27, 2022
81c4fd7
remove wait clients connected, refactor push protocol method
llbartekll Sep 27, 2022
d8e6a47
Merge pull request #511 from WalletConnect/pairing-api
llbartekll Sep 27, 2022
8673ab7
extract push to separate package
llbartekll Sep 27, 2022
0a6fbbe
Add topics store to networking interactor
llbartekll Sep 27, 2022
535ed8b
Default timeouts increased
flypaper0 Sep 27, 2022
c6ea818
InputConfig defaultTimeout
flypaper0 Sep 27, 2022
365e223
Merge pull request #518 from WalletConnect/feature/increase-timeouts
flypaper0 Sep 28, 2022
320e986
Input project id for integration tests
flypaper0 Sep 28, 2022
83517a6
Sample apps Input config
flypaper0 Sep 28, 2022
936b521
Empty config
flypaper0 Sep 28, 2022
99ca31f
Set config for project
flypaper0 Sep 28, 2022
038ae8e
savepoint
llbartekll Sep 28, 2022
3abbf99
refactor pairing client to transport requests
llbartekll Sep 28, 2022
6b44499
add async filter
llbartekll Sep 28, 2022
dbf0eaa
update pairing client public interface
llbartekll Sep 28, 2022
5ae9fb4
Project ID secret
flypaper0 Sep 28, 2022
e1cd337
replace pairings provider
llbartekll Sep 28, 2022
2de9f71
savepoint - refactor auth for pairing
llbartekll Sep 28, 2022
47a0ce7
gitignore title
flypaper0 Sep 28, 2022
fa5b9c5
refactor auth client for pairing
llbartekll Sep 28, 2022
8bdef8c
pass auth tests
llbartekll Sep 29, 2022
d5e514c
refactor pairing registry
llbartekll Sep 29, 2022
8fd4172
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
llbartekll Sep 29, 2022
37569ea
move ping test to pairing
llbartekll Sep 29, 2022
b375139
Project ID required
flypaper0 Sep 29, 2022
524aecf
Update README.md
flypaper0 Sep 29, 2022
61db990
fix pairing ping test
llbartekll Sep 29, 2022
535fb6c
fix tests build
llbartekll Sep 29, 2022
f7f3f35
Web3 from WalletConnect repo
flypaper0 Sep 29, 2022
270f775
AppMetadata redirect
flypaper0 Sep 29, 2022
8af0d03
Merge pull request #519 from WalletConnect/feature/project-id-secrets…
flypaper0 Sep 29, 2022
ac36457
Merge pull request #523 from WalletConnect/feature/metadata-redirect-…
flypaper0 Sep 29, 2022
6e7947e
Merge pull request #522 from WalletConnect/feature/selfhost-web3-#426
flypaper0 Sep 29, 2022
c08a5d4
fix tests
llbartekll Sep 29, 2022
928d648
change task priority in unsubscribe, update sign tests setup
llbartekll Sep 29, 2022
7db4cdf
Fix bug with responding twice for pairing ping
llbartekll Sep 29, 2022
be26f1a
apply to pr suggestions
llbartekll Sep 29, 2022
defa529
remove pairing ping from sign
llbartekll Sep 29, 2022
3a5d828
fix typo
llbartekll Sep 29, 2022
6afd169
SetStore sync read
flypaper0 Sep 30, 2022
30dbb71
PairingProtocolMethod enum
flypaper0 Sep 30, 2022
8a7a058
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
flypaper0 Sep 30, 2022
a175b0c
Configure deprecations
flypaper0 Sep 30, 2022
c625be7
Auth client deprecations
flypaper0 Sep 30, 2022
7bd077f
Build errors
flypaper0 Sep 30, 2022
fad593b
Merge pull request #521 from WalletConnect/pairing
llbartekll Sep 30, 2022
05c3897
remove pairing methods from auth
llbartekll Sep 30, 2022
10c13c5
pass test request on new pairing interface
llbartekll Sep 30, 2022
6d8f836
add pair to sample apps and fix integration tests
llbartekll Sep 30, 2022
7534a4b
fix sample apps
llbartekll Sep 30, 2022
df93845
fix unit tests
llbartekll Sep 30, 2022
ccfc363
fix wallet
llbartekll Sep 30, 2022
8bd029d
fix dapp
llbartekll Sep 30, 2022
d7a458c
Merge pull request #531 from WalletConnect/#526-remove-pairing-method…
llbartekll Sep 30, 2022
4fe4efc
Pair Activate Service
flypaper0 Sep 30, 2022
1c3094a
Pair activate from public interface
flypaper0 Sep 30, 2022
5a55d2e
Build tests error
flypaper0 Sep 30, 2022
ea3a085
Updated config
flypaper0 Oct 3, 2022
8e486eb
Uncomment gitignore
flypaper0 Oct 3, 2022
9dbbbd0
Merge pull request #534 from WalletConnect/feature/default-host
llbartekll Oct 3, 2022
c248530
savepoint
llbartekll Oct 3, 2022
614d57a
add networking instance
llbartekll Oct 3, 2022
0e7542b
Activate or extend in WalletSubscriber
flypaper0 Oct 3, 2022
f0df8a8
pass unsupported method test
llbartekll Oct 4, 2022
996989f
refactor networking client
llbartekll Oct 4, 2022
6460163
update networking configuration in sample apps
llbartekll Oct 4, 2022
9781c87
integrate networking into auth
llbartekll Oct 4, 2022
c7397d1
update pairing tests
llbartekll Oct 4, 2022
7152692
rename networking interactor
llbartekll Oct 4, 2022
60b6b3d
fix build
llbartekll Oct 4, 2022
e862c0b
Merge pull request #533 from WalletConnect/feature/pair-activate-#525
flypaper0 Oct 4, 2022
5ed1707
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
flypaper0 Oct 4, 2022
8d19591
Merge pull request #535 from WalletConnect/pairing-error-response-test
flypaper0 Oct 4, 2022
30e6e89
tvOS operatingSystem
flypaper0 Oct 4, 2022
f27dae5
Merge pull request #538 from WalletConnect/bugfix/tvos-build-error
flypaper0 Oct 4, 2022
6816230
[Sign] Pair integration step 1
flypaper0 Oct 4, 2022
711711f
Build error
flypaper0 Oct 4, 2022
36de1cd
PairEngineRemoved
flypaper0 Oct 4, 2022
a7f2197
Sign Networking instance + topic filter removed
flypaper0 Oct 4, 2022
49684d0
Stability fixes
flypaper0 Oct 6, 2022
6e9014e
Message decoding race condition fixed
flypaper0 Oct 6, 2022
77d7300
PairingTests target
flypaper0 Oct 7, 2022
ab3d846
Old ApproveEngineTests repaired
flypaper0 Oct 7, 2022
83c58b3
Unit tests repaired and restructured
flypaper0 Oct 7, 2022
199b6d1
Update metadata service
flypaper0 Oct 7, 2022
2dba95c
Merge pull request #536 from WalletConnect/feature/pairing-sign
flypaper0 Oct 10, 2022
4c06a6e
update wallet to use pair
llbartekll Oct 10, 2022
b6f87b4
add new connect method to sign client
llbartekll Oct 10, 2022
1100a26
update ping method
llbartekll Oct 10, 2022
c39144d
update sign disconnect method
llbartekll Oct 10, 2022
11d0107
migrate dapp to use Pair
llbartekll Oct 10, 2022
276e2bf
add pairingInteracting protocol
llbartekll Oct 10, 2022
1e1bd3d
add networking client interface
llbartekll Oct 11, 2022
a4c0a1c
restructure file
llbartekll Oct 11, 2022
4e96fe6
fix buid
llbartekll Oct 11, 2022
abfd5fa
fix integration tests build
llbartekll Oct 11, 2022
c7295e2
update auth and pair interfaces
llbartekll Oct 11, 2022
28109d7
auth fix
llbartekll Oct 11, 2022
a3d6c50
fix dapp build
llbartekll Oct 13, 2022
b73ccf1
Merge pull request #541 from WalletConnect/wallet-pairing-integration
llbartekll Oct 13, 2022
395800a
Merge pull request #543 from WalletConnect/networking-client
llbartekll Oct 13, 2022
cacea63
expose client id
llbartekll Oct 13, 2022
71409b6
fix build
llbartekll Oct 13, 2022
433460f
update tests
llbartekll Oct 13, 2022
01a03e7
Merge pull request #545 from WalletConnect/expose-client-id
flypaper0 Oct 13, 2022
9e952c8
update method unsupported
llbartekll Oct 13, 2022
5cf0735
Test case repaired
flypaper0 Oct 14, 2022
f5f5d8e
Merge pull request #547 from WalletConnect/pair-method-unsupported
flypaper0 Oct 14, 2022
a3232a6
EIP1271 verification
flypaper0 Oct 11, 2022
cde6528
EIP191VerifierTests
flypaper0 Oct 11, 2022
af92e58
Cleanup
flypaper0 Oct 11, 2022
50a4a7d
ProjectID from Networking package
flypaper0 Oct 13, 2022
37b9568
After merge fixes
flypaper0 Oct 13, 2022
554351a
EIP1271VerifierTests unit tests
flypaper0 Oct 13, 2022
2a16c8d
SigType in public interface
flypaper0 Oct 13, 2022
15415cc
EIP1271 integration tests
flypaper0 Oct 13, 2022
0174c01
Unit test build fixed
flypaper0 Oct 13, 2022
87831d2
RPCService: chainID from AuthRequestParams
flypaper0 Oct 18, 2022
52edd5b
Unit tests: chainId param
flypaper0 Oct 18, 2022
b3014f6
lint
flypaper0 Oct 18, 2022
3fb5c2a
Merge pull request #546 from WalletConnect/feature/eip1271
flypaper0 Oct 19, 2022
82d5177
Stored Networking interactor
flypaper0 Oct 19, 2022
2070b1c
Ping success response
flypaper0 Oct 19, 2022
996dcbd
Merge pull request #548 from WalletConnect/bugfix/pairing-subscription
flypaper0 Oct 20, 2022
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
5 changes: 5 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
description: 'The endpoint of the relay e.g. relay.walletconnect.com'
required: false
default: 'relay.walletconnect.com'
project-id:
description: 'WalletConnect project id'
required: true

runs:
using: "composite"
Expand All @@ -29,12 +32,14 @@ runs:
shell: bash
env:
RELAY_ENDPOINT: ${{ inputs.relay-endpoint }}
PROJECT_ID: ${{ inputs.project-id }}
run: "xcodebuild \
-project Example/ExampleApp.xcodeproj \
-scheme IntegrationTests \
-clonedSourcePackagesDirPath SourcePackagesCache \
-destination 'platform=iOS Simulator,name=iPhone 13' \
RELAY_HOST='$RELAY_ENDPOINT' \
PROJECT_ID='$PROJECT_ID' \
test"

# Wallet build
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ jobs:
- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1

- name: Resolve Dependencies
shell: bash
run: "
xcodebuild -resolvePackageDependencies -project Example/ExampleApp.xcodeproj -scheme DApp -clonedSourcePackagesDirPath SourcePackagesCache; \
xcodebuild -resolvePackageDependencies -project Example/ExampleApp.xcodeproj -scheme WalletConnect -clonedSourcePackagesDirPath SourcePackagesCache"

- uses: actions/cache@v2
with:
path: |
Expand All @@ -43,9 +37,16 @@ jobs:
restore-keys: |
${{ runner.os }}-spm-

- name: Resolve Dependencies
shell: bash
run: "
xcodebuild -resolvePackageDependencies -project Example/ExampleApp.xcodeproj -scheme DApp -clonedSourcePackagesDirPath SourcePackagesCache; \
xcodebuild -resolvePackageDependencies -project Example/ExampleApp.xcodeproj -scheme WalletConnect -clonedSourcePackagesDirPath SourcePackagesCache"

- uses: ./.github/actions/ci
with:
type: ${{ matrix.test-type }}
project-id: ${{ secrets.PROJECT_ID }}

test-ui:
if: github.ref == 'refs/heads/main'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ Package.resolved
*/fastlane/test_output
*/fastlane/README.md

# Configuration
Configuration.xcconfig

10 changes: 10 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/WalletConnect.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectPairingTests"
BuildableName = "WalletConnectPairingTests"
BlueprintName = "WalletConnectPairingTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
4 changes: 4 additions & 0 deletions Configuration.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RELAY_HOST = relay.walletconnect.com

// Uncomment next line and paste your project id. Get this on: https://cloud.walletconnect.com/sign-in
// PROJECT_ID = YOUR_PROJECT_ID
4 changes: 2 additions & 2 deletions Example/DApp/Auth/AuthCoordinator.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import Auth
import WalletConnectPairing

final class AuthCoordinator {

Expand Down Expand Up @@ -30,8 +31,7 @@ final class AuthCoordinator {
url: "wallet.connect",
icons: ["https://avatars.githubusercontent.com/u/37784886"])

Auth.configure(metadata: metadata, account: nil)

Pair.configure(metadata: metadata)
navigationController.viewControllers = [authViewController]
}
}
15 changes: 9 additions & 6 deletions 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 @@ -13,10 +14,10 @@ final class AuthViewModel: ObservableObject {
private var disposeBag = Set<AnyCancellable>()

@Published var state: SigningState = .none
@Published var uri: String?
@Published var uriString: String?

var qrImage: UIImage? {
return uri.map { QRCodeGenerator.generateQRCode(from: $0) }
return uriString.map { QRCodeGenerator.generateQRCode(from: $0) }
}

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

func copyDidPressed() {
UIPasteboard.general.string = uri
UIPasteboard.general.string = uriString
}

func walletDidPressed() {

}

func deeplinkPressed() {
guard let uri = uri else { return }
guard let uri = uriString else { return }
UIApplication.shared.open(URL(string: "showcase://wc?uri=\(uri)")!)
}
}
Expand Down
12 changes: 12 additions & 0 deletions Example/DApp/Common/InputConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation

struct InputConfig {

static var projectId: String {
return config(for: "PROJECT_ID")!
}

private static func config(for key: String) -> String? {
return Bundle.main.object(forInfoDictionaryKey: key) as? String
}
}
2 changes: 2 additions & 0 deletions Example/DApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PROJECT_ID</key>
<string>$(PROJECT_ID)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>UIApplicationSceneManifest</key>
Expand Down
3 changes: 2 additions & 1 deletion Example/DApp/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import UIKit
import Starscream
import WalletConnectRelay
import WalletConnectNetworking

extension WebSocket: WebSocketConnecting { }

Expand All @@ -18,7 +19,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
private let authCoordinator = AuthCoordinator()

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
Relay.configure(projectId: "3ca2919724fbfa5456a25194e369a8b4", socketFactory: SocketFactory())
Networking.configure(projectId: InputConfig.projectId, socketFactory: SocketFactory())

setupWindow(scene: scene)
}
Expand Down
3 changes: 2 additions & 1 deletion Example/DApp/Sign/Connect/ConnectViewController.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Foundation
import UIKit
import WalletConnectSign
import WalletConnectPairing

class ConnectViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let uri: WalletConnectURI
let activePairings: [Pairing] = Sign.instance.getPairings()
let activePairings: [Pairing] = Pair.instance.getPairings()
let segmentedControl = UISegmentedControl(items: ["Pairings", "New Pairing"])

init(uri: WalletConnectURI) {
Expand Down
10 changes: 5 additions & 5 deletions Example/DApp/Sign/ResponseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class ResponseViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
let record = Sign.instance.getSessionRequestRecord(id: response.result.id)!
let record = Sign.instance.getSessionRequestRecord(id: response.id)!
switch response.result {
case .response(let response):
responseView.nameLabel.text = "Received Response\n\(record.request.method)"
responseView.descriptionLabel.text = try! response.result.get(String.self).description
responseView.nameLabel.text = "Received Response\n\(record.method)"
responseView.descriptionLabel.text = try! response.get(String.self).description
case .error(let error):
responseView.nameLabel.text = "Received Error\n\(record.request.method)"
responseView.descriptionLabel.text = error.error.message
responseView.nameLabel.text = "Received Error\n\(record.method)"
responseView.descriptionLabel.text = error.message
}
responseView.dismissButton.addTarget(self, action: #selector(dismissSelf), for: .touchUpInside)
}
Expand Down
10 changes: 4 additions & 6 deletions Example/DApp/Sign/SelectChain/SelectChainViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Foundation
import WalletConnectSign
import WalletConnectPairing
import UIKit
import Combine

Expand All @@ -15,16 +16,12 @@ class SelectChainViewController: UIViewController, UITableViewDataSource {
private var publishers = [AnyCancellable]()

let chains = [Chain(name: "Ethereum", id: "eip155:1"), Chain(name: "Polygon", id: "eip155:137")]
var onSessionSettled: ((Session) -> Void)?
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Available Chains"
selectChainView.tableView.dataSource = self
selectChainView.connectButton.addTarget(self, action: #selector(connect), for: .touchUpInside)
selectChainView.openWallet.addTarget(self, action: #selector(openWallet), for: .touchUpInside)
Sign.instance.sessionSettlePublisher.sink {[unowned self] session in
onSessionSettled?(session)
}.store(in: &publishers)
}

override func loadView() {
Expand All @@ -38,8 +35,9 @@ class SelectChainViewController: UIViewController, UITableViewDataSource {
let blockchains: Set<Blockchain> = [Blockchain("eip155:1")!, Blockchain("eip155:137")!]
let namespaces: [String: ProposalNamespace] = ["eip155": ProposalNamespace(chains: blockchains, methods: methods, events: [], extensions: nil)]
Task {
let uri = try await Sign.instance.connect(requiredNamespaces: namespaces)
showConnectScreen(uri: uri!)
let uri = try await Pair.instance.create()
try await Sign.instance.connect(requiredNamespaces: namespaces, topic: uri.topic)
showConnectScreen(uri: uri)
}
}

Expand Down
13 changes: 9 additions & 4 deletions Example/DApp/Sign/SignCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import UIKit
import Combine
import WalletConnectSign
import WalletConnectRelay
import WalletConnectPairing

final class SignCoordinator {

Expand All @@ -25,7 +26,7 @@ final class SignCoordinator {
url: "wallet.connect",
icons: ["https://avatars.githubusercontent.com/u/37784886"])

Sign.configure(metadata: metadata)
Pair.configure(metadata: metadata)
#if DEBUG
if CommandLine.arguments.contains("-cleanInstall") {
try? Sign.instance.cleanup()
Expand All @@ -44,6 +45,12 @@ final class SignCoordinator {
presentResponse(for: response)
}.store(in: &publishers)

Sign.instance.sessionSettlePublisher
.receive(on: DispatchQueue.main)
.sink { [unowned self] session in
showAccountsScreen(session)
}.store(in: &publishers)

if let session = Sign.instance.getSessions().first {
showAccountsScreen(session)
} else {
Expand All @@ -53,9 +60,6 @@ final class SignCoordinator {

private func showSelectChainScreen() {
let controller = SelectChainViewController()
controller.onSessionSettled = { [unowned self] session in
showAccountsScreen(session)
}
navigationController.viewControllers = [controller]
}

Expand All @@ -64,6 +68,7 @@ final class SignCoordinator {
controller.onDisconnect = { [unowned self] in
showSelectChainScreen()
}
navigationController.presentedViewController?.dismiss(animated: false)
navigationController.viewControllers = [controller]
}

Expand Down
Loading