Skip to content

Commit

Permalink
Merge pull request #961 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.6.13
  • Loading branch information
llbartekll authored Jul 14, 2023
2 parents 5a170a7 + 8dbc1d1 commit 1472225
Show file tree
Hide file tree
Showing 37 changed files with 461 additions and 90 deletions.
14 changes: 8 additions & 6 deletions .github/actions/run_tests_without_building/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ inputs:
gm-dapp-project-id:
description: 'GM DApp Project ID'
required: false

gm-dapp-project-secret:
description: 'GM DApp Project Secret'
required: false

runs:
using: "composite"
Expand All @@ -39,7 +41,7 @@ runs:
shell: bash
run: test -f products.tar && tar xPpf products.tar || echo "No artifacts to untar"

# Package Unit tests
# Package Unit tests
- name: Run tests
if: inputs.type == 'unit-tests'
shell: bash
Expand All @@ -49,7 +51,7 @@ runs:
- name: Run integration tests
if: inputs.type == 'integration-tests'
shell: bash
run: make integration_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }} CAST_HOST=${{ inputs.notify-endpoint }} GM_DAPP_PROJECT_ID=${{ inputs.gm-dapp-project-id }}
run: make integration_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }} CAST_HOST=${{ inputs.notify-endpoint }} GM_DAPP_PROJECT_ID=${{ inputs.gm-dapp-project-id }} GM_DAPP_PROJECT_SECRET=${{ inputs.gm-dapp-project-secret }}

# Relay Integration tests
- name: Run Relay integration tests
Expand All @@ -63,13 +65,13 @@ runs:
shell: bash
run: make smoke_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }}

# Notify tests
# Notify tests
- name: Run notify tests
if: inputs.type == 'notify-tests'
shell: bash
run: make notify_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }} CAST_HOST=${{ inputs.notify-endpoint }} GM_DAPP_PROJECT_ID=${{ inputs.gm-dapp-project-id }}
run: make notify_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.project-id }} CAST_HOST=${{ inputs.notify-endpoint }} GM_DAPP_PROJECT_ID=${{ inputs.gm-dapp-project-id }} GM_DAPP_PROJECT_SECRET=${{ inputs.gm-dapp-project-secret }}

# Slack notification for failing smoke and relay tests
# Slack notification for failing smoke and relay tests
- name: Slack Notification for Failure
if: failure() && (inputs.type == 'smoke-tests' || inputs.type == 'relay-tests')
uses: 8398a7/action-slack@v3
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}

jobs:
authorize:
environment:
Expand All @@ -32,7 +32,7 @@ jobs:
with:
project-id: ${{ secrets.PROJECT_ID }}

test:
test:
needs: prepare
runs-on: macos-12
timeout-minutes: 15
Expand Down Expand Up @@ -62,11 +62,11 @@ jobs:
shell: bash
run: make unit_tests

# Integration tests
# Integration tests
- name: Run integration tests
if: matrix.type == 'integration-tests'
shell: bash
run: make integration_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }} CAST_HOST=cast.walletconnect.com GM_DAPP_PROJECT_ID=${{ secrets.GM_DAPP_PROJECT_ID }}
run: make integration_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }} CAST_HOST=cast.walletconnect.com GM_DAPP_PROJECT_ID=${{ secrets.GM_DAPP_PROJECT_ID }} GM_DAPP_PROJECT_SECRET=${{ secrets.GM_DAPP_PROJECT_SECRET }}

# Relay Integration tests
- name: Run Relay integration tests
Expand All @@ -80,7 +80,7 @@ jobs:
with:
check_name: ${{ matrix.type }} junit report
report_paths: 'test_results/report.junit'

- name: Zip test artifacts
if: always()
shell: bash
Expand All @@ -93,4 +93,3 @@ jobs:
name: ${{ matrix.type }} test_results
path: ./artifacts.zip
if-no-files-found: warn

45 changes: 45 additions & 0 deletions .github/workflows/deploy_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate docs
shell: bash
run: |
./generate_docs.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload just docs directory
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ DerivedDataCache
*.ipa
*.zip
test_results/

Sources/WalletConnectModal/Secrets/secrets.json
5 changes: 4 additions & 1 deletion Configuration.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ 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

// Uncomment next line and paste dapp id to run all the notify tests
// Uncomment next line and paste dapp's project id to run all the notify tests
// GM_DAPP_PROJECT_ID = GM_DAPP_PROJECT_ID

// Uncomment next line and paste dapp's project secret to run all the notify tests
// GM_DAPP_PROJECT_SECRET = GM_DAPP_PROJECT_SECRET

CAST_HOST = cast.walletconnect.com
2 changes: 0 additions & 2 deletions Example/DApp/Sign/SelectChain/SelectChainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class SelectChainViewController: UIViewController, UITableViewDataSource {
optionalNamespaces: optionalNamespaces,
sessionProperties: sessionProperties
))

