0.4.44 • Published 2 years ago

@deernetwork/type-definitions v0.4.44

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

deer-type-definitions

Usage

This repo contains Typescript bindings for custom deer-node modules.

In order to use the standard API against Deer you must initialize the API's options object as follows:

// We need to import the augmented definitions "somewhere" in our projec
import "@deernetwork/type-definitions/interfaces/augment-api";
import "@deernetwork/type-definitions/interfaces/augment-types";

import { ApiPromise, WsProvider } from "@polkadot/api";
import { ApiOptions } from "@polkadot/api/types";
import { typesBundle } from "@deernetwork/type-definitions";

const options: ApiOptions = {
  provider : new WsProvider('ws://localhost:9944'),
  typesBundle,
};

const api = new ApiPromise(options);

You will also need to update the tsconfig.json of your project to include the following:

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "@polkadot/types/lookup": ["../node_modules/@deernetwork/type-definitions/interfaces/types-lookup.d.ts"],
    }
  }
}

Dependencies

Your project's @polkadot-js dependency versions must match the versions used in this project, including @polkadot/api, @polkadot/keyring, and all associated packages, as well as rxjs (if using ApiRx instead of ApiPromise) and typescript. To verify the versions required, inspect the @polkadot package.json files for the version specified in this project's package.json.

Building

This project depends on the @polkadot/typegen project, which has a step-by-step guide to building this project.

The Deer-specific version is as follows:

  • Ensure in package.json that @polkadot/api is set to the correct version, and that @polkadot/typegen is set to the same version as @polkadot/api. Increase the @deernetwork/type-definitions version if necessary for publication.

  • Ensure that all the definitions.ts files in src/interfaces are updated to the latest versions of each type, if any deer modules changed.

  • Run an deer-node chain on localhost. Then, run ./generateMetadata.bash to update the deer.json file.

  • Once you have an deer.json file, you can rebuild the types with:

    $ npm run generate
    $ npm run lint
  • Upgrade all spec files with any changes necessary as per the @polkadot-js changelog and the underlying Substrate version of the chain.

  • To compile the Typescript to Javascript for npm publication, run node scripts/build.js. This command should not produce any errors and will output build files to the pkg directory.

  • Publish the new version with node scripts/publish.js.

0.4.42

2 years ago

0.4.43

2 years ago

0.4.40

2 years ago

0.4.41

2 years ago

0.4.9

2 years ago

0.4.8

2 years ago

0.4.44

2 years ago

0.4.31

2 years ago

0.4.10

2 years ago

0.4.30

2 years ago

0.4.15

2 years ago

0.4.13

2 years ago

0.4.14

2 years ago

0.4.11

2 years ago

0.4.12

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.1

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.2.6

2 years ago

0.4.0

2 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago