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])