npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@eoscafe/hyperion

v3.3.2

Published

Hyperion HTTP API Javascript library

Downloads

113

Readme

Hyperion HTTP API Javascript library

Installation

Using Yarn:

yarn add @eoscafe/hyperion

or using NPM:

npm install --save @eoscafe/hyperion

Quick Start

CommonJS

const { JsonRpc } = require("@eoscafe/hyperion")
const fetch = require("isomorphic-fetch")

const endpoint = "https://eos.hyperion.eosrio.io"
const rpc = new JsonRpc(endpoint, { fetch })

TypeScript

import { JsonRpc } from "@eoscafe/hyperion"
import fetch from "isomorphic-fetch"

const endpoint = "https://eos.hyperion.eosrio.io"
const rpc = new JsonRpc(endpoint, { fetch })

ENV Variables

HYPERION_ENDPOINT=<Enter Hyperion Endpoint>  # "https://eos.hyperion.eosrio.io"

Supported Endpoints

# State
/v2/state/alive
/v2/state/get_key_accounts
/v2/state/get_tokens
/v2/state/get_voters
/v2/state/get_links

# History
/v2/history/get_abi_snapshot
/v2/history/get_actions
/v2/history/get_created_accounts
/v2/history/get_creator
/v2/history/get_deltas
/v2/history/get_transacted_accounts
/v2/history/get_transaction
/v2/history/get_transfers

API

Table of Contents

JsonRpc

JsonRpc

Parameters

  • endpoint string hyperion endpoint

Examples

const endpoint = "https://br.eosrio.io"
const rpc = new JsonRpc(endpoint, { fetch })

alive

GET /v2/state/alive

simple server healthcheck

Examples
const response = await rpc.alive();
console.log(response);
// => {"status": "OK"}

Returns Promise<Alive> alive

get_abi_snapshot

GET /v2/history/get_abi_snapshot

fetch contract abi at specific block

Parameters
  • contract string contract account
  • block
  • number number target block
Examples
const response = await rpc.get_abi_snapshot("eosio", 200);
console.log(response.version);
// => "eosio::abi/1.0"

for (const table of response.tables) {
    console.log(table);
    // => { name: 'producers', index_type: 'i64', key_names: [ 'owner' ], key_types: [ 'uint64' ], type: 'producer_info' }
}

Returns Promise<GetAbiSnapshot> abi snapshot

get_voters

GET /v2/state/get_voters

get voters

Parameters
  • options object Optional parameters (optional, default {})
    • options.producer string? filter by voted producer (comma separated)
    • options.proxy boolean? true or false
    • options.skip number? skip [n] actions (pagination)
    • options.limit number? limit of [n] actions per page
Examples
const response = await rpc.get_voters({ producer: "eoscafeblock", limit: 100 });
console.log(response.voters);
// => "[{
//   "account": "guzdkmrtgage",
//   "weight": 78434695236505280,
//   "last_vote": 64804768
// }]"

Returns Promise<GetVoters> voters

get_actions

GET /v2/history/get_actions

get actions based on notified account

Parameters
  • account string notified account
  • options object Optional parameters (optional, default {})
    • options.filter string? code::name filter
    • options.skip number? skip [n] actions (pagination)
    • options.limit number? limit of [n] actions per page
    • options.sort string? sort direction
    • options.after string? filter after specified date (ISO8601)
    • options.before string? filter before specified date (ISO8601)
    • options.transfer_to string? transfer filter to
    • options.transfer_from string? transfer filter from
    • options.transfer_symbol string? transfer filter symbol
    • options.act_name string? act name
    • options.act_account string? act account
Examples
const response = await rpc.get_actions("eoscafeblock", {
    filter: "eosio.token:*",
    skip: 100,
    limit: 100,
});

for (const action of response.actions) {
    console.log(action);
    // => { act: { account: 'eosio.token', name: 'transfer', ... } }
}

Returns Promise<GetActions> get actions

get_created_accounts

GET /v2/history/get_created_accounts

get created accounts

Parameters
  • account string created account
Examples
const response = await rpc.get_created_accounts("eosnationftw");
console.log(response);
// => {"accounts": [{"name":"eosnationdsp","trx_id":"728d4a4da36a98d9048080461dacaf975ad083e8158ef84edea60cc755ab2c1a","timestamp":"2019-02-28T22:36:45.000"}, ... ]}

Returns Promise<GetCreatedAccounts> get creator

get_creator

GET /v2/history/get_creator

get creator

Parameters
  • account string created account
