Skip to content

Commit

Permalink
Merge pull request #609 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.0.6
  • Loading branch information
llbartekll authored Nov 28, 2022
2 parents 84197cd + 4c0489c commit 41966b4
Show file tree
Hide file tree
Showing 30 changed files with 392 additions and 126 deletions.
8 changes: 4 additions & 4 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ runs:
-project Example/ExampleApp.xcodeproj \
-scheme Wallet \
-clonedSourcePackagesDirPath SourcePackagesCache \
-derivedDataPath DerivedDataCache \
-sdk iphonesimulator"
-destination 'platform=iOS Simulator,name=iPhone 13' \
-derivedDataPath DerivedDataCache"

# DApp build
- name: Build Example Dapp
Expand All @@ -63,8 +63,8 @@ runs:
-project Example/ExampleApp.xcodeproj \
-scheme DApp \
-clonedSourcePackagesDirPath SourcePackagesCache \
-derivedDataPath DerivedDataCache \
-sdk iphonesimulator"
-destination 'platform=iOS Simulator,name=iPhone 13' \
-derivedDataPath DerivedDataCache"

# UI tests
- name: UI Tests
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

jobs:
build:
runs-on: macos-latest
runs-on: macos-12
strategy:
matrix:
test-type: [unit-tests, integration-tests, build-example-wallet, build-example-dapp]
Expand All @@ -27,6 +27,8 @@ jobs:

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.4.1'

- uses: actions/cache@v2
with:
Expand All @@ -41,8 +43,8 @@ jobs:
- 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"
xcodebuild -resolvePackageDependencies -project Example/ExampleApp.xcodeproj -scheme DApp -clonedSourcePackagesDirPath SourcePackagesCache -derivedDataPath DerivedDataCache -destination 'platform=iOS Simulator,name=iPhone 13'; \
xcodebuild -resolvePackageDependencies -project Example/ExampleApp.xcodeproj -scheme WalletConnect -clonedSourcePackagesDirPath SourcePackagesCache -derivedDataPath DerivedDataCache -destination 'platform=iOS Simulator,name=iPhone 13'"

- uses: ./.github/actions/ci
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "solana (1).png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AccountRequestViewController: UIViewController, UITableViewDelegate, UITab
private let session: Session
private let chainId: String
private let account: String
private let methods = ["eth_sendTransaction", "personal_sign", "eth_signTypedData"]
private let methods: [String]
private let accountRequestView = {
AccountRequestView()
}()
Expand All @@ -16,6 +16,7 @@ class AccountRequestViewController: UIViewController, UITableViewDelegate, UITab
self.session = session
self.chainId = accountDetails.chain
self.account = accountDetails.account
self.methods = accountDetails.methods
super.init(nibName: nil, bundle: nil)
}

Expand All @@ -37,7 +38,7 @@ class AccountRequestViewController: UIViewController, UITableViewDelegate, UITab
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
methods.count
return methods.count
}

