Transfer / Accept collection ownership

📘

What you'll need:

Transferring collection ownership is done in two steps:

Step #1: Sending a transfer ownership request with the Enjin API

To send a transfer ownership request, we use the MutateCollection mutation:

mutation SendTransferOwnershipRequest {
  MutateCollection(
    collectionId: 36105 #Specify the collection ID
    mutation: {
      owner: "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" #Specify the new owner
    }
  ) {
    id
    method
    state
  }
}
curl -X POST "https://platform.enjin.io/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: enjin_api_key" \
-d '{"query": "mutation SendTransferOwnershipRequest { MutateCollection(collectionId: 36105, mutation: { owner: \"cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f\" }) { id method state } }"}'
Work in progress
Work in progress
fetch('https://platform.canary.enjin.io/graphql', {
  method: 'POST',
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'},
  body: JSON.stringify({
    query: `
      mutation SendTransferOwnershipRequest(
        $collection_id: BigInt!
        $new_owner: String
      ) {
        MutateCollection(
          collectionId: $collection_id
          mutation: {
            owner: $new_owner
          }
        ) {
          id
          method
          state
        }
      }
    `,
    variables: {
      collection_id: 36105, //Specify the collection ID
      new_owner: "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" //Specify the new owner
    }
  }),
})
.then(response => response.json())
.then(data => console.log(data));
const axios = require('axios');

axios.post('https://platform.canary.enjin.io/graphql', {
  query: `
    mutation SendTransferOwnershipRequest(
      $collection_id: BigInt!
      $new_owner: String
    ) {
      MutateCollection(
        collectionId: $collection_id
        mutation: {
          owner: $new_owner
        }
      ) {
        id
        method
        state
      }
    }
  `,
  variables: {
    collection_id: 36105, //Specify the collection ID
    new_owner: "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" //Specify the new owner
  }
}, {
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
import requests

query = '''
mutation SendTransferOwnershipRequest(
  $collection_id: BigInt!
  $new_owner: String
) {
  MutateCollection(
    collectionId: $collection_id
    mutation: {
      owner: $new_owner
    }
  ) {
    id
    method
    state
  }
}
'''

variables = {
  'collection_id': 36105, #Specify the collection ID
  'new_owner': 'cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f' #Specify the new owner

}

response = requests.post('https://platform.canary.enjin.io/graphql',
  json={'query': query, 'variables': variables},
  headers={'Content-Type': 'application/json', 'Authorization': 'Your_Platform_Token_Here'}
)
print(response.json())

Once the transaction is confirmed, the new owner needs to approve the ownership transfer request, for the collection ownership to be executed

Step #2: Accepting a transfer ownership request with the Enjin API

To accept a transfer ownership request, we call the AcceptCollectionTransfer mutation from the new collection owner account:

mutation AcceptTransferOwnershipRequest {
  AcceptCollectionTransfer(
    collectionId: 36105 #Specify the collection ID
  ) {
    id
    method
    state
  }
}
curl -X POST "https://platform.enjin.io/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: enjin_api_key" \
-d '{"query": "mutation AcceptTransferOwnershipRequest { AcceptCollectionTransfer(collectionId: 36105) { id method state } }"}'
Work in progress
Work in progress
fetch('https://platform.canary.enjin.io/graphql', {
  method: 'POST',
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'},
  body: JSON.stringify({
    query: `
      mutation AcceptTransferOwnershipRequest(
        $collection_id: BigInt!
      ) {
        AcceptCollectionTransfer(
          collectionId: $collection_id
        ) {
          id
          method
          state
        }
      }
    `,
    variables: {
      collection_id: 36105 //Specify the collection ID
    }
  }),
})
.then(response => response.json())
.then(data => console.log(data));
const axios = require('axios');

axios.post('https://platform.canary.enjin.io/graphql', {
  query: `
    mutation AcceptTransferOwnershipRequest(
      $collection_id: BigInt!
    ) {
      AcceptCollectionTransfer(
        collectionId: $collection_id
      ) {
        id
        method
        state
      }
    }
  `,
  variables: {
    collection_id: 36105 //Specify the collection ID
  }
}, {
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
import requests

query = '''
mutation AcceptTransferOwnershipRequest(
  $collection_id: BigInt!
) {
  AcceptCollectionTransfer(
    collectionId: $collection_id
  ) {
    id
    method
    state
  }
}
'''

variables = {
  'collection_id': 36105 #Specify the collection ID

}

response = requests.post('https://platform.canary.enjin.io/graphql',
  json={'query': query, 'variables': variables},
  headers={'Content-Type': 'application/json', 'Authorization': 'Your_Platform_Token_Here'}
)
print(response.json())

Once the transaction is confirmed, the collection ownership will be transferred to the new owner.