I have a Javascript function which should (does) return a string. The issue is that the C# part is always null although I've verified the JS function IS returning a string.
Here's the Javascript function:
window.get_current_user = () => {
Moralis.User.currentAsync().then(function (user) {
var wallet = user.get('ethAddress');
return wallet;
});
}
Here's the C# calling it
private async void GetAddress()
{
var userAddress = await _js.InvokeAsync<string>("get_current_user");
_js.InvokeVoidAsync("alert", userAddress);
}
I've used the Chrome Dev Console dev tools to breakpoint at the line in which it returns the value and verified the value is correct and a string.
I've also placed a breakpoint on the 4th line of the GetAddress function and see that the value of 'userAddress' is indeed null