Skip to content

Commit 8e2b2a3

Browse files
Feature/collection endpoints (#167)
* feat: add create hyperboard endpoint * feat: add delete hyperboard endpoint * feat: rename collection to hyperboard in graphql * feat: add update hyperboard endpoint * feat: return correct status code and data when updating hyperboard * fix: remove redundant create collection method * feat: add count to collections endpoint * feat: add count to collections endpoint * feat: use typed data with domain for create/update/delete hyperboard * feat: update hyperboard and collections for multiple chain ids and admins * feat: working version of hyperboard calculations in api * feat: add chain id to signed messages * fix: filter out null entries for allowlist entries * feat: add filter by admin id * feat: add chain id to delete endpoint * feat: add correct admin flows to create and update hyperboard endpoint * feat: add chain id to update user endpoint * feat: add caching support * fix: pr cleanup * fix: pr feedback * fix: pr feedback 2 * fix: pr feedback 2 * feat: add test for verifyAuthSignedData.ts * fix: pr feedback 3 * feat: use stored chain id for hyperboard to verify message when updating * feat: fix signatures * feat: pr feedback * chore: add some more tests * feat: fix tests, add error handling in verifyAuthSignedData.ts --------- Co-authored-by: bitbeckers <[email protected]>
1 parent e6730c1 commit 8e2b2a3

29 files changed

+4778
-457
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"commitlint": "commitlint --config commitlintrc.ts --edit"
2525
},
2626
"dependencies": {
27-
"@envelop/graphql-middleware": "^6.0.0",
2827
"@graphql-tools/merge": "^9.0.3",
2928
"@graphql-yoga/plugin-response-cache": "^3.5.0",
3029
"@hypercerts-org/marketplace-sdk": "0.3.36",

pnpm-lock.yaml

Lines changed: 104 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema.graphql

Lines changed: 113 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -252,40 +252,20 @@ input BooleanSearchOptions {
252252

253253
"""Collection of hypercerts for reference and display purposes"""
254254
type Collection {
255-
"""Address of the collection owner"""
256-
admin_id: String!
257-
258-
"""Background image of the collection"""
259-
background_image: String
255+
admins: [User!]!
260256

261257
"""Chain ID of the collection"""
262-
chain_id: EthBigInt
258+
chain_ids: [EthBigInt!]
263259

264-
"""Whether the collection should be rendered as a grayscale image"""
265-
grayscale_image: Boolean
260+
"""Creation timestamp of the collection"""
261+
created_at: String!
262+
263+
"""Description of the collection"""
264+
description: String!
266265
id: ID!
267266

268267
"""Name of the collection"""
269268
name: String!
270-
271-
"""Color of the borders of the hypercert collection"""
272-
tile_border_color: String
273-
}
274-
275-
input CollectionFetchInput {
276-
by: CollectionSortOptions
277-
}
278-
279-
input CollectionSortOptions {
280-
admin_id: SortOrder
281-
chainId: SortOrder
282-
name: SortOrder
283-
}
284-
285-
input CollectionWhereInput {
286-
admin_id: StringSearchOptions
287-
chain_id: BigIntSearchOptions
288-
id: IdSearchOptions
289269
}
290270

291271
"""Pointer to a contract deployed on a chain"""
@@ -404,11 +384,6 @@ type GetAttestationsSchemaResponse {
404384
data: [AttestationSchema!]
405385
}
406386

407-
type GetCollectionsResponse {
408-
count: Int
409-
data: [Collection!]
410-
}
411-
412387
"""Pointer to a contract deployed on a chain"""
413388
type GetContractsResponse {
414389
count: Int
@@ -421,6 +396,11 @@ type GetFractionsResponse {
421396
data: [Fraction!]
422397
}
423398

399+
type GetHyperboardsResponse {
400+
count: Int
401+
data: [Hyperboard!]
402+
}
403+
424404
"""
425405
Hypercert with metadata, contract, orders, sales and fraction information
426406
"""
@@ -456,6 +436,44 @@ type GetUsersResponse {
456436
data: [User!]
457437
}
458438

439+
"""Hyperboard of hypercerts for reference and display purposes"""
440+
type Hyperboard {
441+
admins: [User!]!
442+
443+
"""Background image of the hyperboard"""
444+
background_image: String
445+
446+
"""Chain ID of the hyperboard"""
447+
chain_ids: [EthBigInt!]
448+
449+
"""Whether the hyperboard should be rendered as a grayscale image"""
450+
grayscale_images: Boolean
451+
id: ID!
452+
453+
"""Name of the hyperboard"""
454+
name: String!
455+
sections: SectionResponseType!
456+
457+
"""Color of the borders of the hyperboard"""
458+
tile_border_color: String
459+
}
460+
461+
input HyperboardFetchInput {
462+
by: HyperboardSortOptions
463+
}
464+
465+
input HyperboardSortOptions {
466+
admin_id: SortOrder
467+
chainId: SortOrder
468+
name: SortOrder
469+
}
470+
471+
input HyperboardWhereInput {
472+
admin_id: StringSearchOptions
473+
chain_id: BigIntSearchOptions
474+
id: IdSearchOptions
475+
}
476+
459477
"""
460478
Hypercert with metadata, contract, orders, sales and fraction information
461479
"""
@@ -753,9 +771,9 @@ type Query {
753771
allowlistRecords(first: Int, offset: Int, sort: AllowlistRecordFetchInput, where: AllowlistRecordWhereInput): GetAllowlistRecordResponse!
754772
attestationSchemas(first: Int, offset: Int): GetAttestationsSchemaResponse!
755773
attestations(first: Int, offset: Int, sort: AttestationFetchInput, where: AttestationWhereInput): GetAttestationsResponse!
756-
collections(first: Int, offset: Int, sort: CollectionFetchInput, where: CollectionWhereInput): GetCollectionsResponse!
757774
contracts(first: Int, offset: Int, sort: ContractFetchInput, where: ContractWhereInput): GetContractsResponse!
758775
fractions(first: Int, offset: Int, sort: FractionFetchInput, where: FractionWhereInput): GetFractionsResponse!
776+
hyperboards(first: Int, offset: Int, sort: HyperboardFetchInput, where: HyperboardWhereInput): GetHyperboardsResponse!
759777
hypercerts(first: Int, offset: Int, sort: HypercertFetchInput, where: HypercertsWhereArgs): GetHypercertsResponse!
760778
metadata(first: Int, offset: Int, sort: MetadataFetchInput, where: MetadataWhereInput): GetMetadataResponse!
761779
orders(first: Int, offset: Int, sort: OrderFetchInput, where: OrderWhereInput): GetOrdersResponse!
@@ -833,6 +851,65 @@ input SaleWhereInput {
833851
transaction_hash: IdSearchOptions
834852
}
835853

854+
"""Section representing a collection within a hyperboard"""
855+
type Section {
856+
collection: Collection!
857+
entries: [SectionEntry!]!
858+
label: String!
859+
owners: [SectionOwner!]!
860+
}
861+
862+
"""Entry representing a hypercert or blueprint within a section"""
863+
type SectionEntry {
864+
display_size: Float!
865+
866+
"""ID of the hypercert or blueprint"""
867+
id: String!
868+
is_blueprint: Boolean!
869+
870+
"""Name of the hypercert or blueprint"""
871+
name: String
872+
owners: [SectionEntryOwner!]!
873+
percentage_of_section: Float!
874+
total_units: BigInt
875+
}
876+
877+
type SectionEntryOwner {
878+
"""The address of the user"""
879+
address: String!
880+
881+
"""The avatar of the user"""
882+
avatar: String
883+
884+
"""The chain ID of the user"""
885+
chain_id: EthBigInt
886+
887+
"""The display name of the user"""
888+
display_name: String
889+
percentage: Float!
890+
units: BigInt
891+
}
892+
893+
type SectionOwner {
894+
"""The address of the user"""
895+
address: String!
896+
897+
"""The avatar of the user"""
898+
avatar: String
899+
900+
"""The chain ID of the user"""
901+
chain_id: EthBigInt
902+
903+
"""The display name of the user"""
904+
display_name: String
905+
percentage_owned: Float!
906+
}
907+
908+
type SectionResponseType {
909+
count: Float!
910+
data: [Section!]!
911+
}
912+
836913
"""The direction to sort the query results"""
837914
enum SortOrder {
838915
"""Ascending order"""
@@ -865,6 +942,9 @@ type User {
865942
"""The avatar of the user"""
866943
avatar: String
867944

945+
"""The chain ID of the user"""
946+
chain_id: EthBigInt
947+
868948
"""The display name of the user"""
869949
display_name: String
870950
}

src/__generated__/routes/routes.ts

Lines changed: 134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)