Skip to content

Bug: eth_watchAsset doesn't work #247

Open
@prokhorovxo

Description

@prokhorovxo

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)
                        }
                }
  1. 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)
                    // ...
                }
  1. 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

  • Device: Any device (iPhone 12 Pro Max, iPhone 13 Pro, iPhone 14 Pro)
  • Device: Any iOS, for example 16.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions