Skip to main content

Collections

GraphQL Endpoint

https://platform.beta.enjin.io/graphql

All collection-level actions are submitted through CreateTransaction, with the action selected by the field set on the transaction input. Each section below shows the discriminator and its expected fields.

The response shape is always a Transaction — the examples below all return the standard { uuid, action, state } selection. Once a transaction reaches FINALIZED, the on-chain event(s) it emitted can be read via the flow described in Working with Events.

createCollection

Creates a new on-chain collection. Most fields are optional — the example below shows everything; a minimal call is just transaction: { createCollection: {} }.

The new collection's id is assigned by the chain — once the transaction finalizes, a MultiTokens.CollectionCreated event is emitted containing it.

mutation CreateCollection {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
createCollection: {
forceCollapsingSupply: false
maxTokenCount: 1000
maxTokenSupply: 100
royalties: [
{ address: "efRoyaltyBeneficiary", percentage: 5.0 }
]
attributes: [
{ key: "name", value: "The Multiverse" }
{ key: "uri", value: "https://example.com/metadata/collection.json" }
]
explicitRoyaltyCurrencies: [
{ collectionId: 0, tokenId: 0 }
]
}
}
) {
uuid
action
state
}
}

mutateCollection

Updates a collection's mutable fields — owner, royalties, royalty-currency whitelist, and attributes.

Setting owner initiates an ownership transfer: the collection enters a pending state until the new owner calls acceptCollectionTransfer (or the current owner calls cancelCollectionTransfer to abort).

mutation MutateCollection {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
mutateCollection: {
collectionId: 10943
royalties: [
{ address: "efNewBeneficiaryAddress", percentage: 7.5 }
]
attributes: [
{ key: "description", value: "Updated description" }
]
}
}
) {
uuid
action
state
}
}

acceptCollectionTransfer

Called by the recipient of a pending collection transfer (set up via mutateCollection.owner) to complete the transfer.

mutation AcceptCollectionTransfer {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
acceptCollectionTransfer: { id: 10943 }
}
) {
uuid
action
state
}
}

cancelCollectionTransfer

Called by the current owner before a pending collection transfer is accepted, to abort it.

mutation CancelCollectionTransfer {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
cancelCollectionTransfer: { id: 10943 }
}
) {
uuid
action
state
}
}

destroyCollection

Permanently destroys a collection. The collection must be empty (no tokens) and the deposit is returned to the owner.

mutation DestroyCollection {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
destroyCollection: { id: 10942 }
}
) {
uuid
action
state
}
}

freezeCollection / thawCollection

Freeze or thaw an entire collection — while frozen, no tokens in the collection can be transferred, listed, or otherwise mutated.

mutation FreezeCollection {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
freezeCollection: { collectionId: 10943 }
}
) {
uuid
action
state
}
}

To freeze or thaw an individual token within a collection, use freezeToken / thawToken — see Tokens Mutations.

setCollectionAttribute

Set or update a single key/value attribute on a collection.

mutation SetCollectionAttribute {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
setCollectionAttribute: {
collectionId: 4741
key: "test"
value: "Hello"
}
}
) {
uuid
action
state
}
}

batchSetCollectionAttribute

Set multiple attributes on a collection in a single transaction. The collection id field is named id here (not collectionId).

mutation BatchSetCollectionAttribute {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
batchSetCollectionAttribute: {
id: 4741
attributes: [
{ key: "name", value: "My Collection" }
{ key: "description", value: "A great collection" }
{ key: "uri", value: "https://example.com/metadata/collection.json" }
]
}
}
) {
uuid
action
state
}
}

removeCollectionAttribute

Remove a single attribute from a collection.

mutation RemoveCollectionAttribute {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
removeCollectionAttribute: {
id: 4741
key: "name"
}
}
) {
uuid
action
state
}
}

removeAllCollectionAttributes

Remove every attribute from a collection in one transaction.

mutation RemoveAllCollectionAttributes {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
removeAllCollectionAttributes: { id: 4741 }
}
) {
uuid
action
state
}
}