Skip to content
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

How to get Web3 object from Morails? #60

Open
ksbek opened this issue Feb 3, 2022 · 0 comments
Open

How to get Web3 object from Morails? #60

ksbek opened this issue Feb 3, 2022 · 0 comments

Comments

@ksbek
Copy link

ksbek commented Feb 3, 2022

Hi @ErnoW,

I'm a react native developer. But I have no experience with connecting metamask and call smart contract functions yet. I found your code online. It's great to start. But I have some errors. Would be grateful if you can look at this problem and guide me.
https://github.com/MoralisWeb3/demo-apps/tree/main/react-native-boilerplate

I want to get web3 object and run smart contract functions using the following code.
const web3 = await Moralis.Web3.enableWeb3(); const tokenContract = new web3.eth.Contract(contractAbi, contractAddress)

But I got the following error.
Possible Unhandled Promise Rejection (id: 0): TypeError: undefined is not an object (evaluating '_ref.connector') enableViaWalletConnect$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:358153:29

I think there's an issue with enableViaWalletConnect function.
https://github.com/MoralisWeb3/demo-apps/blob/main/react-native-boilerplate/frontend/Moralis/enableViaWalletConnect.ts#L9
There's no connector option in the response of the connect function. I think it's like an NPM version issue.

Thanks.

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

No branches or pull requests

1 participant