Socket
Socket
Sign inDemoInstall

ethjs

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethjs

A light weight Ethereum RPC interface written in ES6. RPC calls return a promise/stream.


Version published
Weekly downloads
12K
decreased by-15.85%
Maintainers
1
Weekly downloads
 
Created
Source

ethjs

A light weight Ethereum RPC interface written in ES6. RPC calls return a promise/stream.

Installation

npm install ethjs

Usage

Init

import Eth from 'ethjs';

const client = new Eth('<httpProviderUrl>');

RPC methods

RPC methods exposed on client and follow function signature of RPC spec

client.getCoinbase()
  .then(address => console.log(address), err => console.error(err));

Contracts

Create contracts and generate an JS contract interface using the ABI.

const contract = client.contracts.create(abi, {
    from: '<fromAddress>',
    data: contractCode,
    gas: 1000000,
}).subscribe(res => console.log(res), err => console.error(err));

Contract functions can then be called

contract.aFunctionName(10, 'an argument').subscribe(res => console.log(res), err => console.error(err));

Events can be subscribed to

contract.AnEvent().subscribe(res => console.log(res), err => console.error(err));

FAQs

Package last updated on 24 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc