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

Link mode w3m #1366

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension SessionAccountPresenter {
}

private func getRequest(for method: String) throws -> AnyCodable {
let account = session.namespaces.first!.value.accounts.first!.absoluteString
let account = session.namespaces.first!.value.accounts.first!.address
if method == "eth_sendTransaction" {
let tx = Stub.tx
return AnyCodable(tx)
Expand Down
2 changes: 1 addition & 1 deletion Example/DApp/Modules/Sign/SignPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ extension AuthRequestParams {
domain: String = "lab.web3modal.com",
chains: [String] = ["eip155:1", "eip155:137"],
nonce: String = "32891756",
uri: String = "https://app.web3inbox.com/login",
uri: String = "https://lab.web3modal.com",
nbf: String? = nil,
exp: String? = nil,
statement: String? = "I accept the ServiceOrg Terms of Service: https://app.web3inbox.com/tos",
Expand Down
16 changes: 13 additions & 3 deletions Example/DApp/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,28 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
projectId: InputConfig.projectId,
metadata: metadata,
crypto: DefaultCryptoProvider(),
customWallets: [
authRequestParams: .stub(), customWallets: [
.init(
id: "swift-sample",
name: "Swift Sample Wallet",
homepage: "https://walletconnect.com/",
imageUrl: "https://avatars.githubusercontent.com/u/37784886?s=200&v=4",
order: 1,
mobileLink: "walletapp://"
mobileLink: "walletapp://",
linkMode: "https://lab.web3modal.com/wallet"
)
]
)


Web3Modal.instance.authResponsePublisher.sink { (id, result) in
switch result {
case .success((_, _)):
AlertPresenter.present(message: "User Authenticted with SIWE", type: .success)
case .failure(_):
break
}
}.store(in: &publishers)

WalletConnectModal.configure(
projectId: InputConfig.projectId,
metadata: metadata
Expand Down
2 changes: 1 addition & 1 deletion Example/ExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3280,7 +3280,7 @@
repositoryURL = "https://github.com/WalletConnect/web3modal-swift";
requirement = {
kind = revision;
revision = c73ce390bc249af155b7320346b7045e53b89866;
revision = 3baac675811b5fdeb689cef703e3dfc7682704e6;
};
};
A5434021291E6A270068F706 /* XCRemoteSwiftPackageReference "solana-swift" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"repositoryURL": "https://github.com/WalletConnect/web3modal-swift",
"state": {
"branch": null,
"revision": "c73ce390bc249af155b7320346b7045e53b89866",
"revision": "3baac675811b5fdeb689cef703e3dfc7682704e6",
"version": null
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/WalletConnectPairing/Types/AppMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public struct AppMetadata: Codable, Equatable {
/// Universal link URL string.
public let universal: String?

public let linkMode: Bool
public let linkMode: Bool?

/**
Creates a new Redirect object with the specified information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ class AuthResponseSubscriber {

private func getTransportTypeUpgradeIfPossible(peerMetadata: AppMetadata, requestId: RPCID) -> WCSession.TransportType {
// upgrade to link mode only if dapp requested universallink because dapp may not be prepared for handling a response - add this to doc]
// remove record

if let peerRedirect = peerMetadata.redirect,
peerRedirect.linkMode,
let peerLinkMode = peerRedirect.linkMode,
peerLinkMode == true,
let universalLink = peerRedirect.universal,
supportLinkMode {
linkModeLinksStore.set(true, forKey: universalLink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ actor WalletErrorResponder {
let (sessionAuthenticateRequestParams, _) = try getsessionAuthenticateRequestParams(requestId: requestId)

guard let redirect = sessionAuthenticateRequestParams.requester.metadata.redirect,
redirect.linkMode else {
let linkMode = redirect.linkMode,
linkMode == true else {
throw Errors.linkModeNotSupported
}
guard let peerUniversalLink = redirect.universal else {
Expand Down
Loading