diff --git a/dist/es/hash.js b/dist/es/hash.js index ccb4e6b..b0ecb42 100644 --- a/dist/es/hash.js +++ b/dist/es/hash.js @@ -1,15 +1,13 @@ -import { web3 } from './util'; +import { soliditySha3 } from 'web3-utils'; export function keccak256(params) { - var _web3$utils; - if (!Array.isArray(params)) { params = [{ type: 'string', value: params }]; } - return (_web3$utils = web3.utils).soliditySha3.apply(_web3$utils, params); + return soliditySha3.apply(undefined, params); } export var SIGN_PREFIX = '\x19Ethereum Signed Message:\n32'; \ No newline at end of file diff --git a/dist/es/tx-data-by-compiled.js b/dist/es/tx-data-by-compiled.js index df321b3..cba29df 100644 --- a/dist/es/tx-data-by-compiled.js +++ b/dist/es/tx-data-by-compiled.js @@ -1,11 +1,11 @@ -import { web3 } from './util'; +import * as Web3EthContract from 'web3-eth-contract'; export default function txDataByCompiled(abi, bytecode, args) { // solc returns a string which is often passed instead of the json if (typeof abi === 'string') abi = JSON.parse(abi); - var web3Contract = new web3.eth.Contract(abi, null, { + var web3Contract = new Web3EthContract['default'](abi, null, { data: '0x' + bytecode }); diff --git a/dist/es/util.js b/dist/es/util.js index c55377a..e31363c 100644 --- a/dist/es/util.js +++ b/dist/es/util.js @@ -1,7 +1,3 @@ -import Web3 from 'web3'; - -export var web3 = new Web3(); - export function removeTrailing0x(str) { if (str.startsWith('0x')) return str.substring(2);else return str; } diff --git a/dist/lib/hash.js b/dist/lib/hash.js index 8fdcee0..114bf79 100644 --- a/dist/lib/hash.js +++ b/dist/lib/hash.js @@ -11,20 +11,18 @@ var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); exports.keccak256 = keccak256; -var _util = require('./util'); +var _web3Utils = require('web3-utils'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function keccak256(params) { - var _web3$utils; - if (!Array.isArray(params)) { params = [{ type: 'string', value: params }]; } - return (_web3$utils = _util.web3.utils).soliditySha3.apply(_web3$utils, (0, _toConsumableArray3['default'])(params)); + return _web3Utils.soliditySha3.apply(undefined, (0, _toConsumableArray3['default'])(params)); } var SIGN_PREFIX = exports.SIGN_PREFIX = '\x19Ethereum Signed Message:\n32'; \ No newline at end of file diff --git a/dist/lib/tx-data-by-compiled.js b/dist/lib/tx-data-by-compiled.js index 54fed62..da947f0 100644 --- a/dist/lib/tx-data-by-compiled.js +++ b/dist/lib/tx-data-by-compiled.js @@ -5,14 +5,18 @@ Object.defineProperty(exports, "__esModule", { }); exports['default'] = txDataByCompiled; -var _util = require('./util'); +var _web3EthContract = require('web3-eth-contract'); + +var Web3EthContract = _interopRequireWildcard(_web3EthContract); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } function txDataByCompiled(abi, bytecode, args) { // solc returns a string which is often passed instead of the json if (typeof abi === 'string') abi = JSON.parse(abi); - var web3Contract = new _util.web3.eth.Contract(abi, null, { + var web3Contract = new Web3EthContract['default'](abi, null, { data: '0x' + bytecode }); diff --git a/dist/lib/util.js b/dist/lib/util.js index d2df9d4..1f83c67 100644 --- a/dist/lib/util.js +++ b/dist/lib/util.js @@ -3,18 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.web3 = undefined; exports.removeTrailing0x = removeTrailing0x; exports.addTrailing0x = addTrailing0x; - -var _web = require('web3'); - -var _web2 = _interopRequireDefault(_web); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var web3 = exports.web3 = new _web2['default'](); - function removeTrailing0x(str) { if (str.startsWith('0x')) return str.substring(2);else return str; } diff --git a/package.json b/package.json index f36fb5b..53356dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eth-crypto", - "version": "1.2.0", + "version": "1.2.1", "description": "Cryptographic functions for ethereum and how to use them with web3 and solidity", "keywords": [ "ethereum",