Get activities data
Activities are enriched blockchain events which Immutable provides to developers through the Get Activity and List Activities functions.
Activity types
Currently, the following activityTypes
are supported with Immutable's SDK functions:
Activity Type | Description |
---|---|
mint | An activity of type mint means an NFT has been created and recorded onto a blockchain as a unique and indivisible digital asset, representing digital art, music, videos, or other creative works. |
burn | An activity of type burn identifies an NFT that has been intentionally and permanently destroyed, usually by sending it to an unspendable address (0x0000000000000000000000000000000000000000 ). |
transfer | An activity of type transfer means an NFT has been sent from one person's digital wallet address to another person's digital wallet address, resulting in a change of ownership on the blockchain. |
sale | An activity of type sale means an NFT has been exchanged for a certain amount of cryptocurrency or fiat currency between a buyer and a seller on an online marketplace. |
deposit | An activity of type deposit means an ERC20 token has been deposited from Ethereum |
withdrawal | An activity of type withdrawal means an ERC20 token has been withdrawn to Ethereum |
Request parameters
Parameter | Description | Required |
---|---|---|
chainName | String representing the name of the chain; only imtbl-zkevm-testnet is currently supported | Yes |
contractAddress | The contract address of ERC721 contract you want to filter by | No |
activityType | Filter by activity | No |
Pagination parameters | Parameters such as page_size and page_cursor that allow you to control the size and order of the data retrieved | No |
Usage
The ListActivities function returns a list of activities associated with a chain, collection or individual NFT. Specify the activityType
that you wish to filter the activities returned by. Leaving this blank will return all activities. You can get a list of activities or details about a single activity with the following:
- SDK
- API
listActivities.tsView on GitHub
import { blockchainData } from "@imtbl/sdk";
import { client } from "../lib";
export async function listActivities(
chainName: string,
contractAddress: string,
pageSize: number
): Promise<blockchainData.Types.ListActivitiesResult> {
return await client.listActivities({
chainName,
contractAddress,
pageSize,
});
}
📚API reference
GET /chains/{chainName}/activities
Example response
{
"result": [
{
"id": "4e28df8d-f65c-4c11-ba04-6a9dd47b179b",
"chain": {
"id": "eip155:13473",
"name": "imtbl-zkevm-testnet"
},
"type": "mint",
"details": {
"to": "0xe9b00a87700f660e46b6f5deaa1232836bcc07d3",
"amount": "1",
"asset": {
"contract_type": "ERC721",
"contract_address": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"token_id": "1"
}
},
"indexed_at": "2022-08-16T17:43:26.991388Z",
"blockchain_metadata": {
"transaction_hash": "0x68d9eac5e3b3c3580404989a4030c948a78e1b07b2b5ea5688d8c38a6c61c93e",
"block_number": "1",
"transaction_index": "1",
"log_index": "1"
}
}
]
}
info
- Date parameters such as
fromIndexedAt
andtoIndexedAt
should be formated asISO8601 UTC Date
. :::