Giter Site home page Giter Site logo

walletconnectunity's Introduction

WalletConnectUnity

This repository is a monorepo of packages that extend WalletConnectSharp and brings WalletConnect to Unity.

Packages

Package Description OpenUPM
Core High-level, Unity-friendly extension of WalletConnectSharp
- Automatic active session management
- Option to resume session from storage
- Deep linking support
- IL2CPP support
- Lightweight IJsonRpcConnection implementation
- QR Code generation utility
- API to load wallets data and visual assets
openupm
Modal Simplest and most minimal way to connect your players with WalletConnect openupm
UI This is a technical package that provides UI for WalletConnect Modal. It is not intended to be used directly, but rather as a dependency of WalletConnect Modal. openupm
Nethereum This Unity package provides a simple way to integrate WalletConnect with Nethereum library. openupm

Older versions of WalletConnectUnity are available under legacy/* branches

Prerequisites

  • Unity 2021.3 or above
  • IL2CPP managed code stripping level: Minimal (or lower)

Supported Platforms

Documentation

Installation

Install via OpenUPM CLI

To install packages via OpenUPM, you need to have Node.js and openupm-cli installed. Once you have them installed, you can run the following commands:

  • WalletConnect Modal:
    openupm add com.walletconnect.modal
  • WalletConnectUnity Core:
    openupm add com.walletconnect.core
Install via Package Manager with OpenUPM
  1. Open Advanced Project Settings from the gear ⚙ menu located at the top right of the Package Manager’s toolbar
  2. Add a new scoped registry with the following details:
    • Name: OpenUPM
    • URL: https://package.openupm.com
    • Scope(s): com.walletconnect
  3. Press plus ➕ and then Save buttons
  4. In the Package Manager windows open the add ➕ menu from the toolbar
  5. Select Add package by name...
  6. Enter the name of the package you want to install:
    • WalletConnectUnity Modal: com.walletconnect.modal
    • WalletConnectUnity Core: com.walletconnect.core
  7. Press Add button
Install via Package Manager with Git URL
  1. Open the add ➕ menu in the Package Manager’s toolbar
  2. Select Add package from git URL...
  3. Enter the package URL. Note that when installing via a git URL, the package manager won't install git dependencies automatically. Follow the error messages from the console and add all necessary packages manually
    • WalletConnectUnity Modal: https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.modal
    • WalletConnectUnity UI: https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.ui
    • WalletConnectUnity Core: https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.core
  4. Press Add button

It's possible to lock the version of the package by adding #{version} at the end of the git URL, where #{version} is the git tag of the version you want to use. For example, to install version 1.0.0 of WalletConnectUnity Modal, use the following URL:

https://github.com/WalletConnect/WalletConnectUnity.git?path=Packages/com.walletconnect.modal#modal/1.0.0

Usage

  1. Set up in project id and metadata WalletConnectProjectConfig ScriptableAsset (created automatically located at Assets/WalletConnectUnity/Resources/WalletConnectProjectConfig.asset, do NOT move it outside of Resources directory).
  2. Initialize WalletConnect and connect wallet:
// Initialize singleton
await WalletConnect.Instance.InitializeAsync();

// Or handle instancing manually
var walletConnectUnity = new WalletConnect();
await walletConnectUnity.InitializeAsync();


// Try resume last session
var sessionResumed = await WalletConnect.Instance.TryResumeSessionAsync();              
if (!sessionResumed)                                                                         
{                                                                                            
    var connectedData = await WalletConnect.Instance.ConnectAsync(connectOptions);

    // Create QR code texture
    var texture = WalletConnectUnity.Core.Utils.QRCode.EncodeTexture(connectedData.Uri);
    
    // ... Display QR code texture

    // Wait for wallet approval
    await connectedData.Approval;                                                            
}                                                                                            

WalletConnectProjectConfig Fields

  • Id - The id of your project. This will be used inside the relay server.
  • Client Metadata
    • Name - The name of your app. This will be used inside the authentication request.
    • Description - The description of your app. This will be used inside the authentication request.
    • Url - The url of your app. This will be used inside the authentication request.
    • Icons - The icons of your app. This will be used inside the authentication request.
    • Very Url - The verification URL of your app. Currently used but not enforced

WebGL Usage

Due to WebGL's single-threaded nature, certain asynchronous operations like Task.Run, Task.ContinueWith, Task.Delay, and ConfigureAwait(false) are not natively supported.

To enable these operations in WebGL builds, an additional third-party package, WebGLThreadingPatcher, is required. This package modifies the Unity WebGL build to delegate work to the SynchronizationContext, allowing these operations to be executed on the same thread without blocking the main application. Please note that all tasks are still executed on a single thread, and any blocking calls will freeze the entire application.

The WebGLThreadingPatcher package can be added via git URL:

https://github.com/VolodymyrBS/WebGLThreadingPatcher.git

Sample

walletconnectunity's People

Contributors

alansley avatar astasovsky avatar ecp4224 avatar favoyang avatar gigajuwels avatar koenrijpstra avatar leon-do avatar michitomo avatar samikammoun avatar skibitsky avatar underclockeddev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

walletconnectunity's Issues

Help with WalletConnectUnity and Unity

Hi guys,

I am building a game where I want the users to connect their wallets and after that get some metadata from their contracts (various icons).

My question is how can I achieve it

I have set up the Walletconnect script with the default values I saw in one of the document images and this is what the console prints out.

Can someone explain (if possible) what are the fields that the App Data takes inside the WalletConnect?

And also how can I achieve what I mentioned in the beginning.

I am a total beginner so any help is kindly appreciated.

NEthereum extension support

Currently need to overcome dependency conflicts, this should be easy since our only dependency is NewtonsoftJson which has a stable API between versions

Related discussions

AlLansley
what's your solution for WalletConnect and Nethereum both needing NewtonsoftJson? I've previously just deleted the WC version from the packages folder so it relies on the Nethereum one, but now it's spitting emit errors when I deploy to Android so I'm going to try to keep the WC one and do a binding redirect for Nethereum (perhaps related to the above?). Unfortunately it complains about a strongly referenced version of NewtonsoftJson 12.0.0 while the WC one is 10.0.0?
Binding redirect steps I'm using: https://forum.unity.com/threads/dependency-on-newtonsoft-json.814128/#post-5398014

ecp4224
The ideal solution is to have the assembly for developers not using NEthereum (i.e using another web3 layer) and removing the assembly when NEthereum is being imported
Another solution would be to just use Unity's built in NewtonsoftJson, however it's not clear what Unity version this is added in (2020.x)
I have a WIP branch with the demo scene importing NEthereum however this assembly issue is present. This topic will be moved to it's own issue

Smart Contract Deployment

Hey guys,

so I want to deploy a smart contract using WalletConnect, thus the user does not have to reveal his private key.
I tried following this tutorial from NEthereum while constructing
var web3 = wcProtocol.BuildWeb3(ConstantManager.INFURA_ETH_ID).AsUnmanagedAccount();
and then the rest following the tutorial. Somehow I am always stuck in
var transactionHash = await web3.Eth.DeployContract.SendRequestAsync(abi, byteCode, account, deployParam);.
Then nothing happens.

Alternativly I tried

var transaction = new TransactionData()
        {
            data = byteCode,
            from = address,
            to = null,
            gas = "300000",
            value = "0",
            chainId = 5,
        };

var results = await WalletConnect.ActiveSession.EthSendTransaction(transaction);

This method actually prompt MetaMask to open and that's all nothing after that.

Thanks in advance. Please tell me if you need more info.

Might be worth randomising the bridge server used at runtime

Current bridge server of https://f.bridge.walletconnect.org can sometimes not work properly, likely due to load.

I read that servers a-z/A-Z/0-9 exist for the prefix so it might be worth picking a random one at startup to spread the load, as it can be confusing when things work, then don't, then do again etc. when there doesn't seem to be much rhyme or reason as to why things randomly decide to get flaky!

Just a thought!

CreateProvider is missing

after copy the folder WalletConnect.NEthereum folder from WalletConnectSharp, the CreateProvider is not available and get error compiling, also i get a warning that i should use Session intead of Protocol, but Session does not contain this CreateProvider either, i copied the folder next to WalletConnectSharp.Core inside Scripts\WalletConnectSharp

var wcProtocol = WalletConnect.Instance.Protocol
var web3 = new Web3(wcProtocol.CreateProvider(new Uri("https://mainnet.infura.io/v3/<infruaId>"));

Session not recovering problems

There are two problems

  • When I restart WalletConnect app I can't load previous session.
  • Metamask onboard popup doesn't appears again when I cancel it or request permission again.

You can check the captured video here.

WallecConnect session problem

I guess carefully the async OnApplicationQuit/Pause codes doesn't work as expected.
and there should be detection of canceling permission.

[Environment]
Project: https://github.com/WalletConnect/WalletConnectUnity (2021.11.9)
Unity3D version: 2020.3.21f (Mono Build)
Nox emulator version: 7.0.1.7 (Android 7)

WebGL w/Build Setting "Development Build" on WalletConnectSession.DisconnectSession may throw 'Memory Access Out of Bounds'

Summary

In Unity3d for WebGL if Development Build in Build Settings is checked, when WalletConnect.Disconnect is called a "memory access out of bounds" error is thrown.

Steps to reproduce

Unity 2020.3.34 or 2021.2.5

  1. Set WebGL as Platform
  2. Check 'Development Build'
    image
  3. Click Run and Build
  4. When app is running in browser click on button or cause other event that calls WalletConnect.Session.Disconnect().
  5. Error in console log
RuntimeError: memory access out of bounds,RuntimeError: memory access out of bounds
    at __ZN21InterfaceFuncInvoker3IiP52ByteU5BU5D_tDBBEB0E8362242FA7223000D978B0DD19D4B0726iiE6InvokeEtP11Il2CppClassP12Il2CppObjectS1_ii (http://localhost:58545/Build/wgl.wasm:wasm-function[21526]:0x913cea)
    at dynCall_iiiiiii (http://localhost:58545/Build/wgl.wasm:wasm-function[82595]:0x15cca65) ...

What is the current bug behavior?

Appears to be related to the Web Request in the Session.Disconnect method, throws a 'memory out of bounds' error.

What is the expected correct behavior?

Disconnect does not throw an error.

Possible fixes

Appears to be related to a known Unity3D WebGL issue (i.e. https://answers.unity.com/questions/1798594/webgl-runtimeerror-memory-access-out-of-bounds-2.html)

Try to trap and handle error?

Is it possible to retrieve wallet name after resuming session?

Hello,

I'm getting You must use OpenMobileWallet(AppEntry) or set SelectedWallet on iOS! exception after calling OpenMobileWallet() on iOS device when resuming a previous session.
To fix this I'm saving the SelectedWallet value in a PlayerPrefs and reloading it when a session is resumed.
Is it possible to retrieve the wallet AppEntry after resuming session directly from the WalletConnect singleton?

Thanks,

Tls handshake failed after calling WalletConnect.Connect()

Hello, trying to use moralis unity sdk to perform authentication through metamask. Testing on device and getting this error after calling AuthenticationKit.Connect: "System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Security.Interface.TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: 4294957312".

After some deep diving i saw they are using WalletConnect and error happens trying to reach uri "wss://n.bridge.walletconnect.org/" in NativeWebsocketTransport._socketOpen that calls WebSocket.Connect that call s System.Net.WebSockets.ClientWeSocket.ConnectAsync. I tried to set RemoteCertificateValidationCallback on ClientWebSocketOptions and ServerCertificateValidationCallback globally but to no avail - they are not being called and not exposed by api. But even if they were it would be temporary solution.

How can i resolve this?
Is there a way to temporarily disable certificate exception handling?

Do not use .NET packages

Hello.
To see if WalletConnect is compatible with all devices, please Build and Run on WebGL.

Certain .NET packages are not compatible with Unity or the code is deformed after compiling with IL2CPP.

On my Unity project, WalletConnect v2.0 works on Editor but after build do not work.

Thank you.

Unable to authenticate wallet in unity

1.After confirming my wallet authorization in metamask app, the wallet address is not taken by the app. This step fails to authenticate the wallet for the latest 6.5.0 metamask app.
2.It seems to work fine for the older version of metamask app (v6.3.0)
3.I have used all the alphanumerical subdomains of the bridge url such as "f.bridge.walletconnect.org", "m.bridge.walletconnect.org", "8.bridge.walletconnect.org", etc.
It doesn't seem to work on android either for me. Are there any updates or suggestions to where might the problem occur and how I can fix it?

App does not unpause after signature request

Our team is experiencing the same issue on Android very similar to #30 but after signing.

What happened:
After approving the sign request in the wallet (metamask, rainbow, imToken) we navigate back to the app which remains stuck in the signing state.

How to reproduce:

  • Connection request sent
  • Wallet chosen and opened
  • Connection request approved in wallet
  • Navigate back to app
  • Signature request sent
  • Wallet opens, signature request approved.
  • Navigate back to app, nothing else happens.

There are no errors reported. We debugged through WalletConnectSession.EthPersonalSign into Send but that did not return.

Android - Signature request: java.lang.IllegalStateException

Deep link sent and wallet opens.

  • User accepts connection
  • App receives connection response and sends signature request:
    string response = await walletConnect.Session.EthPersonalSign(address, "Moralis Authentication");
  • Exception thrown.

Log:

2021-11-06 16:02:25.994 10738-10767/com.MoralisIO.LogInTest I/Unity: Sending sign request for 0x5819ff18c1c1f42d1ac90ffecc25990431690198 ...
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
MainMenuScript/d__11:MoveNext () (at C:/projects/moralis/unity/LogInTest/Assets/Scripts/MainMenuScript.cs:90)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<MainMenuScript/d__11> (MainMenuScript/d__11&)
MainMenuScript:WalletConnectHandler (WalletConnectSharp.Core.Models.WCSessionData)
UnityEngine.Events.InvokableCall1<WalletConnectSharp.Core.Models.WCSessionData>:Invoke (WalletConnectSharp.Core.Models.WCSessionData) (at /Users/bokken/buildslave/unity/build/Runtime/Export/UnityEvent/UnityEvent.cs:221) UnityEngine.Events.UnityEvent1<WalletConnectSharp.
2021-11-06 16:02:26.125 10738-10738/com.MoralisIO.LogInTest I/Unity: onPause
2021-11-06 16:02:26.126 10738-10767/com.MoralisIO.LogInTest I/Unity: [WebSocket] Pausing
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
WalletConnectSharp.Unity.Network.NativeWebSocketTransport/d__34:MoveNext () (at C:/projects/moralis/unity/LogInTest/Assets/Scripts/WalletConnectSharp.Unity/Network/NativeWebSocketTransport.cs:271)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
2021-11-06 16:02:26.145 10738-10767/com.MoralisIO.LogInTest D/Unity: Vulkan PSO: Pipeline cache has not changed skipping save handle[c102d160]
2021-11-06 16:02:26.145 10738-10767/com.MoralisIO.LogInTest D/lisIO.LogInTes: PlayerBase::stop() from IPlayer
2021-11-06 16:02:26.145 10738-10767/com.MoralisIO.LogInTest D/AudioTrack: stop(690): called with 285504 frames delivered
2021-11-06 16:02:26.148 10738-10767/com.MoralisIO.LogInTest D/Unity: Sensor : Accelerometer ( 1) ; 0.004786 / 0.00s ; LSM6DSR Accelerometer / STMicro
2021-11-06 16:02:26.164 10738-10738/com.MoralisIO.LogInTest I/Unity: windowFocusChanged: false
2021-11-06 16:02:32.606 10738-10738/com.MoralisIO.LogInTest D/Unity: PersistentUnitySurface.preserveContent: android.view.SurfaceView{8e04096 VFE...... .F....I. 0,0-1080,2280 #7f010000 app:id/unitySurfaceView aid=1073741824}
2021-11-06 16:02:32.606 10738-10738/com.MoralisIO.LogInTest D/Unity: Last resumed Activity is the Unity activity, no need to preserve SurfaceView content
2021-11-06 16:02:32.611 10738-10767/com.MoralisIO.LogInTest D/Unity: SetWindow 0 0x0
2021-11-06 16:02:32.617 10738-10824/com.MoralisIO.LogInTest I/SwappyDisplayManager: Terminating looper thread
2021-11-06 16:02:37.140 10738-10763/com.MoralisIO.LogInTest W/MessageQueue: Handler (android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate) {955fbc0} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate) {955fbc0} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:560)
at android.os.Handler.enqueueMessage(Handler.java:778)
at android.os.Handler.sendMessageAtTime(Handler.java:727)
at android.os.Handler.sendMessageDelayed(Handler.java:697)
at android.os.Handler.sendMessage(Handler.java:635)
at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.sendDisplayEvent(DisplayManagerGlobal.java:722)
at android.hardware.display.DisplayManagerGlobal.handleDisplayEvent(DisplayManagerGlobal.java:351)
at android.hardware.display.DisplayManagerGlobal.access$200(DisplayManagerGlobal.java:55)
at android.hardware.display.DisplayManagerGlobal$DisplayManagerCallback.onDisplayEvent(DisplayManagerGlobal.java:708)
at android.hardware.display.IDisplayManagerCallback$Stub.onTransact(IDisplayManagerCallback.java:84)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)

Unable to connect as of 28/6 using 2021.3 LTS

Repro steps:

  • Clone repo
  • Open SimpleUnityDapp scene, no changes
  • Press play

74 warnings show up, mostly missing scripts, but they are warnings, so I am able to select a chain and press

From there, selecting a chain and pressing connect either:

  • Logs Connecting sign client.. before hanging indefinitely
  • Generates a QR code successfully and prompts a wallet (that supports these RPC methods) to connect, but hangs on await connectData.Approval; indefinitely, never getting a callback

This is the same behaviour I would get by initializing the SDK as per your docs in a fresh project with dlls imported into unity.

Other minor observations:

  • Importing the raw scripts with unsafe keyword means you have to allow it explicitly in project settings
  • If the target framework is .NET Framework rather than .NET Standard 2.1 in Unity your System.Web reference is lost and throws an error, to fix you should include it or reference it with a csc.rsp under Assets
  • The QR code is on the far left of the scene, not rendered in the gameview
  • Rainbow wallet seems to throw errors while Metamask hangs, either way I can't seem to connect wallets

If you have a working scenario, please advise.

How to checkout default wallet?

First time to open the WalletConnectUnity in android,has TokenPocket and Metamask. I select the TokenPocket and check do not prompt again. The second time it is no longer selectable MetaMask, even if I uninstall and then reinstall it defaults to TokenPocket. How do i to deal it?Thanks.

Error message after calling EthPersonalSign()

Every time I tried to sign a message, I got the signature along with this error message. It seems that this error message does not affect the performance.

InvalidOperationException
  at WalletConnectSharp.Core.Events.EventDelegator.Trigger (System.String topic, System.String json) [0x00000] in <00000000000000000000000000000000>:0 
  at WalletConnectSharp.Core.WalletConnectProtocol.TransportOnMessageReceived (System.Object sender, WalletConnectSharp.Core.Network.MessageReceivedEventArgs e) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0 
  at WalletConnectSharp.Core.Network.AESCipher.DecryptWithKey (System.Byte[] key, WalletConnectSharp.Core.Models.EncryptedPayload encryptedData, System.Text.Encoding encoding) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0 
--- End of stack trace from previous location where exception was thrown ---

  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0 

InvalidOperationException
  at WalletConnectSharp.Core.Events.EventDelegator.Trigger (System.String topic, System.String json) [0x00000] in <00000000000000000000000000000000>:0 
  at WalletConnectSharp.Core.WalletConnectProtocol.TransportOnMessageReceived (System.Object sender, WalletConnectSharp.Core.Network.MessageReceivedEventArgs e) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0 
  at WalletConnectSharp.Core.Network.AESCipher.DecryptWithKey (System.Byte[] key, WalletConnectSharp.Core.Models.EncryptedPayload encryptedData, System.Text.Encoding encoding) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0 
--- End of stack trace from previous location where exception was thrown ---

  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0 

Here is my code:

string message = "TryToSignThisMessage";
string signature = await WalletConnect.Instance.Session.EthPersonalSign(_address.text, message);
Debug.Log($"[Test] signature {signature}");

The error message appeared right after the log.

My platform is iOS and my wallet is MetaMask.

Lacks a necessary import

Following error happens
Assets/WalletConnectUnity/Demo/Full Session/Scripts/DemoActions.cs(53,9): error CS0246: The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)

It can be fixed by adding an import to DemoActions.cs

using System.Collections;

#55

Interface Errors

Several interfaces are throwing errors when I import into Unity 2020.3.41f

  • ICore
  • IRelayer
  • IAcknowledgement
  • IApprovedData
 error CS8701: Target runtime doesn't support default interface implementation.

Base64UrlEncoder C# version error

The Base64UrlEncoder has an issue with how string decoding is done.

This doesn't work in Unity 2020.3.41f which uses C# 8.0, it says I must be on C# 9.0 or greater

string decodedString = new(char.MinValue, decodedLength);

The error seems to go away when I use string

string decodedString = new string(char.MinValue, decodedLength);

No AOT code for JSsonRpcHistoryFactory

Hi, we're seeing an error when attempting to Connect :

2023-06-29 17:42:08.377 25054-25078/com.TDF.ID E/Unity: ExecutionEngineException: Attempting to call method 'WalletConnectSharp.Core.Controllers.JsonRpcHistoryFactory::JsonRpcHistoryOfType<WalletConnectSharp.Sign.Models.Engine.Methods.SessionPing, System.Boolean>' for which no ahead of time (AOT) code was generated.  Consider increasing the --generic-virtual-method-iterations=1 argument
      at WalletConnectSharp.Core.Controllers.TypedMessageHandler.HandleMessageType[T,TR] (System.Func`3[T1,T2,TResult] requestCallback, System.Func`3[T1,T2,TResult] responseCallback) [0x00000] in <00000000000000000000000000000000>:0
      at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
      at WalletConnectSharp.Core.Controllers.TypedMessageHandler.HandleMessageType[T,TR] (System.Func`3[T1,T2,TResult] requestCallback, System.Func`3[T1,T2,TResult] responseCallback) [0x00000] in <00000000000000000000000000000000>:0
      at WalletConnectSharp.Sign.Engine.RegisterRelayerEvents () [0x000

We're targeting Android, we don't have any code stripping and apart from that we don't see any error. We experienced the same thing while integrating directly WalletConnectSharp.
Do you have any idea what could be causing this?

(Android / iOS) OpenDeepLink(AppEntry app) doesn't work correct with set wallet

When trying to open a wallet for auth in the app from the next code, get invalid behavior.

public WalletConnect Connect => WalletConnect.Instance;
private AppEntry MetaMask => Connect.SupportedWallets.First(w => w.Value.name == nameof(MetaMask)).Value;
............
............
private void OpenMetamask() => Connect.OpenDeepLink(MetaMask);

When using the function OpenMetamask firstly - just open the wallet, with biometric verification, without any auth popup. Next, if I'll return to the app, and again press "Connect Metamask", Metamask will open with auth popup. I think it happened because of pausing my dapp , when switching applications with additional verification (like PIN, or biometric) on my OS (Android, but iOS the same issue), but don't know how to fix it.

Session connection thread does not close when Unity project not playing

Steps to reproduce:

1.) In the WalletConnectUnity demo project clear the session then provide a false custom bridge url like ws://bananas:3434 (obviously there is no bridge server at this endpoint =P)

2.) Click play on the app - WalletConnect tries to connect to the bridge and fails.

3.) Stop the app - WalletConnect does not stop attempting to connect to the bridge server and repeats the following forever:

[WebSocket] OnError Unable to connect to the remote server
System.Exception: Unable to connect to the remote server

So it looks like the connection thread never gets shut down properly. Unity version tested with: 2020.3.18f1

This issue exists in the latest stable as well as PR21 versions of WCU.

Issue Importing Walletconnect.Nethereum and Unity

I added Walletconnect.Nethereum folder to my Unity project.

I also imported all of the DLLs from https://github.com/Nethereum/Unity3dSimpleSampleNet461

But I keep getting this error and I don't know how to fix it:

Assets\WalletConnectUnity\WalletConnectSharp.NEthereum\WalletConnectNEthereumExtensions.cs(56,21): 
error CS0012: The type 'JsonSerializerSettings' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.

Any help in resolving this is kindly appreciated

`OnApplicationPause` on Android does not resume session

What happened:

Taking the single sign session LoginScene from the demo, building for Android, and running on device does not connect to the wallet.

How to reproduce:

Everything works correctly up to the point where after authorizing the request in MetaMask we have to manually switch back to the Unity app. Instead of detecting that the request has been authorized, nothing happens.

Specifically:

  1. Clicking on "Connect to WalletConnect" to open MetaMask via deep link.
  2. See the request to "Connect to this site?" pop up in MetaMask.
  3. Click "Connect" and it will say "Connected [..]. Go back to your browser."
  4. Go back to the app, nothing happens. It still shows the "Connect to WalletConnect" button. It's supposed to show me the "Sign Message" button instead.

As far as I can tell, OnApplicationPause in the NativeWebSocketTransport correctly resumes after the pause, correctly opens the transport connection again, and correctly subscribes to the topic. However, OnApplicationPause in WalletConnect does nothing. The reason is that the session key is empty. The reason for the session key being empty is that in SaveOrDisconnect the transport layer was already closed because it already processed OnApplicationPause.

This might be a race condition between both OnApplicationPauses. I also see a //#if UNITY_IOS on OnApplicationPause in NativeWebSocketTransport.

Suggestion: Have WalletConnectQRImage check for a QRCode in OnEnable

WalletConnectQRImage requires being enabled to set up the callback, but if the developer sets the game object inactive to hide it (perhaps to keep their scene tidy), this won't get called until the gameobject is activated at which point it might be too late and the image will never get updated. This might lead to some head-scratching... I'm suggesting refreshing the image in OnEnable (if it is able to)

QR Code Scan not responding in WalletConnectUnity SimpleUnityDapp scene

Hello Team,

I imported the latest assets from 2.0 branch in my Unity project.

While running the SimpleUnityDapp Demo scene in the editor, I noticed that scanning the generated QR code does nothing. I don't receive any notification on my app nor any logs in the editor.

I also received missing scripts warning in the console when starting the scene. Also noticed some missing scripts references on the QR gameobjects.

I'm attaching screenshots of the warnings and QR gameobject.

Please guide me on how to use the QR code scanner in v2.

QR Missing Script Missing scripts

The WebSocket connection drops constantly

The websocket connection drops constantly and WalletConnect is unable to send/receive petitions from wallets, i've checked with Unity 2019.4.10f1 , just opening the built in demo and leave it for some seconds or minute , caused this issue, it happens randomly

image

System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake. ---> System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
  at System.Net.WebSockets.ManagedWebSocket+<EnsureBufferContainsAsync>d__69.MoveNext () [0x00116] in <14e3453b740b4bd690e8d4e5a013a715>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Net.WebSockets.ManagedWebSocket+<ReceiveAsyncPrivate>d__60.MoveNext () [0x0010d] in <14e3453b740b4bd690e8d4e5a013a715>:0 
  at System.Net.WebSockets.ManagedWebSocket+<ReceiveAsyncPrivate>d__60.MoveNext () [0x00654] in <14e3453b740b4bd690e8d4e5a013a715>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <fb001e01371b4adca20013e0ac763896>:0 
  at NativeWebSocket.WebSocket+<Receive>d__36.MoveNext () [0x00125] in ...\WalletConnectUnity\Assets\WalletConnectUnity\Scripts\WalletConnectSharp.Unity\Network\Client\NativeWebSocket.cs:721 
UnityEngine.Debug:LogError(Object)
NativeWebSocket.<Receive>d__36:MoveNext() (at Assets/WalletConnectUnity/Scripts/WalletConnectSharp.Unity/Network/Client/NativeWebSocket.cs:756)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Int32)
Mono.Net.Security.<StartOperation>d__58:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(AsyncProtocolResult)
Mono.Net.Security.<StartOperation>d__23:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult()
Mono.Net.Security.<ProcessOperation>d__24:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Nullable`1)
Mono.Net.Security.<InnerRead>d__25:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Int32)
Mono.Net.Security.<InnerRead>d__66:MoveNext()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_EXPIRED

I ran the SampleScene demo on an android device.
Errors:

12-31 00:47:22.774 4228-4254/? E/Unity: Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_EXPIRED
12-31 00:47:23.056 4228-4247/? E/Unity: NullReferenceException: Object reference not set to an instance of an object
at WalletConnectSharp.Unity.WalletConnect+d__59.MoveNext () [0x0004d] in :0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <9278b33ecbf54b93bc81f25b9d3a1135>:0
12-31 00:47:23.235 4228-4257/? E/Unity: Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_EXPIRED

And I change the certificateHandler to :

`public class WebRequestCert : UnityEngine.Networking.CertificateHandler
{
protected override bool ValidateCertificate(byte[] certificateData)
{
return true;
}
}

    public IEnumerator FetchWalletList(bool downloadImages = true)
    {
        using (UnityWebRequest webRequest = UnityWebRequest.Get("https://registry.walletconnect.org/data/wallets.json"))
        {               
            webRequest.certificateHandler = new WebRequestCert();

            // Request and wait for the desired page.
            yield return webRequest.SendWebRequest();
            
            if (webRequest.isNetworkError)
            {
                Debug.Log("Error Getting Wallet Info: " + webRequest.error);
            }
            else
            {
                var json = webRequest.downloadHandler.text;

                SupportedWallets = JsonConvert.DeserializeObject<Dictionary<string, AppEntry>>(json);

                if (downloadImages)
                {
                    foreach (var id in SupportedWallets.Keys)
                    {
                        yield return DownloadImagesFor(id);
                    }
                }
            }
        }
    }`

But it still shows the errors.

Mobile wallet not receiving transactions for signing when wallet connect is running on AWS EC2 instance.

I've made a Unity build to test running Wallet Connect on an AWS EC2 instance while a client connects to it. In this way, the EC2 instance sends the URI info for the QR code to the client for connecting to Wallet Connect. This part works fine. I can connect and disconnect from Wallet Connect through this remote connection as much as I like, but for some reason I'm having trouble getting transaction requests sent to my mobile wallet.

When I tested the server client interactions locally, everything worked fine and I was able to sign for transactions, but now that I'm using the actual EC2 instance (I've tried both Linux and Windows), it doesn't even give me an error prompt for the signature request.
And the weird thing is that I actually did get an error message on my mobile wallet when the asset id I was using for payment was wrong. It's only when all the values are correct that it does nothing.

Is there something about running WalletConnectUnity on an EC2 instance that would cause this issue when sending requests to wallet connect?

WalletConnectUnity personal signed data incorrect / cannot be used to recover public wallet address

Hi,

I think there's an issue with the WalletConnectSession.EthPersonalSign() method. When I hash and then sign a message, performing a HashAndEcRecover operation does not result in the original wallet address used to sign the data.

I'll put some example reproduction code in a sec, but one thing that struck me about WalletConnectSession.EthPersonalSign is that it calls WalletConnectSharp.Core.Models.Ethereum.EthPersonalSign, and when it does that it passes the hexData argument as address, and the address argument as hexData. If you switch these around as you'd expect them to be then the calls to a wallet app to sign anything don't work at all - maybe something to do with the JsonRpcRequest argument order? I don't know, but I thought perhaps it might be a lead...

Anyway, here's some example code to reproduce the issue - this can just be plugged into the DemoActions.PersonalSign method, but you'll have to generate a 'good' expected signature as it uses your wallet address' private key to sign.

    var ethSigner = new EthereumMessageSigner();
    var address = WalletConnect.ActiveSession.Accounts[0];
    var message = "This is a test";
    string expectedSHA3OfMessage = "0x93b90fab55adf4e98787d33a38e71106e8c016f1a124dfc784f3cca4d938b1af";
    string expectedSignature = "YOUR_KNOWN_GOOD_SIGNATURE";
    
    // Test 0 - Confirm SHA3 matches expected result (it does, but we need to prefix "0x" to the result)
    /*
    // This will get you the correct hash
    var hashedMessage = "0x" + new Sha3Keccack().CalculateHash(message);
    // These three lines hashing using the ethSigner will also get you the correct hash (just FYI)
    //var messageByteArray = Encoding.UTF8.GetBytes(message);
    //var hashedMBA = ethSigner.Hash(messageByteArray);
    //var hashedMessage = "0x" + ethSigner.Hash(messageByteArray).ToHex();
    bool sha3IsCorrect = hashedMessage.ToLower().Equals(expectedSHA3OfMessage.ToLower());
    Debug.LogWarning("Expected SHA3: " + expectedSHA3OfMessage +
                            "\nGot SHA3: " + hashedMessage +
                            "\nSHA3 correct?: " + sha3IsCorrect;
    */

    // Test 1 - Personal sign plain message [FAILS]
    /*
    var signature = await WalletConnect.ActiveSession.EthPersonalSign(address, message);
    var recoveredAddress = ethSigner.HashAndEcRecover(message, signature);
    */

    /*** Please note: Regardless of whether we prefix "0x" to the message hash or not, the recovered address is incorrect ***/
    
    // Test 2 - Personal sign message hashed via Sha3keccack [FAILS]
    var hashedMessage = "0x" + new Sha3Keccack().CalculateHash(message); // Can add this: .ToHexUTF8() - still fails!
    Debug.LogWarning("Hash matches expected?: " + hashedMessage.ToLower().Equals(expectedSHA3OfMessage.ToLower())); // Result: true
    var signature = await WalletConnect.ActiveSession.EthPersonalSign(address, hashedMessage);
    var recoveredAddress = ethSigner.HashAndEcRecover(message, signature);
    
    
    // Test 3 - Personal sign message hashed via EthereumMessageSigner [FAILS]
    /*
    var messageByteArray = Encoding.UTF8.GetBytes(message);
    var hashedMBA = ethSigner.Hash(messageByteArray);
    var hashedMBAString = "0x" + ethSigner.Hash(messageByteArray).ToHex();
    Debug.LogWarning("Hash matches expected?: " + hashedMBAString.ToLower().Equals(expectedSHA3OfMessage.ToLower())); // Result: true
    var signature = await WalletConnect.ActiveSession.EthPersonalSign(address, hashedMBAString);
    var recoveredAddress = ethSigner.HashAndEcRecover(message, signature);
    */

    // Test 4 - Personal sign hashed message via HashAndHashPrefixedMessage [FAILS]
    /*
    var messageBytes = Encoding.UTF8.GetBytes(message);
    var hashedPrefixedMessageByteArray = ethSigner.HashAndHashPrefixedMessage(messageBytes);
    var hashedPMBAString = Encoding.UTF8.GetString(hashedPrefixedMessageByteArray);  // Can add this: .ToHexUTF8() - still fails!
    Debug.LogWarning("Hash matches expected?: " + hashedPMBAString.ToLower().Equals(expectedSHA3OfMessage.ToLower())); // Result: false
    var signature = await WalletConnect.ActiveSession.EthPersonalSign(address, hashedPMBAString);
    var recoveredAddress = ethSigner.HashAndEcRecover(message, signature);
    */
    
    bool recoverySuccessful = address.ToLower().Equals(recoveredAddress.ToLower());
    resultText.text = "Address: " + address + "\nRecovered address: " + recoveredAddress + "\nSuccess? " + recoverySuccessful;
    resultText.gameObject.SetActive(true);

