I am new to TronGrid.js and node.js. When I execute this file through cmd using node index.js it works fine... but, when I load the same file in an aspx file as script, it gives the following error:
Uncaught ReferenceError: require is not defined
Here is my index.js
const TRONGRID = require("trongrid");
const TRONWEB = require("tronweb");
const tronWeb = new TRONWEB({
fullHost: "https://api.shasta.trongrid.io/"
});
const tronGrid = new TRONGRID(tronWeb);
async function getTransactions() {
let options = {
onlyTo: true
};
var transactions = await tronGrid.account.getTransactions("TJqfBdPgRHbFpWz7epwq3LGzrxtNyzWTTQ", options);
console.log(transactions);
}
getTransactions();