Error in making a price chart


<script src="[email protected]/dist/web3.min.js"></script>

<script src="[email protected]/dist/moralis.js"></script>

<script src=""></script>

<script src="[email protected]/moment.min.js"></script>




    Moralis.start({ serverUrl: "", appId: "pYoxD4y9gigKtUDjWGl829pMmXPJpxbXVLyRRXLA"});

<button id="btn-login">Moralis Login</button>

<button id="btn-logout">Moralis Logout</button>

<input type="radio" name="time" id="week" value=7 checked>7</input>

<input type="radio" name="time" id="2week" value=14 >14</input>

<input type="radio" name="time" id="4week" value=30 >30</input>

<select id="list"></select>


    <canvas id="myChart"></canvas>





    let toks = [];


    async function launch(){


        let response = await fetch("")

        let names = await response.json()

        toks = names.tokens;

        toks.forEach((e,i) =>

        document.getElementById("list").add(new Option(e.symbol, i))






    async function priceHistory() {


        let days = document.querySelector('input[name="time"]:checked').value;

        let i = document.getElementById("list").value

        let addrs = toks[i].address

        let sym = toks[i].symbol


        let dates = ["2021-09-30","2021-10-01","2021-10-02"];

        let blocks = [13321721,13331721,13341721];

        let prices = [4,6,3];


        let dates1 = Array(Number(days)).fill().map((e,i) =>

        moment().substract(i, "d").format("YYYY-MM-DD")


        let blocks1 = await Promise.all(,i) =>

        await Moralis.Web3API.native.getDateToBlock({date:e})


        let prices1 = await Promise.all(,i) =>

        await Moralis.Web3API.token.getTokenPrice({address: addrs, to_block:e.block})



        prices1 = => e.usdPrice)


        const data = {

            labels: dates1,

            datasets: [{

                label: sym,

                backgroundColor: 'rgb(255, 99, 132',

                borderColor: 'rgb(255, 99, 132',




        const config = {

            type: 'line',

            data: data,

            options: {}



        if(window.myChart instanceof Chart){




        window.myChart = new Chart(







Can someone help look into this html code?.
I am trying to build a price chart from uniswap but the chart wouldn’t come up. Maybe it is moment.js idk

Have you based this on a tutorial somewhere? Do you get any errors in your console?

The issue seemed to come from here. You can consider looking into this.
You can also hit Rate Limit too

yeah, moralis price chart.

okay, i will. Thanks bud