- Initialize the client with
{environment: "test"}
or{environment: "production"}
instead of providing a chainID. This will enable queries to the correct graph. WalletClient
is not required. When initializing without a wallet client, or when the wallet client is set to a chain not supported in the environment, the SDK will default to read only mode.PublicClient
is not required. This client is mostly used for transaction simulation. When initializing without a publicClient, the SDK will default to a public client provided byviem
for the chain specified by theWalletClient
.
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.
When using VSCode we recommend using gql.tada for syntax highlighting and other nifty features.
-
Get your types on If you work on VSCode gql.tada is nice: https://github.com/0no-co/gql.tada
-
Connect to a graph endpoint
https://github.com/urql-graphql/urql
import { CONSTANTS } from "@hypercerts-org/sdk"
indexerEnvironment can be an evn var. Either "production" or "test"
export const urqlClient = new Client({
url: CONSTANTS.ENDPOINTS[indexerEnvironment as "production" | "test"],
exchanges: [cacheExchange, fetchExchange],
});
getData
getMetadata
-> in favor of using the Graph
- 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)