Examples
const response = await rpc.get_creator("eosnationftw");
console.log(response);
// => { account: 'eosnationftw', creator: 'gyztcmrvgqge', timestamp: '2018-06-10T13:06:43.500', ... }

Returns Promise<GetCreator> get creator

get_deltas

GET /v2/history/get_deltas

get deltas

Parameters
Examples
const response = await rpc.get_deltas("eosio.token", "eosnationftw", "accounts", "eosnationftw");
console.log(response);
// => { "query_time": 19, "total": { "value": 486, "relation": "eq" }, "deltas": [ ... ] }

Returns Promise<GetDeltas> get deltas

get_key_accounts

GET/v2/state/get_key_accounts

get account by public key

Parameters
  • public_key string Contract account targeted by the action.
Examples
const response = await rpc.get_key_accounts("EOS5Mto3Km6BCVxowb6LkkFaT9oaUwLVgswgcxvY4Qgc4rhHry4Tv");
console.log(response.account_names);
// => [ 'eoscafeblock' ]

Returns Promise<GetKeyAccounts> key accounts

get_tokens

GET /v2/state/get_tokens

get tokens

Parameters
Examples
const response = await rpc.get_tokens("eosnationftw");
for (const token of response.tokens) {
    console.log(token);
    // => { symbol: 'ZOS', precision: 4, amount: 140, contract: 'zosdiscounts' }
}

Returns Promise<GetTokens> get tokens

get_transacted_accounts

GET /v2/history/get_transacted_accounts

get all account that interacted with the source account provided

Parameters
  • account string source account
  • direction string search direction (in, out or both)
  • options
Examples
const response = await rpc.get_transacted_accounts("eoscafeblock", "in");
console.log(response);
// => { query_time: 268, account: 'eoscafeblock', total_in: 1092369.1827, inputs: [ ... ] }

Returns Promise<GetTransactedAccounts> transacted accounts

get_transaction

GET /v2/history/get_transaction

get all actions belonging to the same transaction

Parameters
Examples
const response = await rpc.get_transaction("42dacd5722001b734be46a2140917e06cd21d42425f927f506c07b4388b07f62");
for (const action of response.actions) {
    console.log(action);
    // => { act: { account: 'eosio', name: 'buyrambytes', ... }}
}

Returns Promise<GetTransaction> transaction

get_transfers

GET /v2/history/get_transfers

get token transfers utilizing the eosio.token standard

Parameters
  • options object Optional parameters (optional, default {})
    • options.from string? source account
    • options.to string? destination account
    • options.symbol string? token symbol
    • options.contract string? token contract
    • options.skip number? skip [n] actions (pagination)
    • options.limit number? limit of [n] actions per page
    • options.after string? filter after specified date (ISO8601)
    • options.before string? filter before specified date (ISO8601)
Examples
const response = await rpc.get_transfers({to: "eosnewyorkio"});
for (const action of response.actions) {
    console.log(action.act.data);
    // => { from: 'eosio.bpay', to: 'eosnewyorkio', amount: 326.524, symbol: 'EOS', memo: 'producer block pay' }
}

Returns Promise<GetTransfers> transfers

JsonRpc

alive

GET /v2/state/alive

simple server healthcheck

Examples
const response = await rpc.alive();
console.log(response);
// => {"status": "OK"}

Returns Promise<Alive> alive

get_abi_snapshot

GET /v2/history/get_abi_snapshot

fetch contract abi at specific block

Parameters
  • contract string contract account
  • block
  • number number target block
Examples
const response = await rpc.get_abi_snapshot("eosio", 200);
console.log(response.version);
// => "eosio::abi/1.0"

for (const table of response.tables) {
    console.log(table);
    // => { name: 'producers', index_type: 'i64', key_names: [ 'owner' ], key_types: [ 'uint64' ], type: 'producer_info' }
}

Returns Promise<GetAbiSnapshot> abi snapshot

get_voters

GET /v2/state/get_voters

get voters

Parameters
  • options object Optional parameters (optional, default {})
    • options.producer string? filter by voted producer (comma separated)
    • options.proxy boolean? true or false
    • options.skip number? skip [n] actions (pagination)
    • options.limit number? limit of [n] actions per page
Examples
const response = await rpc.get_voters({ producer: "eoscafeblock", limit: 100 });
console.log(response.voters);
// => "[{
//   "account": "guzdkmrtgage",
//   "weight": 78434695236505280,
//   "last_vote": 64804768
// }]"

Returns Promise<GetVoters> voters

get_actions

GET /v2/history/get_actions

get actions based on notified account