let uri = try await WalletConnectModal.instance.connect(topic: nil)
}

WalletConnectModal.present(from: self)
Expand Down
4 changes: 4 additions & 0 deletions Example/ExampleApp.xcodeproj/IntegrationTests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"key" : "RELAY_HOST",
"value" : "$(RELAY_HOST)"
},
{
"key" : "GM_DAPP_PROJECT_SECRET",
"value" : "$(GM_DAPP_PROJECT_SECRET)"
},
{
"key" : "GM_DAPP_PROJECT_ID",
"value" : "$(GM_DAPP_PROJECT_ID)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@
"version": "3.1.2"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
"version": "1.3.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
},
{
"package": "swift-qrcode-generator",
"repositoryURL": "https://github.com/dagronf/swift-qrcode-generator",
Expand Down
1 change: 1 addition & 0 deletions Example/IntegrationTests/Pairing/PairingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ final class PairingTests: XCTestCase {
logger: pushLogger,
keyValueStorage: keyValueStorage,
keychainStorage: keychain,
groupKeychainStorage: KeychainStorageMock(),
networkInteractor: networkingInteractor,
syncClient: syncClient)
}
Expand Down
1 change: 1 addition & 0 deletions Example/IntegrationTests/Push/Publisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Publisher {
let payload = try encoder.encode(notifyRequestPayload)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("Authorization", forHTTPHeaderField: InputConfig.gmDappProjectSecret)
request.httpBody = payload
let (_, response) = try await URLSession.shared.data(for: request)
guard (response as? HTTPURLResponse)?.statusCode == 200 else { fatalError("Notify error") }
Expand Down
1 change: 1 addition & 0 deletions Example/IntegrationTests/Push/PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ final class PushTests: XCTestCase {
logger: pushLogger,
keyValueStorage: keyValueStorage,
keychainStorage: keychain,
groupKeychainStorage: KeychainStorageMock(),
networkInteractor: networkingInteractor,
syncClient: syncClient)
}
Expand Down
4 changes: 4 additions & 0 deletions Example/Shared/Tests/InputConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ struct InputConfig {
return config(for: "GM_DAPP_PROJECT_ID")!
}

static var gmDappProjectSecret: String {
return config(for: "GM_DAPP_PROJECT_SECRET")!
}

