Skip to content

Commit

Permalink
Merge pull request #24 from holaplex/anshul/multi-wallet-support
Browse files Browse the repository at this point in the history
Multi wallet support
  • Loading branch information
kespinola authored Jul 25, 2023
2 parents 83fbb97 + 51e8f7b commit 08934f6
Show file tree
Hide file tree
Showing 24 changed files with 868 additions and 288 deletions.
13 changes: 12 additions & 1 deletion @types/graphql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ declare module '*/customer.graphql' {
const defaultDocument: DocumentNode;
export const CreateCustomer: DocumentNode;
export const CreateCustomerWallet: DocumentNode;
export const GetCustomerWallet: DocumentNode;
export const GetCustomerWallets: DocumentNode;
export const GetCustomerTreasury: DocumentNode;
export const GetCustomerCollections: DocumentNode;
export const GetCustomerWallet: DocumentNode;

export default defaultDocument;
}
Expand Down Expand Up @@ -41,6 +42,15 @@ declare module '*/transfer.graphql' {
}


declare module '*/collectible.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const GetCollectibleHistory: DocumentNode;

export default defaultDocument;
}


declare module '*/collections.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
Expand All @@ -63,6 +73,7 @@ declare module '*/project.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const GetProjectDrop: DocumentNode;
export const GetProjectDropPurchases: DocumentNode;

export default defaultDocument;
}
Expand Down
151 changes: 126 additions & 25 deletions holaplex.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ type BlockchainCost {
credits: Int!
}

type Collectible {
mintHistory: [Purchase]
}

