ENS integration

Anybody know how to integrate ENS? I seem to have a library version conflict and I’m not quite sure how to resolve it. In ReactJS of course. This is the simplest example straight out of their docs and it doesn’t run. Something about the version of @ethersproject/abi I have installed? Can I slip Moralis in as a provider?


Hi @TheBubbleGuy

I tested it on empty react-moralis build and it worked without any problems.
Yes you can use web3 from useMoralis():

import ENSAddress from "@ensdomains/react-ens-address";
import { useMoralis } from "react-moralis";
import { useEffect } from "react";

function App() {
  const { web3, enableWeb3, isWeb3Enabled } = useMoralis();

  useEffect(() => {
    if (!isWeb3Enabled) {
      enableWeb3();
    }
  }, [isWeb3Enabled, enableWeb3]);
  return (
    <div className="App">
      {isWeb3Enabled && <ENSAddress provider={web3.givenProvider || web3.currentProvider} />}
      <p>Moralis Mages</p>
    </div>
  );
}

export default App;

image

FYI:

Failed to compile.
./node_modules/moralis/lib/browser/MoralisWeb3Api.js
Module not found: Can't resolve 'axios' in '/Users/orbiter/Documents/code/enstest/node_modules/moralis/lib/browser'

Then

./node_modules/moralis/lib/browser/MoralisWalletConnectProvider.js
Module not found: Can't resolve '@walletconnect/web3-provider' in '/Users/orbiter/Documents/code/enstest/node_modules/moralis/lib/browser'

Then in runtime:

…which is to say I forgot my

    <MoralisProvider appId={appId} serverUrl={serverUrl}>

And THEN it runs and I get
Screen Shot 2021-10-12 at 11.07.04 AM

Which is a long-winded way of asking if you might want to review the dependency list for yarn add react-moralis. I’m thinking at least add axios.

It was today un update to Moralis SDK that doesn’t work perfectly, we will fix that.

Cool. Now how do you get the resolved address back out of the <ENSAddress />? Anyway, I’ve documentation to read. Carry on. I’ll be back if it gets weird. :sunglasses:

Do you guys have anything to cure this mess yet? Or is that a separate topic.

those are only warnings, I guess that we are going to remove them at some point