Skip to content

Upgrade MetaMask SDK to 1.3.1 #153

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

Merged
merged 5 commits into from
Feb 28, 2024

Conversation

ecp4224
Copy link
Contributor

@ecp4224 ecp4224 commented Feb 28, 2024

This PR upgrades the MetaMask SDK to the latest version 1.3.1, which fixes several bugs and adds some new features:

Bug Fixes

  • Send TERMINATE message when EndSession() is used
  • Enforce websockets to never use HTTP Pooling
  • Handle case where decryption fails by restarting key exchange with wallet
  • Several bug fixes with iOS and IL2CPP targets
  • Fix bug where large chain id values caused exception
  • Remove duplicated Starscream iOS dependency

Features

  • Batch RPC Support (with type safety)
  • Move Entirety of MetaMask/Runtime into single dll for both .NET Standard 2.0 and .NET Standard 2.1
  • Added ConnectAndSign() function

@0xFirekeeper
Copy link
Member

Thanks @ecp4224 testing this cross platform now.

Can you set UnityUI ScriptableObject back to Spawn Canvas being off - currently MM canvas being spawned behind WalletProvider_MetaMask prefab - thanks

@0xFirekeeper
Copy link
Member

Unable to build for Windows, guessing the new editor script / assembly change made to ThirdwebCore causing issues Assets\Thirdweb\Core\Plugins\MetaMask\Plugins\Libraries\evm.net\Editor\ContractGeneratorEditor.cs(16,6): error CS0246: The type or namespace name 'MenuItemAttribute' could not be found (are you missing a using directive or an assembly reference?)

Would remove that editor script or move it to higher up editor folder where Thirdweb.Editor.MetaMask asmdef lives

@ecp4224
Copy link
Contributor Author

ecp4224 commented Feb 28, 2024

Can you set UnityUI ScriptableObject back to Spawn Canvas being off - currently MM canvas being spawned behind WalletProvider_MetaMask prefab - thanks

Done 👍

Unable to build for Windows, guessing the new editor script / assembly change made to ThirdwebCore causing issues Assets\Thirdweb\Core\Plugins\MetaMask\Plugins\Libraries\evm.net\Editor\ContractGeneratorEditor.cs(16,6): error CS0246: The type or namespace name 'MenuItemAttribute' could not be found (are you missing a using directive or an assembly reference?)

I moved it to MetaMask.Editor, so that should resolve that issue 👍

@0xFirekeeper
Copy link
Member

0xFirekeeper commented Feb 28, 2024

Able to build successfully on standalone and mobile, any other notable/functional changes I should be aware of that you'd like to communicate before shipping this? @ecp4224

@ecp4224
Copy link
Contributor Author

ecp4224 commented Feb 28, 2024

The only notable thing to mention is that the WebGL build now uses the MetaMask JS SDK, however after reviewing the changes here, I remembered that we have the JS SDK bundled into our own WebGL Template (not included here).

Wondering how this should be bundled into the Thirdweb WebGL Template? I can grab it dynamically or I can just add the following script tag

<script src="https://c0f4f41c-2f55-4863-921b-sdk-docs.github.io/cdn/metamask-sdk-unity.js"></script>

I can also simply disable the JS SDK Provider in MetaMaskUnity for now, so all platforms use the same logic inside Thirdweb SDK

@0xFirekeeper
Copy link
Member

In WebGL we use our own template which uses our metamask wallet implementation from our typescript sdk bridge, so yes we don't need WebGL specific libs from the MM Unity SDK but it's okay to leave them in here for now

@0xFirekeeper
Copy link
Member

Other than the added extra GUID in our asmdef this is good to go, let me know if it points to anything on your end, points to nothing on my end. Thanks.

@ecp4224
Copy link
Contributor Author

ecp4224 commented Feb 28, 2024

I've commented out the JS SDK Provider for now and all build platforms will use the same provider logic. Perhaps in the future we can revisit this to use MetaMask JS SDK inside the typescript sdk bridge 😄

I've also removed the unused GUID, unsure why Unity / Rider added this.

@0xFirekeeper
Copy link
Member

Happy to get it done on the typescript side later on.

LGTM, thanks Eddie.

@0xFirekeeper 0xFirekeeper merged commit f1ea962 into thirdweb-dev:main Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants