mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
1.3 KiB
1.3 KiB
@safe-global/store
This is a utility package that deals with the state management of the application. It uses the Redux Toolkit to manage the state of the application.
Usage
The use the generated API you first need to initialiize the baseURL of the API.
import { setBaseUrl } from '@safe-global/store'
setBaseUrl('YOUR_API_BASE_URL')
Automatic code generation from the Client Gateway's OpenAPI
This package includes a script to generate the necessary boilerplate API code from the Client Gateway (CGW)'s OpenAPI specification using @rtk-query/codegen-openapi.
Prerequisites
- You've initialized the monorepo and installed all dependencies.
- The
openapi-config.tsfile is correctly configured in this package with your OpenAPI specification details. - If you're running your own CGW service, set the
PRODUCTION_CGW_API_URLenv variable.
Running the Code Generation Script
From the mono-repo root directory, run the following command:
yarn workspace @safe-global/store build
or, for staging API:
yarn workspace @safe-global/store build:dev
This will:
- Fetch the OpenAPI schema.
- Use the configuration provided in the
openapi-config.tsfile. - Generate the API code using @rtk-query/codegen-openapi.