NFT Gallery is going from strength to strength. One issue I have with it though is the user having to paste their Ethereum address into the wallet page. As anyone can paste any public wallet address, you can have anyones collection on your phone. So I have been thinking how to integrate Web3 tech into the app.
Web3 means cryptocurrencies, blockchain technology and the one problem is that it mostly lives in web browsers. Most people who use Ethereum access it via the Metamask browser plug in. In the mobile world you can’t really have plug ins and so Metamask exists as its own app, Metamask Mobile (or MMM for short). This lets you manage your accounts and interact with Dapps via the built in browser.
To call MMM and get it to run your code you do something like this in c#.
await Browser.OpenAsync($"https://metamask.app.link/dapp/www.redfivesoftware.com/Web3Metamask.htm?return=http://" + AppName);
This opens a url on the device, which opens the deeplink into the app, which in turn opens your web page in the browser tab. In this case Web3Metamask.htm. Currently I pass one parameter in which is the start of the url that calls back to my app.
Then it is simply a case of overriding the OnAppLinkRequestReceived in your App class and processing the URI that was passed back into you.
protected override void OnAppLinkRequestReceived(Uri uri)
string url = uri.AbsolutePath;
var bits= url.Split("/",StringSplitOptions.RemoveEmptyEntries);
string address = bits;
App.SettingsViewModel.UserAddress = address;
And now you have your eth address. In the next post I will show how to get details of NFTs from OpenSea using their API.