What the simplest way of interacting with Metamask in an mobile unity app?
I have tried setting Web3Builder like this
protected override Web3Builder ConfigureWeb3Services(Web3Builder web3Builder)
{
return web3Builder.Configure(services =>
{
// Build config to use.
BuildWalletConnectConfig();
// Use wallet connect providers
services.UseWalletConnect(walletConnectConfig)
.UseWalletConnectSigner()
.UseWalletConnectTransactionExecutor();
});
}
private void BuildWalletConnectConfig()
{
var projectConfig = ProjectConfigUtilities.Load();
ChainModel chain = new ChainModel(ChainModel.EvmNamespace, projectConfig.ChainId, projectConfig.Network);
//WalletConnectWalletModel defaultWallet = null;
walletConnectConfig = new WalletConnectConfig
{
ProjectId = "f4bff60eb260841f46b1c77588cd8acb",
ProjectName = "Web3.Unity",
BaseContext = "unity-game",
#if !UNITY_2022_1_OR_NEWER
// Assign custom connection builder/web socket.
ConnectionBuilder = connectionBuilder,
#endif
Chain = chain,
Metadata = metadata,
SavedSessionTopic = "",
StoragePath = Application.persistentDataPath,
RedirectToWallet = true,
};
}
but it fails when i try to instantiate web3
web3 = await web3Builder.LaunchAsync();
the metamask opens on mobile but it returns a null reference error
Any idea?