The list of collections returned can be filtered by passing in parameters to this function.
Copy const getListCollections = async (keyword: string) => {
const response = await client.listCollections({
keyword,
});
return response.result;
};
getListCollections('NFT')
.then((result) => {
console.log(result);
})
.catch((e) => {
console.log(e);
});
Copy {
result: [
{
address: '0x61e506cec264d5b2705f10e5a934dc5313a56a6e', // Contract address of the collection
name: 'The ARK NFTs',
description: 'Find all the NFTs Created on the ARK Marketplace',
icon_url: 'https://cloudflare-ipfs.com/ipfs/bafkreiadl5kmdwy4tum4tgny4avxedlif33x2awux35c75j4exnz5s7xjm',
collection_image_url: '',
project_id: 92,
project_owner_address: '0x59bb6d1b896a9a139380bf2b8d828819f0cf1409',
metadata_api_url: 'https://api.thearknft.io/v1/nft',
created_at: '2022-09-28T12:01:20.479636Z',
updated_at: '2022-09-28T13:35:07.59868Z'
},
// Other collections returned
...
],
cursor: "eyJuYW1lIjoiSnVqdSBNaW50cyIsImFkZHJlc3MiOiIweDIzZGIwZTcyYmQ3NzM4ZGEwZDBhZmU3YmNjYjQxMDlmNWYwNWVkY2YiLCJwcm9qZWN0X2lkIjoyNCwiY3JlYXRlZF9hdCI6IjIwMjItMDktMjJUMjM6MTI6NTcuNjY0NDU2WiIsInVwZGF0ZWRfYXQiOiIyMDIyLTA5LTIyVDIzOjEyOjU3LjY2NDQ1NloifQ",
// Remaining results
remaining: 1
}
Copy val response = CollectionsApi().listCollections(
pageSize = 20,
orderBy = "name",
direction = "asc"
)
Copy let collections = try await CollectionsAPI.listCollections(
pageSize: 20,
orderBy: .name,
direction: "asc"
)
Copy const getCollection = async (address: string) => {
const response = await client.getCollection({
address,
});
return response;
};
getCollection('0x61e506cec264d5b2705f10e5a934dc5313a56a6e')
.then((result) => {
console.log(result);
})
.catch((e) => {
console.log(e);
});
Copy {
address: '0x61e506cec264d5b2705f10e5a934dc5313a56a6e', // Contract address of the collection
name: 'The ARK NFTs',
description: 'Find all the NFTs Created on the ARK Marketplace',
icon_url: 'https://cloudflare-ipfs.com/ipfs/bafkreiadl5kmdwy4tum4tgny4avxedlif33x2awux35c75j4exnz5s7xjm',
collection_image_url: '',
project_id: 92,
project_owner_address: '0x59bb6d1b896a9a139380bf2b8d828819f0cf1409',
metadata_api_url: 'https://api.thearknft.io/v1/nft',
created_at: '2022-09-28T12:01:20.479636Z',
updated_at: '2022-09-28T13:35:07.59868Z'
}