Insight API Supports Block Queries

Insight API Supports Block Queries

Insight API added support for querying block data.

Try it out on our playground

Or use it directly from code

const getBlock = async (blockNumber: number) => {
  try {
    const response = await fetch(
      `https://1.insight.thirdweb.com/v1/blocks?filter_block_number=${blockNumber}&limit=1`,
      {
        headers: {
          "x-client-id": <your-client-id>,
        },
      },
    );
    const blockResponse = await response.json();
    return blockResponse.data[0];
  } catch (error) {
    console.error("Error:", error);
  }
};

πŸ“– Learn more about Insight - it’s open source and ready to power your applications!