Mokhtar Naamani f4cb727dec bump types and metadata npm package version %!s(int64=2) %!d(string=hai) anos
..
augment ffe2cb4eb7 Olympia types: Add ValidatorPrefs override for polkadot/api >= 6.0 %!s(int64=2) %!d(string=hai) anos
src ffe2cb4eb7 Olympia types: Add ValidatorPrefs override for polkadot/api >= 6.0 %!s(int64=2) %!d(string=hai) anos
.eslintignore ea9098d587 Full typegen support, tooling, linter fixes %!s(int64=4) %!d(string=hai) anos
.eslintrc.js e13f39412e Make defs.json fully runtime-compatible %!s(int64=4) %!d(string=hai) anos
.gitignore 23a386b098 Remove Pioneer %!s(int64=2) %!d(string=hai) anos
.npmignore 639a9475cb @joystream/types: keep src/ in published npm packages, it gets built on install %!s(int64=4) %!d(string=hai) anos
.prettierignore 6d90afa998 Linter: Manual fixes %!s(int64=4) %!d(string=hai) anos
README.md 122b09371e revert change to example for ApiPromise in types/README.md %!s(int64=3) %!d(string=hai) anos
package.json f4cb727dec bump types and metadata npm package version %!s(int64=2) %!d(string=hai) anos
tsconfig-augment-codec.json af0fa72f42 generate:augment-codec %!s(int64=4) %!d(string=hai) anos
tsconfig-augment.json ea9098d587 Full typegen support, tooling, linter fixes %!s(int64=4) %!d(string=hai) anos
tsconfig-base.json bb2b87a98a Types and metadata-protobuf: Patch to target es2017 %!s(int64=2) %!d(string=hai) anos
tsconfig.json ecea87a58a Tooling for api.createType augmentation %!s(int64=4) %!d(string=hai) anos

README.md

@joystream/types

The types package is required to register the custom Substrate runtime types when working with @polkadot/api to communicate with a Joystream full node.

Installation

Add the package as a dependency in your project.

yarn add @joystream/types

# or

npm install --save @joystream/types

Example usage

import { types } from '@joystream/types'
import { ApiPromise, WsProvider } from '@polkadot/api'

async function main() {
  // Initialise the provider to connect to the local node
  const provider = new WsProvider('ws://127.0.0.1:9944')

  // Create the API and wait until ready
  const api = await ApiPromise.create({ provider, types })

  // Retrieve the chain & node information information via rpc calls
  const [chain, nodeName, nodeVersion] = await Promise.all([
    api.rpc.system.chain(),
    api.rpc.system.name(),
    api.rpc.system.version(),
  ])

  console.log(`Chain ${chain} using ${nodeName} v${nodeVersion}`)
}

main()