As an aside, to replicate the (correct) EthereumMessageSigner.HashAndSign functionality, we again cannot hash and then sign the hashed message, we have to go through the following process:

        // This "one hit" Hash-and-Sign operation hashes and signs correctly. It works...
        var signer = new EthereumMessageSigner();
        var oneHitSignature = signer.HashAndSign(nonce, walletPrivateKey);
        Console.WriteLine("One hit signature is: " + oneHitSignature);

        // Replicate HashAndSign - see the following URL for details:
        // https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.Signer/EthereumMessageSigner.cs
        var plainNonceBytes = Encoding.UTF8.GetBytes(nonce);            
        var hashedMessageByteArray = signer.HashAndHashPrefixedMessage(plainNonceBytes);
        //var hashedMessageString = Encoding.UTF8.GetString(hashedMessageByteArray); // Not used atm

        // Signing with a EthereumMessageSigner DOES NOT result in the expected signature
        //var multiStepSignature = signer.Sign(hashedMessageByteArray, walletPrivateKey);

        // But signing with the (base) MessageSigner does because it doesn't first hash the message!
        var baseMessageSigner = new MessageSigner();
        var multiStepSignature = baseMessageSigner.Sign(hashedMessageByteArray, walletPrivateKey);

        Assert.AreEqual(oneHitSignature, multiStepSignature); // PASSES!

