Transactions polygon

When requested data from other chains like Polygon BSC the data comes empty,

export const getTransactionHistory = async (address, chain) => {
  const options = {
    chain: "matic",
    order: "desc",
  let transactions = await Moralis.Web3.getTransactions(options);

  transactions = => {
    if (transaction.value !== "0" && transaction.gas_price) {
      transaction.value = web3.utils.fromWei(transaction.value);
      transaction.gas_price = web3.utils.fromWei(String(transaction.gas_price));
      transaction.chain = chain;

    return transaction;

  transactions = transactions.filter((block) => block.value !== "0");

  return transactions;
1 Like

Can you give example of an address that doesnt work?


1 Like

Hey @renanlopescoder

getTransactions() is used for getting blockchain native cryptocurrency transfers. And your addres doesn’t have them.

Currently for getting Token transfers you can use Deep Index API
Take a look at Deep index API docs

You can easily try Deep index API functionality from the dashboard UI:

There you will also find CURL settings:

This is an example of using Deep Index API:

const address = "0x1d7eF8e3Dbe5E1288163Ece217E5F04a85394b90";
    method: "GET",
    headers: {
      accept: "application/json",
      "X-API-Key": "your_api_key",
).then((response) => {
  //do something with the response 

We are working on adding more functions to SDK. Adding the function for getting token transfers in SDK is our immediate goal. But right now you need to use the HTTP API.

Let me know if you will have any questions :man_factory_worker:


I did it differently, I basically fetch the data from the database and load the contract to get symbol and name,

 * @name getTokenTransactionHistory
 * @description Return transaction history
 * @param {string} chain defines the chain to fetch the transaction history "Eth" "bsc" "matic"
 * @returns {Array}
export const getTokenTransactionHistory = async (address, chain) => {
  let chainToQuery;
  switch (chain) {
    case "matic":
      chainToQuery = "PolygonTokenTransfers";
    case "Eth":
      chainToQuery = "EthTokenTransfers";

      chainToQuery = "EthTokenTransfers";

  const queryFrom = new Moralis.Query(chainToQuery);

  queryFrom.equalTo("from_address", address);

  const queryTo = new Moralis.Query(chainToQuery);

  queryTo.equalTo("to_address", address);

  const mainQuery = Moralis.Query.or(queryFrom, queryTo);
  const results = await mainQuery.find();

  const web3 = getWeb3Chain(chain);

  const promises = (block) => {
    const contract = new web3.eth.Contract(ABI, block.attributes.token_address);

    block.value = web3.utils.fromWei(block.attributes.value);

    const [symbol, name] = await Promise.all([

    block.symbol = symbol; = name;

    return block;

  const blocks = await Promise.all(promises);

  return blocks;