let web3 = new Web3(window.ethereum)
works fine on desktop when calling this function
const encodedFunction= web3.eth.abi.encodeFunctionCall({})
BUT on mobile Iām using this
if(this.isMobile){
web3 = await Moralis.enable({provider:'walletconnect'})
}
the same contract call doesnāt workā¦ Iāll get a
ācannot read property of selectedAddress of undefinedā
errorā¦
how do I use web3 on mobileā¦
full code āwindow.ethereum.selectedAddressā is the main errorā¦ I need to get the users address
const encodedFunction= web3.eth.abi.encodeFunctionCall({
name:"mint",
type:"function",
inputs:[{
type:'address',
name:'account'
},{
type:'uint256',
name:'amount'
},{
type:'bytes',
name:'data'
}
]
},[window.ethereum.selectedAddress,1,web3.utils.asciiToHex(_uri)])
const transactionParameters= {
to:contract,
from:window.ethereum.selectedAddress,
data:encodedFunction
}
lastlyā¦ how do I call this
const txt = await window.ethereum.request({
method:'eth_sendTransaction',
params:[transactionParameters]
});