npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@substrate/generate-type-bundle

v0.1.4

Published

This package allows you generate a valid [OverrideTypesBundle](https://github.com/polkadot-js/api/blob/master/packages/types/src/types/registry.ts#L73-L76) JSON file to inject into a polkadot-js `ApiPromise` under the `typesBundle` option key. This is a h

Downloads

3

Readme

Summary

This package allows you generate a valid OverrideTypesBundle JSON file to inject into a polkadot-js ApiPromise under the typesBundle option key. This is a helper library that works specifically with polkadot-js. It is important to note that this library extracts chain types that are available via apps-config, if the chain types dont exist there it wont be able to support to bundle you need. Example packages that use this implicitly leverage this library are Substrate-api-sidecar, and Txwrapper-core.

Installation

NPM npm install -g @substrate/generate-type-bundle

Yarn yarn global add @substrate/generate-type-bundle

CLI

Options:
      --help             Show help                                     [boolean]
      --version          Show version number                           [boolean]
  -p, --path             Path to directory to generate Type files into. [string]
  -s, --specName         A chain to generate types for. If this is not inputted
                         it will create a types bundle for all chains.  [string]
  -a, --availableChains  List all available chains to generate types for.

Note: -p or --path is required.

Example CLI usage

Generating a Types Bundle to a specific path

-p or --path:

generate-type-bundle -p ~/Desktop/example/types

Note: This flag is required. The CLI will not generate any types bundles without specifying a directory.

Generate a Types Bundle for a specific chain

-s or --specName:

generate-type-bundle -p ~/Desktop/example/types -s moonbeam

List Available Chains

-a or --availableChains:

generate-type-bundle -a

Example Usage

Polkadot-js

import { ApiPromise } from '@polkadot/api';

const main = async () => {
    const api = await ApiPromise.create({
        provider: new WsProvider('ws://127.0.0.1:9944'),
        typesBundle: require('path-to-file.json')
    });
};

Substrate-api-sidecar

It is recommended to declare these env variables within a local .env file, but the below is an example usage from the terminal directly.

$ export SAS_SUBSTRATE_TYPES_BUNDLE=<path_to_file>
$ substrate-api-sidecar