Errors token price function

Hi, everyone. I was trying to create a function that shows every second the current price of one token, which address is given by a parameter. The function works and shows the price in the console, but I have constantly this two errors:

- moralis.js:29036 POST 400

- script.js:391 Uncaught (in promise) {code: 141, error: 'required param address not provided'}

What do these errors mean? What could I do to fix them?


 async function getPrice(tA) {
    var options = { address: "", chain: "bsc" }
    options.address = tA
    setInterval(async function gtp(options) {
        const price = await Moralis.Web3API.token.getTokenPrice(options);
    }, 1000)

you could add some logging to see what you have in options there, maybe you donโ€™t have an address there

This is an example of the code that I use to call the function for a specific token in the balance of the user. Shouldnโ€™t it provide to the function the address of the token being considered?

const options = { chain: 'bsc' }
var balance = await Moralis.Web3.getAllERC20(options);


you should use getTokenBalances:

and you have to filter from the output what token are you interested in