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

dfuse-eoshttp-js-test

v0.1.1

Published

dfuse.io HTTP API Javascript library

Downloads

5

Readme

dfuse.io HTTP API Javascript library

Installation

Using Yarn:

yarn add dfuse-eoshttp-js

or using NPM:

npm install --save dfuse-eoshttp-js

Quick Start

CommonJS

const { JsonRpc } = require("dfuse-eoshttp-js")
const fetch = require("isomorphic-fetch")

const endpoint = "https://mainnet.eos.dfuse.io"
const token = "<Paste your API token here>"
const rpc = new JsonRpc(endpoint, { fetch, token })

TypeScript

import { JsonRpc } from "dfuse-eoshttp-js"
import fetch from "isomorphic-fetch"

const endpoint = "https://mainnet.eos.dfuse.io"
const token = "<Paste your API token here>"
const rpc = new JsonRpc(endpoint, { fetch, token })

ENV Variables

DFUSE_IO_ENDPOINT=<Enter Dfuse Endpoint>  # "https://mainnet.eos.dfuse.io"
DFUSE_IO_API_KEY=<Paste your API token here>  # Get key at dfuse.io
DFUSE_IO_SERVER_API_KEY=<Paste your Server API token here>  # Get key at dfuse.io

API

GET /v0/search/transactions

Search an EOSIO blockchain for transactions based on free-form criterias, using the simple dfuse Search query language.

const searchQuery = 'receiver:eosio.token action:transfer data.to:eoscafeblock'

rpc.search_transactions(searchQuery, { limit: 1 }).then(response => {
    console.log(response)
})

GET /v0/state/abi

Fetches the ABI for a given contract account, at any block height.

rpc.state_abi('eosio', { block_num: 128, json: true }).then(response => {
    console.log(response)
})

GET /v0/state/abi/bin_to_json

Fetches the ABI for a given contract account, at any block height.

rpc.state_abi_bin_to_json('eosio.token', 'accounts', { block_num: 2500000, "hex_rows":["aa2c0b010000000004454f5300000000"] }).then(response => {
    console.log(response)
})

GET /v0/state/permission_links

Fetches snapshots of any account's linked authorizations on the blockchain, at any block height.

rpc.state_permission_links('eoscanadacom', { block_num: 10000000 }).then(response => {
    console.log(response)
})

GET /v0/state/table

Fetches the state of any table, at any block height.

rpc.state_table("eosio.token", "b1", "accounts", {json: true}).then(response => {
    for (const row of response.rows) {
        console.log(row.json.balance)
        //=> 12.2873 EOS
    }
})

GET /v0/state/tables/accounts

Fetches a table for a given contract account for a group of scopes, at any block height.

rpc.state_tables_accounts<{balance: string}>(["eosio.token", "eosadddddddd", "tokenbyeocat"], "b1", "accounts", {block_num: 25000000, json: true}).then(response => {
    console.dir(response, { depth: null })
})

GET /v0/state/tables/scopes

Fetches a table for a given contract account for a group of scopes, at any block height.

rpc.state_tables_scopes("eosio.token", ["b1", "eosio.null"], "accounts", {json: true}).then(response => {
    for (const table of response.tables) {
        for (const row of table.rows) {
            console.log(row.json.balance)
            //=> 12.2873 EOS
            //=> 0.0084 EOS
        }
    }
})

POST /v1/auth/issue

Issues Dfuse API Key using a Server Token

rpc.auth_issue(server_token).then(response => {
    console.log(response)
})