Skip to content

Commit dc47e1c

Browse files
committed
fix(docs): update README and development documentation for v2 endpoints
- Updated GraphQL endpoint references from v1 to v2 in README and development documentation. - Adjusted API routes in various controllers to reflect the new v2 structure. - Added new response types in schema.graphql for hyperboard and section entries. - Updated test descriptions to align with the new v2 endpoints.
1 parent c289e75 commit dc47e1c

17 files changed

+71
-55
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ The API implements a fallback to the first available RPC. You can set the RPCs i
2828

2929
### Supabase
3030

31-
* Install Docker
32-
* `git submodule init`
33-
* `git submodule update --remote`
34-
* `pnpm supabase:start:all`
31+
- Install Docker
32+
- `git submodule init`
33+
- `git submodule update --remote`
34+
- `pnpm supabase:start:all`
3535

3636
This will spin up 2 Supabase instances in Docker, one for the indexer service (caching) and one for the data service (static data) which are both exposed by the API.
3737

@@ -43,21 +43,21 @@ From both instances, you can get their respective keys and add them to the env v
4343

4444
This will run a live production instance by running `swc` to compile the code and `nodemon` to restart the server on changes.
4545

46-
You can then find the API at `localhost:4000/spec` (Swagger instance) and the GraphQL at `localhost:4000/v1/graphql`
46+
You can then find the API at `localhost:4000/spec` (Swagger instance) and the GraphQL at `localhost:4000/v2/graphql`
4747

4848
## Deployments
4949

5050
Production: `https://api.hypercerts.org/`
5151
Staging: `https://staging-api.hypercerts.org`
5252

5353
`/spec` - Swagger instance documenting the API and exposing a playground to experiment with the endpoints
54-
`/v1/graphql` - GraphQL API to access hypercerts data like claims, fractions, attestations, allow lists
54+
`/v2/graphql` - GraphQL API to access hypercerts data like claims, fractions, attestations, allow lists
5555

5656
## Scripts
5757

5858
- `dev`: Starts the development server using `nodemon`, which will automatically restart the server whenever you save a file that the server uses.
5959
- `build`: Denerates the OpenAPI specification and routes using `tsoa`, and then compiles the TypeScript code into JavaScript using `swc`. The compiled code is output to the `dist` directory.
60-
- `start`: Starts the application in production mode.
60+
- `start`: Starts the application in production mode.
6161
- `lint`: Runs `eslint` on the codebase to check for linting errors.
6262
- `test`: Runs tests using `vitest`
6363

@@ -86,38 +86,38 @@ The API also provides an upload and validation endpoint for hypercert and allow
8686
graph TB
8787
Client[Client Applications]
8888
API[Hypercerts API :4000]
89-
89+
9090
subgraph "API Endpoints"
9191
Swagger["/spec\nSwagger Documentation"]
92-
GraphQL["/v1/graphql\nGraphQL Endpoint"]
92+
GraphQL["/v2/graphql\nGraphQL Endpoint"]
9393
Upload["Upload & Validation\nEndpoints"]
9494
end
95-
95+
9696
subgraph "Data Services"
9797
Static[("Static Data Service\n(Supabase DB)\n- User Data\n- Collections\n- Signed Orders")]
9898
Indexer[("Indexer Service\n(Supabase DB)\n- On-chain Data\n- IPFS Data")]
9999
end
100-
100+
101101
subgraph "External Services"
102102
IPFS[(IPFS\nMetadata Storage)]
103103
Blockchain[(Blockchain\nSupported Chains)]
104104
EAS[(EAS\nAttestations)]
105105
end
106-
106+
107107
Client --> API
108108
API --> Swagger
109109
API --> GraphQL
110110
API --> Upload
111-
111+
112112
GraphQL --> Static
113113
GraphQL --> Indexer
114114
Upload --> IPFS
115-
115+
116116
Indexer --> Blockchain
117117
Indexer --> IPFS
118118
Indexer --> EAS
119-
119+
120120
class Swagger,GraphQL,Upload apiEndpoint;
121121
class Static,Indexer database;
122122
class IPFS,Blockchain,EAS external;
123-
```
123+
```

