Ethereum React Native Boilerplate Questions

@iPictorial Can you give more details about what you are trying to do? Thanks!

Hi there I am running into problems trying to authenticate with walletconnect and moralis. In the boilerplate code it appears that the walletconnect connector can be passed directly to the moralis authenticate function as a provider; however when I try to do this I get a Typescript error saying ‘Argument of type ‘{ connector: WalletConnect; }’ is not assignable to parameter of type ‘AuthenticateOptions’.’ I can only pass ‘wc’ or ‘walletconnect’ as providers.

I can use the connect function on the connector with no issues, but I need the user to be authenticated with moralis. Any help or ideas would help thanks!

Hey ì I’m trying to sync my smart contract with moralis. What should i put on topic and abi if my smart contract does not have an event defined?
i was following the moralis video for syncing the smart contract .
that’s my contract, a simple mint erc721 contract
pragma solidity ^0.8.0;

import “github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol”;
import “github.com/OpenZeppelin/openzeppelin-contracts/contracts/utils/Counters.sol”;

contract My_NFT is ERC721URIStorage {
using Counters for Counters.Counter;

Counters.Counter private _tokenIds;

constructor() ERC721("NFT", "Collections1") {}

function mintToken(string memory tokenURI)
    public
    returns (uint256)
{
    _tokenIds.increment();

    uint256 newItemId = _tokenIds.current();
    _mint(msg.sender, newItemId);
    _setTokenURI(newItemId, tokenURI);

    return newItemId;
}

}

I’m trying to run the boilerplate app on my Android phone and keep running into problems.

I run npx yarn start for the Metro bundler and yarn start after installing dependencies. The app loads on my phone but only partially it seems. The Moralis logo and animation behind it show and the green Login button shows. However, the eth.png background doesn’t want to load and after I successfully sign a message with my wallet (metamask/trust wallet) it won’t kick me back into the app and when I manually switch windows back it immediately crashes every time.

Console errors occur simultaneously with crash:

[Thu Jan 13 2022 17:42:37.841]  LOG      BALANCE {"balance": "0"}
[Thu Jan 13 2022 17:42:42.951]  WARN     Possible Unhandled Promise Rejection (id: 0):
Error: Unable to open url.
_callee2$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:329092:73
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25365:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25535:32
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25365:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25437:30
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25447:21
tryCallOne@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27452:16
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27553:27
_callTimer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30992:17
_callImmediatesPass@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:31031:17
callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:31248:33
__callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2688:35
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2474:34
__guard**@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2671:15
flushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2473:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]

I have now been trying to get RN + web3 setup for several days now and i’m hoping to get some help if anyone recognizes what my problem may be. Thanks!

1 Like

Try to replace eth.png with another logo of your choice …

I am facing the next issue to integrate wallectConnect’s “connector” object with Moralis authenticate function.
I understand that moralis authenticate function requires the certain format to be passed in and team has modified the walletConnect’s source code to make it suited. So, I replaced the default wallectconnect lib with the "./frontend/WalletConnect.
The I followed the sample code "./frontend/Components/CryptoAuth.js ( https://github.com/gen02-dev/ethereum-react-native-cli-boilerplate) passing the “connector” object into authenticate(). But it turns out the error

Non ethereum enabled browser

It will be appreciated if you could give me a hint that where did I miss out.
You could also have a look at my repo branch#5 (5.Moralis_WalletConnect) if you have time. The authenticate() call is in ./screens/main.tsx

Many thanks!

3 Likes

Does anybody find the clue about this issue?

1 Like

@happyeric77 I’ll take a look at this.

3 Likes

any updates? spent on this issue around 20 hours and I don’t want to live anymore :frowning:

@ya.ushel hey, what issue are you facing? :slight_smile:

hello) i am on this one Ethereum React Native Boilerplate Questions

1 Like

i am leaved comments in enableViaWalletConnect function (which overrides Moralis.enable function. And every time when it is called - there empty object instead of connector.

2 Likes

Thanks for the support. I am looking forward to the solution. I have spent two days but still cannot get the clue.

1 Like

@happyeric77 @ya.ushel I’m close to a solution, I’ll put it here in a bit :slight_smile:

3 Likes

@happyeric77 My bad, I forgot to fork your repo instead before I made some progress. Can you give me write permission to the repo? I’ll push a branch for the fixes. Thanks.

1 Like

Thank you so much, I have invited you as the collaborator for the repo.

1 Like

@happyeric77 Thanks! I created a brach named fix-walletconnect. When you checkout this branch, make sure to delete node_modules. Then run yarn install again and run the app with yarn ios. Below is the screenshot after I believe I fixed it:

1 Like

@gen Thanks so much! I just have a try and it works! AMAZING AGAIN!
I also briefly checked the diff but I could not really see what was the cause of that issue. I realized:

  1. The App is wrapped one more layer by MoralisDappProvider
  2. Some npm packages have been changed.

It will be appreciated if you do not mind letting me know what is the key taking effect to fix it.

1 Like

@happyeric77 What fixed it is downgrading moralis from "moralis": "0.0.183" to "moralis": "0.0.99". This of course is not ideal since we would like to use the latest moralis version as much as possible. This fix should be temporary until we find the best solution. I also refactored your code to limit some errors you might encounter in the future so you can focus on creating your dapp. :slight_smile:

1 Like

Has anyone been able to get ENS reverse lookup working?