Transactions

Get transactions from any address

getTransactions

Get the transactions of the current user or address. Returns an array of transaction objects (asynchronous).

Options

  • chain(optional): The blockchain to get data from. Valid values listed above. Default value Eth.

  • address (optional): A user address (i.e. 0x1a2b3x...). If specified the user attached to the query is ignored and the address is used instead.

  • order (optional): sorts by block number. Use desc for descending (default) and asc for ascending

// get mainnet transactions for the current user
const userTrans = await Moralis.Web3.getTransactions();
​
// get BSC transactions for a given address
// with most recent transactions appearing first
const options = { chain: "bsc", address: "0x...", order: "desc" };
const transactions = await Moralis.Web3.getTransactions(options);

getTransactionsCount

Get the total transaction count for the current user or address. Returns a number (asynchronous).

Options

  • chain(optional): The blockchain to get data from. Valid values listed above. Default value Eth.

  • address (optional): A user address (i.e. 0x1a2b3x...). If specified the user attached to the query is ignored and the address is used instead.

const numTx = await Moralis.Web3.getTransactionsCount();

Can use the options in the same way as above for getTransactions.