hashgraph / hedera-wallet-connect

This package is a messaging relay between decentralized applications and wallets in Hedera network based on Wallet Connect relays.
Apache License 2.0
13 stars 22 forks source link

Error When Disconnecting via Wallet's "Disconnect" Button #281

Closed MiguelLZPF closed 4 weeks ago

MiguelLZPF commented 1 month ago

Describe the bug A clear and concise description of what the bug is.

We are experiencing an issue when closing the connection between the wallet and the dApp, specifically when the disconnection is triggered from the wallet side.

image

So, when we close the connection from the dApp itself the connection is successfully closed and both sides are disconnected. However, when closing using the "disconnect" button from the wallet, error is thrown from .disconnect(topic) method.

The wallet "disconnect" button is this cross in Blade. We experience the same issue with Hashpack.

image

The topic is correctly passed as parameter:

image

It is worth noting that the .disconnect(topic) method is not explicitly called from the dApp, is triggered by an event.

To Reproduce Steps to reproduce the behavior:

Steps

  1. Clone Stablecoin repository

      git clone https://github.com/hashgraph/stablecoin-studio
      cd stablecoin-studio
      git checkout sprint-52
  2. install dependencies and build project

      npm install
      # wait until finished
  3. Test using Stablecoin WEB

    3.1 Hedera wallet

An hedera wallet with an account is needed. Easiest way is to use Hedera portal and import that account to the Blade Wallet. Blade Wallet browser extension and a Chrome based browser are needed for this test.

3.2 Web Environment

You need to have a correct .env configured on the web directory. Example:

# Log level for the application. The default value is ERROR.
# Acceptable values are ERROR, WARN, INFO, HTTP, VERBOSE, DEBUG and SILLY in order of priority (highest to lowest).
REACT_APP_LOG_LEVEL=DEBUG
# JSON array with a factory id in Hedera format `0.0.XXXXX` per environment.
REACT_APP_FACTORIES='[{"Environment":"testnet","STABLE_COIN_FACTORY_ADDRESS":"0.0.2167166"}]'
# The var must be a unique mirror node service for Hedera network, and this is the service which would be used when the UI starts. If the service doesn't require an API key to authorize requests, the API_KEY and HEADER properties must remain empty.
REACT_APP_MIRROR_NODE='[{"Environment":"testnet","BASE_URL":"https://testnet.mirrornode.hedera.com/api/v1/", "API_KEY": "", "HEADER": ""}]'
# The var must be a unique RPC node service for Hedera network, and this is the service which would be used when the UI starts. If the service doesn't require an API key to authorize requests, the API_KEY and HEADER properties must remain empty.
REACT_APP_RPC_NODE='[{"Environment":"testnet","BASE_URL":"https://testnet.hashio.io/api", "API_KEY": "", "HEADER": ""}]'
# This is a proprietary Create React App configuration. You can read more information in its documentation.[Create React App documentation](https://create-react-app.dev/docs/advanced-configuration/)
GENERATE_SOURCEMAP=true
REACT_APP_SHOW_CONFIG=true

# * Hedera Wallet Connect
REACT_APP_PROJECT_ID='' # Create a project in Wallet Connect Cloud
REACT_APP_DAPP_NAME='Hedera Stablecoin'
REACT_APP_DAPP_DESCRIPTION='StableCoin is a decentralized stablecoin platform built on Hedera Hashgraph.'
REACT_APP_DAPP_URL='https://wc.hgraph.app/'
REACT_APP_DAPP_ICONS='["https://portal.hedera.com/assets/hedera-logo-black-a0b1bd4f.svg","https://stablecoinstudio.com/static/media/hedera-hbar-logo.4fd73fb360de0fc15d378e0c3ebe6c80.svg"]'

3.3 Test

  cd stablecoin-studio/web
  npm start
  1. Connect with wallet connect
  2. Disconnect from the wallet

Expected behavior A clear and concise description of what you expected to happen.

The connection should be closed successfully, and both the dApp and the wallet should be properly disconnected.

Desktop (please complete the following information):

tmctl commented 1 month ago

@MiguelLZPF thank you for reporting, I'll respond back if we have trouble reproducing

tmctl commented 1 month ago

@MiguelLZPF Does this PR solve your issue - https://github.com/hashgraph/hedera-wallet-connect/pull/302?

M-Francia commented 3 weeks ago

@MiguelLZPF Does this PR solve your issue - #302?

Hello @tmctl, thank you for your reply, we have tested with hashpack but it doesn't work, we get the same error =S image