useOneInchSwap is not Work

Hello community. I have a problem using react-moralis, I am doing a token swap, but I have the following error:

I have the plugin installed, and I’m also using react 17

My code


import { useOneInchSwap } from "react-moralis";

 const { swap, data, isFetching, isLoading, error } = useOneInchSwap();
 const onSubmit = (d) => {
      const{amount, quantity} = d;
      const options = {
    chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
    fromTokenAddress: '0x0da6ed8b13214ff28e9ca979dd37439e8a88f6c4', // The token you want to swap
    toTokenAddress: '0x6fd7c98458a943f469e1cf4ea85b173f5cd342f4', // The token you want to receive
    amount: 1000,
    fromAddress: '0x6217e65d864d77DEcbFF0CFeFA13A93f7C1dD064', // Your wallet address
    slippage: 1,
  }
    console.log(d);
  };

I need urgent help

1 Like

wheres the line where yu calling the swap function

I call the swap function below, but it still doesn’t work.

const onSubmit = (d) => {
      const{amount, quantity} = d;
      const options = {
    chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
    fromTokenAddress: '0x0da6ed8b13214ff28e9ca979dd37439e8a88f6c4', // The token you want to swap
    toTokenAddress: '0x6fd7c98458a943f469e1cf4ea85b173f5cd342f4', // The token you want to receive
    amount: 1000,
    fromAddress: '0x6217e65d864d77DEcbFF0CFeFA13A93f7C1dD064', // Your wallet address
    slippage: 1,
  }
    await swap(options)
  };