API Authentication

You can read more about API authentication here: Authenticating with the Tenderly API.

<aside> ℹ️ The rest of this document assumes you have authenticated with one of the two previously mentioned methods.

</aside>

To start off you'll need to get your account_id and project_slug. To do so, simply navigate to the dashboard and look at the address bar:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f4ee8cac-36a4-4da7-abff-9c4685a75dc7/Untitled.png

1. Creating an environment

After you have that, you need to create an environment where the states will be stored. You can do that by calling the following endpoint:

Link: https://api.tenderly.co/api/v1/account/{{account_id}}/project/{{project_slug}}/fork

Request type: POST

Payload:

{
    "network_id": "1",
		"block_number": 15107216,
    "transaction_index": 1,
		"initial_balance": 10000
}

Payload explanation

Response:

fork-response.json

In the response we notice 2 main entities:

  1. simulation_fork From this you will need to store the id field.
  2. root_transaction This will not be relevant to the Metamast use case.

2. Connecting to Metamask