Skip to content

Commit

Permalink
Merge branch 'hotfix/0.2.2'
Browse files Browse the repository at this point in the history
Additional fixes to support Truffle and Solidity v5.
  • Loading branch information
DZariusz committed Feb 8, 2019
2 parents 7100ac9 + 85d5790 commit 020ed08
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.2.2] - 2019-02-07
### Fixed
- Additional fixes to support Truffle and Solidity v5.
- Fix liner errors.

## [0.2.1] - 2019-02-07
### Fixed
- Fix version number in `package.json`.

## [0.2.0] - 2019-02-07
### Changed
- Upgrade dependencies versions to newest
Expand Down
2 changes: 1 addition & 1 deletion ministro-utils/expectedExceptionPromise.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ module.exports = function expectedExceptionPromise(action, gasToUse) {
}
},
);
}
};
6 changes: 4 additions & 2 deletions ministro-utils/getTransactionReceiptMined.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function getTransactionReceiptMined(txHash, interval) {
function getTransactionReceiptMined(txHash, interval) {
const self = this;
const transactionReceiptAsync = (resolve, reject) => {
self.getTransactionReceipt(txHash, (error, receipt) => {
Expand All @@ -21,6 +21,8 @@ module.exports = function getTransactionReceiptMined(txHash, interval) {
return new Promise(transactionReceiptAsync);
}
throw new Error(`Invalid Type: ${txHash}`);
};
}

web3.eth.getTransactionReceiptMined = getTransactionReceiptMined;

module.exports = getTransactionReceiptMined;
16 changes: 0 additions & 16 deletions ministro-utils/ministroExecute.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
const Web3Utils = require('web3-utils');
const { ethGetBalance } = require('./web3');
const expectedExceptionPromise = require('./expectedExceptionPromise');
const txCheck = require('./txCheck');
const txEvents = require('./txEvents');

// this is just to know, how much chars cen we put in one line
const lineLength = 118;
const debug = 0;

/**
* @dev Idea for this function is to be called from test/ministro-contracts/*
Expand Down Expand Up @@ -44,19 +40,7 @@ module.exports = function ministroExecute() {
};

app.setFromVar = async (_from) => {
let balance;
txAttrSaved.from = _from;

try {
balance = await ethGetBalance(_from);
} catch (e) {
console.log('errors', e);
}

balance = parseFloat(web3.fromWei(balance.toString(10), 'ether'));

process.stderr.write(`${' '.repeat(lineLength)}\r`);
if (debug) console.log('[ministroExecute] new `txAttr.from` balance', balance, 'ETH');
};

// @param _txAttr - (optional) can be empty or can be object with transaction parameters like:
Expand Down
8 changes: 3 additions & 5 deletions ministro-utils/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ const pify = require('pify');

const Web3 = require('web3');

const web3 = new Web3(Web3.currentProvider || 'http://localhost:8545');

const ethAsync = pify(web3.eth);
const web3 = new Web3(Web3.givenProvider || 'ws://localhost:8545');

module.exports = {
ethGetBalance: ethAsync.getBalance,
ethGetTransactionReceipt: ethAsync.getTransactionReceipt,
ethGetBalance: pify(web3.eth.getBalance),
ethGetTransactionReceipt: pify(web3.eth.getTransactionReceipt),
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "ministro-tool",
"version": "0.2.1",
"version": "0.2.2",
"description": "JavaScript tool created for helping in process of testing solidity smart contracts.",
"main": "ministro-utils/index.js",
"scripts": {
"test": "scripts/test.sh",
"lint": "./node_modules/.bin/eslint ./test --no-ignore --ext .js --fix"
"lint:test": "./node_modules/.bin/eslint ./test --no-ignore --ext .js --fix",
"lint:src": "./node_modules/.bin/eslint ./ministro-utils --no-ignore --ext .js --fix",
"lint": "npm run lint:test && npm run lint:src"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 020ed08

Please sign in to comment.