Best wishes,
Al

Unable to properly sign a message with escaped string like `\n`

When you try to sign a message that includes escaped string like \n, the library can't handle it properly.

For example, if we want to sign

Hello,
I am signing a message

The user should be able to sign and confirm a mesage like this on MetaMask

However, because of the current implementation, a message you can sign will be this instead

I have a pull request who needs an immediate fix but I would want somebody good in C# to write a proper fix.

Hi, is there any documentation about installing this?

I think it's nice to have the steps recommended installing this package.

Also, I think it's also nice if you add the discussion feature in this repo to handle discussions and questions like this. Thank you by the way!

WebGL

Hey, this is more of a question rather than an issue. Is it possible to use the library with a WebGL unity build? It works great when running in the editor but I don't receive a sign request when running a built web version. The QR code pops up but scanning it in metamask etc has no effect.

Thanks a lot, the library is awesome and will be a great feature to add to our project.

Does this plugin support V2?

Hey Folks,
I am using this plugin to connect to react-wallet-v2 . it gives me Error: Cannot safe json parse value of type undefined. does this mean this plugin only supports v1? how can i connect to v2?

Slow response from bridge server only IOS device

Summary

Slow response from bridge server bug apear maybe half month ago. on Android working fine.

Steps to reproduce

Unity 2020.3.1f or 2021.2.5

