pull/15/head
pubkey 7 years ago
parent 9cb70a1e59
commit 95025be7e7
  1. 6
      dist/es/hash.js
  2. 4
      dist/es/tx-data-by-compiled.js
  3. 4
      dist/es/util.js
  4. 6
      dist/lib/hash.js
  5. 8
      dist/lib/tx-data-by-compiled.js
  6. 10
      dist/lib/util.js
  7. 2
      package.json

6
dist/es/hash.js vendored

@ -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';

@ -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
});

4
dist/es/util.js vendored

@ -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;
}

6
dist/lib/hash.js vendored

@ -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';

@ -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
});

10
dist/lib/util.js vendored

@ -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;
}

@ -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",

Loading…
Cancel
Save