Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet connect 2 docs #106

Merged
merged 5 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Docs/migration-from-wc1-to-wc2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# AnkrSDK WalletConnect 2.0 migration guide

In the SDK version 0.6.0, we are introducing WalletConnect 2.0 implementation. It is represented by the `WalletConnect2` class having a partially identical and partially similar interface to the `WalletConnect` class. This extension also includes additional Unity example scenes analogous to previously added WalletConnect example scenes.

This guide explains the differences in the interface of the two implementations

### 1. Status enum changed

`WalletConnect.Status` property returns an enum value of the `WalletConnectStatus` type while the `WalletConnect2.Status` property returns an enum value of the `WalletConnect2Status` type. `WalletConnect2Status` has 4 values `Uninitialized`, `Disconnected`, `ConnectionRequestSent`, and `WalletConnected`. These correspond to the values of `WalletConnectStatus` with the same numeric value. `TransportConnected` and `DisconnectedSessionCached` value is deprecated for `WalletConnect2`.

### 2. The status transition event changed

`WalletConnect2.SessionStatusUpdated` event now has a different argument type: ' WalletConnect2TransitionBase` instead of `WalletConnectTransitionBase` with a separate set of subclasses corresponding to each possible transition.


### 3. `WalletConnect2` no longer implements the `IUpdatable` interface

`IUpdatable` is not implemented for `WalletConnect2` since this implementation does not have to be ticked on a per-frame basis in order to function and trigger status transition events.

### 4. `WalletConnect2` has a different disconnect method name

`WalletConnect2` does not have the `CloseSession()` method anymore but has the `Disconnect()` method to replace it
35 changes: 35 additions & 0 deletions Docs/migration-to-0.6.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AnkrSDK version 0.6.0 migration guide

In this release, we are adding a WalletConnect 2.0 protocol implementation based on [WalletConnectSharp](https://github.com/WalletConnect/WalletConnectSharp) implementation with some additions intended to support previously developed functionality. You can inspect the additional WalletConnectSharp changes in the [WalletConnectSharp-Fork](https://github.com/Ankr-network/WalletConnectSharp-Fork) repo main branch. In order to make sure WalletConnect 2.0 implementation can support a similar interface as WalletConnect 1.0 implementation we had to bring some breaking changes.

### 1. `WalletConnect.Connect()` method does not return the `WCSessionData` object anymore.

Since WalletConnect 2.0 implementation is not compatible with WCSessionData class which contains certain fields not compatible with WalletConnect 2.0 it was removed from a return value of the `Connect()` method. If you want to use WalletConnect 1.0 implementation with the 0.6.0 version you can still access the values of `WCSessionData` like this:

Let there be a `wcSessionData` object reference of the `WCSessionData` type and a `walletConnect` object reference of the `WalletConnect` type. This table shows which field corresponds to which between these two classes.

| 0.5.x | 0.6.x |
| --- | --- |
| `wcSessionData.peerId` | `walletConnect.PeerId` |
| `wcSessionData.peerMeta` | `walletConnect.WalletMetadata` |
| `wcSessionData.chainId` | `walletConnect.ChainId` |
| `wcSessionData.networkId` | `walletConnect.NetworkId` |
| `wcSessionData.accounts` | `walletConnect.Accounts` |

### 2. The `AppEntry` class was renamed to `WalletEntry`

Since this class is only related to wallet apps in every context of its usage it was renamed to WalletEntry.

### 3. The `SettingsType` field is removed from the `IWalletConnectable` interface

This field is not required to be in this interface since it is possible to initialize all `IWalletConnectable` implementations without using a Type object for settings scriptable object.

### 4. `IWalletConnectCommunicator` is separated into two interfaces `IWalletConnectCommunicator` and `IWalletConnectGenericRequester`

`IWalletConnectGenericRequester` is intended to be used only within the SDK `WalletConnectClient` class. The `IWalletConnectCommunicator.Status` property was replaced with an `IWalletConnectGenericRequester.CanSendRequests` bool property determining when it is allowed to send a request with it.

The rest of the methods of `IWalletConnectCommunicator` stay the same except the 'Send' method

### 5. `IWalletConnectCommunicator.Send` generic method properties are now restricted to `IIdentifiable` and `IErrorHolder` interfaces

This is done to make both `WalletConnect` and `WalletConnect2` comply with the same `IWalletConnectCommunicator` interface.