build this repo to ios devices
try connect wallet to metamask
after clicking connect app in metamask go to app previous opened
now you have to wait 1 minute to be call Connected Event

What is the current bug behavior?

Appears to be related to the bridge server with (alphanumeric).bridge.walletconnect slow response of session

What is the expected correct behavior?

instant connect with connected event called.

Possible fixes

https://user-images.githubusercontent.com/83002252/172593459-d6aa7516-26d8-4d68-a145-50be7d0f9ae4.jpg

Error message on start

I got the following error message on start:

Waiting for Wallet connection
WalletConnectSharp.Unity.<CompleteConnect>d__55:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:CompleteConnect()
WalletConnectSharp.Unity.<Connect>d__50:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:Connect()
WalletConnectSharp.Unity.<Start>d__49:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:Start()

[WebSocket] Subs Cleared
WalletConnectSharp.Unity.Network.NativeWebSocketTransport:ClearSubscriptions()
WalletConnectSharp.Unity.Network.<Open>d__21:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Unity.Network.NativeWebSocketTransport:Open(String, Boolean)
WalletConnectSharp.Core.<SetupTransport>d__53:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Core.WalletConnectProtocol:SetupTransport()
WalletConnectSharp.Core.<ConnectSession>d__48:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Core.WalletConnectSession:ConnectSession()
WalletConnectSharp.Unity.<SourceConnectSession>d__6:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnectUnitySession:SourceConnectSession()
WalletConnectSharp.Unity.<CompleteConnect>d__55:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:CompleteConnect()
WalletConnectSharp.Unity.<Connect>d__50:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:Connect()
WalletConnectSharp.Unity.<Start>d__49:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:Start()

