zkitter-js 中文文档教程

发布于 2年前 浏览 11 更新于 2年前

ZkitterJS

独立 Zkitter 节点的 Javascript 实现

CLI 用法

安装 CLI:

npm i -g zkitter-js

同步:

# either https or wss provider will work
zkitter init -a wss://arb-mainnet.g.alchemy.com/v2/[api-key]
zkitter sync
zkitter timeline --limit=5

CLI 选项:

Options:
  -V, --version       output the version number
  -h, --help          display help for command

Commands:
  init [options]      initialize zkitter
  status              display status
  timeline [options]  display timeline
  sync [options]      sync with arbitrum and group
  fetch [options]     fetch historical data (30 days max) from waku
  whois <address>     sync with arbitrum and group
  up                  start zkitter and subscribe to all global events
  write [options]     publish a post
  list [options]      list all groups or users
  help [command]      display help for command

NPM 用法

import {Zkitter} from "zkitter-js";
const zkitter = await Zkitter.initialize({
  arbitrumHttpProvider: 'https://...',
});

// Sync with arbitrum registrar
await zkitter.syncUsers();

// Sync with zk groups on zkitter
await zkitter.syncGroup();

// Get all historical messages (30 days) from Waku store
await zkitter.queryAll();

// Subscribe to all future messages from everyone
await zkitter.subscribe();

开发

# node v16 
npm install

# build a dev cli to build/cli.js 
npm run dev

ZkitterJS

Javascript implementation of a standalone Zkitter node

CLI Usage

To install CLI:

npm i -g zkitter-js

To sync:

# either https or wss provider will work
zkitter init -a wss://arb-mainnet.g.alchemy.com/v2/[api-key]
zkitter sync
zkitter timeline --limit=5

CLI options:

Options:
  -V, --version       output the version number
  -h, --help          display help for command

Commands:
  init [options]      initialize zkitter
  status              display status
  timeline [options]  display timeline
  sync [options]      sync with arbitrum and group
  fetch [options]     fetch historical data (30 days max) from waku
  whois <address>     sync with arbitrum and group
  up                  start zkitter and subscribe to all global events
  write [options]     publish a post
  list [options]      list all groups or users
  help [command]      display help for command

NPM Usage

import {Zkitter} from "zkitter-js";
const zkitter = await Zkitter.initialize({
  arbitrumHttpProvider: 'https://...',
});

// Sync with arbitrum registrar
await zkitter.syncUsers();

// Sync with zk groups on zkitter
await zkitter.syncGroup();

// Get all historical messages (30 days) from Waku store
await zkitter.queryAll();

// Subscribe to all future messages from everyone
await zkitter.subscribe();

Development

# node v16 
npm install

# build a dev cli to build/cli.js 
npm run dev
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文