MobileWalletProtocol / wallet-mobile-sdk

An open protocol for mobile web3 apps to interact with wallets
https://mobilewalletprotocol.github.io/wallet-mobile-sdk/
Other
290 stars 110 forks source link

Bug: eth_watchAsset doesn't work #247

Open prokhorovxo opened 1 year ago

prokhorovxo commented 1 year ago

Describe the bug

I'm trying to make eth_watchAsset method and unfortunately always get an error inside Coinbase Wallet iOS App

Steps

  1. Install last version (now it's 28.55) of Coinbase Wallet iOS App and sign in to account
  2. Install CoinbaseWalletSDK 1.0.4 via SPM
  3. Configure MWPClient
  4. Get an instance of MWPClient calling MWPClient.getInstance(to: Wallet.coinbaseWallet)
  5. Initiate handshake like this:

    mwpClient.initiateHandshake(
                    initialActions: [
                        Action(jsonRpc: .eth_requestAccounts)
                    ]
                ) { [weak owner] result, account in
                    switch result {
                        case .success(let response):
                            debugPrint(response.content)
    
                            guard let account else { return }
                            debugPrint(account)
    
                        case .failure(let error):
                            debugPrint(error.localizedDescription)
                        }
                }
  6. Make eth_watchAsset for Tether(USDT) request like this:
    mwpClient.makeRequest(
                    Request(actions: [
                        Action(
                            jsonRpc: .wallet_watchAsset(
                                type: "ERC20",
                                options: WatchAssetOptions(
                                    address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
                                    symbol: "USDT",
                                    decimals: 6,
                                    image: "https://etherscan.io/token/images/tethernew_32.png"
                                )
                            )
                        )
                    ])
                ) { result in
                    debugPrint(result)
                    // ...
                }
  7. Dapp redirects to Coinbase Wallet iOS App, then Coinbase Wallet throws an "Something went wrong" error (See Additional Info please)

Expected behavior

Coinbase Wallet doesn't throw an error and I can watch any asset

Version

1.0.4

Additional info

Coinbase Wallet "Something went wrong error"

Also I pressed "Try again" button and nothing happens. When I return to dapp nothing happens in makeRequest completion block, it just doesn't execute.

I've tried with different tokens (top 10 tokens from etherscan.io) and I've tried to send a batch request with a couple of eth_watchAsset actions and it still doesn't work.

And also I've a question: why SDK redirects me to the Coinbase Wallet if I just want to track asset? How can I get a list of assets by my wallet's address?

Desktop

No response

Smartphone

bearsworth commented 1 year ago

I am getting similar issues and even send Transaction is failing. They should really investigate this app, but more importantly the mobile app itself to make sure everything is working properly.

bangtoven commented 1 year ago

hey. sorry for the late response again. seems like there had been some error on input validation. we will take a look

prokhorovxo commented 11 months ago

@bangtoven hi, any updates here?