hyperstack

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hyperstack

Hyperstack

Hyperstack provides real-time streaming data from Solana programs via WebSocket. Think of it as a typed, structured pub/sub system for on-chain state.
Key concepts:
  • Stack: A deployed streaming server that watches Solana programs and produces structured entity updates
  • Entity: A domain object (e.g.
    OreRound
    ,
    OreMiner
    ) with typed fields organized in sections
  • View: A lens on an entity, either
    state
    (keyed lookup) or
    list
    (collection). Custom views can add sorting and filtering.
  • SDK: TypeScript, React, or Rust client libraries that connect to a stack's WebSocket and provide typed access to views
Hyperstack通过WebSocket提供来自Solana程序的实时数据流。可以将其视为针对链上状态的类型化、结构化发布/订阅系统。
核心概念:
  • Stack:已部署的流服务器,用于监控Solana程序并生成结构化实体更新
  • Entity:领域对象(例如
    OreRound
    OreMiner
    ),其类型化字段按模块组织
  • View:实体的视角,分为
    state
    (键值查找)或
    list
    (集合)。自定义视图可添加排序和筛选功能。
  • SDK:TypeScript、React或Rust客户端库,用于连接到Stack的WebSocket并提供对视图的类型化访问

CLI Setup

CLI 安装配置

The Hyperstack CLI has different binary names depending on how it was installed:
  • cargo install:
    hs
  • npm install -g:
    hyperstack-cli
Before running any CLI commands, detect which binary is available:
bash
undefined
Hyperstack CLI根据安装方式不同有不同的二进制名称:
  • cargo install
    hs
  • npm install -g
    hyperstack-cli
在运行任何CLI命令之前,先检测可用的二进制文件:
bash
undefined

Check which CLI is available (prefer hs)

Check which CLI is available (prefer hs)

if command -v hs &> /dev/null; then HS_CLI="hs" elif command -v hyperstack-cli &> /dev/null; then HS_CLI="hyperstack-cli" else echo "Hyperstack CLI not found. Install with: cargo install hyperstack-cli (recommended) or npm install -g hyperstack-cli" exit 1 fi

Then use `$HS_CLI` for all commands, or just use `hs` directly if you confirmed it's available.
if command -v hs &> /dev/null; then HS_CLI="hs" elif command -v hyperstack-cli &> /dev/null; then HS_CLI="hyperstack-cli" else echo "Hyperstack CLI not found. Install with: cargo install hyperstack-cli (recommended) or npm install -g hyperstack-cli" exit 1 fi

然后使用`$HS_CLI`执行所有命令,或者如果已确认`hs`可用,也可以直接使用`hs`。

Quick Start

快速开始

bash
undefined
bash
undefined

Scaffold a new app from a template

Scaffold a new app from a template

npx hyperstack-cli create my-app
npx hyperstack-cli create my-app

Or install the CLI globally (cargo is preferred)

Or install the CLI globally (cargo is preferred)

cargo install hyperstack-cli # Installs as 'hs'
cargo install hyperstack-cli # Installs as 'hs'

OR

OR

npm install -g hyperstack-cli # Installs as 'hyperstack-cli'
undefined
npm install -g hyperstack-cli # Installs as 'hyperstack-cli'
undefined

Discovering Available Stacks and Schemas

发现可用的堆栈和模式

CRITICAL: Always run the explore command before writing Hyperstack code. Never guess entity names, field paths, or types.
bash
undefined
重要提示:在编写Hyperstack代码之前,务必先运行explore命令。切勿猜测实体名称、字段路径或类型。
bash
undefined

List all available stacks (use 'hs' or 'hyperstack-cli' depending on your install)

List all available stacks (use 'hs' or 'hyperstack-cli' depending on your install)

hs explore --json
hs explore --json

Get entities and views for a specific stack

Get entities and views for a specific stack

hs explore <stack-name> --json
hs explore <stack-name> --json

Get detailed field info for a specific entity

Get detailed field info for a specific entity

hs explore <stack-name> <EntityName> --json

> **Note:** All CLI examples use `hs`. If you installed via npm, substitute `hyperstack-cli` for `hs`.

The `--json` flag gives machine-readable output with exact field paths, types, and view definitions.
hs explore <stack-name> <EntityName> --json

> **注意:** 所有CLI示例均使用`hs`。如果通过npm安装,请将`hs`替换为`hyperstack-cli`。

`--json`标志会提供机器可读的输出,包含精确的字段路径、类型和视图定义。

Which Skill Do You Need?

你需要哪个技能?

Consuming an existing stack (connecting to streams, subscribing to data, building UIs): -> See the
hyperstack-consume
skill
Building your own stack (writing Rust DSL, defining entities from program IDLs, deploying): -> See the
hyperstack-build
skill
消费现有堆栈(连接到数据流、订阅数据、构建UI): -> 查看
hyperstack-consume
技能
构建自定义堆栈(编写Rust DSL、从程序IDL定义实体、部署): -> 查看
hyperstack-build
技能

Prepackaged Stacks

预打包堆栈

Run
hs explore
to see what's available. Current public stacks include:
  • ore, ORE mining rounds, miners, treasury state
Install the prepackaged SDK types:
npm install hyperstack-stacks
运行
hs explore
查看可用的堆栈。当前的公开堆栈包括:
  • ore:ORE挖矿回合、矿工、国库状态
安装预打包的SDK类型:
npm install hyperstack-stacks