Historical

Reading transactions using Etherspot

Before we continue, please ensure that you have had a look at our Supported Ethereum Chains, followed the steps in Install Etherspot SDK and how to Bootstrap Etherspot SDK. We're assuming that you have completed these steps before going forward.

Getting started

The Etherspot SDK makes it really easy for you to send a transaction on any of our Supported Ethereum Chains. The method call is the same for each chain.

Fetching historical transactions

Fetching transactions using the Etherspot SDK is easy. Just call the getTransactions method against the Etherspot SDK instance to fetch all transactions on the account. This is the same method across all chains on the Etherspot SDK.

const transactions = await sdk.getTransactions();

console.log('Transactions:', transactions);

Try this out now on Etherspot Playground.

Fetching a single transaction

Along with fetching all transactions above, you can also simply fetch a single transaction by hash and the data associated with that transaction. This is the same method across all chains on the Etherspot SDK.

const singleTransaction = await sdk.getTransaction({
  hash: null, // Replace null with your transaction hash
});

console.log('Transaction:', singleTransaction);

Try this out now on Etherspot Playground.

🎉 Finished!

Last updated