Collections
https://platform.beta.enjin.io/graphql
Collection is the parent resource for a set of related tokens. A collection carries its mint, market, and transfer policies, its on-chain attributes, and any token groups defined within it. Individual tokens within a collection are read separately via GetTokens.
GetCollection
Returns a single collection by id.
- GraphQL
- Response
query GetCollection {
GetCollection(network: ENJIN, chain: MATRIX, id: 2967) {
id
owner {
address
}
attributes {
key
value
}
metadata {
name
description
}
mintPolicy {
forceCollapsingSupply
maxTokenCount
maxTokenSupply
}
marketPolicy {
beneficiaries {
accountId
percentage
}
}
transferPolicy {
isFrozen
}
pendingTransfer {
address
}
tokenGroups {
id
metadata {
name
}
}
}
}
{
"data": {
"GetCollection": {
"id": "2967",
"owner": {
"address": "efPvNL3eGKd82cwQ9SeV1fyuiwDMM5wkrW5EoAPF42kvDJgG1"
},
"attributes": [],
"metadata": {
"name": "The Multiverse",
"description": "Use these items in 10+ games. Find out more at enjin.io/multiverse"
},
"mintPolicy": {
"forceCollapsingSupply": false,
"maxTokenCount": null,
"maxTokenSupply": null
},
"marketPolicy": {
"beneficiaries": []
},
"transferPolicy": {
"isFrozen": false
},
"pendingTransfer": null,
"tokenGroups": [
{ "id": "694", "metadata": { "name": "Epochrome Sword" } },
{ "id": "695", "metadata": { "name": "Pegasoid Steed" } },
{ "id": "700", "metadata": { "name": "Soulshift Armor" } }
]
}
}
}
pendingTransfer is non-null while a transfer is in progress — see GetPendingCollectionTransfers.
GetCollections
Returns a flat list of collections. Pass ids to fetch specific collections, or address to fetch collections owned by an address (or both to intersect).
- GraphQL
- Response
query GetCollections {
GetCollections(
network: ENJIN
chain: MATRIX
ids: [2967, 7153]
) {
id
owner {
address
}
metadata {
name
}
mintPolicy {
forceCollapsingSupply
maxTokenCount
}
}
}
{
"data": {
"GetCollections": [
{
"id": "2967",
"owner": { "address": "efPvNL3eGKd82cwQ9SeV1fyuiwDMM5wkrW5EoAPF42kvDJgG1" },
"metadata": { "name": "The Multiverse" },
"mintPolicy": { "forceCollapsingSupply": false, "maxTokenCount": null }
},
{
"id": "7153",
"owner": { "address": "cxLnsZcpE1xETr7TQrMCCsRYpSfpHPUpJUFAfiZdZvU6Ccy4B" },
"metadata": { "name": "Test Collection" },
"mintPolicy": { "forceCollapsingSupply": false, "maxTokenCount": 100 }
}
]
}
}
GetPendingCollectionTransfers
Returns collections that have a pending ownership transfer — the owner field on mutateCollection was set to a new address, but the recipient hasn't called acceptCollectionTransfer yet (and the current owner hasn't called cancelCollectionTransfer).
You can filter by ids (specific collections) or address (collections being transferred to this address).
- GraphQL
- Response
query GetPendingCollectionTransfers {
GetPendingCollectionTransfers(
network: ENJIN
chain: MATRIX
address: "efRecipientWalletAddress"
) {
id
owner {
address
}
pendingTransfer {
address
}
metadata {
name
}
}
}
{
"data": {
"GetPendingCollectionTransfers": [
{
"id": "12345",
"owner": { "address": "efOriginalOwnerAddress" },
"pendingTransfer": { "address": "efRecipientWalletAddress" },
"metadata": { "name": "Hand-off Collection" }
}
]
}
}
See the Transfer a Collection guide for the full transfer / accept / cancel flow.