Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@parity/api

paritytech101MIT5.1.19

The Parity Promise-based API library for interfacing with Ethereum over RPC

Ethereum, API, RPC, Parity, Promise

readme

@parity/api

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

Build Status npm (scoped) npm dependencies Status

installation

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

usage

initialisation

// import the actual Api class
import Api from '@parity/api';

// do the setup
const provider = new Api.Provider.Http('http://localhost:8545');
const api = new Api(provider);

making calls

perform a call

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

multiple promises

Promise.all([api.eth.coinbase(), api.net.listening()]).then(
  ([coinbase, listening]) => {
    // do stuff here
  }
);

chaining promises

api.eth
  .newFilter({...})
  .then((filterId) => api.eth.getFilterChanges(filterId))
  .then((changes) => {
    console.log(changes);
  });

contracts

attach contract

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

find & call a function

contract.instance.callMe
  .call({ gas: 21000 }, [true, 'someString']) // or estimateGas or postTransaction
  .then(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) -

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

5.1.19 (2020-02-10)

Note: Version bump only for package @parity/api

5.1.18 (2020-01-27)

Note: Version bump only for package @parity/api

5.1.17 (2020-01-15)

Note: Version bump only for package @parity/api

5.1.16 (2019-12-27)

Note: Version bump only for package @parity/api

5.1.15 (2019-11-18)

Note: Version bump only for package @parity/api

5.1.14 (2019-09-30)

Bug Fixes

  • api: Add 10s timeout handle for fetch in HttpProvider (#229) (aea9973)

5.1.13 (2019-09-13)

Note: Version bump only for package @parity/api

5.1.12 (2019-09-02)

Note: Version bump only for package @parity/api

5.1.11 (2019-07-23)

Note: Version bump only for package @parity/api

5.1.10 (2019-07-23)

Note: Version bump only for package @parity/api

5.1.9 (2019-07-11)

Note: Version bump only for package @parity/api

5.1.8 (2019-07-11)

Note: Version bump only for package @parity/api

5.1.7 (2019-06-25)

Note: Version bump only for package @parity/api

5.1.6 (2019-06-11)

Note: Version bump only for package @parity/api

5.1.5 (2019-05-31)

Note: Version bump only for package @parity/api

5.1.4 (2019-05-24)

Note: Version bump only for package @parity/api

5.1.3 (2019-04-05)

Note: Version bump only for package @parity/api

5.1.2 (2019-03-20)

Bug Fixes

  • Hide incorrect password from logs (parity_exportAccount) (#209) (43c9624)

5.1.1 (2019-03-13)

Bug Fixes

5.1.0 (2019-03-12)

Note: Version bump only for package @parity/api

5.0.1 (2019-03-07)

Note: Version bump only for package @parity/api

5.0.0 (2019-03-05)

Note: Version bump only for package @parity/api

4.1.1 (2019-03-05)

Note: Version bump only for package @parity/api

4.1.0 (2019-03-05)

Note: Version bump only for package @parity/api

4.0.3 (2019-02-04)

Note: Version bump only for package @parity/api

4.0.2 (2019-01-22)

Note: Version bump only for package @parity/api

4.0.1 (2019-01-22)

Note: Version bump only for package @parity/api

4.0.0 (2019-01-22)

Code Refactoring

  • Rewrite post$ to take a password and not use signer (689ae52)

BREAKING CHANGES

  • post$ now requires passphrase in its options.

Non-constant contract method calls from makeContract now require passphrase in their options.

post$ now returns {estimated}? {signed} {sent} {confirmed} and postRaw$ now returns {sent} {confirmed}

3.0.0 (2018-11-27)

BREAKING CHANGES