1.0.0-beta6 • Published 7 years ago

ethereum-sandbox-helper v1.0.0-beta6

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
7 years ago

Ethereum Sandbox Helper

A helper for a tesing with Ethereum Sandbox.

Installation

$ npm install ethereum-sandbox-helper

Usage

helper.compile(dir, files)

Compiles specified sol-files in the dir. Throws an array of errors in case of compilation errors.

var compiled = helper.compile('contracts', ['contract.sol']);

The function uses solc-js under the hood and returns a provided array.

helper.waitForReceipt(web3, txHash, cb)

Waits for a receipt of the transaction with the provided transaction hash (txHash).

helper.waitForReceipt(sandbox.web3, txHash, function(err, receipt) {
  if (err) return done(err);
  console.log(receipt.logs);
  done();
});

helper.waitForSandboxReceipt(web3, txHash, cb)

Waits for a sandbox receipt of the transaction with the provided transaction hash (txHash). Sandbox receipt has a return value of called function.

helper.waitForSandboxReceipt(sandbox.web3, txHash, function(err, receipt) {
  if (err) return done(err);
  console.log(receipt.returnValue);
  done();
});