Moralis Objects : Enable, Plugins, and InitPlugins, not defined?

Hey guys! I’ve added the 1inch plugin to my react app. I updated Moralis and React Moralis to latest versions and for some reason the I’m getting an error of property “Plugins” and “initPlugins” does not exist for Moralis. Any clues? I’ll include the code and screenshots below

function TokenPrices() {

    const { Moralis } = useMoralis();

    const [eViralPrice, setEViralPrice] = useState(0);
    const [beViralPrice, setBEViralPrice] = useState(0);
    const init = 0;

    const getEViralQuote = async() => {
        const quote = await Moralis.Plugins.oneInch.quote({
        chain: 'eth', // The blockchain you want to use (eth/bsc/polygon)
        fromTokenAddress: '0x7cec018ceef82339ee583fd95446334f2685d24f', // The token you want to swap
        toTokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f', // The token you want to receive
        amount: 1,
        });
        setEViralPrice(quote);
    }

    const getBEViralQuote = async() => {
        const quote = await Moralis.Plugins.oneInch.quote({
        chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
        fromTokenAddress: '0x7cec018ceef82339ee583fd95446334f2685d24f', // The token you want to swap
        toTokenAddress: '0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3', // The token you want to receive
        amount: 1,
        });
        setBEViralPrice(quote);
    }

    useEffect(() => {
        try{
            (async function(){
                Moralis.initPlugins();
            })();
            console.log("success");
        } catch (error) {
            alert(error)
        }
        }, [init])

Hi, if you make a request that works for Moralis SDK, what do you see in your server logs for the version of Moralis SDK that is making those requests?

Hi! Not sure where to find that in the logs, but on the server home page it shows my server is updated to 2.60
image

Is that what you were curious about?

I’m also trying to set up at custom wallet login with Fortmatic and I’m getting the issue that “.enable” is not a property of Moralis.
image

In those logs that you see there, if you run an sdk call for getNFTsForContract for example, do you see more info for that request?

image
Is this what you are looking for?

I don’t have any issues with Moralis.Cloud.run(), Moralis.User.current(), Moralis.Query()

I was trying to figure out if it is a build problem, by finding what version of Moralis SDK is running.

Anyway, my assumptions were wrong on how to get current version of Moralis SDK that is running.

Oh I posted a pic of my current Moralis SDK above. Here you go! This came from my package.json file image

@solalch

Plugins are not available currently from the react library. You can import “moralis” itself and use his Plugins functionality

1 Like

But Plugins support for the react will be added in the coming days.

Thanks YooMoo, I seem to be getting an issue still even when importing straight from Moralis instead of react-moralis where the enable and initPlugins properties are not found.image

You need to import it this way: import { Moralis } from "moralis"

Hi Yomoo, I used { Moralis } and still Moralis.enable and Moralis.initPlugins are not recognized?

What you get if you run Moralis.CoreManager.get("VERSION")? It should show you current Moralis SDK version that you have.
Do you get only a warning or an error on execution for Moralis.enable and Moralis.initPlugins?

I just ran the code and it’s the same version that was in my package.json, 0.0.45

image

After updating moralis today I’ve started experiencing other issues. When I call authenticate with wallet provider set to wallet connect, it no longer works. Metamask authenticate still works. It has been working for the last month and after updating npm moralis and npm react moralis today it stopped working. No errors in console, it’s like nothing happens?

image

Please share your repo, it’s difficult to debug screens.
I’ve tested yesterday importing import { Moralis } from "moralis" and .Plugins work with it correctly

Regarding walletconnect, make sure you have isntalled it npm install @walletconnect/web3-provider

Sure thing! The github repo is : https://github.com/solidity-alchemist/Eviral
The authentication calls are in the component Navbar.js

1 Like