static var relayUrl: String {
return "wss://\(relayHost)"
}
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ ifneq ($(integrationxctestrun),)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.RELAY_HOST -string $(RELAY_HOST) $(integrationxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.PROJECT_ID -string $(PROJECT_ID) $(integrationxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.GM_DAPP_PROJECT_ID -string $(GM_DAPP_PROJECT_ID) $(integrationxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.GM_DAPP_PROJECT_SECRET -string $(GM_DAPP_PROJECT_SECRET) $(integrationxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.CAST_HOST -string $(CAST_HOST) $(integrationxctestrun)
# test-without-building
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -clonedSourcePackagesDirPath ../SourcePackagesCache -resultBundlePath 'test_results/IntegrationTests.xcresult' -xctestrun '$(integrationxctestrun)' test-without-building | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
else
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project Example/ExampleApp.xcodeproj -scheme IntegrationTests -testPlan IntegrationTests -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -clonedSourcePackagesDirPath ../SourcePackagesCache -resultBundlePath 'test_results/IntegrationTests.xcresult' RELAY_HOST='$(RELAY_HOST)' PROJECT_ID='$(PROJECT_ID)' GM_DAPP_PROJECT_ID='$(GM_DAPP_PROJECT_ID)' CAST_HOST='$(CAST_HOST)' test | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project Example/ExampleApp.xcodeproj -scheme IntegrationTests -testPlan IntegrationTests -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -clonedSourcePackagesDirPath ../SourcePackagesCache -resultBundlePath 'test_results/IntegrationTests.xcresult' RELAY_HOST='$(RELAY_HOST)' PROJECT_ID='$(PROJECT_ID)' GM_DAPP_PROJECT_ID='$(GM_DAPP_PROJECT_ID)' GM_DAPP_PROJECT_SECRET='$(GM_DAPP_PROJECT_SECRET)' CAST_HOST='$(CAST_HOST)' test | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
endif

relayxctestrun = $(shell find . -name '*_RelayIntegrationTests*.xctestrun')
Expand All @@ -75,7 +76,6 @@ else
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project Example/ExampleApp.xcodeproj -scheme RelayIntegrationTests -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -resultBundlePath 'test_results/RelayIntegrationTests.xcresult' RELAY_HOST='$(RELAY_HOST)' PROJECT_ID='$(PROJECT_ID)' test | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
endif


notifyxctestrun = $(shell find . -name '*_NotifyTests*.xctestrun')

notify_tests: test_setup
Expand All @@ -84,14 +84,14 @@ ifneq ($(notifyxctestrun),)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.RELAY_HOST -string $(RELAY_HOST) $(notifyxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.PROJECT_ID -string $(PROJECT_ID) $(notifyxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.GM_DAPP_PROJECT_ID -string $(GM_DAPP_PROJECT_ID) $(notifyxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.GM_DAPP_PROJECT_SECRET -string $(GM_DAPP_PROJECT_SECRET) $(notifyxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.CAST_HOST -string $(CAST_HOST) $(notifyxctestrun)
# test-without-building
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -clonedSourcePackagesDirPath ../SourcePackagesCache -resultBundlePath 'test_results/NotifyTests.xcresult' -xctestrun '$(notifyxctestrun)' test-without-building | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
else
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project Example/ExampleApp.xcodeproj -scheme NotifyTests -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataCache -resultBundlePath 'test_results/NotifyTests.xcresult' RELAY_HOST='$(RELAY_HOST)' PROJECT_ID='$(PROJECT_ID)' GM_DAPP_PROJECT_ID='$(GM_DAPP_PROJECT_ID)' CAST_HOST='$(CAST_HOST)' test | tee ./test_results/xcodebuild.log | xcpretty --report
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project Example/ExampleApp.xcodeproj -scheme NotifyTests -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -resultBundlePath 'test_results/NotifyTests.xcresult' RELAY_HOST='$(RELAY_HOST)' PROJECT_ID='$(PROJECT_ID)' GM_DAPP_PROJECT_ID='$(GM_DAPP_PROJECT_ID)' GM_DAPP_PROJECT_SECRET='$(GM_DAPP_PROJECT_SECRET)' CAST_HOST='$(CAST_HOST)' test | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
endif


smokexctestrun = $(shell find . -name '*_SmokeTests*.xctestrun')

smoke_tests: test_setup
Expand Down
4 changes: 4 additions & 0 deletions NotifyTests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"key" : "RELAY_HOST",
"value" : "$(RELAY_HOST)"
},
{
"key" : "GM_DAPP_PROJECT_SECRET",
"value" : "$(GM_DAPP_PROJECT_SECRET)"
},
{
"key" : "GM_DAPP_PROJECT_ID",
"value" : "$(GM_DAPP_PROJECT_ID)"
Expand Down
52 changes: 52 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"object": {
"pins": [
{
"package": "QRCode",
"repositoryURL": "https://github.com/WalletConnect/QRCode",
"state": {
"branch": null,
"revision": "263f280d2c8144adfb0b6676109846cfc8dd552b",
"version": "14.3.1"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
"version": "1.3.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
},
{
"package": "swift-qrcode-generator",
"repositoryURL": "https://github.com/dagronf/swift-qrcode-generator",
"state": {
"branch": null,
"revision": "5ca09b6a2ad190f94aa3d6ddef45b187f8c0343b",
"version": "1.0.3"
}
},
{
"package": "SwiftImageReadWrite",
"repositoryURL": "https://github.com/dagronf/SwiftImageReadWrite",
"state": {
"branch": null,
"revision": "5596407d1cf61b953b8e658fa8636a471df3c509",
"version": "1.1.6"
}
}
]
},
"version": 1
}
11 changes: 9 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let package = Package(
name: "WalletConnect",
platforms: [
.iOS(.v14),
.macOS(.v11),
.macOS(.v12),
.tvOS(.v14)
],
products: [
Expand Down Expand Up @@ -55,6 +55,7 @@ let package = Package(

],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
.package(url: "https://github.com/WalletConnect/QRCode", from: "14.3.1")
],
targets: [
Expand Down Expand Up @@ -132,7 +133,13 @@ let package = Package(
dependencies: ["WalletConnectUtils", "WalletConnectNetworking"]),
.target(
name: "WalletConnectModal",
dependencies: ["QRCode", "WalletConnectSign"]),
dependencies: ["QRCode", "WalletConnectSign"],
exclude: ["Secrets/secrets.json.sample"],
resources: [
.copy("Secrets/secrets.json"),
.copy("Resources/Assets.xcassets")
]
),
.target(
name: "WalletConnectSync",
dependencies: ["WalletConnectSigner"]),
Expand Down
13 changes: 13 additions & 0 deletions Sources/WalletConnectModal/Mocks/Listing+Mocks.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Foundation

#if DEBUG

extension Listing {
static let stubList: [Listing] = [
Listing(id: UUID().uuidString, name: "Sample Wallet", homepage: "https://example.com", order: 1, imageId: UUID().uuidString, 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: "sampleapp://deeplink", universal: "https://example.com/universal")),
Listing(id: UUID().uuidString, name: "Awesome Wallet", homepage: "https://example.com/awesome", order: 2, imageId: UUID().uuidString, 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://example.com/awesome/universal")),
Listing(id: UUID().uuidString, name: "Cool Wallet", homepage: "https://example.com/cool", order: 3, imageId: UUID().uuidString, 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: "coolapp://deeplink", universal: "https://example.com/cool/universal"))
]
}

#endif
Loading

0 comments on commit 1472225

Please sign in to comment.