How to make chart of historical transactions

Hi, I am wondering if it is possible to make a table/chart and paste in there all the historical transactions that have been made by the user loged in.
Any helpful links, videos, etc. are welcome.

https://docs.moralis.io/moralis-server/web3-sdk/account#gettransactions

many thanks, thats what I need

Hi, I am having some problems when trying getHistoricalNFTTransfers.

image

This is my code:

async function getHistoricalTransfers() {

const options = { 
  chain: "ganache", 
  address: "0x5C912Bd3D06c60Cdd7EBe11b14C0A22caeE43E77", 
  from_block: "1111",
  to_block: "2222"
};

const transfersNFT = await Moralis.Web3API.account.getHistoricalNFTTransfers(options);
console.log(transfersNFT);
}
getHistoricalTransfers();

I don’t understand why the error. Besides, could you explain what is the from_block and to_block ?

Many Thanks

1 Like

I am also facing the same issue. Will get back to you regarding this.

Hi,
Not all Moralis.Web3API functions work with local ganache. You can advance to testnet to get access to all that functionality.
from_block and to_block are parameters that will specify to look only on that block interval for the information, in a blockchain the transactions are grouped in blocks and every 3 seconds a new block is created on Binance Smart Chain network for example.

Hey guys! I’m getting the same results result trying to console log transaction with my logged in wallet. Moralis and server are up to date. Kept code as simple as possible. Web3API confirmed in console as a plugin. Any clues?

import React, {useEffect, useState} from 'react';
import { Moralis } from 'moralis';

function Wallet() {
    const getTransactions = async() => {
        let transactions = await Moralis.Web3API.account.getTransactions();
        console.log(transactions);
    }

    return (
        <div>
            <button onClick={getTransactions}>History</button>
        </div>
    )
}

export default Wallet;

@solach, it could be something related to your server, try to use https://admin.moralis.io/web3Api for a query first and then try again (in case that your masterKey is not generated).

It says I can use an optional chain. Thank for the explanation

Hi @solalch I did this with get transactions and worked. Hope it is helpful.

async function getTransactions(){

const options = { chain: "ganache", address: "0x5C912Bd3D06c60Cdd7EBe11b14C0A22caeE43E77", order: "desc", from_block: "0" };
const transactions = await Moralis.Web3API.account.getTransactions(options);
console.log(transactions)
}

getTransactions();

Oh, interesting. I didn’t try to run the web3api in my admin panel previously. I just did and now the function call worked from my app! Thanks Cryptokid

1 Like