
web3data.js Javascript API
Wrapper for Amberdata.io's REST API
Table of Contents
Installation
Using npm:
npm install web3data-js
Using CDN:
<script src="https://unpkg.com/web3data-js/dist/web3data.min.js"></script>
Usage
import Web3Data from 'Web3Data'
const w3d = new Web3Data('<api-key>')
( async () => {
const contract = await w3d.contract.getDetails("0x06012c8cf97bead5deae237070f9587f8e7a266d")
console.log(contract)
}
)()
Websockets
import Web3Data from 'Web3Data'
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
Obtaining an API key
Visit Amberdata.io and select the developer plan to get started!
Once you have you're key place it in a file named .env
— see ./env.example for reference.
Commands
npm run build
npm run lint
npm run lintfix
npm run test
npm run test-record
npm run test-live
npm run test-fast
npm run test-verbose
npm run clean-fix
npm run example
Resources
Licensing
This project is licensed under the Apache Licence 2.0.