Optional parameters in fetchERC20Balances

Hi team,

I studying hook useERC20Balances.
Looking at the code below, I do not seem to get the optional parameters from_block/to_block working. Am I correct in expecting an array of balances within the given blocks? I get the latest balance only.

Also when using from_date/to_date parameters I get the latest balance.

import { useERC20Balances } from "react-moralis";

const { fetchERC20Balances, data, isLoading, isFetching, error } = useERC20Balances();

const ERC20Balances = () => {
  return (
    <div>
      {error && <>{JSON.stringify(error)}</>}
      <button onClick={() => fetchERC20Balances({params: {from_block: 13948582, to_block: 13940582}})}>Refetch</button>
      <pre>{JSON.stringify(data, null, 2)}</pre>
    </div>
  );
};
1 Like

Hi @Elio

It allows to specify only the to_block param (docs). I just tested the hook with to_block - it works correctly