Skip to content

Commit

Permalink
Merge pull request #54 from holaplex/mpw/more-colors
Browse files Browse the repository at this point in the history
add syntax highlight to code blocks
  • Loading branch information
mpwsh authored Aug 4, 2023
2 parents bf7bece + c23adcf commit 591f752
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 105 deletions.
183 changes: 96 additions & 87 deletions docs/hub/developers/mint-to-collection-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,113 +2,122 @@
sidebar_position: 7
---

Minting to a Collection via API
============
# Minting to a Collection via API

Hub's API can be used to create a verified collection on Solana and then mint a token into that collection, compressed or uncompressed.

## Step 1: Authenticate

All API calls need a header of the form
```
{ "Authorization": "Your_API_Token" }

```json
{ "Authorization": "Your_API_Token" }
```

To get an API token:

  a. Log into [Hub](https://hub.holaplex.com/)

  b. On your organization's page, open the "Credentials" tab
  a. Log into [Hub](https://hub.holaplex.com/)

  b. On your organization's page, open the "Credentials" tab

  c. Click "Generate token"
  c. Click "Generate token"

## Step 2: GraphQL mutation
## Step 2: GraphQL mutation

A sample `mintToCollection` mutation:
```
mutation MintToCollection($input: MintToCollectionInput!) {
mintToCollection(input: $input) {
collectionMint {
id
creationStatus
compressed
}
A sample `mintToCollection` mutation:

```graphql
mutation MintToCollection($input: MintToCollectionInput!) {
mintToCollection(input: $input) {
collectionMint {
id
creationStatus
compressed
}
}
```
Variables:
```
{
"input": {
"collection": "<COLLECTION_ID>",
"recipient": "<RECIPIENT_WALLET_ADDRESS>",
"compressed": false,
"creators":[
{
"address": "<CREATOR_WALLET_ADDRESS>",
"share": 100,
"verified": false
}
],
"metadataJson": {
"name": "Token name",
"symbol": "SYMBOL",
"description": "Token description",
"image": "<LINK_TO_IMAGE>",
"attributes": []
}
}
```

Variables:

```json
{
"input": {
"collection": "<COLLECTION_ID>",
"recipient": "<RECIPIENT_WALLET_ADDRESS>",
"compressed": false,
"creators": [
{
"address": "<CREATOR_WALLET_ADDRESS>",
"share": 100,
"verified": false
}
],
"metadataJson": {
"name": "Token name",
"symbol": "SYMBOL",
"description": "Token description",
"image": "<LINK_TO_IMAGE>",
"attributes": []
}
}
```
}
```

Note the `creator` field `verified` can only be set to `true` when the creator is the project treasury wallet. Otherwise, the `creator` input must have `"verified": false`.

Note the `creator` field `verified` can only be set to `true` when the creator is the project treasury wallet. Otherwise, the `creator` input must have `"verified": false`.
## Step 3: Check status of collection mint

## Step 3: Check status of collection mint

To view the status of a collection mint created by the steps above, use the collection's `id`:
```
query GetCollectionMintStatus($project: UUID!, $collection:UUID!) {
project(id: $project) {
To view the status of a collection mint created by the steps above, use the collection's `id`:

```graphql
query GetCollectionMintStatus($project: UUID!, $collection: UUID!) {
project(id: $project) {
id
name
collection(id: $collection) {
id
creationStatus
mints {
id
name
collection(id: $collection) {
id
creationStatus,
mints {
id,
creationStatus
}
}
}
creationStatus
}
}
```
Variables:
```
{
"project": "<PROJECT_ID>",
"collection": "<COLLECTION_ID>"
}
```

## Step 4: Retry a failed mint

To retry a mint from collection that has failed, use the `retryMintToCollection` mutation:
```
mutation RetryMintToCollection($input: RetryMintEditionInput!) {
retryMintToCollection(input: $input) {
collectionMint {
id
creationStatus
compressed
}
}
}
```
Variables:
```
{
"input": {
"id":"<MINT_ID>"
}
}
```

Variables:

```json
{
"project": "<PROJECT_ID>",
"collection": "<COLLECTION_ID>"
}
```

## Step 4: Retry a failed mint

To retry a mint from collection that has failed, use the `retryMintToCollection` mutation:

```graphql
mutation RetryMintToCollection($input: RetryMintEditionInput!) {
retryMintToCollection(input: $input) {
collectionMint {
id
creationStatus
compressed
}
```
}
}
```

Variables:

```json
{
"input": {
"id": "<MINT_ID>"
}
}
```
43 changes: 25 additions & 18 deletions docs/hub/developers/minting-drops.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,28 @@ mutation MintNft($input: MintDropInput!) {
## Step 1: Authenticate

All API calls need a header of the form
```
{ "Authorization": "Your_API_Token" }

```json
{ "Authorization": "Your_API_Token" }
```

To get an API token:

&nbsp; a. Log into [Hub](https://hub.holaplex.com/)

&nbsp; b. On your organization's page, open the "Credentials" tab
&nbsp; a. Log into [Hub](https://hub.holaplex.com/)

&nbsp; b. On your organization's page, open the "Credentials" tab

&nbsp; c. Click "Generate token"
&nbsp; c. Click "Generate token"

## Step 2: Create a customer and destination wallet

Each Hub token is minted *to* a specific customer and *into* a customer's wallet. Thus, the first step to mint a token is to create a customer and associated wallet where that token will be sent.
Each Hub token is minted _to_ a specific customer and _into_ a customer's wallet. Thus, the first step to mint a token is to create a customer and associated wallet where that token will be sent.

If you've already created a customer and customer wallet, skip to step N.

### Create a customer

Customers are assigned to a
Customers are assigned to a

## Minting a Drop

Expand Down Expand Up @@ -84,9 +85,9 @@ Example:
mutation {
mintEdition(
input: {
{
drop: "drop-id",
recipient: "wallet-address"
{
drop: "drop-id",
recipient: "wallet-address"
}
}
) {
Expand All @@ -97,10 +98,13 @@ mutation {
}
}
```

CURL:
```

```bash
curl 'https://api.holaplex.com/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: file://' -H 'Authorization: ACCESS-TOKEN' --data-binary '{"query":"mutation MintNft($input: MintDropInput!) {\n mintEdition(input: $input) {\n collectionMint {\n address\n owner\n }\n }\n}\n","variables":{"input":{"drop":"DROP-ID","recipient":"RECIPIENT-WALLET-ADDRESS"}}}' --compressed
```

Replace `ACCESS-TOKEN`, `DROP-ID`, and `RECIPIENT-WALLET-ADDRESS`

### Example Response
Expand All @@ -124,27 +128,30 @@ Replace `ACCESS-TOKEN`, `DROP-ID`, and `RECIPIENT-WALLET-ADDRESS`
- `recipient`: The wallet address where the minted drop should be sent. This should be the address of the wallet created on the Holaplex Hub.

Note to find a customer's wallet address, perform the following query, e.g.:
```

```graphql
{
project(id:"a56e7745-37a2-40b7-9d25-d5c20b6fc137") {
name
customer(id:"33dedde4-543d-4653-bc10-db0a38e719cc") {
project(id: "a56e7745-37a2-40b7-9d25-d5c20b6fc137") {
name
customer(id: "33dedde4-543d-4653-bc10-db0a38e719cc") {
wallet {
address
}
}
}
}
```

CURL:
```

```bash
curl 'https://api.holaplex.com/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: file://' -H 'Authorization: ACCESS-TOKEN' --data-binary '{"query":"{\n project(id:\"PROJECT-ID\") {\n\t\tname\n customer(id:\"CUSTOMER-ID\") {\n wallet {\n address\n }\n }\n }\n}"}' --compressed
```

Replace `ACCESS-TOKEN`, `PROJECT-ID`, and `CUSTOMER-ID`

After successfully minting the drop, you will receive a response containing the collection address and the owner wallet address. The collection address can be used to manage and query the drop on the Holaplex Hub platform.

## Next Steps

After minting a drop, you can perform additional actions, such as querying the drop, etc. Check out the API docs to figure out what is possible!

0 comments on commit 591f752

Please sign in to comment.