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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@polymeshassociation/polymesh-types

v7.0.0

Published

Substrate types used in Polymesh chain

Readme

Polymesh Types

Substrate types used in polymesh chain.

Usage

Basic Usage (Type Bundles)

To use the Polymesh type bundles with the Polkadot.js API:

import { ApiPromise, WsProvider } from '@polkadot/api';
import { typesBundle } from '@polymeshassociation/polymesh-types';

async function main() {
  const provider = new WsProvider('wss://testnet-rpc.polymesh.live');
  const api = await ApiPromise.create({
    provider,
    typesBundle,
  });
  // ... your code here
}

Using Type Augmentations

To get full TypeScript support for Polymesh-specific types, import the type augmentations before using the API types or instantiating the Polkadot API. The best practice is to place these imports at the very top of your project's entry point (e.g., src/index.ts or src/main.ts).

If your tsconfig.json includes the src folder (e.g., "include": ["src"]), the type augmentations will be available globally to all files in src.

Standalone Usage (Direct Polkadot API)

If you're using the Polkadot API directly (without the Polymesh SDK):

// At the top of your entry point file
import '@polymeshassociation/polymesh-types/polkadot/augment-types';
import '@polymeshassociation/polymesh-types/polkadot/augment-api';

import { ApiPromise, WsProvider } from '@polkadot/api';
import { typesBundle } from '@polymeshassociation/polymesh-types';

async function main() {
  const provider = new WsProvider('wss://testnet-rpc.polymesh.live');
  const api = await ApiPromise.create({
    provider,
    typesBundle,
  });
  // Now you have full type support for Polymesh modules
}

Usage with Polymesh SDK

If you're using the Polymesh SDK and need access to the underlying Polkadot API with full type support, use type-only imports to avoid runtime conflicts:

// At the top of your entry point file
import type {} from '@polymeshassociation/polymesh-types/polkadot/types-lookup';

import { Polymesh } from '@polymeshassociation/polymesh-sdk';

async function main() {
  const polymesh = await Polymesh.connect({
    nodeUrl: 'wss://testnet-rpc.polymesh.live',
    // ... other config
  });

  // Access the underlying API with full type support
  const api = polymesh._polkadotApi;
  // Now api.query, api.tx, etc. have proper Polymesh types instead of 'any'
}

Notes:

  • The augmentation imports must come before any Polkadot API or Polymesh SDK usage.
  • Use regular imports (import '...') when using Polkadot API directly.
  • Use type-only import of types-lookup (import type {} from '.../types-lookup') when using with Polymesh SDK to resolve "any" type issues.
  • Type-only imports provide TypeScript type information without executing module code at runtime.
  • The types-lookup import specifically resolves type lookup definitions, while augment-api and augment-types extend the API interfaces.

Importing Specific Types

After importing the type augmentations, you can import specific Polymesh types using the standard Polkadot types imports. The augmentations make Polymesh-specific types available through the Polkadot type system:

// Import type augmentations first (at the top of your entry file)
import type {} from '@polymeshassociation/polymesh-types/polkadot/types-lookup';

// Then import specific types using standard Polkadot imports
import type { PalletStakingActiveEraInfo } from '@polkadot/types/lookup';
import type { PolymeshPrimitivesIdentityId } from '@polkadot/types/lookup';
import type { PalletAssetAssetDetails } from '@polkadot/types/lookup';

// These imports will now have full Polymesh type definitions
function processEraInfo(era: PalletStakingActiveEraInfo) {
  // TypeScript will have full type information for Polymesh-specific fields
}

This works because the type augmentations extend the Polkadot type lookup system with Polymesh-specific definitions, making them available through the standard import paths.


Generating Types for a Custom Node

You can generate types for any Polymesh or Polymesh-based private chain by specifying a custom node endpoint. By default, the scripts connect to ws://localhost:9944, but you can override this using the POLYMESH_ENDPOINT environment variable:

POLYMESH_ENDPOINT=wss://testnet-rpc.polymesh.live yarn generate:types

This will fetch the chain metadata and generate types for the specified node.


Development

Types specific to different chain versions are in types folder