Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eris-contracts-promise

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eris-contracts-promise

This library is built to be able to work with Eris Contracts using JS and Promises

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Eris contracts JS

This library is built to be able to work with Eris Contracts using JS and Promises

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-contracts-promise

Getting Account data

First of all to be able to use this module you have to have your account:

  • Address
  • Private key
  • Public key

On most of Linux based OS you will find them into ~/.eris/chains/<your-chain-name>/priv_validator.json

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 ContractContent = `
  contract GetSetContract {

    uint public something;

    function setSomething(uint newSome) {
      something = newSome;
    }
  }
`

const ErisContracts = require('eris-contracts-promise')

// Your ErisRPC url
const rpcUrl = 'http://localhost:1337/rpc'
// Account details
const account = {
  address: 'someaddress',
  privKey: 'accountPrivateKey',
  pubKey: 'accountPublicKey'
}
const ContractManager = ErisContracts.newContractManager(rpcUrl, account)

/**
* You have to compile your contract before using it.
*/
const compiled = require('solc').compile(ContractContent, 1).contracts['ContractName']
const abi = JSON.parse(compiled.interface)
// Create contract instance
const SomeContract = ContractManager.newContract(abi, compiled.bytecode.toUpperCase())

// Now we could work with newly created contract
SampleContract.at('address')
  .then((contract) => {
    // And call it's functions
    return contract
      .setSomething(1)
      .then(() => {
        //new value set
      })
  })

For more information please take a look into test folder. You will find more examples in there.

FAQs

Package last updated on 20 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