Parameters
  • account string notified account
  • options object Optional parameters (optional, default {})
    • options.filter string? code::name filter
    • options.skip number? skip [n] actions (pagination)
    • options.limit number? limit of [n] actions per page
    • options.sort string? sort direction
    • options.after string? filter after specified date (ISO8601)
    • options.before string? filter before specified date (ISO8601)
    • options.transfer_to string? transfer filter to
    • options.transfer_from string? transfer filter from
    • options.transfer_symbol string? transfer filter symbol
    • options.act_name string? act name
    • options.act_account string? act account
Examples
const response = await rpc.get_actions("eoscafeblock", {
    filter: "eosio.token:*",
    skip: 100,
    limit: 100,
});

for (const action of response.actions) {
    console.log(action);
    // => { act: { account: 'eosio.token', name: 'transfer', ... } }
}

Returns Promise<GetActions> get actions

get_created_accounts

GET /v2/history/get_created_accounts

get created accounts

Parameters
  • account string created account
Examples
const response = await rpc.get_created_accounts("eosnationftw");
console.log(response);
// => {"accounts": [{"name":"eosnationdsp","trx_id":"728d4a4da36a98d9048080461dacaf975ad083e8158ef84edea60cc755ab2c1a","timestamp":"2019-02-28T22:36:45.000"}, ... ]}

Returns Promise<GetCreatedAccounts> get creator

get_creator

GET /v2/history/get_creator

get creator

Parameters
  • account string created account
Examples
const response = await rpc.get_creator("eosnationftw");
console.log(response);
// => { account: 'eosnationftw', creator: 'gyztcmrvgqge', timestamp: '2018-06-10T13:06:43.500', ... }

Returns Promise<GetCreator> get creator

get_deltas

GET /v2/history/get_deltas

get deltas

Parameters
Examples
const response = await rpc.get_deltas("eosio.token", "eosnationftw", "accounts", "eosnationftw");
console.log(response);
// => { "query_time": 19, "total": { "value": 486, "relation": "eq" }, "deltas": [ ... ] }

Returns Promise<GetDeltas> get deltas

get_key_accounts

GET/v2/state/get_key_accounts

get account by public key

Parameters
  • public_key string Contract account targeted by the action.
Examples
const response = await rpc.get_key_accounts("EOS5Mto3Km6BCVxowb6LkkFaT9oaUwLVgswgcxvY4Qgc4rhHry4Tv");
console.log(response.account_names);
// => [ 'eoscafeblock' ]

Returns Promise<GetKeyAccounts> key accounts

get_tokens

GET /v2/state/get_tokens

get tokens

Parameters
Examples
const response = await rpc.get_tokens("eosnationftw");
for (const token of response.tokens) {
    console.log(token);
    // => { symbol: 'ZOS', precision: 4, amount: 140, contract: 'zosdiscounts' }
}

Returns Promise<GetTokens> get tokens

get_transacted_accounts

GET /v2/history/get_transacted_accounts

get all account that interacted with the source account provided

Parameters
  • account string source account
  • direction string search direction (in, out or both)
  • options
Examples
const response = await rpc.get_transacted_accounts("eoscafeblock", "in");
console.log(response);
// => { query_time: 268, account: 'eoscafeblock', total_in: 1092369.1827, inputs: [ ... ] }

Returns Promise<GetTransactedAccounts> transacted accounts

get_transaction

GET /v2/history/get_transaction

get all actions belonging to the same transaction

Parameters
Examples
const response = await rpc.get_transaction("42dacd5722001b734be46a2140917e06cd21d42425f927f506c07b4388b07f62");
for (const action of response.actions) {
    console.log(action);
    // => { act: { account: 'eosio', name: 'buyrambytes', ... }}
}

Returns Promise<GetTransaction> transaction

get_transfers

GET /v2/history/get_transfers

get token transfers utilizing the eosio.token standard

Parameters
  • options object Optional parameters (optional, default {})
    • options.from string? source account
    • options.to string? destination account
    • options.symbol string? token symbol
    • options.contract string? token contract
    • options.skip number? skip [n] actions (pagination)
    • options.limit number? limit of [n] actions per page
    • options.after string? filter after specified date (ISO8601)
    • options.before string? filter before specified date (ISO8601)
Examples
const response = await rpc.get_transfers({to: "eosnewyorkio"});
for (const action of response.actions) {
    console.log(action.act.data);
    // => { from: 'eosio.bpay', to: 'eosnewyorkio', amount: 326.524, symbol: 'EOS', memo: 'producer block pay' }
}

Returns Promise<GetTransfers> transfers

Error

Error