type Collection {
"""
The blockchain address of the collection used to view it in blockchain explorers.
Expand All @@ -97,13 +101,21 @@ type Collection {
"""The blockchain of the collection."""
blockchain: Blockchain!

"""The date and time in UTC when the collection was created."""
createdAt: DateTime!

"""The user id of the person who created the collection."""
createdById: UUID!

"""
The creation status of the collection. When the collection is in a `CREATED` status you can mint NFTs from the collection.
"""
creationStatus: CreationStatus!

"""The list of attributed creators for the collection."""
creators: [CollectionCreator!]
creditsDeductionId: UUID
drop: Drop

"""The list of current holders of NFTs from the collection."""
holders: [Holder!]
Expand All @@ -122,6 +134,7 @@ type Collection {
The list of minted NFTs from the collection including the NFTs address and current owner's wallet address.
"""
mints: [CollectionMint!]
projectId: UUID!

"""
A list of all NFT purchases from the collection, including both primary and secondary sales.
Expand Down Expand Up @@ -152,22 +165,6 @@ type CollectionCreator {
verified: Boolean!
}

"""An attributed creator for a colleciton."""
input CollectionCreatorInput {
"""The wallet address of the creator."""
address: String!

"""The share of royalties payout the creator should receive."""
share: Int!

"""
This field indicates whether the collection's creator has been verified. This feature is only supported on the Solana blockchain.
## References
[Metaplex Token Metadata - Verify creator instruction](https://docs.metaplex.com/programs/token-metadata/instructions#verify-a-creator)
"""
verified: Boolean
}

"""Represents a single NFT minted from a collection."""
type CollectionMint {
"""
Expand All @@ -183,6 +180,11 @@ type CollectionMint {
"""The ID of the collection the NFT was minted from."""
collectionId: UUID!

"""
Indicates if the NFT is compressed. Compression is only supported on Solana.
"""
compressed: Boolean!

"""The date and time when the NFT was created."""
createdAt: DateTime!

Expand Down Expand Up @@ -217,6 +219,17 @@ type CollectionMint {
signature: String
}

input CreateCollectionInput {
blockchain: Blockchain!
creators: [CreatorInput!]!
metadataJson: MetadataJsonInput!
project: UUID!
}

type CreateCollectionPayload {
collection: Collection!
}

"""
This struct represents the input for creating a new API credential, including the ID of the organization that the credential will be associated with and the friendly name assigned to the credential.
"""
Expand Down Expand Up @@ -277,7 +290,7 @@ type CreateCustomerWalletPayload {

input CreateDropInput {
blockchain: Blockchain!
creators: [CollectionCreatorInput!]!
creators: [CreatorInput!]!
endTime: DateTime
metadataJson: MetadataJsonInput!
price: Int
Expand Down Expand Up @@ -342,6 +355,22 @@ enum CreationStatus {
REJECTED
}

"""An attributed creator for a collection or mint."""
input CreatorInput {
"""The wallet address of the creator."""
address: String!

"""The share of royalties payout the creator should receive."""
share: Int!

"""
This field indicates whether the creator has been verified. This feature is only supported on the Solana blockchain.
## References
[Metaplex Token Metadata - Verify creator instruction](https://docs.metaplex.com/programs/token-metadata/instructions#verify-a-creator)
"""
verified: Boolean
}

"""
An `OAuth2` client application used for authentication with the Hub API.
"""
Expand Down Expand Up @@ -707,6 +736,13 @@ enum InviteStatus {
"""A scalar that can represent any JSON value."""
scalar JSON

type Me {
email: String
image: String
name: String
wallets: [Wallet]
}

"""
A member of a Holaplex organization, representing an individual who has been granted access to the organization.
"""
Expand Down Expand Up @@ -847,6 +883,19 @@ type MintEditionPayload {
collectionMint: CollectionMint!
}

input MintToCollectionInput {
collection: UUID!
compressed: Boolean!
creators: [CreatorInput!]!
metadataJson: MetadataJsonInput!
recipient: String!
sellerFeeBasisPoints: Int
}

type MintToCollectionPayload {
collectionMint: CollectionMint!
}

type Mutation {
"""
Accept an invite to the organization.
Expand All @@ -855,6 +904,13 @@ type Mutation {
"""
acceptInvite(input: AcceptInviteInput!): AcceptInvitePayload!

"""
This mutation creates a new NFT drop and its associated collection. The drop returns immediately with a creation status of CREATING. You can [set up a webhook](https://docs.holaplex.dev/hub/For%20Developers/webhooks-overview) to receive a notification when the drop is ready to be minted.
Error
If the drop cannot be saved to the database or fails to be emitted for submission to the desired blockchain, the mutation will result in an error.
"""
createCollection(input: CreateCollectionInput!): CreateCollectionPayload!

"""
Create an API credential to authenticate and authorize API requests to the Holaplex Hub.
"""
Expand Down Expand Up @@ -953,6 +1009,14 @@ type Mutation {
If the mint cannot be saved to the database or fails to be emitted for submission to the desired blockchain, the mutation will result in an error.
"""
mintEdition(input: MintDropInput!): MintEditionPayload!
mintToCollection(input: MintToCollectionInput!): MintToCollectionPayload!

"""
This mutation allows updating a drop and it's associated collection by ID.
It returns an error if it fails to reach the database, emit update events or assemble the on-chain transaction.
Returns the `PatchDropPayload` object on success.
"""
patchCollection(input: PatchCollectionInput!): PatchCollectionPayload!

"""
This mutation allows updating a drop and it's associated collection by ID.
Expand All @@ -979,6 +1043,17 @@ type Mutation {
"""
resumeDrop(input: ResumeDropInput!): ResumeDropPayload!

"""
This mutation retries an existing drop.
The drop returns immediately with a creation status of CREATING.
You can [set up a webhook](https://docs.holaplex.dev/hub/For%20Developers/webhooks-overview) to receive a notification when the drop is ready to be minted.
Errors
The mutation will fail if the drop and its related collection cannot be located,
if the transaction response cannot be built,
or if the transaction event cannot be emitted.
"""
retryCollection(input: RetryCollectionInput!): CreateCollectionPayload!

"""
This mutation retries an existing drop.
The drop returns immediately with a creation status of CREATING.
Expand All @@ -995,7 +1070,8 @@ type Mutation {
# Errors
If the mint cannot be saved to the database or fails to be emitted for submission to the desired blockchain, the mutation will result in an error.
"""
retryMint(input: RetryMintInput!): RetryMintPayload!
retryMintEdition(input: RetryMintEditionInput!): RetryMintEditionPayload!
retryMintToCollection(input: RetryMintEditionInput!): RetryMintEditionPayload!

"""
Shuts down a drop by writing the current UTC timestamp to the shutdown_at field of drop record.
Expand Down Expand Up @@ -1199,10 +1275,28 @@ type Owner {
userId: UUID!
}

"""Input object for patching a drop and associated collection by ID"""
input PatchCollectionInput {
"""The creators of the drop"""
creators: [CreatorInput!]

"""The unique identifier of the drop"""
id: UUID!

"""The new metadata JSON for the drop"""
metadataJson: MetadataJsonInput
}

"""Represents the result of a successful patch drop mutation."""
type PatchCollectionPayload {
"""The drop that has been patched."""
collection: Collection!
}

"""Input object for patching a drop and associated collection by ID"""
input PatchDropInput {
"""The creators of the drop"""
creators: [CollectionCreatorInput!]
creators: [CreatorInput!]

"""The new end time for the drop in UTC"""
endTime: DateTime
Expand Down Expand Up @@ -1244,6 +1338,11 @@ type PauseDropPayload {
A Holaplex project that belongs to an organization. Projects are used to group unique NFT campaigns or initiatives, and are used to assign objects that end customers will interact with, such as drops and wallets.
"""
type Project {
collection(id: UUID!): Collection

"""The collections associated with the project."""
collections: [Collection!]

"""The datetime, in UTC, when the project was created."""
createdAt: DateTime!

Expand Down Expand Up @@ -1316,6 +1415,7 @@ type Purchase {
}

type Query {
collectible: Collectible
collections: [CollectionMint]

"""
Expand All @@ -1342,7 +1442,7 @@ type Query {

"""Retrieve a member invitation by its ID."""
invite(id: UUID!): Invite
me: User
me: Me

"""
Query an organization by its ID, this query returns `null` if the organization does not exist.
Expand Down Expand Up @@ -1373,19 +1473,23 @@ type ResumeDropPayload {
drop: Drop!
}

input RetryCollectionInput {
id: UUID!
}

input RetryDropInput {
drop: UUID!
}

"""
Represents input data for `retry_mint` mutation with an ID as a field of type UUID
"""
input RetryMintInput {
input RetryMintEditionInput {
id: UUID!
}

"""Represents payload data for `retry_mint` mutation"""
type RetryMintPayload {
type RetryMintEditionPayload {
collectionMint: CollectionMint!
}

Expand Down Expand Up @@ -1462,18 +1566,15 @@ type User {

"""The unique identifier for the user identity."""
id: UUID!
image: String

"""The last name of the user identity."""
lastName: String!
name: String

"""The profile image associated with the user identity."""
profileImage: String

"""The timestamp in UTC when the user identity was last updated."""
updatedAt: String!
wallet: Wallet
}

"""
Expand Down
11 changes: 11 additions & 0 deletions prisma/migrations/20230721091723_drop_wallet/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- You are about to drop the `Wallet` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Wallet" DROP CONSTRAINT "Wallet_holaplexCustomerId_fkey";

-- DropTable
DROP TABLE "Wallet";
7 changes: 0 additions & 7 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,8 @@ model User {
holaplexCustomerId String? @unique @db.Uuid
accounts Account[]
sessions Session[]
wallets Wallet[]
}

model Wallet {
id String @id @default(cuid())
holaplexCustomerId String @db.Uuid
user User @relation(fields: [holaplexCustomerId], references: [holaplexCustomerId], onDelete: Cascade)
address String
}

model VerificationToken {
identifier String
Expand Down
3 changes: 2 additions & 1 deletion render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ services:
sync: false
- key: NEXTAUTH_SECRET
generateValue: true
- key: HOLAPLEX_WALLET_ASSET_TYPE
- key: HOLAPLEX_WALLET_ASSET_TYPES
value: SOL
sync: false
- key: HOLAPLEX_API_ENDPOINT
value: https://api.holaplex.com/graphql
- key: DATABASE_URL
Expand Down
Loading

0 comments on commit 08934f6

Please sign in to comment.