Skip to content

Commit

Permalink
Merge pull request #745 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.5.1
  • Loading branch information
llbartekll authored Mar 14, 2023
2 parents 605b102 + fc49833 commit 7594446
Show file tree
Hide file tree
Showing 32 changed files with 560 additions and 169 deletions.
19 changes: 19 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ runs:
PROJECT_ID: ${{ inputs.project-id }}
run: make integration_tests RELAY_HOST=$RELAY_ENDPOINT PROJECT_ID=$PROJECT_ID

# Relay Integration tests
- name: Run integration tests
if: inputs.type == 'relay-tests'
shell: bash
env:
RELAY_ENDPOINT: ${{ inputs.relay-endpoint }}
PROJECT_ID: ${{ inputs.project-id }}
run: make relay_tests RELAY_HOST=$RELAY_ENDPOINT PROJECT_ID=$PROJECT_ID

# Smoke tests
- name: Run smoke tests
if: inputs.type == 'smoke-tests'
shell: bash
env:
RELAY_ENDPOINT: ${{ inputs.relay-endpoint }}
PROJECT_ID: ${{ inputs.project-id }}
run: make smoke_tests RELAY_HOST=$RELAY_ENDPOINT PROJECT_ID=$PROJECT_ID


# Wallet build
- name: Build Example Wallet
if: inputs.type == 'build-example-wallet'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: macos-12
strategy:
matrix:
test-type: [unit-tests, integration-tests, build-example-wallet, build-example-dapp]
test-type: [unit-tests, integration-tests, build-example-wallet, build-example-dapp, relay-tests]

