Skip to main content

Interacting with a Wallet

We implement WalletConnect 2.0 SignClient to allow for the connection of a Wallet to the Unreal application. Be sure to use a wallet compatible with this version.

Currently, each instance of the Unreal application can be paired with a single wallet. The SignClient is bound to a GameInstance Subsystem (Web3GISub), meaning that it will persist for the lifetime of the instance and be accessible anywhere.

How to Get Client

Connection

The pairing process is made quick and easy with a few blueprint nodes. It is done in two steps :

  • Session start : Create a connection from the app to the relay and get a connection uri.
  • Wallet connection : Display uri and wait for wallet connection

To kickstart this process, we provide the StartSession node. Once called, it will asynchronously perform all the tasks required to achieve a pairing. However, you need to react to the OnHandshake event : it will provide the Uri that the wallet must follow to procede with the pairing.

Start Session node usage

See QR code display to discover how to display the connection uri as a QR code.

Another useful event is OnConnected, which is fired when the pairing process comes to an end successfully. The Id of the newly connected wallet can also be found in the Subsystem.

Sending requests

Once paired, it is possible to send requests to the wallet through the relay. We provide a few convenient functions :

  • Request : Send a generic request with a json as content, asynchronous. Will get the original content and the response json string in return.

  • PersonalSign : Send a personal_sign request, asynchronous. Will get the original message, the signature, the announced signer and a boolean indicating a potential signature error. The signature/signer must still be verified to validate result locally.

    RequestPersonalSign
    Request node usagePersonalSign node usage

    Multiplayer

    In multiplayer, it is recommended to use a WcComponent to access the user's SignClient rather than directly refering to the Subsystem. This component is currently minimalist (providing only ClientStartSession to request a client to iniate a walletconnect pairing) but could grow with more useful multiplayer functions.