npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hyperchain/jssdk

v1.1.0

Published

js-sdk for hyperchain

Readme

JS SDK

Commitizen friendly

@hyperchain/jssdk 是一个能与 Hyperchain 直接通信的 JavaScript 库。

Feature

  • 便于使用:开发者无需关注 Hyperchain 内部的具体实现,即可编写出与"链"交互的应用;
  • 功能对齐:API 全面与 LITE SDK 对齐,提供相对统一的使用方式,减少使用者的学习成本;
  • 兼容平台:兼容 Node.js 和浏览器两套运行环境;
  • 类型提示:提供全套的 TypeScript 类型注解;
  • 详尽文档:完善的使用文档,帮助开发者快速全面了解和使用 JS SDK;

Prerequisites

  • Node version 15.0.0 or higher;

Architecture

jssdk-class

@hyperchain/jssdk 主要分为两个大模块——网络通信模块(如上图的左侧)、服务提供模块(如上图的右侧)。

网络通信模块

“网络通信模块”封装底层网络通信,子模块如下:

  • provider 子模块:向上提供基础的网络通信能力;
  • request 子模块:统一“请求”和“响应”的逻辑;

服务提供模块

”服务提供模块”封装请求参数,以 Service 的形式对外提供,给开发者提供统一的调用方式,子模块如下:

  • account 子模块:结合加密算法和哈希算法生成账户,提供签名、验签功能;
  • transaction 子模块:对“交易体”进行统一的封装;
  • service 子模块:请求参数封装,直接对外提供调用链上方法的服务,主要有以下 7 个服务:
    1. Account Service:为用户提供创建、查询 Account 服务;
    2. Contract Service:部署合约、调用合约、管理合约;
    3. SQL Service:管理数据库、SQL 调用;
    4. DID Service:提供分布式数字身份体系(DID)的操作;
    5. Tx Service:查询交易信息,可查询内容与 LiteSDK 对齐;
    6. Block Service:查询 Block 信息,可查询内容与 LiteSDK 对齐;
    7. Node Service:查询 Node 信息,可查询内容与 LiteSDK 对齐;

Directory

.
├── src
│   ├── common                   // 通用工具
|   ├── error                    // 错误类型
│   ├── provider                 // 网络通信模块 / provider 模块
│   ├── request                  // 网络通信模块 / reqeust 模块
│   ├── account                  // 服务提供模块 / account 模块
│   ├── transaction              // 服务提供模块 / transaction 模块
│   ├── service                  // 服务提供模块 / service 模块
│   └── index.ts
├── test                         // 单测
├── docs                         // 文档
├── example                      // 示例
├── LICENSE
├── README.md
├── package.json
├── tsconfig.json
└── webpack.config.js

Getting Started

Documentation

You can find for more details, API, and other docs on docs.

Example

You can find for complete code example on example.

Installation

npm install @hyperchain/jssdk --save

Import

import {
  Provider,
  ProviderManager,
  Transaction,
  ServiceManager
} from "@hyperchain/jssdk";

Usage

1. Build provider manager
const httpProvider1 = new HttpProvider(1, "localhost:8081");

const providerManager = await ProviderManager.createManager({
  httpProviders: [httpProvider1]
});
2. Build service
const accountService = ServiceManager.getAccountService(providerManager);
const contractService = ServiceManager.getContractService(providerManager);
3. Create account
const account = accountService.genAccount(Algo.ECRAW);
4. Build transaction
const file: Buffer = fs.readFileSync(
  path.resolve(__dirname, "../resource/hvm-jar/credential-1.0-credential.jar")
);

const transaction = await new Transaction.HVMBuilder(
  account.getAddress(),
  providerManager
)
  .deploy(file)
  .then((builder) => builder.build());
transaction.sign(account);
5. Get response
const deployRequest = contractService.deploy(transaction);
const response = await deployRequest.send();
const deployHvmResult = await response.poll();

Work locally

First, you should confirm that Node.js version is 15.0.0 or higher.

You can use n to manage your Node.js Versions.

1. Publish locally

You can use yalc to grab only files that should be published to NPM and puts them in a special global store (located, for example, in ~/.yalc).

# in the root path of the project
npm i        # install dependencies
npm run link # publish locally

2. Add

You can use yalc to add @hyperchain/jssdk in your dependent project.

yalc will copy the current version from the store to your project's .yalc folder and inject a file:.yalc/my-package dependency into package.json.

# in your dependent project
npx yalc add @hyperchain/jssdk

Now, you can use @hyperchain/jssdk as a common npm package in your project.

For usage about @hyperchain/jssdk, please visit Getting Started.

Issue

If you have any suggestions or idea, please submit issue in this project!