This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@hive-staging/autobee
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

AutoBee

Example bot to use in your browser app based on the wax and beekeeper library

Install

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 12 or higher is required.

Installation is done using the npm install command:

npm install @hive-staging/autobee

Usage

Iterating indefinitely over new blocks

import AutoBee from "@hive-staging/autobee";

const bot = new AutoBee({ postingKey: '5JkFnXrLM2ap9t3AmAxBJvQHF7xSKtnTrCTginQCkhzU5S7ecPT' });
bot.on("error", console.error);

await bot.start();

for await(const { block, number } of bot)
  console.info(`Got block #${block.block_id} (${number})`);

Wait for the next block using observer

import AutoBee from "@hive-staging/autobee";

const bot = new AutoBee({ postingKey: '5JkFnXrLM2ap9t3AmAxBJvQHF7xSKtnTrCTginQCkhzU5S7ecPT' });
bot.on("error", console.error);

await bot.start();

const block = await new Promise(blockResolve => {
  bot.once("block", blockResolve);
}); // Get one latest block

console.info(`Waiting for block: #${block.number + 1}`);
const observer = bot.observe.block(block.number + 1);

const observed = observer.subscribe({
  next() {
    console.info('Block detected');
  },
  // Complete method is optional
  complete() {
    observed.unsubscribe();
  }
});

API

See API definition in api.md

Support and tests

Tested on the latest Chromium (v117)

Automated CI test runs are available.

To run the tests on your own, clone the Wax repo and install the dependencies and then compile the project:

sudo npm install -g pnpm
pnpm install

Compile source:

npm run build

Then run tests:

npm run test

License

See license in the LICENSE.md file

Readme

Keywords

none

Package Sidebar

Install

npm i @hive-staging/autobee

Weekly Downloads

1

Version

0.2.1

License

SEE LICENSE IN LICENSE.md

Unpacked Size

9.44 MB

Total Files

8

Last publish

Collaborators

  • mtyszczak