Fetch activities
Users, items, collections or global marketplace activities
By user
You would have to use the activity query with the below parameters :
User address hex address,
The target filter set to artist,
The activity types to get with the types array filters (all available on collection target),
The optional period on which to fetch the activities: days_filter
The optional pagination parameter
Graphql Example
Request
query UserActivity($userAddress: Address!) {
activity(
input: {
user_address: $userAddress
target: artist
types: all
days_filter: yearly
}
pagination: { page: 1, size: 3 }
) {
hasMore
activities {
type
quantity
price
transaction_hash
nft {
asset_id
}
}
}
}
Example Parameters
{ "userAddress": "0x26acae237d5b2ab062faf58508cf638547b7233a" }
With CURL
curl -X POST -H 'content-type: application/json' \
-d '{"query":"query UserActivity($userAddress: Address!) {\n activity(input: {\n types: all\n target: artist\n days_filter: yearly\n user_address: $userAddress\n } pagination: {\n page: 1\n size: 3\n }) {\n hasMore\n activities {\n type\n quantity\n price\n transaction_hash\n nft {\n asset_id\n }\n }\n }\n }","variables":{"userAddress":"0x26acae237d5b2ab062faf58508cf638547b7233a"},"operationName":"UserActivity"}' \
https://public-api.dev.kalao.io/query
Response
{
"data":{
"activity":{
"hasMore":true,
"activities":[
{
"type":"transfer",
"quantity":"-",
"price":0,
"transaction_hash":"0xe4af8f69689ac2bb14a964977514022cb2c6b3c3b995684f29c0ed6b294b7e1a",
"nft":{
"asset_id":"0x327c8f7006cd85c9e858bdc03870a3e8a2901363_280"
}
},
{
"type":"listing",
"quantity":"-",
"price":3.938580299,
"transaction_hash":"",
"nft":{
"asset_id":"0x327c8f7006cd85c9e858bdc03870a3e8a2901363_280"
}
},
{
"type":"sale",
"quantity":"-","price":3.199690632,
"transaction_hash":"0x4d92ac80b1c611b7d958124fc3101abe705de43e3c421ebc16bb1a2384d84d75",
"nft":{
"asset_id":"0x327c8f7006cd85c9e858bdc03870a3e8a2901363_280"
}
}
]
}
}
}
By collection
You would have to use the activity query with the below parameters :
Collection contract hex address.
The desired activities to show with the target filter: collection
The activity types to get with the types array filters
The optional pagination parameter
Graphql Example
Request
query CollectionActivity($contractAddress: Address!) {
activity(
input: {
types: all
target: collection
days_filter: yearly
collection_address: $contractAddress
}
pagination: { page: 1, size: 3 }
) {
hasMore
activities {
type
quantity
price
transaction_hash
nft {
asset_id
}
}
}
}
Example Parameters
{ "contractAddress": "0x3caf681231bd99df1d2247f41f8e5f02e750fc5e" }
With CURL
curl -X POST -H 'content-type: application/json' \
-d '{"query":"query CollectionActivity($contractAddress: Address!) {\n activity(input: {\n types: all\n target: collection\n days_filter: yearly\n collection_address: $contractAddress\n } pagination: {\n page: 1\n size: 3\n }) {\n hasMore\n activities {\n type\n quantity\n price\n transaction_hash\n nft {\n asset_id\n }\n }\n }\n }","variables":{"contractAddress":"0x3caf681231bd99df1d2247f41f8e5f02e750fc5e"},"operationName":"CollectionActivity"}' \
https://public-api.dev.kalao.io/query
Response
{
"data": {
"activity": {
"hasMore": true,
"activities": [
{
"type": "offer",
"quantity": "-",
"price": 0.8,
"transaction_hash": "",
"nft": {
"asset_id": "0x3caf681231bd99df1d2247f41f8e5f02e750fc5e_1"
}
},
{
"type": "sale",
"quantity": "-",
"price": 0.5,
"transaction_hash": "0x2b8d8882b2c9ac46b4bdbd4d2c1c1dcdabe5c2446628da41f15f04bc7de65275",
"nft": {
"asset_id": "0x3caf681231bd99df1d2247f41f8e5f02e750fc5e_1"
}
},
{
"type": "collection_offer",
"quantity": "1",
"price": 0.6,
"transaction_hash": "",
"nft": {
"asset_id": ""
}
}
]
}
}
}
By NFT
You would have to use the activity query with the below parameters :
The asset id of the NFT,
The target filter is nft
The activity types to get with the types array filters (mint, transfer and sale are available on nft target)
The optional pagination parameter
Graphql Example
Request
query NftActivity($assetId: String!) {
activity(
input: {
types: all
target: nft
asset_id: $assetId
}
pagination: { page: 1, size: 3 }
) {
hasMore
activities {
type
quantity
price
transaction_hash
}
}
}
Example Parameters
{ "assetId": "0xfb150c658091bd6079d1942dd4dd5373a58ff3e4_28" }
With CURL
curl -X POST -H 'content-type: application/json' \
-d '{"query":"query NftActivity($assetId: String!) {\n activity(input: {\n types: all\n target: nft\n asset_id: $assetId\n } pagination: {\n page: 1\n size: 3\n }) {\n hasMore\n activities {\n type\n quantity\n price\n transaction_hash\n }\n }\n }","variables":{"assetId":"0xfb150c658091bd6079d1942dd4dd5373a58ff3e4_28"},"operationName":"NftActivity"}' \
https://public-api.dev.kalao.io/query
Response
{
"data":{
"activity":{
"hasMore":false,
"activities":[
{
"type":"transfer",
"quantity":"-",
"price":0,
"transaction_hash":"0x3ea1d7d67164f38d02af53715dc8391d64e1eba041a5a9a0986622773f62bf47",
},
{
"type":"mint",
"quantity":"-",
"price":0,
"transaction_hash":"0x1574d7afdb74e7a4e675b19c60004aba4db490d1d47a7b58cfd910f9b7d756b9"
}
]
}
}
}
On Kalao Marketplace
You would have to use the activity query with the below parameters :
The activity target will be set to global
The activity types to get with the types array filters (all available)
The optional pagination parameter
Graphql Example
Request
query GlobalActivity() {
activity(
input: {
types: all
target: global
}
pagination: { page: 1, size: 3 }
) {
hasMore
activities {
type
quantity
price
transaction_hash
timestamp
nft{
name
thumbnail
asset_id
token_id
}
collection{
name
avatar
address
}
}
}
}
Example Parameters
None
With CURL
curl -X POST -H 'content-type: application/json' \
-d '{"query":"query GlobalActivity() {\n activity(input: {\n types: all\n target: global\n } pagination: {\n page: 1\n size: 2\n }) {\n hasMore\n activities {\n type\n quantity\n price\n transaction_hash\n timestamp\n nft {\n name\n thumbnail\n asset_id\n token_id\n }\n collection {\n name\n avatar\n address\n }\n }\n }\n }","operationName":"GlobalActivity"}' \
https://public-api.dev.kalao.io/query
Response
{
"data":{
"activity":{
"hasMore":true,
"activities":[
{
"type":"listing",
"quantity":"-",
"price":2,
"transaction_hash":"",
"timestamp":1667468455,
"nft":{
"name":"The Great War #59",
"thumbnail":"https://storage.googleapis.com/beta-kalao/nfts/0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def/79/thumbnail",
"asset_id":"0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def_59",
"token_id":"59"
},
"collection":{
"name":"The Great War",
"avatar":"https://storage.googleapis.com/beta-kalao/nfts/0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def/85/thumbnail",
"address":"0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def"
}
},
{
"type":"listing",
"quantity":"-",
"price":2,
"transaction_hash":"",
"timestamp":1667468348,
"nft":{
"name":"The Great War #92",
"thumbnail":"https://storage.googleapis.com/beta-kalao/nfts/0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def/79/thumbnail",
"asset_id":"0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def_92",
"token_id":"92"
},
"collection":{
"name":"The Great War",
"avatar":"https://storage.googleapis.com/beta-kalao/nfts/0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def/85/thumbnail",
"address":"0xd7e51b2cc213c44d005a9d8bb2dd44f75ce95def"
}
}
]
}
}
}