-1

Here is the code for Fetching ethereum listings but I cannot see what am I missing here, I added the script under the Footer where and endpoints are given properly as I see, please do correct me where I'm not doing good.

<footer>
  <!-- Your existing footer content here -->
</footer>



<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script


<script>
// API endpoint to fetch liquidity pool data (replace with the actual API URL)
const apiEndpoint = 'https://lb.drpc.org/ogrpc?network=ethereum&dkey=Aplih23rc0AduW9QMaOBjgzw7p7fNIkR7ribDs9_4c5n/graphql';
// Function to fetch new contracts with locked liquidity and store in database
async function fetchAndDisplayNewTokenListings() {
    try {
        const query = `
            {
                newTokenListings {
                    id
                    name
                    symbol
                    lockedLiquidity
                    // Add other relevant fields you need
                }
            }
        `;

        const response = await axios.post(apiEndpoint, { query });
        const newTokenListings = response.data.data.newTokenListings;

        const contractList = document.getElementById('contractList');
        contractList.innerHTML = ''; // Clear existing data

        newTokenListings.forEach(token => {
            const listItem = document.createElement('li');
            listItem.textContent = `Name: ${token.name}, Symbol: ${token.symbol}, Locked Liquidity: ${token.lockedLiquidity}`;
            contractList.appendChild(listItem);
        });
    } catch (error) {
        console.error('Error fetching and displaying token data:', error);
    }
}

// Call the fetchAndDisplayNewTokenListings function initially and set the interval
fetchAndDisplayNewTokenListings(); // Call initially
setInterval(fetchAndDisplayNewTokenListings, 1800000); // Call every 30 minutes

As I have put src axios in it and given the endpoint with the data it need to show me but it is not showing it as expected, I see bank page in the web site other than my styling.

TylerH
  • 20,799
  • 66
  • 75
  • 101

0 Answers0