Skip to content

Commit

Permalink
feat(graph): remove indexer module and cleanup build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers committed Jun 23, 2024
1 parent f36800a commit 5dba26b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sdk/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ rules:
"@typescript-eslint/no-unused-vars":
- error
- argsIgnorePattern: "_"
varsIgnorePattern: "_"
varsIgnorePattern: "_"
3 changes: 2 additions & 1 deletion sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store
/.idea
/.idea
stats.html
50 changes: 33 additions & 17 deletions sdk/migrationV1_V2.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,39 @@
publicClient, the SDK will default to a public client provided by `viem` for the chain specified by the
`WalletClient`.

# Updated Graph client and queries
# Removed GraphQL client

- `SDK` now exports `graphClient` which can be used to query the graph directly.
- Updated queries:
We removed the client in favor of letting developers using the graph directly. During development we learned that
there's not a single query that fits all use cases. By using the graph directly, developers can build queries that fit
their specific needs.

```
HypercertById,
HypercertsByOwner,
FractionsByHypercert,
FractionsByOwner,
RecentHypercerts,
FractionById,
MetadataByUri,
MetadataForHypercert
```
> When using VSCode we recommend using [gql.tada](https://github.com/0no-co/gql.tada) for syntax highlighting and other
> nifty features.
## Example for setting up your own graph client

1. Get your types on If you work on VSCode gql.tada is nice: https://github.com/0no-co/gql.tada

2. Connect to a graph endpoint

#### Use urql as your graph client:

- When using VSCode we recommend using [gql.tada](https://github.com/0no-co/gql.tada) for syntax highlighting and other
nifty features.
https://github.com/urql-graphql/urql

#### Get Graph URL from SDK

import { CONSTANTS } from "@hypercerts-org/sdk"

#### Set up urql client:

> indexerEnvironment can be an evn var. Either "production" or "test"
```js
export const urqlClient = new Client({
url: CONSTANTS.ENDPOINTS[indexerEnvironment as "production" | "test"],
exchanges: [cacheExchange, fetchExchange],
});
```

# Removed methods

Expand All @@ -34,5 +49,6 @@

# Nerd stuff

- GraphQL client autogenerated from the graph schema.
- API client autogenerated from the graph schema.
- API client autogenerated from the OpenAPI endpoint
- Using gql.tada for building queries
- Reduced package size from 556Kb (2.0.0-alpha.0) to 158Kb (2.0.0-alpha.22)

0 comments on commit 5dba26b

Please sign in to comment.