Ethereum React Native Boilerplate Questions

can i have test token in RN moralis to test transfer ?

you can create a separate thread for this, you should not use beforeConsume, you should use a Nitro server (any new server is a nitro server), you can also add logging to see when that event happens

there shouldn’t be a delay like that
you can also share the server url

@cryptokid


I have use Moralis ethereum RN boilerplate when I try to transfer it rediredts me to metamask wallet but not doing anything like not opening confirm payment dialogue. can you please guide me

I can move all the content to create seperate thread if you mean to ask my question on another topic.
My server url: https://dgh8t1xlpfeh.usemoralis.com:2053/server
I do not know if my server is nitro. I understand that if i do not use beforeConsume and add logging to events then i can see the transfer events without delay.

Thanks its working can you please tell me how to send erc20 tokens

this is a nitro server, because it has coreservices plugin
you can try to use afterSave

Thank you for the response, I just updated my server instance to nitro. I tried with afterSave and i received erc20 real time events. I have one more and last question. Is there any way to receive native token events through moralis? Because i can not add contract abi on sync feature.

Thank you.

You choose have a table with all the transactions in real time for the addresses that you add to watch or for current users

@cryptokid


i want to send custom token my own to other address where do i add contractaddress ?

Hello, I am unable to even get the boiler plate running successfully.

I am on an Apple M1 machine, I followed all the pertinent steps in the Quickstart guide, and when I attempt to run “react-native run-ios”, I get quite a long error message several seconds into the build process.

The error message is probably too long to post, but the relevant part seems to be:
“fatal error: module map file ‘/Users//Library/Developer/Xcode/DerivedData/EthereumRNBoilerplate-dvlnkxkxpzvrurbrhzcwmgmmgmdb/Build/Products/Debug-iphonesimulator/lottie-ios/Lottie.modulemap’ not found”

react-native info:
System:
OS: macOS 12.2.1
CPU: (8) arm64 Apple M1
Memory: 94.56 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.1 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.2 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 13.3/13E113 - /usr/bin/xcodebuild
Languages:
Java: Not Found
Python: 3.8.8 - /opt/anaconda3/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: ~17.0.2 => 17.0.2
react-native: ~0.63.3 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Looking around, it seems like there are issues with Apple silicon & react-native that cause things resembling this. But any help would be much appreciated.

Hi, I am simply trying to request Moralis DB from my RN app, following this example.
So my App.tsx has

import { MoralisProvider } from "react-moralis";
import Moralis from "moralis/react-native";
import AsyncStorage from "@react-native-async-storage/async-storage";
Moralis.setAsyncStorage(AsyncStorage);

with

return (
      <SafeAreaProvider>
        <MoralisProvider
          serverUrl="https://xxxx/server"
          appId="xxx"
        >
          <Navigation colorScheme={colorScheme} />
          <StatusBar />
        </MoralisProvider>
      </SafeAreaProvider>
    );

and my component TrackListScreen has

import { useMoralis } from "react-moralis";

with the call

useEffect(() => {
    const EventsNFT = Moralis.Object.extend("EventsNFT");
    const query = new Moralis.Query(EventsNFT);
    query.equalTo("artist", "stormzy");
    const fetchData = async () => {
      const results = await query.find();
      console.log(`Successfully retrieved ${results.length} lines`);
      //setSoundsList(results)
    };
    fetchData().catch(console.error);
  }, []);

Unfortunately I get the below errors triggered in my useEffect() :frowning: any idea what I did wrong?

Can’t find variable: localStorage
at node_modules/moralis/lib/browser/ParseFileEncode.js:45:23 in encodeBase64
at 127.0.0.1:8081/index.bundle?platform=ios&dev=true&hot=false&minify=false:342307:56 in getItemAsync
at 127.0.0.1:8081/index.bundle?platform=ios&dev=true&hot=false&minify=false:328327:42 in currentInstallationId
at node_modules/moralis/lib/browser/RESTController.js:348:6 in request
at node_modules/moralis/lib/browser/ParseQuery.js:793:43 in first.then$argument_0
at components/TrackListScreen.js:69:28 in fetchData
at components/TrackListScreen.js:68:22 in fetchData
at components/TrackListScreen.js:75:13 in useEffect$argument_0

TypeError: undefined is not an object (evaluating ‘EventEmitter.prototype.addListener’)
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-dev-launcher/build/DevLauncherErrorManager.js:44:19 in errorHandler
at node_modules/expo-dev-launcher/build/DevLauncherErrorManager.js:49:24 in
at node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0

thanks for your help!

it may be to address, you can also try to use Moralis.transfer: https://docs.moralis.io/moralis-server/sending-assets/transfer-tokens

Hi, I get this issue when I try to launch the app on the emulator, following the coinbase clone youtube tutorial. And I did check on that react-native-community folder, and it is missing clipboard. Where can I get this? Thanks!

Hello all,

how can I best display the value of a staking pool?
I have now built something very simple and get an error message
“Compiled with problems:
ERROR in ./src/components/StakeFarm100.jsx 22:6-20
export ‘default’ (imported as ‘useAPIContract’) was not found in ‘hooks/useAPIContract’ (possible exports: useAPIContract)”.

import React, { useState, useEffect } from "react";
import useAPIContract from "hooks/useAPIContract";

function StakeFarmV100() {
    let stakeFarmV100Address = 'CONTRACT DELETET FOR POSTING';
    let stakeFarmV100ABI = 'ABI DELETET FOR POSTING';
    const stakeFarmV100ABIJson = JSON.parse(stakeFarmV100ABI);

    const { runContractFunction, contractResponse, error, isLoading, isFetching } = useAPIContract({
        abi: stakeFarmV100ABIJson,
        address: stakeFarmV100Address,
        functionName: 'pool',
        //chain: 'BSC',
        params: {
        },
    });

    return (
        <div>
            {error && <ErrorMessage error={error} />}
            <button onClick={() => runContractFunction()} disabled={isLoading}>Fetch data</button>
            {contractResponse && JSON.stringify(contractResponse)}

        </div>
    );
}
export default StakeFarmV100;

Moralis.transfer is not opening confirm transaction popup

I’m also facing the same issue

I cloned the react native boilerplate and did yarn install/pod install successfully.
I installed the app on my Samsung S20 plus device, but I am getting an authentication error when press the “Crypto Wallet Login” button. It says "Authentication Error: You need to call Parse.initialize before using Parse."

I already have a Trust Wallet and Metamask app installed on my phone.
I have created a Moralis Testnet Server (I checked Ethereum Ropsten and Polygon) and is running. I have copied and pasted the Server Url and Application Id to my .env file.
I am not sure exactly why it’s failing to authenticate.
Has anyone encountered this issue and how it was fixed?
Thanks.

@adriancabal for Android, try to hard code appId and server url in Providers.tsx file:
serverUrl={"server url here"}
appId={"appId here"}


how to fix ?

1 Like

2 Likes