@deernetwork/type-definitions v0.4.44
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/apiis set to the correct version, and that@polkadot/typegenis set to the same version as@polkadot/api. Increase the@deernetwork/type-definitionsversion if necessary for publication.Ensure that all the
definitions.tsfiles insrc/interfacesare updated to the latest versions of each type, if any deer modules changed.Run an deer-node chain on localhost. Then, run
./generateMetadata.bashto update thedeer.jsonfile.Once you have an
deer.jsonfile, you can rebuild the types with:$ npm run generate $ npm run lintUpgrade 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.
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago