4

How to obtain list of transactions/activity on metamask ? I'm building an app that interact with metamask, I want to access all of the transactions that is written on metamask from the connected address, but I couldn't find how to do it on metamask documentation. Is it possible to do that ?

1 Answers1

1

MetaMask doesn't provide accounts' transaction history. The only viable option is to fetch recent transactions through Etherscan API. If you use Ethers.js, you can use the getHistory method:

let etherscanProvider = new ethers.providers.EtherscanProvider();

etherscanProvider.getHistory(address).then((history) => { history.forEach((tx) => { console.log(tx); }) });


Or with ethers v6:

const etherScan = new ethers.EtherscanProvider(network);

/** @type {import('ethers').Transaction[]} */ const history = await etherScan.fetch('account', { address: walletAddress, action: 'txlist', });

Sid Vishnoi
  • 103
  • 3
Deniz
  • 264
  • 1
  • 10