@storagehub/api-augment
v0.1.0
Published
This package is used to generate TypeScript types for the Storage Hub Runtime using the Polkadot{.js} typegen package. It automates the process of:
Downloads
2
Readme
@storagehub/api-augment
This package is used to generate TypeScript types for the Storage Hub Runtime using the Polkadot{.js} typegen package. It automates the process of:
- Launching a local Storage Hub node
- Fetching the metadata blob
- Running the blob through the Polkadot{.js} typegen package to create TypeScript type interfaces
[!TIP]
For more information on this process, see the Polkadot{.js} docs
Generating
To generate the types, run the following commands:
pnpm i
pnpm scrape
pnpm generate:all
Importing into Files for Type Completion
At the top of your file, add:
import "@storagehub/api-augment";
[!TIP]
This step is also achievable by runningpnpm typegen
from within the/test
folder.
Available Scripts
In addition to the generation scripts, the following scripts are available:
pnpm fmt
: Format the codebase using Biome.pnpm fmt:fix
: Format and fix the codebase using Biome.pnpm tsc
: Run TypeScript compiler without emitting files.pnpm build
: Build the TypeScript project.pnpm scrape
: Scrape metadata from the local Storage Hub node.pnpm generate:all
: Generate all types (definitions and metadata).pnpm generate:defs
: Generate type definitions.pnpm generate:meta
: Generate metadata types.
CI/CD Workflow
api-augment-publish.yml
This workflow will publish the @storagehub/api-augment
at a given git hash.
api-augment-update.yml
This workflow will update the api-augment
package and raise a PR with the changes.