@openrealm/hub-node
TypeScript icon, indicating that this package has built-in type declarations

0.10.18 • Public • Published

@openrealm/hub-nodejs

A lightweight, fast Typescript interface for Openrealm Hubs. Designed to work with Hub and any other Hub that implements the Openrealm protocol.

Features

  • Call any Hub endpoint from a NodeJS environment.
  • Serializes and deserializes Openrealm protobufs into Javascript objects.
  • Has helpers to create and sign Openrealm messages.
  • Written entirely in TypeScript, with strict types for safety.

Installation

Install @openrealm/hub-nodejs with the package manager of your choice

npm install @openrealm/hub-nodejs
yarn add @openrealm/hub-nodejs
pnpm install @openrealm/hub-nodejs

Quickstart

Fetching Data from Hubs

import { getSSLHubRpcClient } from '@openrealm/hub-nodejs';

client.$.waitForReady(Date.now() + 5000, async (e) => {
  if (e) {
    console.error(`Failed to connect to ${hubRpcEndpoint}:`, e);
    process.exit(1);
  } else {
    console.log(`Connected to ${hubRpcEndpoint}`);
    const castsResult = await client.getCastsByQid({ qid: 8928 });
    castsResult.map((casts) => casts.messages.map((cast) => console.log(cast.data?.castAddBody?.text)));
    client.close();
  }
});

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i @openrealm/hub-node

Weekly Downloads

0

Version

0.10.18

License

MIT

Unpacked Size

1.28 MB

Total Files

5

Last publish

Collaborators

  • wvrld