Hi,
I am trying to fetch historical reserve using the Moralis Web3 API.
The following code works.
export const Web3Api = () => {
  useEffect(() => {
    const fetchData = async () => {
      await (Moralis as any).enableWeb3();
      const reserves = await Moralis.Web3API.defi.getPairReserves({
        pair_address:
          "0xd7538cABBf8605BdE1f4901B47B8D42c61DE0367".toLowerCase(),
        chain: "avalanche",
      });
      console.log(reserves);
    };
    fetchData();
  }, []);
  return <></>;
};
But if I were to add the to_block parameter in order to fetch historical figure, the API returns {code: 141, error: ‘No reserves data found for pair’} I am just wondering what am I doing wrong here. Thanks
export const Web3Api = () => {
  useEffect(() => {
    const fetchData = async () => {
      await (Moralis as any).enableWeb3();
      const reserves = await Moralis.Web3API.defi.getPairReserves({
        pair_address:
          "0xd7538cABBf8605BdE1f4901B47B8D42c61DE0367".toLowerCase(),
        chain: "avalanche",
        to_block: "7538642",
      });
      console.log(reserves);
    };
    fetchData();
  }, []);
  return <></>;
};