Git Product home page Git Product logo

web3data-js's Introduction

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.

web3data-js's People

Contributors

dependabot[bot] avatar joanesespanol avatar taylorjdawson avatar trevorjtclarke avatar

Forkers

itwiz122

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.