steps:
- uses: actions/checkout@v2
Expand Down
39 changes: 39 additions & 0 deletions Example/ExampleApp.xcodeproj/IntegrationTests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"configurations" : [
{
"id" : "BAABD63B-F7E2-4928-AD6F-325C999C17BB",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {
"codeCoverage" : false,
"environmentVariableEntries" : [
{
"key" : "RELAY_HOST",
"value" : "$(RELAY_HOST)"
},
{
"key" : "PROJECT_ID",
"value" : "$(PROJECT_ID)"
}
],
"targetForVariableExpansion" : {
"containerPath" : "container:ExampleApp.xcodeproj",
"identifier" : "A5E03DEC286464DB00888481",
"name" : "IntegrationTests"
}
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:ExampleApp.xcodeproj",
"identifier" : "A5E03DEC286464DB00888481",
"name" : "IntegrationTests"
}
}
],
"version" : 1
}
164 changes: 138 additions & 26 deletions Example/ExampleApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -48,6 +48,15 @@
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<TestPlans>
<TestPlanReference
reference = "container:ExampleApp.xcodeproj/IntegrationTests.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:SmokeTests.xctestplan">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "844749F229B9E5B9005F520B"
BuildableName = "RelayIntegrationTests.xctest"
BlueprintName = "RelayIntegrationTests"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "844749F229B9E5B9005F520B"
BuildableName = "RelayIntegrationTests.xctest"
BlueprintName = "RelayIntegrationTests"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "RELAY_HOST"
value = "$(RELAY_HOST)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "PROJECT_ID"
value = "$(PROJECT_ID)"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "844749F229B9E5B9005F520B"
BuildableName = "RelayIntegrationTests.xctest"
BlueprintName = "RelayIntegrationTests"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "844749F229B9E5B9005F520B"
BuildableName = "RelayIntegrationTests.xctest"
BlueprintName = "RelayIntegrationTests"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ final class SessionDetailViewController: UIHostingController<SessionDetailView>
private func showSessionRequest(_ request: Request) {
let viewController = RequestViewController(request)
viewController.onSign = { [unowned self] in
let result = Signer.sign(request: request)
respondOnSign(request: request, response: result)
reload()
do {
let result = try Signer.sign(request: request)
respondOnSign(request: request, response: result)
reload()
} catch {
fatalError(error.localizedDescription)
}
}
viewController.onReject = { [unowned self] in
respondOnReject(request: request)
Expand Down
20 changes: 16 additions & 4 deletions Example/ExampleApp/Shared/Signer/Signer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import Foundation
import Commons
import WalletConnectSign

class Signer {

final class Signer {
enum Errors: Error {
case notImplemented
}

private init() {}

static func sign(request: Request) -> AnyCodable {
static func sign(request: Request) throws -> AnyCodable {
switch request.method {
case "personal_sign":
return ETHSigner.personalSign(request.params)
Expand All @@ -19,8 +22,17 @@ class Signer {

case "solana_signTransaction":
return SOLSigner.signTransaction(request.params)

default:
fatalError("not implemented")
throw Signer.Errors.notImplemented
}
}
}

extension Signer.Errors: LocalizedError {
var errorDescription: String? {
switch self {
case .notImplemented: return "Requested method is not implemented"
}
}
}
10 changes: 7 additions & 3 deletions Example/ExampleApp/Wallet/WalletViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ final class WalletViewController: UIViewController {
private func showSessionRequest(_ request: Request) {
let requestVC = RequestViewController(request)
requestVC.onSign = { [unowned self] in
let result = Signer.sign(request: request)
respondOnSign(request: request, response: result)
reloadSessionDetailsIfNeeded()
do {
let result = try Signer.sign(request: request)
respondOnSign(request: request, response: result)
reloadSessionDetailsIfNeeded()
} catch {
fatalError(error.localizedDescription)
}
}
requestVC.onReject = { [unowned self] in
respondOnReject(request: request)
Expand Down
File renamed without changes.
74 changes: 74 additions & 0 deletions Example/SmokeTests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"configurations" : [
{
"id" : "EB662E8C-8DC0-4689-A2FF-B41B80A99F85",
"name" : "Configuration 1",
"options" : {
"targetForVariableExpansion" : {
"containerPath" : "container:ExampleApp.xcodeproj",
"identifier" : "A5E03DEC286464DB00888481",
"name" : "IntegrationTests"
}
}
}
],
"defaultOptions" : {
"environmentVariableEntries" : [
{
"key" : "RELAY_HOST",
"value" : "$(RELAY_HOST)"
},
{
"key" : "PROJECT_ID",
"value" : "$(PROJECT_ID)"
}
],
"testTimeoutsEnabled" : true
},
"testTargets" : [
{
"skippedTests" : [
"AuthTests\/testEIP1271RespondSuccess()",
"AuthTests\/testEIP191RespondError()",
"AuthTests\/testRequest()",
"AuthTests\/testRespondSignatureVerificationFailed()",
"AuthTests\/testUserRespondError()",
"CacaoSignerTest",
"ChatTests\/testAcceptAndCreateNewThread()",
"ChatTests\/testInvite()",
"EIP1271VerifierTests",
"EIP191VerifierTests",
"PairingTests",
"PushTests\/testDappDeletePushSubscription()",
"PushTests\/testRequestPush()",
"PushTests\/testWalletApprovesPushRequest()",
"PushTests\/testWalletDeletePushSubscription()",
"PushTests\/testWalletRejectsPushRequest()",
"RegistryTests",
"RelayClientEndToEndTests",
"SignClientTests\/testCaip25SatisfyAllRequiredAllOptionalNamespacesSuccessful()",
"SignClientTests\/testCaip25SatisfyAllRequiredNamespacesSuccessful()",
"SignClientTests\/testCaip25SatisfyEmptyRequiredNamespacesExtraOptionalNamespacesSuccessful()",
"SignClientTests\/testCaip25SatisfyPartiallyRequiredNamespacesFails()",
"SignClientTests\/testCaip25SatisfyPartiallyRequiredNamespacesMethodsFails()",
"SignClientTests\/testNewSessionOnExistingPairing()",
"SignClientTests\/testSessionDelete()",
"SignClientTests\/testSessionEventFails()",
"SignClientTests\/testSessionEventSucceeds()",
"SignClientTests\/testSessionPing()",
"SignClientTests\/testSessionPropose()",
"SignClientTests\/testSessionReject()",
"SignClientTests\/testSessionRequestFailureResponse()",
"SignClientTests\/testSuccessfulSessionExtend()",
"SignClientTests\/testSuccessfulSessionUpdateNamespaces()",
"SignerTest"
],
"target" : {
"containerPath" : "container:ExampleApp.xcodeproj",
"identifier" : "A5E03DEC286464DB00888481",
"name" : "IntegrationTests"
}
}
],
"version" : 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x86",
"green" : "0x86",
"red" : "0x79"
"blue" : "134",
"green" : "134",
"red" : "121"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct ConnectionDetailsView: View {
.foregroundColor(.grey50)
.font(.system(size: 13, weight: .medium, design: .rounded))
}
.padding(.horizontal, 15)

ForEach(presenter.session.namespaces.keys.sorted(), id: \.self) { namespace in
VStack {
Expand Down
Loading

0 comments on commit 7594446

Please sign in to comment.