[WebSocket] Waiting for Open wss://o.bridge.walletconnect.org
WalletConnectSharp.Unity.Network.<_socketOpen>d__22:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Unity.Network.NativeWebSocketTransport:_socketOpen()
WalletConnectSharp.Unity.Network.<Open>d__21:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Unity.Network.NativeWebSocketTransport:Open(String, Boolean)
WalletConnectSharp.Core.<SetupTransport>d__53:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Core.WalletConnectProtocol:SetupTransport()
WalletConnectSharp.Core.<ConnectSession>d__48:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Core.WalletConnectSession:ConnectSession()
WalletConnectSharp.Unity.<SourceConnectSession>d__6:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnectUnitySession:SourceConnectSession()
WalletConnectSharp.Unity.<CompleteConnect>d__55:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:CompleteConnect()
WalletConnectSharp.Unity.<Connect>d__50:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:Connect()
WalletConnectSharp.Unity.<Start>d__49:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(TStateMachine&)
WalletConnectSharp.Unity.WalletConnect:Start()

NullReferenceException: Object reference not set to an instance of an object.
  at WalletConnectSharp.NEthereum.WalletConnectNEthereumExtensions.CreateProvider (WalletConnectSharp.Core.WalletConnectProtocol protocol, Nethereum.JsonRpc.Client.IClient readClient) [0x00000] in <00000000000000000000000000000000>:0 
  at MoralisWeb3ApiSdk.MoralisInterface.SetupWeb3 () [0x00000] in <00000000000000000000000000000000>:0 
  at GameManager.Start () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at GameManager.Start () [0x00000] in <00000000000000000000000000000000>:0 
--- End of stack trace from previous location where exception was thrown ---

  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0

My platform is iOS and it seems that this error message does not affect the performance. The WalletConnect used in this project is not the lastest version. I tried the latest version in this repo https://github.com/WalletConnect/WalletConnectUnity, and this error message didn't appear.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.