Launch Week Day 1:Rust Support in Socket Is Now Generally Available.Learn More
Socket
Book a DemoInstallSign in
Socket

nanoeth

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanoeth

Tiny RPC module to request methods on an ETH node

Source
npmnpm
Version
2.5.1
Version published
Weekly downloads
2
Maintainers
2
Weekly downloads
 
Created
Source

nanoeth

Tiny RPC module to request methods on an ETH node

npm install nanoeth

Usage

const NanoETH = require('nanoeth/ipc')

// pass in the ipc socket path
const eth = new NanoETH('/tmp/parity.sock')

// call methods
await eth.blockNumber()

// to close the underlying socket/rpc when all
// current requests are done do
await eth.end()

For a list of supported methods see https://wiki.parity.io/JSONRPC-eth-module.html

If you are using Parity you can also use the pubsub module, to subscribe to changes:

const unsubscribe = await eth.subscribe(eth.getBlockByNumber('latest', false), function (err, block) {
  if (err) return
  if (parseInt(block.timestamp) > Date.now() - 1000 * 60) return unsubscribe()

  console.log(block)
})

RPC providers

The following RPC providers are included

  • nanoeth/metamask
  • nanoeth/ipc
  • nanoeth/ws

License

MIT

Keywords

eth

FAQs

Package last updated on 01 May 2020

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