3

I currently have an iOS application where I want users to be able to import their crypto wallets via WalletConnect. I try using the WalletConnect example app and I get as far as generating a url that opens metamask but it does not ask for any kind of verification, it just opens metamask and nothing else. I see others with the same issue on their github too with no resolution. I don't see any other service/package performing these functions besides WalletConnect either, I would appreciate any suggestions on what I may be doing wrong or other options that I can try out

b_b
  • 41
  • 1
  • 2

1 Answers1

3

You can connect, reconnect & disconnect with meta mask using walletconnect swift lib. Here is the link of it: https://github.com/WalletConnect/WalletConnectSwift

There have two section:

  1. Server
  2. Client

Server is used for wallet side functionalities. i.e. metamask, trustwallet and so on

Client is used to implement dApps where User initiate connect request and metamask/trustwallet app gets and request and approve it.

You should take a look at clientside code, which helpful to implement dapps.

Verfication is depends on the bridgeURL you used in the demo. Here is the bridge link, you should use: https://safe-walletconnect.gnosis.io/

Here is the code which help to have verification on metamask:

func connect() -> String {
    let wcUrl = WCURL(topic: UUID().uuidString,
        bridgeURL: URL(string: "https://safe-walletconnect.gnosis.io/")!,
        key: try! randomKey())

    let clientMeta = Session.ClientMeta(name: "ExampleDemoApp",
        description: "WalletConnectDemo",
        icons: [],
        url: URL(string: "https://safe.gnosis.io")!)

    let dAppInfo = Session.DAppInfo(peerId: UUID().uuidString,
        peerMeta: clientMeta,
        chainId: ViewController.chainID)

    client = Client(delegate: self, dAppInfo: dAppInfo)

    print("WalletConnect URL: \(wcUrl.absoluteString)")

    try! client.connect(to: wcUrl)
    return wcUrl.absoluteString
}

Hope it will help you. Its working on my side.

JK Patel
  • 858
  • 8
  • 22