Skip to content

@therootnetwork/api-types

TRN-specific Substrate type bundle (typesBundle, definitions) for use with @polkadot/api.

Vendor-neutral, on-chain only

Published under @therootnetwork. These talk directly to TRN nodes (WS or HTTPS) — no hosted Futureverse service in the path — so they are the safest dependency to take for projects that need to outlive the Futureverse company.

Version
1.2.0
Published
2025-07-18
License
Apache-2.0
Status
trn-active
npm
https://www.npmjs.com/package/@therootnetwork/api-types
Types
./dist/index.d.ts
Maintainers
karishma09, aidan-starke, zees-fv, kenvu-ai
Peer deps
@polkadot/types
Recent versions
1.0.4 · 1.0.5 · 1.0.6 · 1.0.7 · 1.0.8 · 1.0.9 · 1.1.0 · 1.2.0
## Technical notes

Why use it

You are using @polkadot/api directly (not via @therootnetwork/api) and need the chain’s lookup definitions so storage queries / extrinsic args round-trip correctly.

When to skip it

You are already using @therootnetwork/api, which re-exports these types.

Pairs with

Example

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

const api = await ApiPromise.create({
  provider: new WsProvider('wss://root.rootnet.live/archive/ws'),
  typesBundle,
});

Gotchas

  • Lookup definitions track runtime upgrades — bump this package when the chain runtime version increments and you see decode warnings.

Upstream README

@therootnetwork/api-types

A type package that supplements @therootnetwork/api, and makes The Root Network specific types available from @polkadot/{api,types}/lookup.

Install

bash
yarn add -D @therootnetwork/api-types

Usage

  • Add import @therootnetwork/api-types at the top to augument The Root Network specific types to the standard @polkadot/types
typescript
import "@therootnetwork/api-types";
// after import, TRN types are automatically augmented to the standard `@polkadot/types` package
import { type Option } from "@polkadot/types";
import { type PalletNftCollectionInformation } from "@polkadot/types/lookup";

import { ApiPromise } from "@polkadot/api";
import { getApiOptions, getPublicProvider } from "@therootnetwork/api";

const api = await ApiPromise.create({
  ...getApiOptions(),
  ...getPublicProvider("root"),
});

const info = (await api.query.nft.collectionInfo(1124)) as Option<PalletNftCollectionInformation>;

Curated independently by Codeology. Source-attributed reference for The Root Network. Not affiliated with Futureverse / TRN Labs.