Fundamental data endpoint allows retrieving such data as Events and Calls. These endpoints are particularly powerful, for they allow us to track arbitrary smart contract activity and interactions.

Events

Events endpoint provides events:

  • with the specified Origin address, or with any Origin address, if not specified
  • on a specified Contract, or on any Contract, if not specified
  • within a specified block/time range or across all history, if not specified
  • of a specified event type (Topic 0) or of all types if not specified
  • with specified arguments (Topics 1-3) or with any arguments, if not specified

Now, let's dive into the examples of how this endpoint might be used.

Get all events on a specified contract

This request will pull every event that ever happened on our PRQ token Smart Contract on ETH Mainnet. Make sure to replace YOUR_API_KEY with your actual API key.

curl --request GET \
--url 'https://api.parsiq.net/tsunami/eip155-1/v1/events?block_number_start=0&block_number_end=latest&contract=0x362bc847A3a9637d3af6624EeC853618a43ed7D2&limit=1000' \
--header 'Authorization: Bearer YOUR_API_KEY'

Get all Uniswap pairs

Let us say we need the list of all Uniswap V2 pools/pairs. We will need to specify Topic 0 to see events of the specified type and the address of the Uniswap V2 Factory contract. We will need to specify the block range, too. In this example it is from 1 to latest.

This request will pull every PairCreated event (i.e. where Topic 0 is 0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9) on the Uniswap V2 Factory contract. Make sure to replace YOUR_API_KEY with your actual API key.

curl --request GET \
     --url 'https://api.parsiq.net/tsunami/eip155-1/v1/events?block_number_start=1&block_number_end=latest&limit=100&contract=0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f&topic_0=0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer YOUR_API_KEY'

Get all Aave Borrows by a specified address

Let us say we need to see all the times when a specified address borrowed anything at Aave. We will need to specify Topic 0 to see events of the specified type and the address of the borrower. We will need to specify the block range, too. In this example it is from 1 to latest.

This request will pull every Borrow event (i.e. where Topic 0 is 0xc6a898309e823ee50bac64e45ca8adba6690e99e7841c45d754e2a38e9019d9b) on any contract triggered by the specified address (Origin). Make sure to replace YOUR_API_KEY with your actual API key.

curl --request GET \
     --url 'https://api.parsiq.net/tsunami/eip155-1/v1/events?origin=0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f&block_number_start=1&block_number_end=latest&limit=100&topic_0=0xc6a898309e823ee50bac64e45ca8adba6690e99e7841c45d754e2a38e9019d9b' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer YOUR_API_KEY'

Calls

Calls endpoint provides function calls:

  • with the specified Origin address, or with any Origin address, if not specified
  • with the specified Sender (msg.sender) address, or with any Sender address, if not specified
  • with the specified Signature hash of the function we are looking for, or with any, if not specified
  • on a specified Contract, or on any Contract, if not specified
  • within a specified block/time range or across all history, if not specified
  • also, we can specify, whether or not to include Events in the response

Now, let's dive into the examples of how this endpoint might be used.

How to get signature hash of the function

It might be tricky to get the signature hash of the function, since Etherscan does not provide it. To get it, let us use this very endpoint and filter the results not by signature hash (which we don't have yet), but by the addresses of the contract and of the origin.

We will need to find a transaction that we know is the call of the needed function and we will see the signature hash in the Tsunami response. We will need to specify the block range, too. In this example it is from 1 to latest.

This request will pull every function call on the specified contract triggered by the specified address (Origin). Make sure to replace YOUR_API_KEY with your actual API key.

curl --request GET \
     --url 'https://api.parsiq.net/tsunami/eip155-1/v1/calls?origin=0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860&block_number_start=1&block_number_end=latest&limit=100&contract=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer Ujlp157DtncttvfTfWV0JNmt2jMHkJJP'

Find the transaction with the right tx_hash and see the sig_hash in the response:

{
  "range": {
    "has_more": false,
    "start_block": 1,
    "end_block": 16541428,
    "next_offset": null
  },
  "items": [
    {
      "id": "0000000000fc660e-0018-00000000",
      "sender": "0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860",
      "sig_hash": "0x095ea7b3",
      "tx_hash": "0x71f0866502848f379b4b35d24f3588df5c14b669506dfb7ce2eb7121d36fb66c",
      "block_hash": "0x5f301020023d0f1a4b63eaf656f2071e9561b6d5ed68758858f99d4aaeaaff12",
      "block_number": 16541198,
      "timestamp": 1675341887,
      "origin": "0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860",
      "contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "input_data": "0x095ea7b3000000000000000000000000c92e8bdf79f0507f65a392b0ab4667716bfe0110ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
    }
  ]
}

Get all approve() calls by a specified address

Let us say we want to see all the times when a specified address approved any token for spending. We will need to specify the address of interest and the function signature hash to see all calls of approve() function. We will need to specify the block range, too. In this example it is from 1 to latest.

This request will pull every approve() function call (i.e. where function signature hash is 0x095ea7b3) on any contract called by the specified address (Origin). Make sure to replace YOUR_API_KEY with your actual API key.

curl --request GET \
     --url 'https://api.parsiq.net/tsunami/eip155-1/v1/calls?origin=0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860&sig_hash=0x095ea7b3&block_number_start=1&block_number_end=latest&limit=100' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer YOUR_API_KEY'

Get all swaps on a specified Uniswap pool

Let us say we want to see all the swaps on a specified Uniswap pool. We will need to specify the address of the pool and the function signature hash to see all calls of swap() function. We will need to specify the block range, too. In this example it is from 1 to latest.

This request will pull every swap() function call (i.e. where function signature hash is 0x022c0d9f) on the specified contract. Make sure to replace YOUR_API_KEY with your actual API key.

curl --request GET \
     --url 'https://api.parsiq.net/tsunami/eip155-1/v1/calls?sig_hash=0x022c0d9f&block_number_start=1&block_number_end=latest&limit=100&contract=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer YOUR_API_KEY'