func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
Expand Down
25 changes: 22 additions & 3 deletions Example/DApp/Sign/Connect/ConnectViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,28 @@ class ConnectViewController: UIViewController, UITableViewDataSource, UITableVie

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let pairingTopic = activePairings[indexPath.row].topic
let blockchains: Set<Blockchain> = [Blockchain("eip155:1")!, Blockchain("eip155:137")!]
let methods: Set<String> = ["eth_sendTransaction", "personal_sign", "eth_signTypedData"]
let namespaces: [String: ProposalNamespace] = ["eip155": ProposalNamespace(chains: blockchains, methods: methods, events: [], extensions: nil)]
let namespaces: [String: ProposalNamespace] = [
"eip155": ProposalNamespace(
chains: [
Blockchain("eip155:1")!,
Blockchain("eip155:137")!
],
methods: [
"eth_sendTransaction",
"personal_sign",
"eth_signTypedData"
], events: [], extensions: nil
),
"solana": ProposalNamespace(
chains: [
Blockchain("solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ")!,
],
methods: [
"solana_signMessage",
"solana_signTransaction",
], events: [], extensions: nil
)
]
Task {
_ = try await Sign.instance.connect(requiredNamespaces: namespaces, topic: pairingTopic)
connectWithExampleWallet()
Expand Down
32 changes: 28 additions & 4 deletions Example/DApp/Sign/SelectChain/SelectChainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ class SelectChainViewController: UIViewController, UITableViewDataSource {
}()
private var publishers = [AnyCancellable]()

let chains = [Chain(name: "Ethereum", id: "eip155:1"), Chain(name: "Polygon", id: "eip155:137")]
let chains = [
Chain(name: "Ethereum", id: "eip155:1"),
Chain(name: "Polygon", id: "eip155:137"),
Chain(name: "Solana", id: "solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ")
]

override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Available Chains"
Expand All @@ -31,9 +36,28 @@ class SelectChainViewController: UIViewController, UITableViewDataSource {
@objc
private func connect() {
print("[PROPOSER] Connecting to a pairing...")
let methods: Set<String> = ["eth_sendTransaction", "personal_sign", "eth_signTypedData"]
let blockchains: Set<Blockchain> = [Blockchain("eip155:1")!, Blockchain("eip155:137")!]
let namespaces: [String: ProposalNamespace] = ["eip155": ProposalNamespace(chains: blockchains, methods: methods, events: [], extensions: nil)]
let namespaces: [String: ProposalNamespace] = [
"eip155": ProposalNamespace(
chains: [
Blockchain("eip155:1")!,
Blockchain("eip155:137")!
],
methods: [
"eth_sendTransaction",
"personal_sign",
"eth_signTypedData"
], events: [], extensions: nil
),
"solana": ProposalNamespace(
chains: [
Blockchain("solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ")!,
],
methods: [
"solana_signMessage",
"solana_signTransaction",
], events: [], extensions: nil
)
]
Task {
let uri = try await Pair.instance.create()
try await Sign.instance.connect(requiredNamespaces: namespaces, topic: uri.topic)
Expand Down
35 changes: 34 additions & 1 deletion Example/ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
A51AC0D928E436A3001BACF9 /* InputConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51AC0D828E436A3001BACF9 /* InputConfig.swift */; };
A51AC0DD28E43727001BACF9 /* InputConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51AC0DB28E436E6001BACF9 /* InputConfig.swift */; };
A51AC0DF28E4379F001BACF9 /* InputConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51AC0DE28E4379F001BACF9 /* InputConfig.swift */; };
A5434023291E6A270068F706 /* SolanaSwift in Frameworks */ = {isa = PBXBuildFile; productRef = A5434022291E6A270068F706 /* SolanaSwift */; };
A55CAAB028B92AFF00844382 /* ScanModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = A55CAAAB28B92AFF00844382 /* ScanModule.swift */; };
A55CAAB128B92AFF00844382 /* ScanPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A55CAAAC28B92AFF00844382 /* ScanPresenter.swift */; };
A55CAAB228B92AFF00844382 /* ScanRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A55CAAAD28B92AFF00844382 /* ScanRouter.swift */; };
Expand Down Expand Up @@ -91,6 +92,8 @@
A578FA372873D8EE00AA7720 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = A578FA362873D8EE00AA7720 /* UIColor.swift */; };
A578FA392873FCE000AA7720 /* ChatScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A578FA382873FCE000AA7720 /* ChatScrollView.swift */; };
A578FA3D2874002400AA7720 /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = A578FA3C2874002400AA7720 /* View.swift */; };
A57E71A6291CF76400325797 /* EthereumSigner.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57E71A5291CF76400325797 /* EthereumSigner.swift */; };
A57E71A8291CF8A500325797 /* SolanaSigner.swift in Sources */ = {isa = PBXBuildFile; fileRef = A57E71A7291CF8A500325797 /* SolanaSigner.swift */; };
A58E7CEB28729F550082D443 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58E7CEA28729F550082D443 /* AppDelegate.swift */; };
A58E7CED28729F550082D443 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58E7CEC28729F550082D443 /* SceneDelegate.swift */; };
A58E7CF428729F550082D443 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A58E7CF328729F550082D443 /* Assets.xcassets */; };
Expand Down Expand Up @@ -282,6 +285,8 @@
A578FA362873D8EE00AA7720 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
A578FA382873FCE000AA7720 /* ChatScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatScrollView.swift; sourceTree = "<group>"; };
A578FA3C2874002400AA7720 /* View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; };
A57E71A5291CF76400325797 /* EthereumSigner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthereumSigner.swift; sourceTree = "<group>"; };
A57E71A7291CF8A500325797 /* SolanaSigner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SolanaSigner.swift; sourceTree = "<group>"; };
A58E7CE828729F550082D443 /* Showcase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Showcase.app; sourceTree = BUILT_PRODUCTS_DIR; };
A58E7CEA28729F550082D443 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
A58E7CEC28729F550082D443 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -370,6 +375,7 @@
buildActionMask = 2147483647;
files = (
A5AE354728A1A2AC0059AE8A /* Web3 in Frameworks */,
A5434023291E6A270068F706 /* SolanaSwift in Frameworks */,
764E1D5826F8DBAB00A1FB15 /* WalletConnect in Frameworks */,
A5D85226286333D500DAF5C3 /* Starscream in Frameworks */,
A5C4DD8728A2DE88006A626D /* WalletConnectRouter in Frameworks */,
Expand Down Expand Up @@ -434,10 +440,10 @@
761248182819FA8B00CB6D48 /* Shared */ = {
isa = PBXGroup;
children = (
A57E71A4291CF73300325797 /* Signer */,
761C64A526FCB0AA004239D1 /* SessionInfo.swift */,
84F568C32795832A00D0A289 /* EthereumTransaction.swift */,
A5A4FC5D283D23CA00BBEC1E /* Array.swift */,
84F568C1279582D200D0A289 /* Signer.swift */,
765056262821989600F9AE79 /* Color+Extension.swift */,
84494387278D9C1B00CC26BB /* UIAlertController.swift */,
76235E882820198B004ED0AA /* UIKit+Previews.swift */,
Expand Down Expand Up @@ -755,6 +761,16 @@
path = SwiftUI;
sourceTree = "<group>";
};
A57E71A4291CF73300325797 /* Signer */ = {
isa = PBXGroup;
children = (
84F568C1279582D200D0A289 /* Signer.swift */,
A57E71A5291CF76400325797 /* EthereumSigner.swift */,
A57E71A7291CF8A500325797 /* SolanaSigner.swift */,
);
path = Signer;
sourceTree = "<group>";
};
A58E7CE928729F550082D443 /* Showcase */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1132,6 +1148,7 @@
A5D85225286333D500DAF5C3 /* Starscream */,
A5AE354628A1A2AC0059AE8A /* Web3 */,
A5C4DD8628A2DE88006A626D /* WalletConnectRouter */,
A5434022291E6A270068F706 /* SolanaSwift */,
);
productName = ExampleApp;
productReference = 764E1D3C26F8D3FC00A1FB15 /* WalletConnect Wallet.app */;
Expand Down Expand Up @@ -1263,6 +1280,7 @@
packageReferences = (
A5D85224286333D500DAF5C3 /* XCRemoteSwiftPackageReference "Starscream" */,
A5AE354528A1A2AC0059AE8A /* XCRemoteSwiftPackageReference "Web3" */,
A5434021291E6A270068F706 /* XCRemoteSwiftPackageReference "solana-swift" */,
);
productRefGroup = 764E1D3D26F8D3FC00A1FB15 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1339,9 +1357,11 @@
76235E8B28201C9C004ED0AA /* Utilities.swift in Sources */,
76744CF726FE4D5400B77ED9 /* ActiveSessionItem.swift in Sources */,
A5A4FC5A283CC08600BBEC1E /* SessionNamespaceViewModel.swift in Sources */,
A57E71A8291CF8A500325797 /* SolanaSigner.swift in Sources */,
764E1D4226F8D3FC00A1FB15 /* SceneDelegate.swift in Sources */,
84F568C2279582D200D0A289 /* Signer.swift in Sources */,
A5A4FC56283CBB7800BBEC1E /* SessionDetailView.swift in Sources */,
A57E71A6291CF76400325797 /* EthereumSigner.swift in Sources */,
7600223B2819FC0B0011DD38 /* ProposalView.swift in Sources */,
761248172819F9E600CB6D48 /* WalletView.swift in Sources */,
A5A4FC58283CBB9F00BBEC1E /* SessionDetailViewModel.swift in Sources */,
Expand Down Expand Up @@ -1983,6 +2003,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
A5434021291E6A270068F706 /* XCRemoteSwiftPackageReference "solana-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/flypaper0/solana-swift";
requirement = {
branch = "feature/available-13";
kind = branch;
};
};
A5AE354528A1A2AC0059AE8A /* XCRemoteSwiftPackageReference "Web3" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/WalletConnect/Web3.swift";
Expand Down Expand Up @@ -2018,6 +2046,11 @@
isa = XCSwiftPackageProductDependency;
productName = WalletConnectAuth;
};
A5434022291E6A270068F706 /* SolanaSwift */ = {
isa = XCSwiftPackageProductDependency;
package = A5434021291E6A270068F706 /* XCRemoteSwiftPackageReference "solana-swift" */;
productName = SolanaSwift;
};
A5629AE92877F2D600094373 /* WalletConnectChat */ = {
isa = XCSwiftPackageProductDependency;
productName = WalletConnectChat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,40 @@
"version": "0.1.7"
}
},
{
"package": "SolanaSwift",
"repositoryURL": "https://github.com/flypaper0/solana-swift",
"state": {
"branch": "feature/available-13",
"revision": "a98811518e0a90c2dfc60c30cfd3ec85c33b6790",
"version": null
}
},
{
"package": "Starscream",
"repositoryURL": "https://github.com/daltoniam/Starscream",
"state": {
"branch": null,
"revision": "e6b65c6d9077ea48b4a7bdda8994a1d3c6969c8d",
"version": "3.1.1"
"revision": "a063fda2b8145a231953c20e7a646be254365396",
"version": "3.1.2"
}
},
{
"package": "swift-nio-zlib-support",
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
"package": "Task_retrying",
"repositoryURL": "https://github.com/bigearsenal/task-retrying-swift.git",
"state": {
"branch": null,
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
"version": "1.0.0"
"revision": "645eaaf207a6f39ab4b469558d916ae23df199b5",
"version": "1.0.3"
}
},
{
"package": "TweetNacl",
"repositoryURL": "https://github.com/bitmark-inc/tweetnacl-swiftwrap.git",
"state": {
"branch": null,
"revision": "f8fd111642bf2336b11ef9ea828510693106e954",
"version": "1.1.0"
}
},
{
Expand Down
11 changes: 1 addition & 10 deletions Example/ExampleApp/Request/RequestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ class RequestViewController: UIViewController {
}

private func getParamsDescription() -> String {
let method = sessionRequest.method
if method == "personal_sign" {
return try! sessionRequest.params.get([String].self).description
} else if method == "eth_signTypedData" {
return try! sessionRequest.params.get([String].self).description
} else if method == "eth_sendTransaction" {
let params = try! sessionRequest.params.get([EthereumTransaction].self)
return params[0].description
}
fatalError("not implemented")
return String(describing: sessionRequest.params.value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class SessionDetailViewController: UIHostingController<SessionDetailView>
private func showSessionRequest(_ request: Request) {
let viewController = RequestViewController(request)
viewController.onSign = { [unowned self] in
let result = Signer.signEth(request: request)
let result = Signer.sign(request: request)
respondOnSign(request: request, response: result)
reload()
}
Expand Down
Loading

0 comments on commit 41966b4

Please sign in to comment.