npm.io
7.5.3 • Published 1 year ago

@substrate/txwrapper-registry

Licence
Apache-2.0
Version
7.5.3
Deps
2
Size
47 kB
Vulns
0
Weekly
0
Stars
80



@substrate/txwrapper-registry

Registry creation support, catering to chains with types in [@polkadot/apps-config](https://github.com/polkadot-js/apps/tree/master/packages/apps-config/README.md)

npm Github Actions david-dm



yarn add @substrate/txwrapper-registry

In a JS/TS index file of package:

import { getRegistry } from '@substrate/txwrapper-registry';

  // Create Polkadot's type registry.
  const registry = getRegistry({
    chainName: 'Polkadot',
    specName: 'polkadot',
    specVersion: 26,
    metadataRpc,
  });

Have a look at the examples to see how getRegistry is used in the whole lifecycle of a transaction, from generation to signing to broadcast.

Config

In order to instantiate a registry with your chains custom types you must pass in the path to your own types bundle file. If you would like to generate a types bundle file and don't know how to, feel free to use this helper library we have created to generate these types. generate-type-bundle.

The following env variable is accepted:

TX_TYPES_BUNDLE=/path-to-file - Note: It must be a valid JSON file that has the same structure as the OverrideBundleTypes in polkadot-js.