# @plasm/types

> Plasm Network node type definitions generated with @polkadot/typegen

Latest version **1.5.4-3** (published 2021-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @plasm/types
pnpm add @plasm/types
yarn add @plasm/types
bun add @plasm/types
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.4-3 |
| Published | 2021-06-06 |
| First published | 2020-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 271.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Stake Technologies |
| Maintainers | public_sate, taskooh, t8m8, hoonsubin, y-shijo, hskang9 |
| Keywords | plasm, typescript, polkadot, blockchain, substrate, types |

## Links

- npm: https://www.npmjs.com/package/@plasm/types
- Repository: https://github.com/PlasmNetwork/api
- Homepage: https://github.com/PlasmNetwork/api/tree/master/packages/types#readme
- Issues: https://github.com/PlasmNetwork/api/issues
- npm.io page: https://npm.io/package/@plasm/types

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.5.4-3 (latest) — 2021-06-06
- 1.5.4-2 — 2021-06-01
- 1.5.4 — 2021-05-31
- 1.5.3 — 2021-05-26
- 1.5.2 — 2021-05-26
- 1.5.1-alpha.3 — 2021-05-26
- 1.5.1-alpha.2 — 2021-05-26
- 1.4.0 — 2020-10-29
- 1.3.0 — 2020-07-28

## README

# @plasm/types

[![NPM](https://nodei.co/npm/@plasm/types.png?downloads=true)](https://www.npmjs.com/package/@plasm/types)

This is a substrate type definitions made with [@polkadot-js/typegen](https://www.npmjs.com/package/@polkadot/typegen).
It is meant for developers working with TypeScript to interact with the Plasm node.
This package is meant to be used with the [@polakdot-js/api](https://github.com/polkadot-js/api) library.

## Usage

### Importing Types

You can use the `ApiOptions` interface to set the node configuration before initializing the Polkadot API instance.

```ts
import { WsProvider, ApiPromise } from '@polkadot/api';
import { ApiOptions } from '@polkadot/api/types';
import { plasmDefinitions} from '@plasm/types';

// using ApiOptions interface
const options: ApiOptions = {
    provider: new WsProvider('ws://localhost:9944'),
    types: {
        ...plasmDefinitions,
    },
};

const api = new ApiRx(options);
```

Or, you can pass the node types directly when initializing the API instance.

```ts
import { WsProvider, ApiPromise } from '@polkadot/api';
import { plasmDefinitions} from '@plasm/types';

// using the ApiPromise class
const api = await ApiPromise.create({
    provider: new WsProvider('ws://localhost:9944'),
    types: {
        ...plasmDefinitions,
    }
});

await api.isReady;
```

Finally, you can register the types after the API instance has already been created.

```ts
import { plasmDefinitions} from '@plasm/types';

// already initialized api instance
await api.registerTypes(dustyDefinitions);
```

### Generating Types

First, you'll have to manually define chain specific types for each pallets from the `src/interfaces/<module-name>/definitions.ts` file.

The script should export an object that looks something like this:

```ts
export default {
    types: {
        StructA: {
            id: 'u8',
            value_hash: 'H256',
        },
        TypeA: 'H256',
        ...
    },
};
```

---
_Source: https://npm.io/package/@plasm/types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
