Ethereum React Native Boilerplate Questions

When do you think moralis will stabilize for production in mobile?
I need make schedule.

Nobody get a success to see the popup for transaction in metamask yet.
Moralis.executeFunction - is totally not working in react-native.

this is really unbelievable and very annoying… because Crypto auth uses web3.eth.personal.sign() to sign the auth message and that modal pops up fine in metamask and even in trustwallet perfectly.
I just can’t understand what is the difference here?
I thought maybe if I change my default browser to chrome it will work, because of this error: Failed to open url: https://metamask.app.link: Error - The request to open com.apple.mobilesafari failed
but no success… :frowning:

I think the moralis team need to fix at least show popup for transaction. Then it will be really appreciated.

Yes, agreed! good job really on this boilerplate so far! but unfortunately for me without being able to make a smart contract transaction, only simple view contract calls it is not so useful.

1 Like

Hi, @gen, when can see the popup for transactions? Can you give us an estimatiated time about that?
Thanks.

1 Like

I am using the React Boilerplate and OpenSea server plugin. I am trying to place an offer on an NFT, but I am receiving the error “web3Sign trigger signer address missing or invalid”. I am somewhat familiar with signers because before I found Moralis and the boilerplate, I was designing this dapp with the opensea sdk and ethers.js library, however, I do not understand how to specify the signer in this case. Any assistance is greatly appreciated.

Please see below the file OfferBot.jsx file.

import { useMoralis } from "react-moralis";
import { Button } from "@mui/material";
import React, { useEffect, useMemo } from "react";

export default function OfferBot() {
  const {
    Moralis,
    user,
    isAuthenticated,
    isWeb3Enabled,
    enableWeb3,
  } = useMoralis();

  useEffect(() => {
    if (!isWeb3Enabled && isAuthenticated) {
      enableWeb3();
      console.log("web3 enabled");
    }
  }, [isWeb3Enabled, isAuthenticated, enableWeb3]);

  const web3Account = useMemo(
    () => isAuthenticated && user.get("accounts")[0],
    [user, isAuthenticated],
  );

  const createBuyOrder = async () => {
    let x = await Moralis.Plugins.opensea.createBuyOrder({
      network: "mainnet",
      tokenAddress: "My_Token_Address", 
      tokenId: 1000,
      tokenType: "ERC721",
      amount: 0.005,
      userAddress: web3Account
    });
    console.log(x);
  };

  return (
    <div>
      <Button variant="contained" onClick={createBuyOrder}>
        Make Offer
      </Button>
    </div>
  );
}```

Hi! I manage to make the app run with android emulator, but when I press the login button it won’t show the list of wallets to connect to, instead it redirects me to a 404 page of walletconnect with the error “No wallets found”.This is a screenshot of the error

I don’t know if you still have this issue but i’ve managed to make it work by typing org.gradle.jvmargs=-Xmx4608m in gradle.properties inside android folder

Is this issue related to WalletConnect?

Works sometimes, and mostly crash

1 Like

I have the same problem

Hi,
Thank you for your reply.
Capture
video: https://streamable.com/o42ty9

The transaction popup in metamask, is still not opened. Are there any solutions to fix this?

I GOT THIS MASSEGE FROM 1INCH SUPPORT:

Hi, the token must have 10k USD worth of liquidity on a connector token. Along with that, the Moralis plugin is outdated and uses an old version of 1inch.

Hi, even I’m getting same error. Is there a solution for this?
Thank you

@fatih01 @eugene @gen
It seems that after 2 weeks of struggling I finally found the solution for the transaction pop up problem in react-native app using the boilerplate project with WalletConnect and MetaMask.
You can see my approach below:

const { web3 } = useMoralis();
const connector = useWalletConnect();

const sendTransaction = React.useCallback(async () => {
    try {
      const data = web3.eth.abi.encodeFunctionCall({
        name: 'storeGeoCoordinate',
        type: 'function',
        inputs: [{type: 'string', name: 'lat'},
                {type: 'string', name: 'long'}]
      }, ["40.730610", "-73.935242"])

       await connector.sendTransaction({
        data: data,
        from: connector.accounts[0],
        to: '0x8caa9810Ecd5E19b85585Bdd342cb1EE8984261e',
        value: '0x00',
      });
    } catch (e) {
      console.error(e);
    }
  }, [connector]);

Use the walletConnector instance instead of Moralis.executeFunction to send the transaction and encode the smart contract function parameters through web3 instance as showed above.
For the “to” param specify the live smart contract address on the network you are using.
The modal to sign the transaction will finally pop up and the transaction goes through, and writes the state as expected. I tested it on ropsten test network, but should be working also on kovan and other networks.
:ok_hand:

2 Likes

Awesome! @sandormaraczy
Really helped me a lot. Thanks.

1 Like

I get Internal JSON-RPC error. from wallet connect when sending the transaction - any ideas? The encodeFunctionCall works as expected though

Reinstall the metamask. It can be the solution.