New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eris-db-promise

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eris-db-promise

This is JavaScript JSON-RPC 2.0 client library for ErisDB

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-55.56%
Maintainers
1
Weekly downloads
 
Created
Source

ErisDB Promise JS lib (Alpha)

This is JavaScript JSON-RPC 2.0 client library for ErisDB

Installation

Prerequisites

You will need ErisDB installed and running Also this library is using ES6 so you will have to use node.js > 4.0.0

Installing node module

$ npm i --save eris-db-promise

Usage

Finding out ErisDB IP

$ eris chains inspect <name of ErisDB server> NetworkSettings.IPAddress

After that you will be able to create new instance of library:

const erisFactory = require('eris-db-promise')
// For base HTTP JSON RPC
const erisDb = erisFactory.createInstance('http://<Your IP Address>:1337/rpc')
// For WebSocket RPC client
const erisDb = erisFactory.createInstance('ws://<Your IP Address>:1337/socketrpc')

This library uses Promise so all methods will return promises:

erisDb.accounts
  .getAccounts()
  .then((list) => {
    // working with list of accounts
  })

API Reference

Library contains this components:

Component NameAccessor
AccountsErisDB.accounts
BlockchainErisDB.blockchain
ConsensusErisDB.consensus
EventsErisDB.events
NameRegErisDB.namereg
NetworkErisDB.network
TransactionsErisDB.transactions
UnsafeErisDB.unsafe

All methods are made using documentation here

All methods usages are described in tests

Browser usage

This library has browser version into dist/index.js you could download it and use in browser. Example of usage is into dist/index.html

Signing transactions

This library includes transaction signing mechanism.

Sample:

const tx = {
  inputs: [
    {
      address: user.address,
      amount: 101,
      sequence: 1,
      pub_key: user.pub_key
    }
  ],
  outputs: [
    {
      address: other_account.address,
      amount: 100
    }
  ]
}
const txForSign = {
  chain_id: 'chainIdHere',
  tx: [
    2,
    _.cloneDeep(tx)
  ]
}
erisdb.transactions
  .sign(txForSign, config.account.privKey)
  .then((signed) => {
    tx.inputs[0].signature = signed
  })
  .then(() => {
    return global.erisdb
      .transactions
      .broadcastTx(tx)
  })

FAQs

Package last updated on 23 Feb 2017

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