Ethereum React Native Boilerplate Questions

Hi, I tried to get the Chat app running in iOS. (yarn install, pod install)
After react-native run-ios I get the error:
The following build commands failed:
PhaseScriptExecution [CP]\ Copy\ XCFrameworks /Users/danasugu/Library/Developer/Xcode/DerivedData/moraliscreatereactnativedapp-gpczqzfgezmrqvapwpfjazjifidn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/UMCore.build/Script-93000F99857BC7CE7F7D8004B598863C.sh (in target ‘UMCore’ from project ‘Pods’)
(1 failure)

Please help, thanks!

After I deleted Pods run pod install it started running.

I get this error now:
Make sure you’re running a packager server or have included a .jsbundle file in your application bundle.
Please help

HI WHEN I CLONE THE PROJECT I FACE THIS ERROR:

TypeError: Moralis.onAccountChanged is not a function. (In ‘Moralis.onAccountChanged(function (address) {
setWalletAddress(address[0]);
})’, ‘Moralis.onAccountChanged’ is undefined)

This error is located at:
in MoralisDappProvider (at Providers.tsx:63)
in MoralisProvider (at Providers.tsx:59)
in WalletConnectProvider (at Providers.tsx:58)
in Providers (at AppWithProviders.tsx:6)
in _default (at renderApplication.js:45)
in RCTView (at View.js:34)
in View (at AppContainer.js:106)
in RCTView (at View.js:34)
in View (at AppContainer.js:132)
in AppContainer (at renderApplication.js:39)

Hello can you read this.

I cloned the boileropate repo in macOS and performed the following

  1. deleted the yarnlock file
  2. yarn installed
  3. pod installed in the ios folder
  4. opened the workspace in Xcode as demonstrated in video
  5. built the project in iphone13

I got the following error

error: TypeError: Cannot read properties of undefined (reading 'transformFile')
    at /Users/aniket.dhar/kriya/ethereum/ethereum-react-native-boilerplate/node_modules/metro/src/Bundler.js:91:34
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/aniket.dhar/kriya/ethereum/ethereum-react-native-boilerplate/node_modules/metro/src/Bundler.js:14:24)
    at _next (/Users/aniket.dhar/kriya/ethereum/ethereum-react-native-boilerplate/node_modules/metro/src/Bundler.js:34:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I am having the you need to initialize parse.initialize before using parse error.
The thing is i have properly set my .env variables, and is still not working

can you please console the moralis and see what is inside the console. i think the function name is changed a bit Moralis.onAccountsChanged or something i dont remember right now but you can console Moralis ans see inside the prototype.

I got only metamask i think you if you dont have other wallet in your phone then maybe it redirects you to metamask because i dont have other wallet but metamask.

Can you try hardcoding your serverUrl and appId into <MoralisProvider> in frontend\Providers.tsx to see if that works.

Yes the link I posted covers that.

1 Like

image
I need only metamask here. how can I remove all other wallets?

You can add the required wallets using the mobilelink parameter in authenticate function.

Moralis.authenticate({ provider: "walletconnect", mobileLinks: ["metamask"] })

probably, the function looks different in react native, but adding mobileLinks: ["metamask"] should do the trick.

authenticate({
// connector,
provider: “walletconnect”,
mobileLinks: [“metamask”],
signingMessage: “TG authentication”,
})

Still not working. @johnversus

Which file did you make this change in?

That list of wallets may be related to the code here which pulls a JSON list of wallets from WalletConnect’s site. Try breaking the fetch link to see if that affects that list.

1 Like

web3.eth.getChainId() is not working. I am getting error

~Provider not set or invalid~

const web3 = new Web3(Moralis.provider);
web3.eth.getChainId()

Where do you have this code? In the boilerplate chainId from the useMoralisDapp hook can be used.

import { useMoralisDapp } from "providers/MoralisDappProvider/MoralisDappProvider";
...
const { chainId } = useMoralisDapp();

Did you find a solution to your previous wallet list issue?

I am struggling to the make lazymint code working.

I have to run this code in react-native.
web3.eth.getChainId()
web3.currentProvider.sendAsync
web3.currentProvider.isMetaMask
…
Provider not set or invalid
This is working in react.js with same moralis, react-moralis packages. but not working in react-native.

Still struggling to the make lazymint code working.

I have to run this code in react-native.
web3.eth.getChainId()
…
Provider not set or invalid
This is working in react.js with same moralis, react-moralis packages. but not working in react-native.

const web3 = new Web3(Web3.givenProvider);
var web3 = new Web3(); web3.setProvider(new Web3.providers.HttpProvider(“http://localhost:8545”));
var web3 = new Web3(web3.currentProvider);
const web3js = new Web3(Moralis.provider);
const { web3 } = useMoralis();

I a facing the same issue, Is there anyone who can help with this?