maurovz / Swift-WalletConnect

Easy iOS Web3 connection for MetaMask, TrustWallet and Rainbow Wallet
Apache License 2.0
59 stars 16 forks source link

How can i access public address, loginUser callback not working #6

Closed dervisyilm closed 1 year ago

dervisyilm commented 2 years ago

I added the glaip on my project, and call the loginUser function but, this function callback does not work, I want to access public address glaip.loginUser(type: .WalletConnect) { result in print(result) // not work
} please help me

maurovz commented 2 years ago

Thanks for your question. Please update your package (right click, update) and add the following to your code

       glaip.loginUser(type: .WalletConnect) { result in
          switch result {
            case .success(let user):
              print(user.wallet.address)
            case .failure(let error):
              print(error)
          }
        }
dervisyilm commented 2 years ago

thank you, i access public address

eugeniychepelev commented 2 years ago

I have the same problem, here is my code. Help me please))

 let glaip = Glaip(title: "Test", description: "Test descr", supportedWallets: [.MetaMask])
        glaip.loginUser(type: .MetaMask) { result in
            switch result {
            case .success(let user):
                print(user.wallet.address)
            case .failure:
                break
            }
        }
maurovz commented 2 years ago

@eugeniychepelev your problem is that you never get a call back in either success or failure?

eugeniychepelev commented 2 years ago

@maurovz Yes, in any case, call back does not work

maurovz commented 2 years ago

@eugeniychepelev try installing Glaip from this branch: bugfix/self-nil-reference

You can switch to the branch as follow:

  1. Double click here

    Screenshot 2022-09-19 at 13 16 58
  2. Change to branch and paste bugfix/self-nil-reference

    Screenshot 2022-09-19 at 13 17 07

let me know if that works. If so, I'll merge that branch into main