@edgeware/node-types

中文文档
3.6.2-wako发布于 2021/07/09ISCCommonJS零依赖近 30 天下载 29.1万

Type definitions for edgeware chain.

原始使用文档
文档目录3 节
  1. Usage
  2. Dependencies
  3. Building

edgeware-node-types

Usage

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

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

import { spec } from '@edgeware/node-types';

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

const api = new ApiPromise(options);

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

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@polkadot/api/augment": ["./node_modules/@edgeware/node-types/interfaces/augment-api.d.ts"],
      "@polkadot/types/augment": ["./node_modules/@edgeware/node-types/interfaces/augment-types.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 Edgeware-specific version is as follows:

  1. 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 @edgeware/node-types version if necessary for publication.

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

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

  4. Once you have an edgeware.json file, you can rebuild the types with:

    $ yarn generate
    $ yarn lint
    
  5. You will notice that the output of the lint command contains an error. This is because the typegen script does not handle relative paths well for custom modules that depend on each other. You will have to make a manual change to signaling/types.ts as follows:

    - import { VoteStage } from './voting';
    + import { VoteStage } from '../voting';
    
  6. Upgrade all spec files with any changes necessary as per the @polkadot-js changelog and the underlying Substrate version of the chain.

  7. To compile the Typescript to Javascript for npm publication, run yarn build. This command should not produce any errors and will output build files to the dist directory.

  8. Run a simple test of the newly-built API against a live edgeware node with yarn verify [mainnet | beresheet].

  9. Publish the new version with npm publish.

版本与发布记录

@edgeware/node-types 共发布 62 个版本,首次发布于 2020/07/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.6.2-wakolatest2021/07/095 年前
3.6.1-wako2021/06/295 年前
3.6.0-wako2021/06/265 年前
3.6.0-erup-4.1erup-42021/06/045 年前
3.6.0-erup-4.02021/06/045 年前
3.5.1-erup-42021/05/285 年前

其他发布通道:tokyo → 3.3.2-tokyo.0,tel-aviv → 3.4.0-tel-aviv.4,erup-4 → 3.6.0-erup-4.1,erup → 3.5.0-erup-4.0。

关于 @edgeware/node-types 的常见问题

@edgeware/node-types 是什么?

Type definitions for edgeware chain.

如何安装 @edgeware/node-types?

在项目目录运行 npm install @edgeware/node-types,或使用 pnpm add / yarn add / bun add。

@edgeware/node-types 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/edgeware__node-types 是否存在。

@edgeware/node-types 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@edgeware/node-types 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@edgeware/node-types 可以商用吗?

@edgeware/node-types 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@edgeware/node-types 的下载量有多少?

根据 npm 官方下载统计,@edgeware/node-types 在 2026/10/13 – 2026/11/11 这 30 天内被下载 291,476 次,日均约 9,716 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@edgeware/node-types 还在维护吗?

最新版本 3.6.2-wako 发布于 2021/07/09(5 年前);至今共发布 62 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/07/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。