0.10.18 • Published 2 years ago

@openrealm/hub-node v0.10.18

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@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

0.10.18

2 years ago

0.10.17

2 years ago