We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openapi.yaml
openapi-typescript
pakage.json
{ "scripts": { "generate-api": "rimraf ./src/types/schema.ts && openapi-typescript ./assets/openapi.yaml -o ./src/types/schema.ts" } }
Refs: https://github.com/scalarorg/simple-staking/blob/scalar/src/types/schema.ts
import createFetchClient from "openapi-fetch"; import createClient, { OpenapiQueryClient } from "openapi-react-query"; import { ProjectENV } from "@/env"; import { paths } from "@/types/schema"; const scalarFetchClient = createFetchClient<paths>({ baseUrl: ProjectENV.NEXT_PUBLIC_SCALAR_API_URL, }); const ScalarAPI: OpenapiQueryClient<paths> = createClient(scalarFetchClient); export default ScalarAPI;
import ScalarAPI from "@/apis/scalar"; export const useScalarnetParams = () => { return ScalarAPI.useQuery("get", "/scalar/scalarnet/v1beta1/params", {}); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Prerequisites:
openapi.yaml
: https://github.com/scalarorg/simple-staking/tree/scalar/assetsopenapi-typescript
then generate to the schema file, example:pakage.json
Refs: https://github.com/scalarorg/simple-staking/blob/scalar/src/types/schema.ts
The text was updated successfully, but these errors were encountered: