paritytech/js-api

Name: js-api

Owner: Parity Technologies

Description: Moved to https://github.com/Parity-JS/api

Created: 2017-07-27 11:30:37.0

Updated: 2018-01-22 09:49:54.0

Pushed: 2018-01-12 12:36:57.0

Homepage: https://github.com/Parity-JS/api

Size: 476

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

@parity/api

Parity.js is a thin, fast, Promise-based wrapper around the Ethereum APIs.

Build Status Coverage Status Dependency Status devDependency Status

installation

Install the package with npm install --save @parity/api

usage
initialisation
mport the actual Api class
rt Api from '@parity/api';

o the setup
t provider = new Api.Provider.Http('http://localhost:8545');
t api = new Api(provider);
making calls

perform a call

eth
oinbase()
hen((coinbase) => {
console.log(`The coinbase is ${coinbase}`);
;

multiple promises

ise
ll([
api.eth.coinbase(),
api.net.listening()

hen(([coinbase, listening]) => {
// do stuff here
;

chaining promises

eth
ewFilter({...})
hen((filterId) => api.eth.getFilterChanges(filterId))
hen((changes) => {
console.log(changes);
;
contracts

attach contract

t abi = [{ name: 'callMe', inputs: [{ type: 'bool', ...}, { type: 'string', ...}]}, ...abi...];
t address = '0x123456...9abc';
t contract = api.newContract(abi, address);

find & call a function

ract.instance
allMe
all({ gas: 21000 }, [true, 'someString']) // or estimateGas or postTransaction
hen((result) => {
console.log(`the result was ${result}`);
;
apis

APIs implement the calls as exposed in the Ethcore JSON Ethereum RPC definitions. Mapping follows the naming conventions of the originals, i.e. eth_call becomes eth.call, personal_accounts becomes personal.accounts, etc.

public node

For operation within a public node, the following peerDependencies needs to be added (this functionality will be moved shortly) -


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.