[solved] How to use the code for Binance smart chain?

No, just use that constant for all that EVM chain syntax

i modify the code:

const express = require(“express”);

const Moralis = require(“moralis”).default;

const app = express();

const cors = require(“cors”);

require(“dotenv”).config();

const port = 3001;

const chain = EvmChain.BSC;

app.use(cors());

app.use(express.json());

app.get("/tokenPrice", async (req, res) => {

const {query} = req;

const responseOne = await Moralis.EvmChain.BSC.token.getTokenPrice({

chain,

address: query.addressOne

})

const responseTwo = await Moralis.EvmChain.BSC.token.getTokenPrice({

chain,

address: query.addressTwo

})

console.log(responseOne.raw);

console.log(responseTwo.raw);

return res.status(200).json({});

});

Moralis.start({

apiKey: process.env.MORALIS_KEY,

}).then(() => {

app.listen(port, () => {

console.log(`Listening for API Calls`);

});

});

you can read here about how to post code on forum:

replace this with
const chain = “0x38”;

Thank you very much that fix the error.

1 Like