From 0badea4381ab64c3e0d7d724234fc99cb99059e1 Mon Sep 17 00:00:00 2001 From: mpw Date: Fri, 4 Aug 2023 13:50:56 -0300 Subject: [PATCH 1/4] syntax highlighting for codeblocks --- README.md | 2 +- docs/hub/Guides/creating-a-customer-wallet.md | 36 +++++--- docs/hub/Guides/hosting-locally.md | 88 ++++++++----------- docs/hub/Guides/transfer-out-of-hub-wallet.md | 23 ++--- 4 files changed, 75 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 76a7b9f..14e755c 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This command generates static content into the `build` directory and can be serv Retrieve the most recent version of the GraphQL schema and generate documentation pages for the "API Reference." -``` +```bash $ yarn run graphql-to-doc ``` diff --git a/docs/hub/Guides/creating-a-customer-wallet.md b/docs/hub/Guides/creating-a-customer-wallet.md index a227c24..cb00a2d 100644 --- a/docs/hub/Guides/creating-a-customer-wallet.md +++ b/docs/hub/Guides/creating-a-customer-wallet.md @@ -13,10 +13,11 @@ In this guide, we'll walk you through the process of creating a customer and a w - Hub API Playground: [https://api.holaplex.com](https://api.holaplex.com/). You could also use a GraphQL client such as [Apollo Client](https://www.apollographql.com/client/) or a tool like [GraphQL Playground](https://github.com/graphql/graphql-playground) For all API requests to Hub, you'll need to include an authentication header of the form -``` - { - "Authorization": "" - } + +```json +{ + "Authorization": "" +} ``` ## Step 1: Create a Customer @@ -24,6 +25,7 @@ For all API requests to Hub, you'll need to include an authentication header of The first step is creating a customer associated to a project in Hub. To do this, you need to send a `createCustomer` mutation with the required input parameters. #### Mutation + ```graphql mutation CreateCustomer($input: CreateCustomerInput!) { createCustomer(input: $input) { @@ -35,6 +37,7 @@ mutation CreateCustomer($input: CreateCustomerInput!) { ``` #### Variables + ```json { "input": { @@ -46,9 +49,11 @@ mutation CreateCustomer($input: CreateCustomerInput!) { The `project-id` can be found in Hub, by clicking the menu button next to the project name. #### Example Curl Request + ``` 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 CreateCustomer($input: CreateCustomerInput!) {\n createCustomer(input: $input) {\n customer {\n id\n }\n }\n}\n","variables":{"input":{"project":"PROJECT-ID"}}}' --compressed ``` + Replace `ACCESS-TOKEN` and `PROJECT-ID` ### Response @@ -70,6 +75,7 @@ Replace `ACCESS-TOKEN` and `PROJECT-ID` After creating a customer, the next step is to create a wallet for that customer using the `createCustomerWallet` mutation. Note that creating a wallet will use credits. #### Mutation + ```graphql mutation CreateCustomerWallet($input: CreateCustomerWalletInput!) { createCustomerWallet(input: $input) { @@ -81,6 +87,7 @@ mutation CreateCustomerWallet($input: CreateCustomerWalletInput!) { ``` #### Variables + ```json { "input": { @@ -89,12 +96,15 @@ mutation CreateCustomerWallet($input: CreateCustomerWalletInput!) { } } ``` + Check out the list of supported asset types on the [enums documentation](../../api/enums/asset-type.mdx). We currently support `"assetType": "SOL"`. #### Example Curl Request + ``` 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 CreateCustomerWallet($input: CreateCustomerWalletInput!) {\n createCustomerWallet(input: $input) {\n wallet {\n address\n }\n }\n}","variables":{"input":{"customer":"CUSTOMER-ID","assetType":"SOL"}}}' --compressed ``` + Replace `ACCESS-TOKEN` and `CUSTOMER-ID` ### Response @@ -112,15 +122,16 @@ Replace `ACCESS-TOKEN` and `CUSTOMER-ID` ``` After completing these two steps, you will have successfully created a wallet for the customer in Holaplex Hub. -The wallet address can be used for minting NFTs, trading, and other wallet-related operations. +The wallet address can be used for minting NFTs, trading, and other wallet-related operations. Customers and wallets can be viewed on the project page in 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 } @@ -128,8 +139,11 @@ Note to find a customer's wallet address, perform the following query, e.g.: } } ``` + CURL: -``` + +```sh 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` \ No newline at end of file + +Replace `ACCESS-TOKEN`, `PROJECT-ID`, and `CUSTOMER-ID` diff --git a/docs/hub/Guides/hosting-locally.md b/docs/hub/Guides/hosting-locally.md index 2380353..4aa7eb9 100644 --- a/docs/hub/Guides/hosting-locally.md +++ b/docs/hub/Guides/hosting-locally.md @@ -2,11 +2,9 @@ sidebar_position: 7 --- -Hosting Locally -=============== +# Hosting Locally -Overview -======== +# Overview In this guide, we are going to locally host this repository [](https://github.com/holaplex/eluvio-sxsw) and in the process, we'll learn how a complete application using Hub can be run locally, so that you can tinker around with the various parts and test how everything works. @@ -20,8 +18,7 @@ Before we get started, log into Hub and create a project and a few drops inside Let's begin. -Table of Contents ------------------ +## Table of Contents 1. Installation 2. Usage @@ -29,10 +26,7 @@ Table of Contents 4. Setting Up ngrok for Webhooks 5. Configuration - - -Setting Up Google SSO ---------------------- +## Setting Up Google SSO To set up Single Sign-On (SSO) with Google, follow these steps: @@ -45,8 +39,7 @@ To set up Single Sign-On (SSO) with Google, follow these steps: 7. Set the "Authorized redirect URIs" field to `http://localhost:3000/api/auth/callback/google`. 8. Click "Create" to generate your `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`. -Setting Up Ngrok for Webhooks ------------------------------ +## Setting Up Ngrok for Webhooks To test webhooks locally, you can use [ngrok](https://ngrok.com/) to expose your local server to the internet. @@ -61,8 +54,7 @@ To test webhooks locally, you can use [ngrok](https://ngrok.com/) to expose 3. Copy Forwarding URL provided by ngrok (e.g., `https://yoursubdomain.ngrok.io`or `yoursubdomain.ngrok-free.app`) -Creating Webhooks ------------------ +## Creating Webhooks 1. Log into Hub and navigate to the Webhooks section 2. Click on the "Add Webhook" button. @@ -72,40 +64,38 @@ Creating Webhooks 6. Choose the Events for the webhook namely, "Customer created", "Customer treasury created", "Customer wallet created", "Drop created" & "Drop minted". 7. The webhook secret key should be copied and pasted in your `.env` file. -Configuration ------------- +## Configuration Create a `.env` file at the root of the project and add the following environment variables: - ``` - NEXT_PUBLIC_FQDN=http://localhost:3000 - - # Set up SSO with Google - GOOGLE_CLIENT_ID=your_google_client_id - GOOGLE_CLIENT_SECRET=your_google_client_secret - - # Database - DATABASE_URL=postgres://postgres:holaplex@localhost:5432/hub-starter - POSTGRES_DB=hub-starter - POSTGRES_PASSWORD=holaplex - - # Holaplex - HOLAPLEX_API_ENDPOINT=your_holaplex_api_endpoint - HOLAPLEX_AUTH_TOKEN=your_holaplex_auth_token - HOLAPLEX_WEBHOOK_SECRET=your_holaplex_webhook_secret - HOLAPLEX_PROJECT_ID=your_holaplex_project_id - NEXT_PUBLIC_FQDN=http://localhost:3000 - ``` +```toml +NEXT_PUBLIC_FQDN=http://localhost:3000 + +# Set up SSO with Google +GOOGLE_CLIENT_ID=your_google_client_id +GOOGLE_CLIENT_SECRET=your_google_client_secret + +# Database +DATABASE_URL=postgres://postgres:holaplex@localhost:5432/hub-starter +POSTGRES_DB=hub-starter +POSTGRES_PASSWORD=holaplex + +# Holaplex +HOLAPLEX_API_ENDPOINT=your_holaplex_api_endpoint +HOLAPLEX_AUTH_TOKEN=your_holaplex_auth_token +HOLAPLEX_WEBHOOK_SECRET=your_holaplex_webhook_secret +HOLAPLEX_PROJECT_ID=your_holaplex_project_id +NEXT_PUBLIC_FQDN=http://localhost:3000 +``` Replace the placeholder values with your actual credentials and API keys. The `HOLAPLEX_AUTH_TOKEN` can be created in the Hub, in the Organization's "Credentials" section. -Your `HOLAPLEX_PROJECT_ID` refers to the numbers & letters you see in the url bar after /projects/. +Your `HOLAPLEX_PROJECT_ID` refers to the numbers & letters you see in the url bar after /projects/. In the same way, you can navigate to each of your drops by the copying the part of the url after the /drops/ section & and pasting it after localhost. Adding the drop id after the [localhost:3000/](http://localhost:3000/) url should bring you to the relevant drops page from where you'll be able to mint your NFT. -Installation ------------- +## Installation 1. **Ensure you have Node.js and Docker installed on your workstation.** @@ -114,51 +104,45 @@ Installation ```bash git clone cd eluvio-sxsw - ``` -4. **Start PostgreSQL in a Docker container:** +3. **Start PostgreSQL in a Docker container:** ```bash docker compose up -d - ``` -5. **Install dependencies:** +4. **Install dependencies:** ```bash npm install - ``` -6. **Set up the database:** +5. **Set up the database:** ```bash npm run reset - ``` -7. **Set up Prisma client:** +6. **Set up Prisma client:** ```bash npm run generate - ``` -Usage ------ +## Usage After completing the installation steps, you can run the application using the following command: ```bash npm run dev - ``` You can access the application at [](http://localhost:3000/). At any point if things don't work, reset the database, generate the client and try again: -``` + +```bash npm run reset npm run generate -``` \ No newline at end of file +``` diff --git a/docs/hub/Guides/transfer-out-of-hub-wallet.md b/docs/hub/Guides/transfer-out-of-hub-wallet.md index d590afa..46691ef 100644 --- a/docs/hub/Guides/transfer-out-of-hub-wallet.md +++ b/docs/hub/Guides/transfer-out-of-hub-wallet.md @@ -11,21 +11,23 @@ In this guide, we'll use Hub API to transfer a Hub-minted token out of a Hub wal - A token minted out of a drop within [Holaplex Hub](https://hub.holaplex.com/) or via Hub API - Access to the Holaplex Hub GraphQL API (an access token can be generated on Hub's "Credentials" page) - Hub API Playground: [https://api.holaplex.com](https://api.holaplex.com/). You could also use a GraphQL client such as [Apollo Client](https://www.apollographql.com/client/) or a tool like [GraphQL Playground](https://github.com/graphql/graphql-playground) -- +- For all API requests to Hub, you'll need to include an authentication header of the form -``` - { - "Authorization": "" - } + +```json +{ + "Authorization": "" +} ``` The first step is creating a customer associated to a project in Hub. To do this, you need to send a `createCustomer` mutation with the required input parameters. ## Mutation + ```graphql -mutation TransferAsset($input:TransferAssetInput!) { - transferAsset(input:$input) { +mutation TransferAsset($input: TransferAssetInput!) { + transferAsset(input: $input) { mint { id address @@ -35,11 +37,12 @@ mutation TransferAsset($input:TransferAssetInput!) { ``` ### Variables + ```json { "input": { "id": "", - "recipient":"" + "recipient": "" } } ``` @@ -52,11 +55,11 @@ mutation TransferAsset($input:TransferAssetInput!) { "transferAsset": { "mint": { "id": "", - "address": "", + "address": "" } } } } ``` -Note that the API only supports transfering an NFT out of a Hub wallet. If a transfer is requested from an external wallet (even if the token was minted by Hub), Hub will return an error. \ No newline at end of file +Note that the API only supports transfering an NFT out of a Hub wallet. If a transfer is requested from an external wallet (even if the token was minted by Hub), Hub will return an error. From 84ac5311f9ad47205af5d930063d1dfbdcc233d9 Mon Sep 17 00:00:00 2001 From: mpw Date: Fri, 4 Aug 2023 13:52:19 -0300 Subject: [PATCH 2/4] missing some --- docs/hub/Guides/creating-a-customer-wallet.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/hub/Guides/creating-a-customer-wallet.md b/docs/hub/Guides/creating-a-customer-wallet.md index cb00a2d..ab7d9e8 100644 --- a/docs/hub/Guides/creating-a-customer-wallet.md +++ b/docs/hub/Guides/creating-a-customer-wallet.md @@ -101,7 +101,7 @@ Check out the list of supported asset types on the [enums documentation](../../a #### Example Curl Request -``` +```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 CreateCustomerWallet($input: CreateCustomerWalletInput!) {\n createCustomerWallet(input: $input) {\n wallet {\n address\n }\n }\n}","variables":{"input":{"customer":"CUSTOMER-ID","assetType":"SOL"}}}' --compressed ``` @@ -142,7 +142,7 @@ Note to find a customer's wallet address, perform the following query, e.g.: CURL: -```sh +```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 ``` From e107f5ae8c5b47692d7e88f92b28081eec9d56f8 Mon Sep 17 00:00:00 2001 From: mpw Date: Fri, 4 Aug 2023 13:53:56 -0300 Subject: [PATCH 3/4] add bash pls --- docs/hub/Guides/creating-a-customer-wallet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/Guides/creating-a-customer-wallet.md b/docs/hub/Guides/creating-a-customer-wallet.md index ab7d9e8..19bdacf 100644 --- a/docs/hub/Guides/creating-a-customer-wallet.md +++ b/docs/hub/Guides/creating-a-customer-wallet.md @@ -50,7 +50,7 @@ The `project-id` can be found in Hub, by clicking the menu button next to the pr #### Example Curl Request -``` +```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 CreateCustomer($input: CreateCustomerInput!) {\n createCustomer(input: $input) {\n customer {\n id\n }\n }\n}\n","variables":{"input":{"project":"PROJECT-ID"}}}' --compressed ``` From af4b9867cf9d1662195a69798e7e17fc69ed8b42 Mon Sep 17 00:00:00 2001 From: mpw Date: Fri, 4 Aug 2023 13:56:02 -0300 Subject: [PATCH 4/4] toml mad --- docs/hub/Guides/hosting-locally.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/Guides/hosting-locally.md b/docs/hub/Guides/hosting-locally.md index 4aa7eb9..2c18d88 100644 --- a/docs/hub/Guides/hosting-locally.md +++ b/docs/hub/Guides/hosting-locally.md @@ -68,7 +68,7 @@ To test webhooks locally, you can use [ngrok](https://ngrok.com/) to expose Create a `.env` file at the root of the project and add the following environment variables: -```toml +```bash NEXT_PUBLIC_FQDN=http://localhost:3000 # Set up SSO with Google