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

web3data-js

v0.7.5

Published

A javascript wrapper for accessing amberdata's public API.

Downloads

96

Readme

Web3data.js Javascript API

Build Status XO code style Try web3data-js on RunKit

Web3data.js Javascript API

Wrapper for Amberdata.io's REST API

Table of Contents

The API Key

Visit Amberdata.io and select the developer plan to get started!

Once you've got your key, place it in a file named .env — see env.example for reference.

Then in you code you can use it like so:

const web3Data = new Web3Data(process.env.API_KEY)

Installation

Using npm:

npm install web3data-js

Using CDN:

<script src="https://unpkg.com/web3data-js/dist/web3data.min.js"></script>

Getting Started

Check out the Quick Start documentation to get started.

Usage

import Web3Data from 'web3data-js'

const w3d = new Web3Data('<api-key>')

;( async () => {
     const contract = await w3d.contract.getDetails("0x06012c8cf97bead5deae237070f9587f8e7a266d")
     console.log(contract) // { ... }
})()

Websockets

import Web3Data from 'web3data-js'

const w3d = new Web3Data('<api-key>')

w3d.connect(status => {
  console.log('status ->', status.type)
})
w3d.on({eventName: 'block'}, data => {
  console.log(data)
})

Testing

This will run all tests using the prerecorded responses from the fixtures.

npm test

Runs tests using live responses from our endpoints. (Requires API key see Obtaining an Api key).

npm run test-live

Runs tests using live responses from our endpoints and records them in your fixtures folder.

npm run test-record

Commands

npm run build # Build for browser and output as `dist/web3data.min.js`
npm run docs:serve # Serves the documentation locally
npm run docs:gen # Generates the documentation and ouputs markdown
npm run lint # run linter
npm run lint:fix # fix linting errors
npm run test # runs all tests in playback mode
npm run test:record # run tests in record mode
npm run test:live # run tests hitting live endpoints
npm run test:fast # run tests but stop when one fails
npm run test:verbose # run tests with verbose output
npm run clean-recs # removes all recordings
npm run example # runs the example - see web3data-js in action!

Resources

Licensing

This project is licensed under the Apache Licence 2.0.