status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
287 stars 78 forks source link

[Wallet Connect] Analyse and implement missing APIs #16180

Open alexjba opened 3 weeks ago

alexjba commented 3 weeks ago

Description

The purpose of this task is to analyse and implement the integration needed to cover the following events. The wallet should implement the meaningful handlers for these events and also emit the events on meaningful flows.

This event can signal the following events:

  • connect

The Provider emits connect when it:

first connects to a chain after being initialized. first connects to a chain, after the disconnect event was emitted. interface ProviderConnectInfo { readonly chainId: string; } The event emits an object with a hexadecimal string chainId per the eth_chainId Ethereum RPC method, and other properties as determined by the Provider.

  • disconnect

The Provider emits disconnect when it becomes disconnected from all chains. This event emits a ProviderRpcError. The error code follows the table of CloseEvent status codes.

  • chainChanged

The Provider emits chainChanged when connecting to a new chain. The event emits a hexadecimal string chainId per the eth_chainId Ethereum RPC method.

  • accountsChanged

The Provider emits accountsChanged if the accounts returned from the Provider (eth_accounts) change. The event emits with accounts, an array of account addresses, per the eth_accounts Ethereum RPC method.

  • message

The Provider emits message to communicate arbitrary messages to the consumer. Messages may include JSON-RPC notifications, GraphQL subscriptions, and/or any other event as defined by the Provider.

interface ProviderMessage { readonly type: string; readonly data: unknown; }

Acceptance criteria:

alexjba commented 3 weeks ago

We'll need to send connect and disconnect events whenever the providers or connection are on/off.