Closed dfl-zeke closed 1 year ago
@dfl-zeke are you referring to this line: https://github.com/magicblock-labs/Solana.Unity-SDK/blob/main/Samples~/Solana%20Wallet/Scripts/example/screens/LoginScreen.cs#L109 ?
@GabrielePicco I don't think so.
I mean that when you build WebGL project, you could be doing it for two reasons 1) to build for web 2) to build for xNFT
right?
So when you want to detect if it's xNFT or not, you call var account = await Web3.Instance.LoginXNFT();
and it does not return anything and I think it should return null if xNFT wallet is not available (here we already detect if it's xNFT or not, just needs callback for it https://github.com/magicblock-labs/Solana.Unity-SDK/blob/5996cf7803fb6a7fb99f83e47a7dc4a2f063b1c8/Runtime/Plugins/xNFT.jslib#L14 )
So instead of getting stuck on that line, it should return null.
Hello @dfl-zeke ,
You can now call var isXnft = await SolanaWalletAdapterWebGL.IsXnft();
if you just want to check wether it's an xNFT running inside Backpack.
LoginXNFT is now automatically called for you on Start in Web3 as you can see here
You might be interested in manually calling it for example when user changes network, as we show in the Solana Wallet example
Describe the bug I think this is more enhancement than bug, but in jslib files, in catch block, or else block, there is not returning anything, which is not best pattern to do so. For example in this function:
It never goes to the
if
block, because LoginXNFT does not return anything and it should return null if login is not possible.To Reproduce Just run above function and try to log in with webgl without xnft wallet. It will never go to the line after await.
Expected behavior Expected behavior would be to
return null
instead of wait endlessly.WebGL (please complete the following information): It only happens on webGL, because in other platforms it returns null.
P.S.: I've seen how you handle it in demo project, but still think it's not the best solution.