docs/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ For a complete example, you can look at the implementation of existing entities
165165
## Testing Your Implementation
166166

167167
1. Start the development server: `pnpm dev`
168-
2. Access the GraphQL playground at `http://localhost:4000/v1/graphql`
168+
2. Access the GraphQL playground at `http://localhost:4000/v2/graphql`
169169
3. Test your queries and mutations
170170
4. Run the test suite: `pnpm test`
171171

schema.graphql

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,11 @@ type GetFractionsResponse {
515515
data: [Fraction!]
516516
}
517517

518+
type GetHyperboardOwnersResponse {
519+
count: Int
520+
data: [HyperboardOwner!]
521+
}
522+
518523
type GetHyperboardsResponse {
519524
count: Int
520525
data: [Hyperboard!]
@@ -553,6 +558,16 @@ type GetSalesResponse {
553558
data: [Sale!]
554559
}
555560

561+
type GetSectionEntryOwnersResponse {
562+
count: Int
563+
data: [SectionEntryOwner!]
564+
}
565+
566+
type GetSectionsResponse {
567+
count: Int
568+
data: [Section!]
569+
}
570+
556571
type GetSignatureRequestResponse {
557572
count: Int
558573
data: [SignatureRequest!]
@@ -579,13 +594,20 @@ type Hyperboard {
579594

580595
"""Name of the hyperboard"""
581596
name: String!
582-
owners: [HyperboardOwner!]!
583-
sections: [SectionResponseType!]!
597+
owners: GetHyperboardOwnersResponse!
598+
sections: GetSectionsResponse!
584599

585600
"""Color of the borders of the hyperboard"""
586601
tile_border_color: String
587602
}
588603

604+
input HyperboardCollectionWhereInput {
605+
created_at: StringSearchOptions
606+
description: StringSearchOptions
607+
id: StringSearchOptions
608+
name: StringSearchOptions
609+
}
610+
589611
type HyperboardOwner {
590612
"""The address of the user"""
591613
address: String!
@@ -620,6 +642,7 @@ input HyperboardUserWhereInput {
620642
input HyperboardWhereInput {
621643
admins: HyperboardUserWhereInput = {}
622644
chain_ids: NumberArraySearchOptions
645+
collections: HyperboardCollectionWhereInput = {}
623646
id: StringSearchOptions
624647
}
625648

@@ -822,9 +845,7 @@ type Metadata {
822845
"""References additional information related to the hypercert"""
823846
external_url: String
824847
id: ID
825-
826-
"""Base64 encoded representation of the image of the hypercert"""
827-
image: String
848+
image: String!
828849

829850
"""Impact scope of the hypercert"""
830851
impact_scope: [String!]
@@ -915,7 +936,7 @@ type Order {
915936
chainId: EthBigInt!
916937
collection: String!
917938
collectionType: Float!
918-
createdAt: String!
939+
createdAt: Float!
919940
currency: String!
920941
endTime: Float!
921942
globalNonce: String!
@@ -936,7 +957,7 @@ type Order {
936957
startTime: Float!
937958
strategyId: Float!
938959
subsetNonce: Float!
939-
validator_codes: [String!]
960+
validator_codes: [Int!]
940961
}
941962

942963
input OrderHypercertWhereInput {
@@ -1102,12 +1123,12 @@ input SaleWhereInput {
11021123
transaction_hash: StringSearchOptions
11031124
}
11041125

1105-
"""Section representing a collection within a hyperboard"""
1126+
"""Section representing one or more collectionswithin a hyperboard"""
11061127
type Section {
1107-
collection: Collection!
1128+
collections: [Collection!]!
11081129
entries: [SectionEntry!]!
11091130
label: String!
1110-
owners: [HyperboardOwner!]!
1131+
owners: GetHyperboardOwnersResponse!
11111132
}
11121133

11131134
"""Entry representing a hypercert or blueprint within a section"""
@@ -1120,9 +1141,9 @@ type SectionEntry {
11201141

11211142
"""Name of the hypercert or blueprint"""
11221143
name: String
1123-
owners: [SectionEntryOwner!]!
1144+
owners: GetSectionEntryOwnersResponse!
11241145
percentage_of_section: Float!
1125-
total_units: BigInt
1146+
total_units: EthBigInt
11261147
}
11271148

11281149
type SectionEntryOwner {
@@ -1142,12 +1163,7 @@ type SectionEntryOwner {
11421163

11431164
"""Pending signature requests for the user"""
11441165
signature_requests: GetSignatureRequestResponse
1145-
units: BigInt
1146-
}
1147-
1148-
type SectionResponseType {
1149-
count: Float!
1150-
data: [Section!]!
1166+
units: EthBigInt
11511167
}
11521168

11531169
"""Pending signature request for a user"""

src/client/graphql.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const yoga = createYoga({
5353
cors: {
5454
methods: ["POST"],
5555
},
56-
graphqlEndpoint: "/v1/graphql",
56+
graphqlEndpoint: "/v2/graphql",
5757
plugins: [
5858
useResponseCache({
5959
// global cache
@@ -76,6 +76,6 @@ export const yoga = createYoga({
7676
});
7777

7878
export const urqlClient = new Client({
79-
url: `${CONSTANTS.ENDPOINTS[indexerEnvironment as "production" | "test"]}/v1/graphql`,
79+
url: `${CONSTANTS.ENDPOINTS[indexerEnvironment as "production" | "test"]}/v2/graphql`,
8080
exchanges: [cacheExchange, fetchExchange],
8181
});

src/controllers/AllowListController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
} from "../types/api.js";
1818
import { jsonToBlob } from "../utils/jsonToBlob.js";
1919

20-
@Route("v1/allowlists")
20+
@Route("v2/allowlists")
2121
@Tags("Allowlists")
2222
export class AllowListController extends Controller {
2323
/**

src/controllers/BlueprintController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { verifyAuthSignedData } from "../utils/verifyAuthSignedData.js";
2626
import { waitForTxThenMintBlueprint } from "../utils/waitForTxThenMintBlueprint.js";
2727

2828
@injectable()
29-
@Route("v1/blueprints")
29+
@Route("v2/blueprints")
3030
@Tags("Blueprints")
3131
export class BlueprintController extends Controller {
3232
constructor(

src/controllers/HyperboardController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const allChains = Object.keys(CONSTANTS.DEPLOYMENTS).map((chain) =>
3333
);
3434

3535
@injectable()
36-
@Route("v1/hyperboards")
36+
@Route("v2/hyperboards")
3737
@Tags("Hyperboards")
3838
export class HyperboardController extends Controller {
3939
constructor(

src/controllers/MarketplaceController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { FractionService } from "../services/database/entities/FractionEntitySer
2626
import { MarketplaceOrdersService } from "../services/database/entities/MarketplaceOrdersEntityService.js";
2727

2828
@injectable()
29-
@Route("v1/marketplace")
29+
@Route("v2/marketplace")
3030
@Tags("Marketplace")
3131
export class MarketplaceController extends Controller {
3232
constructor(

src/controllers/MetadataController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { jsonToBlob } from "../utils/jsonToBlob.js";
2121
import { validateMetadataAndClaimdata } from "../utils/validateMetadataAndClaimdata.js";
2222
import { validateRemoteAllowList } from "../utils/validateRemoteAllowList.js";
2323

24-
@Route("v1/metadata")
24+
@Route("v2/metadata")
2525
@Tags("Metadata")
2626
export class MetadataController extends Controller {
2727
/**

src/controllers/SignatureRequestController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface CancelSignatureRequest {
2121
}
2222

2323
@injectable()
24-
@Route("v1/signature-requests")
24+
@Route("v2/signature-requests")
2525
@Tags("SignatureRequests")
2626
export class SignatureRequestController extends Controller {
2727
constructor(

0 commit comments

Comments
 (0)